POST
/
v0
/
project
/
{project_name}
/
contexts
curl --request POST \
  --url 'https://api.unify.ai/v0/project/my_project/contexts' \
  --header "Authorization: Bearer $UNIFY_KEY"
  --header 'Content-Type: application/json' \
  --data '{
    "name": "experiment1/trial1",
    "description": "Context for experiment 1 trial 1",
    "is_versioned": true,
    "allow_duplicates": true
}'
{
    "name": "experiment1/trial1",
    "description": "Context for experiment 1 trial 1",
    "is_versioned": true,
    "version": 1
}

Creates a new context within a project. Contexts can be used to organize logs and artifacts within a project.

If is_versioned=True, all logs in this context will be versioned and mutable. The context version will increment automatically when logs are added, updated, or removed.

The context can be provided as a string (which will be used as the name with no description) or as an object with name and description fields.

Authorizations

Authorization
string
required

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

Path Parameters

project_name
string
required

Name of the project to create context in.

Body

name
string
required

Context name, can be nested using ’/’ (e.g., ‘parent/child’). Must contain only alphanumeric characters, underscores, and hyphens.

description
string | null

Optional description of the context

is_versioned
boolean
default:false

Whether the context should be versioned. If True, the context will be versioned and mutable.

allow_duplicates
boolean
default:true

Whether duplicate log entries are allowed in this context. If False, attempts to add duplicate logs will be ignored.

curl --request POST \
  --url 'https://api.unify.ai/v0/project/my_project/contexts' \
  --header "Authorization: Bearer $UNIFY_KEY"
  --header 'Content-Type: application/json' \
  --data '{
    "name": "experiment1/trial1",
    "description": "Context for experiment 1 trial 1",
    "is_versioned": true,
    "allow_duplicates": true
}'
{
    "name": "experiment1/trial1",
    "description": "Context for experiment 1 trial 1",
    "is_versioned": true,
    "version": 1
}