v1

latestOpenAPI 3.1.02026-07-13154170539.0 KB
Contexts

Create Context

Creates one or more contexts 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)
  • A ContextCreateRequest object with name and description fields
  • A list of strings for batch creation
  • A list of ContextCreateRequest objects for batch creation
post/v0/project/{project_name}/contexts

Path parameters

project_namestring required

Name of the project to create context in.

Name of the project to create context in.

Request body

OR
string required
OR

Example request

{
  "name": "experiment1/trial1",
  "description": "Context for experiment 1 trial 1",
  "is_versioned": true,
  "allow_duplicates": true,
  "unique_keys": {
    "company_id": "int",
    "department_id": "int",
    "first_name": "str",
    "last_name": "str"
  },
  "auto_counting": {
    "company_id": "department_id"
  },
  "foreign_keys": [
    {
      "default": 0,
      "name": "department_id",
      "on_delete": "SET DEFAULT",
      "on_update": "CASCADE",
      "references": "Departments.id"
    }
  ]
}

Response

Successful Response

{"stackTrail":"paths:/v0/project/{project_name}/contexts:post:responses:200:content:application/json:schema","oasType":"schema","type":"unknown"}