---
title: "Create Fields"
method: POST
path: "/v0/logs/fields"
tags: ["Logs"]
---

# Create Fields

`POST /v0/logs/fields`

Creates one or more fields in a project. Fields are field definitions that can be used
in logs. This endpoint allows pre-defining fields before adding any log data.

Each field can have an optional description. If a field already exists, its description
will be updated.

## Request body

- CreateFieldsRequest — Request model for creating fields in a project context. Fields can be defined with various properties including mutability. The `mutable` flag determines whether field values can be updated after creation via update endpoints. Immutable fields (mutable=False) provide data integrity guarantees once set.
  - `project_name` string, required — Name of the project the fields belong to.
  - `context` string, nullable — Optional context path for the fields.
  - `fields` object, required — Dictionary mapping field names to their type definitions. Supports multiple formats: - Simple string: 'str', 'int', 'float', 'bool', 'list', 'dict', 'datetime', 'image', etc. - JSON Schema types: 'string', 'integer', 'number', 'boolean', 'array', 'object' - StandardFieldDefinition: {'type': 'str', 'mutable': True, 'unique': False} - Full JSON Schema: {'type': 'string', 'format': 'date-time'} or {'$ref': '#/$defs/MyModel'} - EnumType: {'type': 'enum', 'values': ['a', 'b', 'c']} - None: Untyped field (accepts any value)
  - `backfill_logs` boolean — Whether to backfill existing logs in the context with None values for the new fields. When True, all existing logs will get the new fields with None values, ensuring all rows can participate in derived equations without errors.

## Response `200`

Fields created successfully

- unknown

## Other responses

- `404` — Project or context not found
- `422` — Validation Error

---

[API](https://skmtc.net/unify/apis/unifyai-http-api-reference.md) · [All operations](https://skmtc.net/unify/apis/unifyai-http-api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/unify/unifyai-http-api-reference/revisions/900377f918b6/schema)
