v1

latestOpenAPI 3.1.02026-07-13154170539.0 KB
Logs

Create 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.

post/v0/logs/fields

Request body

project_namestring required

Name of the project the fields belong to.

contextstring nullable

Optional context path for the fields.

fieldsobject 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_logsboolean

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.

Example request

{
  "project_name": "eval-project",
  "context": "experiment1/trial1",
  "fields": {
    "email": {
      "description": "User email address",
      "type": "str",
      "unique": true
    },
    "score": "int",
    "status": {
      "type": "enum",
      "values": [
        "pending",
        "approved",
        "rejected"
      ]
    },
    "timestamp": {
      "description": "ISO-8601 timestamp",
      "format": "date-time",
      "type": "string"
    }
  },
  "backfill_logs": true
}

Response

Fields created successfully

{"stackTrail":"paths:/v0/logs/fields:post:responses:200:content:application/json:schema","oasType":"schema","type":"unknown"}