Skip to main content
POST
/
contexts
Save conversation context
curl --request POST \
  --url https://apigcp.trynia.ai/v2/contexts \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "title": "<string>",
  "summary": "<string>",
  "content": "<string>",
  "agent_source": "<string>",
  "tags": [
    "<string>"
  ],
  "metadata": {},
  "nia_references": {
    "indexed_repositories": [
      "<string>"
    ],
    "indexed_documentation": [
      "<string>"
    ],
    "queried_repositories": [
      "<string>"
    ],
    "queried_documentation": [
      "<string>"
    ],
    "web_searches": [
      "<string>"
    ],
    "deep_research_queries": [
      "<string>"
    ]
  },
  "edited_files": [
    {
      "file_path": "<string>",
      "operation": "created",
      "lines_added": 123,
      "lines_removed": 123,
      "language": "<string>"
    }
  ],
  "workspace_override": "<string>",
  "memory_type": "scratchpad",
  "ttl_seconds": 1,
  "lineage": {
    "source_ids": [
      "<string>"
    ],
    "confidence": 0.5,
    "derived_from": [
      "<string>"
    ],
    "tool_calls": [
      "<string>"
    ],
    "model_version": "<string>"
  }
}
'
{
  "id": "<string>",
  "user_id": "<string>",
  "organization_id": "<string>",
  "title": "<string>",
  "summary": "<string>",
  "content": "<string>",
  "tags": [
    "<string>"
  ],
  "agent_source": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "metadata": {},
  "nia_references": {
    "indexed_repositories": [
      "<string>"
    ],
    "indexed_documentation": [
      "<string>"
    ],
    "queried_repositories": [
      "<string>"
    ],
    "queried_documentation": [
      "<string>"
    ],
    "web_searches": [
      "<string>"
    ],
    "deep_research_queries": [
      "<string>"
    ]
  },
  "edited_files": [
    {
      "file_path": "<string>",
      "operation": "created",
      "lines_added": 123,
      "lines_removed": 123,
      "language": "<string>"
    }
  ],
  "memory_type": "scratchpad",
  "expires_at": "2023-11-07T05:31:56Z",
  "lineage": {
    "created_at": "2023-11-07T05:31:56Z",
    "source_ids": [
      "<string>"
    ],
    "confidence": 0.5,
    "derived_from": [
      "<string>"
    ],
    "tool_calls": [
      "<string>"
    ],
    "model_version": "<string>"
  }
}

Authorizations

Authorization
string
header
required

API key must be provided in the Authorization header

Body

application/json
title
string
required

Descriptive title for the context

Required string length: 1 - 200
summary
string
required

Brief summary of the conversation

Required string length: 10 - 1000
content
string
required

Full conversation context

Minimum string length: 50
agent_source
string
required

Which agent is creating this context (e.g., "cursor", "claude-code")

tags
string[]

Searchable tags for categorization

metadata
object

Optional metadata like file paths, repositories discussed, etc.

nia_references
object

References to NIA resources used during the conversation

edited_files
object[]

List of files that were modified during conversation

workspace_override
string

Optional custom workspace name (overrides auto-detection)

memory_type
enum<string>

Memory taxonomy type:

  • scratchpad: Temporary working memory (1hr TTL)
  • episodic: Session summaries (7d TTL)
  • fact: Atomic factual statements (permanent)
  • procedural: Tool/function definitions (permanent)
Available options:
scratchpad,
episodic,
fact,
procedural
ttl_seconds
integer | null

Custom TTL in seconds. If not set, uses memory_type default (scratchpad=3600, episodic=604800, fact/procedural=permanent)

Required range: x >= 0
lineage
object

Provenance tracking input for content artifacts

Response

Context saved successfully

id
string

Unique identifier for the context

user_id
string

User who created the context

organization_id
string

Organization ID if context belongs to an organization

title
string

Context title

summary
string

Context summary

content
string

Full context content

tags
string[]
agent_source
string

Source agent (e.g., "cursor", "claude-code")

created_at
string<date-time>

When the context was created

updated_at
string<date-time>

When the context was last updated

metadata
object
nia_references
object

References to NIA resources used during the conversation

edited_files
object[]
memory_type
enum<string>

Memory taxonomy type:

  • scratchpad: Temporary working memory (1hr TTL)
  • episodic: Session summaries (7d TTL)
  • fact: Atomic factual statements (permanent)
  • procedural: Tool/function definitions (permanent)
Available options:
scratchpad,
episodic,
fact,
procedural
expires_at
string<date-time> | null

When this context will expire (null for permanent memory types)

lineage
object

Provenance tracking metadata for content artifacts