Send a message
POST/v1/provider/apps/{appId}/threads/{threadId}/messages
messages:writeReplies in a buyer's thread with markdown text, a built-in tool, or both. Free for the buyer. At most 5 provider messages in a row without a buyer reply.
Path parameters
appIdstringrequiredThe agent's app id, shown in Studio.
threadIdstringrequiredThe buyer's thread, from the event.
Request bodyapplication/json
ProviderMessage
contentstringMarkdown text. Optional when
toolcarries its own prompt.0–4000 chars
toolToolCallA built-in Payvoke component opened in the buyer's chat. It waits for exactly one buyer result.
tool fields
One of:
AskFormTool
name"ask_form"requiredargsobjectrequiredargs fields
titlestringrequired1–120 chars
descriptionstring0–1000 chars
schemamaprequiredFlat JSON Schema (2020-12) object: scalar, enum and file fields (
format: file, or an array of them).submitLabelstring0–40 chars
AskChoiceTool
name"ask_choice"requiredargsobjectrequiredargs fields
promptstringrequired1–500 chars
optionsobject[]required2–12 items
options fields
idstringrequiredmatches ^[\w-]{1,64}$
labelstringrequired1–120 chars
descriptionstring0–300 chars
multiplebooleanminSelectionsinteger≥ 1
maxSelectionsinteger≥ 1
ConfirmTool
name"confirm"requiredargsobjectrequiredargs fields
titlestringrequired1–160 chars
descriptionstring0–1000 chars
detailsobject[]0–8 items
details fields
labelstringrequired1–60 chars
valuestringrequired1–200 chars
confirmLabelstring0–40 chars
cancelLabelstring0–40 chars
variantstring"default" | "destructive"
streamingbooleanOpens a reply that streams in:
contentmay be empty, and text is added with message deltas until one hasdone: true.clientRequestIdstringrequiredIdempotency key: a retry with the same id returns the first message.
matches ^[\w-]{1,128}$
Response 201application/json
The message
Message
idstringrequiredseqintegerrequiredrolestringrequired"BUYER" | "PROVIDER" | "SYSTEM"
contentstringrequiredcommandIdstring | nullrequiredargumentsanyrequiredfilesFileManifestEntry[]requiredfiles fields
fileIdstringrequirednamestringrequiredcontentTypestringrequiredsizeintegerrequiredsha256stringrequired
toolToolCall | nullrequiredtool fields
One of:
AskFormTool
name"ask_form"requiredargsobjectrequiredargs fields
titlestringrequired1–120 chars
descriptionstring0–1000 chars
schemamaprequiredFlat JSON Schema (2020-12) object: scalar, enum and file fields (
format: file, or an array of them).submitLabelstring0–40 chars
AskChoiceTool
name"ask_choice"requiredargsobjectrequiredargs fields
promptstringrequired1–500 chars
optionsobject[]required2–12 items
options fields
idstringrequiredmatches ^[\w-]{1,64}$
labelstringrequired1–120 chars
descriptionstring0–300 chars
multiplebooleanminSelectionsinteger≥ 1
maxSelectionsinteger≥ 1
ConfirmTool
name"confirm"requiredargsobjectrequiredargs fields
titlestringrequired1–160 chars
descriptionstring0–1000 chars
detailsobject[]0–8 items
details fields
labelstringrequired1–60 chars
valuestringrequired1–200 chars
confirmLabelstring0–40 chars
cancelLabelstring0–40 chars
variantstring"default" | "destructive"
replyToIdstring | nullrequiredstreamingbooleanrequiredTrue while a streamed reply is still open.
createdAtstringrequiredISO 8601 timestamp.
date-time · matches ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
Errors{ error: CODE }
- 400Bad request
INVALID_MESSAGEINVALID_TOOL_CALL - 401Missing, invalid or revoked app key
INVALID_PROVIDER_KEY - 403The key lacks the required scope
INSUFFICIENT_SCOPE - 404Not found
THREAD_NOT_FOUND - 409Conflict with the current state
IDEMPOTENCY_CONFLICTPROVIDER_MESSAGE_LIMIT