---
title: "Update context"
method: PUT
path: "/contexts/{context_id}"
tags: ["Contexts"]
---

# Update context

`PUT /contexts/{context_id}`

Update an existing context. Re-indexes in vector store if content changes.

## Path parameters

- `context_id` string, required

## Request body

- ContextShareUpdateRequest — Request model for updating a shared context.
  - `title` string, nullable
  - `summary` string, nullable
  - `content` string, nullable
  - `tags` string[], nullable
  - `metadata` object, nullable
  - `nia_references` RoutesV2ContextsNiaReferencesInput — Structured tracking of NIA resources used during conversation.
    - `indexed_resources` RoutesV2ContextsIndexedResource[]
      - `identifier` string, required — Repository (owner/repo) or documentation URL/ID
      - `resource_type` string, required — Type: 'repository' or 'documentation'
      - `purpose` string, required — Why this resource was used/referenced
      - `indexed_at` string, nullable — When it was indexed
    - `search_queries` RoutesV2ContextsSearchQuery[]
      - `query` string, required — The search query that was performed
      - `query_type` string, required — Type: 'codebase', 'documentation', etc.
      - `resources_searched` string[]
      - `key_findings` string, required — Brief summary of what was found
      - `useful_results_count` integer
    - `session_summary` string, nullable
  - `edited_files` RoutesV2ContextsEditedFile[], nullable
    - `file_path` string, required — Path to the file
    - `operation` string, required — Type: 'created', 'modified', 'deleted'
    - `changes_description` string, required — Brief description of changes
    - `key_changes` string[]
    - `language` string, nullable — Programming language of the file
  - `organization_id` string, nullable
  - `memory_type` 'scratchpad' | 'episodic' | 'fact' | 'procedural', nullable — Memory type
  - `ttl_seconds` integer, nullable — Custom TTL in seconds
  - `lineage` LineageInput — Input model for lineage tracking.
    - `source_ids` string[] — Source identifiers (e.g., 'repo:owner/repo', 'doc:name')
    - `confidence` number, nullable — Confidence score 0-1
    - `derived_from` string[], nullable — Parent context IDs if derived
    - `tool_calls` string[], nullable — Tools used to create this artifact
    - `model_version` string, nullable — Model version that created this

## Response `200`

Successful Response

- ContextShareResponse — Response model for context operations.
  - `id` string, required
  - `user_id` string, required
  - `organization_id` string, nullable
  - `title` string, required
  - `summary` string, required
  - `content` string, required
  - `tags` string[], required
  - `agent_source` string, required
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, nullable
  - `metadata` object, required
  - `nia_references` NiaReferencesOutput — Structured tracking of NIA resources used during conversation.
    - `indexed_resources` IndexedResourceOutput[]
      - `identifier` string, required — Repository (owner/repo) or documentation URL/ID
      - `resource_type` string, required — Type: 'repository' or 'documentation'
      - `purpose` string, required — Why this resource was used/referenced
      - `indexed_at` string, nullable — When it was indexed
    - `search_queries` SearchQueryOutput[]
      - `query` string, required — The search query that was performed
      - `query_type` string, required — Type: 'codebase', 'documentation', etc.
      - `resources_searched` string[]
      - `key_findings` string, required — Brief summary of what was found
      - `useful_results_count` integer
    - `session_summary` string, nullable
  - `edited_files` EditedFileOutput[]
    - `file_path` string, required — Path to the file
    - `operation` string, required — Type: 'created', 'modified', 'deleted'
    - `changes_description` string, required — Brief description of changes
    - `key_changes` string[]
    - `language` string, nullable — Programming language of the file
  - `memory_type` 'scratchpad' | 'episodic' | 'fact' | 'procedural'
  - `expires_at` string, date-time, nullable
  - `lineage` LineageMetadata — Provenance tracking for content artifacts.
    - `created_at` string, date-time, required — When this artifact was created
    - `source_ids` string[] — Source identifiers (e.g., 'repo:owner/repo', 'doc:name')
    - `confidence` number, nullable — Confidence score 0-1
    - `derived_from` string[], nullable — Parent context IDs if derived
    - `tool_calls` string[], nullable — Tools used to create this artifact
    - `model_version` string, nullable — Model version that created this
  - `category_id` string, nullable

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/nozomio-labs/apis/nia-ai-api.md) · [All operations](https://skmtc.net/nozomio-labs/apis/nia-ai-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/nozomio-labs/nia-ai-api/versions/dbb602a3ef17/schema)
