Database context
Store and read named text or Markdown documents on a database.
List database contexts
GET
/v1/databases/{database_id}/contextList the context documents saved on a database, sorted by name.
Path parameters
| Name | Type | Description |
|---|---|---|
database_id (required) | string | Database ID |
Response 200 — Contexts
| Name | Type | Description |
|---|---|---|
contexts (required) | DatabaseContextEntry[] |
Fields of contexts
| Name | Type | Description |
|---|---|---|
contexts[].content (required) | string | |
contexts[].name (required) | string | |
contexts[].updated_at (required) | string |
Example response
{
"contexts": [
{
"content": "string",
"name": "string",
"updated_at": "2026-01-01T00:00:00Z"
}
]
}
Errors
| Status | Description |
|---|---|
404 | Database not found |
Create or update database context
POST
/v1/databases/{database_id}/contextSave a named text or Markdown document on a database. Saving under an existing name replaces its content. Content can be up to 512,000 characters.
Path parameters
| Name | Type | Description |
|---|---|---|
database_id (required) | string | Database ID |
Request body
| Name | Type | Description |
|---|---|---|
content (required) | string | Text or Markdown, up to 512,000 characters. |
name (required) | string | Name of the entry; an existing entry with this name is replaced. 1 to 128 ASCII letters, digits or _, not starting with a digit, and not a SQL reserved word. |
Example request
{
"content": "The orders table holds one row per completed purchase. `amount` is in USD cents.",
"name": "orders_overview"
}
Response 200 — Context saved
| Name | Type | Description |
|---|---|---|
context (required) | DatabaseContextEntry | A named piece of text stored with a database. |
Fields of context
| Name | Type | Description |
|---|---|---|
context.content (required) | string | |
context.name (required) | string | |
context.updated_at (required) | string |
Example response
{
"context": {
"content": "string",
"name": "string",
"updated_at": "2026-01-01T00:00:00Z"
}
}
Errors
| Status | Description |
|---|---|
400 | Invalid request |
404 | Database not found |
Get one database context
GET
/v1/databases/{database_id}/context/{name}Get one context document by name.
Path parameters
| Name | Type | Description |
|---|---|---|
database_id (required) | string | Database ID |
name (required) | string | Context name. Follows the same rules as a table name. |
Response 200 — Context found
| Name | Type | Description |
|---|---|---|
context (required) | DatabaseContextEntry | A named piece of text stored with a database. |
Fields of context
| Name | Type | Description |
|---|---|---|
context.content (required) | string | |
context.name (required) | string | |
context.updated_at (required) | string |
Example response
{
"context": {
"content": "string",
"name": "string",
"updated_at": "2026-01-01T00:00:00Z"
}
}
Errors
| Status | Description |
|---|---|
400 | Invalid request |
404 | Database or context not found |
Delete database context
DELETE
/v1/databases/{database_id}/context/{name}Delete a context document from a database.
Path parameters
| Name | Type | Description |
|---|---|---|
database_id (required) | string | Database ID |
name (required) | string | Context name. Follows the same rules as a table name. |
Response 204 — Context deleted
Errors
| Status | Description |
|---|---|
400 | Invalid request |
404 | Database or context not found |