Chats API

Stores the AI drawer’s conversation history. Each chat belongs to one user in one instance and holds an ordered list of prompts with the model’s responses and any generated artifacts.

Base URL: https://mcp.content.one/api. All requests and responses are JSON (Content-Type: application/json, max 1 MB body). Every response has a message; successful responses also have data.

Method Path Description
GET /api/chats List the user’s chats
POST /api/chats Create a chat
GET /api/chats/:chatZuid Get a chat with its prompts
POST /api/chats/:chatZuid/prompt Add a prompt to a chat
PATCH /api/chats/:chatZuid/prompt/:promptZuid Update a prompt’s approval

Authentication & instance

Every endpoint requires a Zesty session token and an instance the user can access.

Header Value Notes
Authorization Bearer <SESSION_TOKEN> · required Verified with the Zesty auth service. The user is taken from the token.
X-Instance-Zuid <INSTANCE_ZUID> · required* The instance to read or write chats in.

*The instance ZUID can also be sent as instanceZuid in the JSON body or the ?instanceZuid= query string. If more than one is sent, the body wins, then the query string, then the header. The user’s access to the instance is checked on every request.

Errors on every endpoint

Status Message When
400 Authorization header with Bearer token is required. Missing or non-Bearer Authorization header.
401 The auth service's message, e.g. No Session The session token is invalid or expired. Unauthorized session. when the auth service gives no message.
502 Authentication service unavailable. The auth service failed; retry later.
400 <JSON parse error> The request body is not valid JSON.
413 request entity too large The body is over 1 MB.
400 Missing "instanceZuid". No instance ZUID in the body, query string or header.
403 User does not have access to the requested instance. The user is not a member of the instance.
404 Instance not found. The instance ZUID does not exist.
502 Unexpected error checking instance access. The Accounts API failed while checking access; retry later.
500 Authentication failed. / Instance access check failed. The auth or instance check itself crashed (e.g. the upstream service was unreachable).
500 Internal server error. Unexpected server or Datastore error.

Data model

Chats are stored per user and per instance: Users → Instances → Chats → Prompts. A user only ever sees their own chats in the instance they request.

Chat

Field Type Description
chatZuid string Chat ZUID.
userZuid string Owner.
instanceZuid string Instance the chat belongs to.
roleZuid string Owner’s role in the instance.
title string Display title (the first prompt when created by /client).
referer string Manager UI URL the chat started from.
createdAt string ISO 8601 timestamp.
updatedAt string ISO 8601 timestamp of the latest activity.
deletedAt string | null Set when soft-deleted. Soft-deleted chats are never returned.

Prompt

Field Type Description
promptZuid string Prompt ZUID.
chatZuid string Parent chat.
instanceZuid string Instance.
prompt string The user’s prompt.
response string The model’s output as a JSON string.
metadata object Generation settings.
url string Manager UI URL where the prompt was sent.
approval string Approval state.
artifacts Artifact[] Outputs kept with the prompt.
createdAt / updatedAt string ISO 8601 timestamps.
deletedAt string | null Set when soft-deleted. Soft-deleted prompts are never returned.

Artifact

Field Type Description
type "image" | "block" | "code" What was produced.
fileZuid string Media file ZUID (images).
url string Media URL (images).
path string Manager UI path to the generated block (blocks).
value string Code editor contents as a JSON string (code).

List chats

GET/api/chats

Returns the authenticated user’s chats for the instance, most recently active first. A chat’s updatedAt is bumped whenever a prompt is added or its approval changes.

Query parameters

Field Type Description
instanceZuid string Instance ZUID, if not sent in the X-Instance-Zuid header.

Example

curl https://mcp.content.one/api/chats \
  -H "Authorization: Bearer $SESSION_TOKEN" \
  -H "X-Instance-Zuid: $INSTANCE_ZUID"

Response 200

{
  "data": [ {
      "chatZuid": "51-abc123-xyz",
      "userZuid": "5-abc123-xyz",
      "instanceZuid": "8-abc123-xyz",
      "roleZuid": "30-abc123-xyz",
      "title": "Write a tagline for our homepage",
      "referer": "https://8-abc123-xyz.manager.zesty.io/content/6-abc/7-abc",
      "createdAt": "2026-10-13T17:02:11.512Z",
      "updatedAt": "2026-10-13T17:05:40.091Z",
      "deletedAt": null
    } ],
  "message": "Fetched chats successfully."
}

Create a chat

POST/api/chats

Starts a new, empty chat. The AI drawer usually doesn’t call this directly: POST /client creates the chat automatically on the first prompt when url and roleZuid are sent without a chatZuid.

Body

Field Type Description
roleZuid string · required The user’s role ZUID in the instance.
title string · optional Display title. Defaults to an empty string.
referer string · optional Manager UI URL the chat was started from. Defaults to an empty string.
instanceZuid string · optional Instance ZUID, if not sent in the header.

Example

curl -X POST https://mcp.content.one/api/chats \
  -H "Authorization: Bearer $SESSION_TOKEN" \
  -H "X-Instance-Zuid: $INSTANCE_ZUID" \
  -H "Content-Type: application/json" \
  -d '{"roleZuid":"30-abc123-xyz","title":"Homepage copy"}'

Response 201

