Skip to navigation

Create a conversation

Authentication

AuthorizationBearer
API key or Clerk session token

Request

This endpoint expects an object.
agentIdstringOptional1-255 characters

Agent (agent_…) this conversation belongs to, stored as metadata.agentId. Must name an agent the caller owns.

messageslist of objectsOptionalDefaults to []

Full-fidelity transcript. A tool message must carry toolResults answering an assistant toolCalls entry issued earlier in the array; ids and createdAt are minted when omitted.

metadatamap from strings to anyOptionalDefaults to {}
modelIdstringOptional<=255 characters
ownerIdstring or nullOptional1-255 characters

Owner key for this conversation, stored in the indexed owner_id column and filterable via ?ownerId=. Overrides a nested metadata.ownerId. Null means no owner.

sourceobjectOptional
Import provenance, stored as metadata.importSource.
systemPromptstringOptional
titlestringOptional<=500 charactersDefaults to New Chat

Response

A conversation with this source.system and source.externalId was already imported. Nothing was created and the existing conversation is returned with imported: false.

createdAtstring
idstring
messageslist of objects
metadatamap from strings to any
modelIdstring or null
ownerIdstring or null
sourceenum
Allowed values:
systemPromptstring or null
titlestring
updatedAtstring
importedbooleanOptional

Set by POST /v1/conversations only. True when this call created the conversation (201); false when a conversation with the same source.system and source.externalId already existed and is returned unchanged (200).

schemaWarningslist of objectsOptional

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
422
Unprocessable Entity Error
500
Internal Server Error
503
Service Unavailable Error