POST
/
v0
/
logs
/
fields
curl --request POST \
  --url 'https://api.unify.ai/v0/logs/fields' \
  --header "Authorization: Bearer $UNIFY_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
    "project": "eval-project",
    "context": "experiment1/trial1",
    "fields": {
        "comment": {
            "description": "User comment",
            "mutable": true,
            "type": "str"
        },
        "email": {
            "description": "User email address",
            "type": "str",
            "unique": true
        },
        "score": "int"
    },
    "backfill_logs": true
}'
{
    "info": "Fields created successfully."
}
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.

Authorizations

Authorization
string
required
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

project
string
required
Name of the project the fields belong to.
context
string | null
Optional context path for the fields.
fields
object
required
Dictionary mapping field names to their type definitions.
backfill_logs
boolean
default:"true"
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.
curl --request POST \
  --url 'https://api.unify.ai/v0/logs/fields' \
  --header "Authorization: Bearer $UNIFY_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
    "project": "eval-project",
    "context": "experiment1/trial1",
    "fields": {
        "comment": {
            "description": "User comment",
            "mutable": true,
            "type": "str"
        },
        "email": {
            "description": "User email address",
            "type": "str",
            "unique": true
        },
        "score": "int"
    },
    "backfill_logs": true
}'
{
    "info": "Fields created successfully."
}