{
  "data": {
    "chatZuid": "51-abc123-xyz",
    "userZuid": "5-abc123-xyz",
    "instanceZuid": "8-abc123-xyz",
    "roleZuid": "30-abc123-xyz",
    "title": "Write a tagline for our homepage",
    "referer": "https://8-abc123-xyz.manager.zesty.io/content/6-abc/7-abc",
    "createdAt": "2026-10-13T17:02:11.512Z",
    "updatedAt": "2026-10-13T17:05:40.091Z",
    "deletedAt": null
  },
  "key": "51-abc123-xyz",
  "message": "Chat created successfully."
}

Errors

Status Message
400 Missing roleZuid in request body.

Get a chat

GET/api/chats/:chatZuid

Returns one chat with all of its prompts, oldest first (conversation order). Each prompt includes its artifacts.

Path parameters

Field Type Description
chatZuid string The chat ZUID.

Query parameters

Field Type Description
instanceZuid string Instance ZUID, if not sent in the header.

Example

curl https://mcp.content.one/api/chats/51-abc123-xyz \
  -H "Authorization: Bearer $SESSION_TOKEN" \
  -H "X-Instance-Zuid: $INSTANCE_ZUID"

Response 200

{
  "data": {
    "chatZuid": "51-abc123-xyz",
    "title": "Write a tagline for our homepage",
    "…": "other chat fields",
    "prompts": [ {
        "promptZuid": "52-abc123-xyz",
        "chatZuid": "51-abc123-xyz",
        "instanceZuid": "8-abc123-xyz",
        "prompt": "Write a tagline for our homepage",
        "response": "\"Content that scales with you.\"",
        "metadata": { "temperature": 0.5, "tone": "Professional" },
        "url": "https://8-abc123-xyz.manager.zesty.io/content/6-abc/7-abc",
        "approval": "0",
        "artifacts": [],
        "createdAt": "2026-10-13T17:05:40.012Z",
        "updatedAt": "2026-10-13T17:05:40.012Z",
        "deletedAt": null
      } ]
  },
  "message": "Fetched 51-abc123-xyz chat successfully."
}

Errors

Status Message
404 No chats found.

Add a prompt

POST/api/chats/:chatZuid/prompt

Appends one prompt/response exchange to a chat and bumps the chat’s updatedAt. POST /client calls this automatically when url is sent.

Path parameters

Field Type Description
chatZuid string The chat ZUID.

Body

Field Type Description
prompt string · required The user’s prompt.
response string · required The model’s output, as a JSON string.
metadata object · required Generation settings, e.g. temperature, tone, language, modelZuid, itemZuid.
url string · required Manager UI URL where the prompt was sent.
approval string · required Initial approval state: "0" pending, "1" approved, "-1" rejected.
artifacts Artifact[] · optional Outputs to keep with the prompt. See Artifact.
instanceZuid string · optional Instance ZUID, if not sent in the header.

Example

curl -X POST https://mcp.content.one/api/chats/51-abc123-xyz/prompt \
  -H "Authorization: Bearer $SESSION_TOKEN" \
  -H "X-Instance-Zuid: $INSTANCE_ZUID" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"Write a tagline","response":"\"Content that scales.\"","metadata":{"temperature":0.5},"url":"https://…","approval":"0","artifacts":[]}'

Response 201

{
  "data": {
    "promptZuid": "52-abc123-xyz",
    "chatZuid": "51-abc123-xyz",
    "instanceZuid": "8-abc123-xyz",
    "prompt": "Write a tagline for our homepage",
    "response": "\"Content that scales with you.\"",
    "metadata": { "temperature": 0.5, "tone": "Professional" },
    "url": "https://8-abc123-xyz.manager.zesty.io/content/6-abc/7-abc",
    "approval": "0",
    "artifacts": [],
    "createdAt": "2026-10-13T17:05:40.012Z",
    "updatedAt": "2026-10-13T17:05:40.012Z",
    "deletedAt": null
  },
  "key": "52-abc123-xyz",
  "message": "Prompt created successfully."
}

Errors

Status Message
400 Missing required fields in request body.
400 Invalid approval value. Expected one of: 0, 1, -1.
404 Chat not found.

Update prompt approval

PATCH/api/chats/:chatZuid/prompt/:promptZuid

Records whether the user approved a response, and bumps the chat’s updatedAt.

Path parameters

Field Type Description
chatZuid string The chat ZUID.
promptZuid string The prompt ZUID.

Body

Field Type Description
approval string · required New approval state: "0" pending, "1" approved, "-1" rejected.
instanceZuid string · optional Instance ZUID, if not sent in the header.

Example

curl -X PATCH https://mcp.content.one/api/chats/51-abc123-xyz/prompt/52-abc123-xyz \
  -H "Authorization: Bearer $SESSION_TOKEN" \
  -H "X-Instance-Zuid: $INSTANCE_ZUID" \
  -H "Content-Type: application/json" \
  -d '{"approval":"1"}'

Response 200

{
  "data": { "promptZuid": "52-abc123-xyz", "approval": "1", "…": "other prompt fields" },
  "message": "Prompt approval updated successfully."
}

Errors

Status Message
400 Missing approval field in request body.
400 Invalid approval value. Expected one of: 0, 1, -1.
404 Prompt not found.