> For the complete documentation index, see [llms.txt](https://docs.dropzone.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dropzone.ai/api/context-memory.md).

# Context Memory

## GET /app/api/v1/context-memory

> List Context Memory Items with optional filtering, sorting, and pagination.\
> \
> Returns active and/or archived user-created context memory entries accessible to this tenant.\
> Use \`limit\` and \`offset\` for pagination. Supports filtering by source type, status, tenant union,\
> and free-text search.<br>

```json
{"openapi":"3.0.3","info":{"title":"Dropzone AI","version":"0.1.0"},"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"PaginatedContextMemoryList":{"type":"object","properties":{"count":{"type":"integer","description":"Total number of matching items"},"next":{"type":"string","format":"uri","nullable":true,"description":"URL to next page"},"previous":{"type":"string","format":"uri","nullable":true,"description":"URL to previous page"},"results":{"type":"array","items":{"$ref":"#/components/schemas/ContextMemoryItemToCustomer"}}},"required":["count","next","previous","results"]},"ContextMemoryItemToCustomer":{"type":"object","description":"Read-only serializer for customer-facing API endpoints.\nExposes a safe subset of fields — no embeddings, source_data, or internal keys.\ntenant_union is a nested object. Write inputs use tenant_union_id (int) on create/update.","properties":{"id":{"type":"integer","readOnly":true},"created_at":{"type":"string","format":"date-time","readOnly":true},"updated_at":{"type":"string","format":"date-time","readOnly":true},"expires_at":{"type":"string","format":"date-time","readOnly":true,"nullable":true},"is_archived":{"type":"boolean","readOnly":true},"content":{"type":"string","readOnly":true},"source_type":{"allOf":[{"$ref":"#/components/schemas/SourceTypeEnum"}],"readOnly":true},"tenant_id":{"type":"string","readOnly":true,"nullable":true},"tenant_label":{"type":"string","readOnly":true,"nullable":true},"tenant_union":{"allOf":[{"$ref":"#/components/schemas/TenantUnion"}],"readOnly":true,"nullable":true},"tags":{"type":"array","items":{"type":"string"},"readOnly":true}},"required":["content","created_at","expires_at","id","is_archived","source_type","tags","tenant_id","tenant_label","tenant_union","updated_at"]},"SourceTypeEnum":{"enum":["config_form","chat_message","investigation_edit","integration_scrape"],"type":"string","description":"* `config_form` - config_form\n* `chat_message` - chat_message\n* `investigation_edit` - investigation_edit\n* `integration_scrape` - integration_scrape"},"TenantUnion":{"type":"object","description":"Adds update nested feature","properties":{"id":{"type":"integer","readOnly":true},"last_modified_by":{"allOf":[{"$ref":"#/components/schemas/CustomUser"}],"nullable":true},"created_at":{"type":"string","format":"date-time","readOnly":true},"updated_at":{"type":"string","format":"date-time","readOnly":true},"display_name":{"type":"string"},"lookup_dict":{}},"required":["created_at","display_name","id","updated_at"]},"CustomUser":{"type":"object","description":"Basic serializer to pass CustomUser details to the front end.\nExtend with any fields your app needs.","properties":{"id":{"type":"integer","readOnly":true},"first_name":{"type":"string","maxLength":150},"last_name":{"type":"string","maxLength":150},"email":{"title":"Email address","oneOf":[{"type":"string","format":"email","maxLength":254},{"type":"string","maxLength":0}]},"role":{"$ref":"#/components/schemas/UserRoleEnum"},"oidc_user_id":{"type":"string","nullable":true}},"required":["id","role"]},"UserRoleEnum":{"enum":["admin","member","restricted-read-only"],"type":"string","description":"* `admin` - admin\n* `member` - member\n* `restricted-read-only` - restricted-read-only"}}},"paths":{"/app/api/v1/context-memory":{"get":{"operationId":"context_memory_list_external","description":"List Context Memory Items with optional filtering, sorting, and pagination.\n\nReturns active and/or archived user-created context memory entries accessible to this tenant.\nUse `limit` and `offset` for pagination. Supports filtering by source type, status, tenant union,\nand free-text search.\n","parameters":[{"in":"query","name":"limit","schema":{"type":"integer"},"description":"Number of results per page"},{"in":"query","name":"offset","schema":{"type":"integer"},"description":"Number of results to skip"},{"in":"query","name":"search_query","schema":{"type":"string"},"description":"Free-text search against item content"},{"in":"query","name":"sort_by","schema":{"type":"string","enum":["id","updated_at","usage_count"]},"description":"Sort field (default: `updated_at`)"},{"in":"query","name":"sort_order","schema":{"type":"string","enum":["asc","desc"]},"description":"Sort direction (default: `desc`)"},{"in":"query","name":"source_types","schema":{"type":"array","items":{"type":"string","enum":["chat_message","config_form","integration_scrape","investigation_edit"]}},"description":"Filter by source type(s). Repeatable."},{"in":"query","name":"status","schema":{"type":"string","enum":["active","all","inactive"]},"description":"Filter by archive status (default: `all`)"},{"in":"query","name":"tags","schema":{"type":"array","items":{"type":"string"}},"description":"Filter by tag(s). Returns items that have *any* of the specified tags. Repeatable."},{"in":"query","name":"tenant_union_id","schema":{"type":"string"},"description":"Filter by tenant union. Pass an integer ID to scope to a specific union, or the string `null` to return only untenanted items. Omit to return all."}],"tags":["context-memory"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedContextMemoryList"}}},"description":"Paginated list of Context Memory Items"},"400":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"Bad request - invalid input"},"401":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string"},"error_msg":{"type":"string"},"required_permission":{"type":"object","description":"RBAC permission the caller lacks. Present when the permission check denies the request.","properties":{"resource":{"type":"string"},"action":{"type":"string"}}}}}}},"description":"Access denied"},"500":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"System error"},"503":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"System not ready for requests"}}}}}}
```

## GET /app/api/v1/context-memory/{item\_id}

> Retrieve a single Context Memory Item by ID.

```json
{"openapi":"3.0.3","info":{"title":"Dropzone AI","version":"0.1.0"},"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"ContextMemoryItemToCustomer":{"type":"object","description":"Read-only serializer for customer-facing API endpoints.\nExposes a safe subset of fields — no embeddings, source_data, or internal keys.\ntenant_union is a nested object. Write inputs use tenant_union_id (int) on create/update.","properties":{"id":{"type":"integer","readOnly":true},"created_at":{"type":"string","format":"date-time","readOnly":true},"updated_at":{"type":"string","format":"date-time","readOnly":true},"expires_at":{"type":"string","format":"date-time","readOnly":true,"nullable":true},"is_archived":{"type":"boolean","readOnly":true},"content":{"type":"string","readOnly":true},"source_type":{"allOf":[{"$ref":"#/components/schemas/SourceTypeEnum"}],"readOnly":true},"tenant_id":{"type":"string","readOnly":true,"nullable":true},"tenant_label":{"type":"string","readOnly":true,"nullable":true},"tenant_union":{"allOf":[{"$ref":"#/components/schemas/TenantUnion"}],"readOnly":true,"nullable":true},"tags":{"type":"array","items":{"type":"string"},"readOnly":true}},"required":["content","created_at","expires_at","id","is_archived","source_type","tags","tenant_id","tenant_label","tenant_union","updated_at"]},"SourceTypeEnum":{"enum":["config_form","chat_message","investigation_edit","integration_scrape"],"type":"string","description":"* `config_form` - config_form\n* `chat_message` - chat_message\n* `investigation_edit` - investigation_edit\n* `integration_scrape` - integration_scrape"},"TenantUnion":{"type":"object","description":"Adds update nested feature","properties":{"id":{"type":"integer","readOnly":true},"last_modified_by":{"allOf":[{"$ref":"#/components/schemas/CustomUser"}],"nullable":true},"created_at":{"type":"string","format":"date-time","readOnly":true},"updated_at":{"type":"string","format":"date-time","readOnly":true},"display_name":{"type":"string"},"lookup_dict":{}},"required":["created_at","display_name","id","updated_at"]},"CustomUser":{"type":"object","description":"Basic serializer to pass CustomUser details to the front end.\nExtend with any fields your app needs.","properties":{"id":{"type":"integer","readOnly":true},"first_name":{"type":"string","maxLength":150},"last_name":{"type":"string","maxLength":150},"email":{"title":"Email address","oneOf":[{"type":"string","format":"email","maxLength":254},{"type":"string","maxLength":0}]},"role":{"$ref":"#/components/schemas/UserRoleEnum"},"oidc_user_id":{"type":"string","nullable":true}},"required":["id","role"]},"UserRoleEnum":{"enum":["admin","member","restricted-read-only"],"type":"string","description":"* `admin` - admin\n* `member` - member\n* `restricted-read-only` - restricted-read-only"}}},"paths":{"/app/api/v1/context-memory/{item_id}":{"get":{"operationId":"context_memory_retrieve_external","description":"Retrieve a single Context Memory Item by ID.","parameters":[{"in":"path","name":"item_id","schema":{"type":"integer"},"description":"ID of the Context Memory Item","required":true}],"tags":["context-memory"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContextMemoryItemToCustomer"}}},"description":"Context Memory Item"},"400":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"Bad request - invalid input"},"401":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string"},"error_msg":{"type":"string"},"required_permission":{"type":"object","description":"RBAC permission the caller lacks. Present when the permission check denies the request.","properties":{"resource":{"type":"string"},"action":{"type":"string"}}}}}}},"description":"Access denied"},"404":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"Resource not found"},"500":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"System error"},"503":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"System not ready for requests"}}}}}}
```

## POST /app/api/v1/context-memory/archive/{item\_id}

> Archive a user-created Context Memory Item. Idempotent on already-archived items (returns 200 without error). Returns 403 if the item is not user-created.

```json
{"openapi":"3.0.3","info":{"title":"Dropzone AI","version":"0.1.0"},"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization"}}},"paths":{"/app/api/v1/context-memory/archive/{item_id}":{"post":{"operationId":"context_memory_archive_create","description":"Archive a user-created Context Memory Item. Idempotent on already-archived items (returns 200 without error). Returns 403 if the item is not user-created.","parameters":[{"in":"path","name":"item_id","schema":{"type":"string"},"required":true}],"tags":["context-memory"],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object","properties":{"item_id":{"type":"number"}}}}},"description":"Context Memory Item archived"},"400":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"Bad request - invalid input"},"401":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"Context Memory Item is not user-created"},"404":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"Resource not found"},"500":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"System error"},"503":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"System not ready for requests"}}}}}}
```

## POST /app/api/v1/context-memory/create

> Create a new user Context Memory Item (+ optional tenant union OR tenant id/label). Prefer tenant\_union\_id for union-scoped context (multiple integration slots); tenant\_id+tenant\_label for upstream tenant scoping.

```json
{"openapi":"3.0.3","info":{"title":"Dropzone AI","version":"0.1.0"},"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization"}}},"paths":{"/app/api/v1/context-memory/create":{"post":{"operationId":"context_memory_create_create","description":"Create a new user Context Memory Item (+ optional tenant union OR tenant id/label). Prefer tenant_union_id for union-scoped context (multiple integration slots); tenant_id+tenant_label for upstream tenant scoping.","tags":["context-memory"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string","default":"Hello world"},"tenant_id":{"type":"string","default":null},"tenant_label":{"type":"string","default":null},"tenant_union_id":{"type":"number","default":null},"tags":{"type":"array","items":{"type":"string","maxLength":64},"maxItems":20,"description":"Optional free-form organizational tags.","default":[]}}}}}},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object","properties":{"item_id":{"type":"number"}}}}},"description":"Context Memory Item created"},"400":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"Bad request - invalid input"},"401":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string"},"error_msg":{"type":"string"},"required_permission":{"type":"object","description":"RBAC permission the caller lacks. Present when the permission check denies the request.","properties":{"resource":{"type":"string"},"action":{"type":"string"}}}}}}},"description":"Access denied"},"500":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"System error"},"503":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"System not ready for requests"}}}}}}
```

## DELETE /app/api/v1/context-memory/delete/{item\_id}

> Delete an existing user Context Memory Item

```json
{"openapi":"3.0.3","info":{"title":"Dropzone AI","version":"0.1.0"},"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization"}}},"paths":{"/app/api/v1/context-memory/delete/{item_id}":{"delete":{"operationId":"context_memory_delete_destroy","description":"Delete an existing user Context Memory Item","parameters":[{"in":"path","name":"item_id","schema":{"type":"string"},"required":true}],"tags":["context-memory"],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object","properties":{"item_id":{"type":"number"}}}}},"description":"Context Memory Item deleted"},"401":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string"},"error_msg":{"type":"string"},"required_permission":{"type":"object","description":"RBAC permission the caller lacks. Present when the permission check denies the request.","properties":{"resource":{"type":"string"},"action":{"type":"string"}}}}}}},"description":"Access denied"},"404":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"Resource not found"},"500":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"System error"},"503":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"System not ready for requests"}}}}}}
```

## POST /app/api/v1/context-memory/restore/{item\_id}

> Restore a user-created Context Memory Item. Idempotent on active items (returns 200 without error). Returns 403 if the item is not user-created.

```json
{"openapi":"3.0.3","info":{"title":"Dropzone AI","version":"0.1.0"},"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization"}}},"paths":{"/app/api/v1/context-memory/restore/{item_id}":{"post":{"operationId":"context_memory_restore_create","description":"Restore a user-created Context Memory Item. Idempotent on active items (returns 200 without error). Returns 403 if the item is not user-created.","parameters":[{"in":"path","name":"item_id","schema":{"type":"string"},"required":true}],"tags":["context-memory"],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object","properties":{"item_id":{"type":"number"}}}}},"description":"Context Memory Item restored"},"400":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"Bad request - invalid input"},"401":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"Context Memory Item is not user-created"},"404":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"Resource not found"},"500":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"System error"},"503":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"System not ready for requests"}}}}}}
```

## PUT /app/api/v1/context-memory/update/{item\_id}

> Update an existing user Context Memory Item (+ optional tenant union OR tenant id/label). Prefer tenant\_union\_id for union-scoped context (multiple integration slots); tenant\_id+tenant\_label for upstream tenant scoping.

```json
{"openapi":"3.0.3","info":{"title":"Dropzone AI","version":"0.1.0"},"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization"}}},"paths":{"/app/api/v1/context-memory/update/{item_id}":{"put":{"operationId":"context_memory_update_update","description":"Update an existing user Context Memory Item (+ optional tenant union OR tenant id/label). Prefer tenant_union_id for union-scoped context (multiple integration slots); tenant_id+tenant_label for upstream tenant scoping.","parameters":[{"in":"path","name":"item_id","schema":{"type":"string"},"required":true}],"tags":["context-memory"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string","default":"Hello world"},"tenant_id":{"type":"string","default":null},"tenant_label":{"type":"string","default":null},"tenant_union_id":{"type":"number","default":null},"tags":{"type":"array","items":{"type":"string","maxLength":64},"maxItems":20,"description":"Optional free-form organizational tags. Omit to leave existing tags unchanged.","default":[]}}}}}},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object","properties":{"item_id":{"type":"number"}}}}},"description":"Context Memory Item updated"},"400":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"Bad request - invalid input"},"401":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string"},"error_msg":{"type":"string"},"required_permission":{"type":"object","description":"RBAC permission the caller lacks. Present when the permission check denies the request.","properties":{"resource":{"type":"string"},"action":{"type":"string"}}}}}}},"description":"Access denied"},"404":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"Resource not found"},"409":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"Invalid action taken on resource"},"500":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"System error"},"503":{"content":{"application/json":{"schema":{"type":"object","properties":{"error_msg":{"type":"string"}}}}},"description":"System not ready for requests"}}}}}}
```
