> For the complete documentation index, see [llms.txt](https://docs.zaia.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zaia.app/documentation/api-reference-alpha/reference/chat-messages.md).

# Chat Messages

## GET /api/v1/chat-messages

> Retrieves multiple chat messages.

```json
{"openapi":"3.1.0","info":{"title":"Public API","version":"1.0.0"},"servers":[{"description":"API Server","url":"https://api.endless.zaia.app"}],"paths":{"/api/v1/chat-messages":{"get":{"description":"Retrieves multiple chat messages.","tags":["Chat Messages"],"parameters":[{"schema":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"required":true,"description":"A UUID v4 string that identifies an entity.","name":"chatId","in":"query"},{"schema":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"required":false,"description":"A UUID v4 string that identifies an entity.","name":"chatThreadId","in":"query"},{"schema":{"anyOf":[{"type":"array","items":{"type":"string","enum":["chat-message-follow-ups","senders"]}},{"type":"string","enum":["chat-message-follow-ups","senders"]}],"default":[]},"required":false,"name":"joins","in":"query"},{"schema":{"type":"object","properties":{"limit":{"type":"number","minimum":1,"maximum":1000,"default":250}},"default":{"limit":250}},"required":false,"name":"pagination","in":"query"},{"schema":{"anyOf":[{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."}},{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."}],"default":[]},"required":false,"name":"ticketIds","in":"query"},{"schema":{"type":"string","description":"The API key to use for authentication. Can be created in the api keys section on the workspace settings page."},"required":true,"description":"The API key to use for authentication. Can be created in the api keys section on the workspace settings page.","name":"authorization","in":"header"}],"responses":{"200":{"description":"Retrieves all chat messages for the specified chat.","content":{"application/json":{"schema":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"createdAt":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"updatedAt":{"type":"string","format":"date-time"},"chatId":{"type":"string","format":"uuid","description":"The chat ID associated with the message."},"chatThreadId":{"type":"string","nullable":true,"format":"uuid","description":"The id of the chat thread that the message belongs to."},"content":{"type":"string","minLength":0,"maxLength":100000,"description":"The content of the message."},"detail":{"type":"object","properties":{"attachments":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"id":{"type":"string","format":"uuid","description":"The attachment ID associated with this payload."},"description":{"type":"string","minLength":3,"maxLength":250,"description":"The description of the PNG image."},"extension":{"type":"string","enum":["png"],"description":"The attachment subtype represented by this payload."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The display name of the PNG file."}},"required":["file","id","description","extension","name"]},{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"id":{"type":"string","format":"uuid","description":"The attachment ID associated with this payload."},"description":{"type":"string","minLength":3,"maxLength":250,"description":"The description of the PDF file."},"extension":{"type":"string","enum":["pdf"],"description":"The attachment subtype represented by this payload."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The display name of the PDF file."}},"required":["file","id","description","extension","name"]},{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"id":{"type":"string","format":"uuid","description":"The attachment ID associated with this payload."},"extension":{"type":"string","enum":["wav"],"description":"The attachment subtype represented by this payload."},"mode":{"type":"string","enum":["attachment","message"],"description":"The mode of the audio attachment. \"attachment\" sends it as an attachment and \"message\" sends it as the main message."},"summary":{"type":"string","maxLength":1000,"description":"The summary of the audio file."},"transcription":{"type":"string","description":"The transcription of the audio file."}},"required":["file","id","extension","mode","summary","transcription"]},{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"id":{"type":"string","format":"uuid","description":"The attachment ID associated with this payload."},"description":{"type":"string","minLength":3,"maxLength":250,"description":"The description of the markdown file."},"extension":{"type":"string","enum":["md"],"description":"The attachment subtype represented by this payload."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The display name of the markdown file."}},"required":["file","id","description","extension","name"]},{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"id":{"type":"string","format":"uuid","description":"The attachment ID associated with this payload."},"description":{"type":"string","minLength":3,"maxLength":250,"description":"The description of the text file."},"extension":{"type":"string","enum":["txt"],"description":"The attachment subtype represented by this payload."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The display name of the text file."}},"required":["file","id","description","extension","name"]}]},"description":"The attachments associated with the chat message."},"delivery":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"content":{"anyOf":[{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."},"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["attachmentsIds","text"]},{"type":"object","properties":{"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["text"]},{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."}},"required":["attachmentsIds"]}],"description":"The content payload delivered through the external provider."},"id":{"type":"string","format":"uuid","description":"The stable identifier of this delivery entry."},"provider":{"type":"string","enum":["waha","whatsapp","instagram"],"description":"The external provider that received the delivery payload."},"timestamp":{"type":"string","nullable":true,"format":"date-time","description":"When the delivery payload was recorded."},"externalId":{"type":"string","minLength":3,"maxLength":250,"description":"External reference in the integrated system."},"status":{"type":"string","enum":["sent"],"description":"The delivery status represented by this payload."}},"required":["content","id","provider","timestamp","externalId","status"]},{"type":"object","properties":{"content":{"anyOf":[{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."},"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["attachmentsIds","text"]},{"type":"object","properties":{"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["text"]},{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."}},"required":["attachmentsIds"]}],"description":"The content payload delivered through the external provider."},"id":{"type":"string","format":"uuid","description":"The stable identifier of this delivery entry."},"provider":{"type":"string","enum":["waha","whatsapp","instagram"],"description":"The external provider that received the delivery payload."},"timestamp":{"type":"string","nullable":true,"format":"date-time","description":"When the delivery payload was recorded."},"error":{"nullable":true,"description":"The error payload returned when the delivery failed."},"status":{"type":"string","enum":["failed"],"description":"The delivery status represented by this payload."}},"required":["content","id","provider","timestamp","status"]},{"type":"object","properties":{"content":{"anyOf":[{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."},"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["attachmentsIds","text"]},{"type":"object","properties":{"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["text"]},{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."}},"required":["attachmentsIds"]}],"description":"The content payload delivered through the external provider."},"id":{"type":"string","format":"uuid","description":"The stable identifier of this delivery entry."},"provider":{"type":"string","enum":["waha","whatsapp","instagram"],"description":"The external provider that received the delivery payload."},"timestamp":{"type":"string","nullable":true,"format":"date-time","description":"When the delivery payload was recorded."},"status":{"type":"string","enum":["pending"],"description":"The delivery status represented by this payload."}},"required":["content","id","provider","timestamp","status"]}]},"default":[],"description":"The delivery status for external channel messages."},"referral":{"type":"object","nullable":true,"properties":{"body":{"type":"string","nullable":true,"description":"The primary text from the ad or post."},"ctwaClid":{"type":"string","nullable":true,"description":"The Click-to-WhatsApp click identifier."},"headline":{"type":"string","nullable":true,"description":"The headline from the ad or post."},"imageUrl":{"type":"string","nullable":true,"description":"The image URL when the ad uses image media."},"mediaType":{"type":"string","nullable":true,"enum":["image","video",null],"description":"The media type used in the ad or post."},"sourceId":{"type":"string","description":"The Meta ID for the ad or post."},"sourceType":{"type":"string","enum":["ad","post"],"description":"Whether the referral came from an ad or a post."},"sourceUrl":{"type":"string","description":"The URL of the ad or post."},"thumbnailUrl":{"type":"string","nullable":true,"description":"The thumbnail URL when the ad uses video media."},"videoUrl":{"type":"string","nullable":true,"description":"The video URL when the ad uses video media."}},"default":null,"required":["body","ctwaClid","headline","imageUrl","mediaType","sourceId","sourceType","sourceUrl","thumbnailUrl","videoUrl"],"description":"Referral metadata when the message originated from Click-to-WhatsApp."}},"required":["attachments"],"description":"The structured detail payload associated with the message."},"externalId":{"type":"string","nullable":true,"minLength":3,"maxLength":250,"description":"External reference in the integrated system."},"rawContent":{"type":"string","nullable":true,"minLength":0,"maxLength":100000,"description":"The raw content of the message as it was generated by the assistant."},"role":{"type":"string","enum":["user","assistant","support","system"],"description":"The role of the actor that produced the message."},"senderId":{"type":"string","nullable":true,"format":"uuid","description":"The super identity ID of the sender (agents, squads, users or external users) of the message."},"chatMessageFollowUp":{"type":"object","nullable":true,"properties":{"createdAt":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"updatedAt":{"type":"string","format":"date-time"},"chatId":{"type":"string","format":"uuid","description":"The id of the chat this follow-up belongs to."},"chatMessageId":{"type":"string","nullable":true,"format":"uuid","description":"The id of the chat message this follow-up belongs to."},"dueDate":{"type":"string","format":"date-time","description":"The date and time when the follow-up message should be sent."},"finishedAt":{"type":"string","nullable":true,"format":"date-time","description":"The date and time when the follow-up went from pending to any other status."},"message":{"type":"string","minLength":1,"description":"The follow-up message content."},"reason":{"type":"string","nullable":true,"description":"The reason why the follow-up failed."},"status":{"type":"string","enum":["pending","sent","failed","cancelled"],"description":"The current status of the follow-up."},"triggerChatMessageId":{"type":"string","format":"uuid","description":"The id of the chat message that triggered the follow-up."}},"required":["createdAt","id","updatedAt","chatId","chatMessageId","dueDate","finishedAt","message","reason","status","triggerChatMessageId"]},"senderSuperIdentity":{"type":"object","nullable":true,"properties":{"createdAt":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"updatedAt":{"type":"string","format":"date-time"},"entity":{"type":"string","enum":["agents","squads","users","externalUsers","workflows"]},"sender":{"anyOf":[{"type":"object","properties":{"createdAt":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"isRemoved":{"type":"boolean"},"referenceId":{"type":"string","nullable":true,"format":"uuid","description":"The ID of the original entity in production."},"updatedAt":{"type":"string","format":"date-time"},"versionId":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"codeRuntime":{"type":"boolean","description":"Whether the agent should be able to execute JavaScript code using the Code Runtime tool."},"internalName":{"type":"string","nullable":true,"minLength":3,"maxLength":50,"description":"The internal name of the agent. For internal use only."},"iterations":{"type":"number","minimum":2,"maximum":100,"description":"The number of iterations (steps) the agent can execute in a single execution."},"llm":{"type":"string","enum":["claude-haiku-4-5","claude-opus-4-8","claude-opus-4-6","claude-opus-4-5","claude-sonnet-4-6","claude-sonnet-4-5","gpt-5.2","gpt-5.5","gpt-5.4","gpt-5.4-mini","gpt-5.4-nano","gemini-2.5-flash","gemini-2.5-pro","gemini-3.5-flash","gemini-3-flash","gemini-3-pro","gemini-3.1-pro","kimi-k2.5","kimi-k2.6","grok-4.3"],"description":"The LLM model key to use for the agent."},"llmProviderId":{"type":"string","nullable":true,"format":"uuid","description":"The id of the LLM provider to use for the agent."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The name of the agent."},"picture":{"type":"string","nullable":true,"description":"The picture of the agent."},"planning":{"type":"boolean","description":"Whether the agent should plan before each execution."},"prompt":{"type":"string","minLength":1,"maxLength":10000,"description":"The main description of the agent's behavior."},"reasoningMode":{"type":"string","nullable":true,"enum":["low","medium","high","xhigh",null],"description":"The reasoning mode to use for the agent. If null, reasoning will be disabled."},"role":{"type":"string","minLength":1,"maxLength":250,"description":"The role of the agent. Particularly useful to give other agents context of what the agent does."},"superIdentityId":{"type":"string","format":"uuid","description":"The super identity ID associated with the agent."},"temperature":{"type":"number","minimum":0,"maximum":2,"description":"The temperature to use for the agent. The lower the more deterministic. The higher the more creative."},"timezone":{"type":"string","nullable":true,"enum":["Africa/Cairo","Africa/Johannesburg","America/Chicago","America/Denver","America/Los_Angeles","America/New_York","America/Sao_Paulo","America/Manaus","Asia/Dubai","Asia/Kolkata","Asia/Shanghai","Asia/Singapore","Asia/Tokyo","Australia/Sydney","Europe/Berlin","Europe/London","Europe/Moscow","Europe/Paris","Pacific/Auckland","Pacific/Auckland2","UTC","auto",null],"description":"The timezone to use for the agent. If null, no timezone will be used."},"toolCount":{"type":"integer","minimum":0,"description":"The number of tools currently associated with the agent."},"voiceId":{"type":"string","nullable":true,"format":"uuid","description":"The TTS voice to use for audio responses. Null when disabled for the agent."},"workspaceId":{"type":"string","format":"uuid","description":"The workspace ID that owns the agent."}},"required":["createdAt","id","isRemoved","referenceId","updatedAt","versionId","codeRuntime","internalName","iterations","llm","llmProviderId","name","picture","planning","prompt","reasoningMode","role","superIdentityId","temperature","timezone","toolCount","voiceId","workspaceId"]},{"type":"object","properties":{"createdAt":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"isRemoved":{"type":"boolean"},"referenceId":{"type":"string","nullable":true,"format":"uuid","description":"The ID of the original entity in production."},"updatedAt":{"type":"string","format":"date-time"},"versionId":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":{"type":"string","nullable":true,"minLength":3,"maxLength":250,"description":"The internal description of the squad."},"mode":{"type":"string","enum":["hierarchical","flat"],"description":"The management mode. In flat, agents redirect the chat to one another. In hierarchical, all iterations are intermediated by the manager."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The display name of the squad."},"picture":{"type":"string","nullable":true,"description":"The picture associated with the squad."},"superIdentityId":{"type":"string","format":"uuid","description":"The super identity ID associated with the squad."},"workspaceId":{"type":"string","format":"uuid","description":"The workspace ID that owns the squad."}},"required":["createdAt","id","isRemoved","referenceId","updatedAt","versionId","description","mode","name","picture","superIdentityId","workspaceId"]},{"type":"object","properties":{"createdAt":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"updatedAt":{"type":"string","format":"date-time"},"brandId":{"type":"string","nullable":true,"format":"uuid","description":"The brand ID associated with the user."},"clientReferenceId":{"type":"string","nullable":true,"description":"The external client reference ID associated with the user."},"email":{"type":"string","format":"email","description":"The email address of the user."},"emailStatus":{"type":"string","enum":["pending","verified"],"description":"The email verification status of the user."},"firstAccessAt":{"type":"string","nullable":true,"format":"date-time","description":"When the user first accessed the platform."},"gtm":{"type":"object","nullable":true,"additionalProperties":{"type":"string"},"description":"The GTM parameters to be used in tracking events for the user."},"language":{"type":"string","enum":["enUs","esEs","ptBr"],"description":"The preferred language configured for the user."},"lastAuthenticationAt":{"type":"string","nullable":true,"format":"date-time","description":"When the user last authenticated."},"metadata":{"type":"object","nullable":true,"additionalProperties":{"type":"string"},"description":"Metadata to be used in tracking events for the user."},"name":{"type":"string","nullable":true,"minLength":3,"maxLength":50,"description":"The display name of the user."},"phoneNumber":{"type":"string","nullable":true,"minLength":6,"maxLength":15},"picture":{"type":"string","nullable":true,"description":"The picture associated with the user."},"superIdentityId":{"type":"string","format":"uuid","description":"The super identity ID associated with the user."},"whiteLabelId":{"type":"string","nullable":true,"format":"uuid","description":"The white label ID associated with the user, when one exists."}},"required":["createdAt","id","updatedAt","brandId","clientReferenceId","email","emailStatus","firstAccessAt","gtm","language","lastAuthenticationAt","metadata","name","phoneNumber","picture","superIdentityId","whiteLabelId"]},{"type":"object","properties":{"createdAt":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"updatedAt":{"type":"string","format":"date-time"},"blocked":{"type":"boolean","description":"Whether the external user is blocked."},"channelId":{"type":"string","format":"uuid","description":"The ID of the channel associated with the external user."},"externalId":{"type":"string","nullable":true,"minLength":3,"maxLength":250,"description":"External reference in the integrated system."},"externalUserGroupId":{"type":"string","nullable":true,"format":"uuid","description":"The ID of the external user group associated with the external user."},"identifier":{"type":"string","nullable":true,"description":"A unique identifier of the external user (usernames, emails, phone numbers and etc)."},"name":{"type":"string","nullable":true,"minLength":3,"maxLength":50,"description":"The display name of the external user."},"superIdentityId":{"type":"string","format":"uuid","description":"The ID of the super identity associated with the external user."},"tierId":{"type":"string","nullable":true,"format":"uuid","description":"The ID of the tier associated with the external user."},"workspaceId":{"type":"string","format":"uuid","description":"The ID of the workspace associated with the external user."}},"required":["createdAt","id","updatedAt","blocked","channelId","externalId","externalUserGroupId","identifier","name","superIdentityId","tierId","workspaceId"]}]}},"required":["createdAt","id","updatedAt","entity","sender"]}},"required":["createdAt","id","updatedAt","chatId","chatThreadId","content","detail","externalId","rawContent","role","senderId","chatMessageFollowUp","senderSuperIdentity"]}},{"type":"array","items":{"type":"object","properties":{"createdAt":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"updatedAt":{"type":"string","format":"date-time"},"chatId":{"type":"string","format":"uuid","description":"The chat ID associated with the message."},"chatThreadId":{"type":"string","nullable":true,"format":"uuid","description":"The id of the chat thread that the message belongs to."},"content":{"type":"string","minLength":0,"maxLength":100000,"description":"The content of the message."},"detail":{"type":"object","properties":{"attachments":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"id":{"type":"string","format":"uuid","description":"The attachment ID associated with this payload."},"description":{"type":"string","minLength":3,"maxLength":250,"description":"The description of the PNG image."},"extension":{"type":"string","enum":["png"],"description":"The attachment subtype represented by this payload."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The display name of the PNG file."}},"required":["file","id","description","extension","name"]},{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"id":{"type":"string","format":"uuid","description":"The attachment ID associated with this payload."},"description":{"type":"string","minLength":3,"maxLength":250,"description":"The description of the PDF file."},"extension":{"type":"string","enum":["pdf"],"description":"The attachment subtype represented by this payload."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The display name of the PDF file."}},"required":["file","id","description","extension","name"]},{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"id":{"type":"string","format":"uuid","description":"The attachment ID associated with this payload."},"extension":{"type":"string","enum":["wav"],"description":"The attachment subtype represented by this payload."},"mode":{"type":"string","enum":["attachment","message"],"description":"The mode of the audio attachment. \"attachment\" sends it as an attachment and \"message\" sends it as the main message."},"summary":{"type":"string","maxLength":1000,"description":"The summary of the audio file."},"transcription":{"type":"string","description":"The transcription of the audio file."}},"required":["file","id","extension","mode","summary","transcription"]},{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"id":{"type":"string","format":"uuid","description":"The attachment ID associated with this payload."},"description":{"type":"string","minLength":3,"maxLength":250,"description":"The description of the markdown file."},"extension":{"type":"string","enum":["md"],"description":"The attachment subtype represented by this payload."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The display name of the markdown file."}},"required":["file","id","description","extension","name"]},{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"id":{"type":"string","format":"uuid","description":"The attachment ID associated with this payload."},"description":{"type":"string","minLength":3,"maxLength":250,"description":"The description of the text file."},"extension":{"type":"string","enum":["txt"],"description":"The attachment subtype represented by this payload."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The display name of the text file."}},"required":["file","id","description","extension","name"]}]},"description":"The attachments associated with the chat message."},"delivery":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"content":{"anyOf":[{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."},"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["attachmentsIds","text"]},{"type":"object","properties":{"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["text"]},{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."}},"required":["attachmentsIds"]}],"description":"The content payload delivered through the external provider."},"id":{"type":"string","format":"uuid","description":"The stable identifier of this delivery entry."},"provider":{"type":"string","enum":["waha","whatsapp","instagram"],"description":"The external provider that received the delivery payload."},"timestamp":{"type":"string","nullable":true,"format":"date-time","description":"When the delivery payload was recorded."},"externalId":{"type":"string","minLength":3,"maxLength":250,"description":"External reference in the integrated system."},"status":{"type":"string","enum":["sent"],"description":"The delivery status represented by this payload."}},"required":["content","id","provider","timestamp","externalId","status"]},{"type":"object","properties":{"content":{"anyOf":[{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."},"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["attachmentsIds","text"]},{"type":"object","properties":{"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["text"]},{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."}},"required":["attachmentsIds"]}],"description":"The content payload delivered through the external provider."},"id":{"type":"string","format":"uuid","description":"The stable identifier of this delivery entry."},"provider":{"type":"string","enum":["waha","whatsapp","instagram"],"description":"The external provider that received the delivery payload."},"timestamp":{"type":"string","nullable":true,"format":"date-time","description":"When the delivery payload was recorded."},"error":{"nullable":true,"description":"The error payload returned when the delivery failed."},"status":{"type":"string","enum":["failed"],"description":"The delivery status represented by this payload."}},"required":["content","id","provider","timestamp","status"]},{"type":"object","properties":{"content":{"anyOf":[{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."},"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["attachmentsIds","text"]},{"type":"object","properties":{"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["text"]},{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."}},"required":["attachmentsIds"]}],"description":"The content payload delivered through the external provider."},"id":{"type":"string","format":"uuid","description":"The stable identifier of this delivery entry."},"provider":{"type":"string","enum":["waha","whatsapp","instagram"],"description":"The external provider that received the delivery payload."},"timestamp":{"type":"string","nullable":true,"format":"date-time","description":"When the delivery payload was recorded."},"status":{"type":"string","enum":["pending"],"description":"The delivery status represented by this payload."}},"required":["content","id","provider","timestamp","status"]}]},"default":[],"description":"The delivery status for external channel messages."},"referral":{"type":"object","nullable":true,"properties":{"body":{"type":"string","nullable":true,"description":"The primary text from the ad or post."},"ctwaClid":{"type":"string","nullable":true,"description":"The Click-to-WhatsApp click identifier."},"headline":{"type":"string","nullable":true,"description":"The headline from the ad or post."},"imageUrl":{"type":"string","nullable":true,"description":"The image URL when the ad uses image media."},"mediaType":{"type":"string","nullable":true,"enum":["image","video",null],"description":"The media type used in the ad or post."},"sourceId":{"type":"string","description":"The Meta ID for the ad or post."},"sourceType":{"type":"string","enum":["ad","post"],"description":"Whether the referral came from an ad or a post."},"sourceUrl":{"type":"string","description":"The URL of the ad or post."},"thumbnailUrl":{"type":"string","nullable":true,"description":"The thumbnail URL when the ad uses video media."},"videoUrl":{"type":"string","nullable":true,"description":"The video URL when the ad uses video media."}},"default":null,"required":["body","ctwaClid","headline","imageUrl","mediaType","sourceId","sourceType","sourceUrl","thumbnailUrl","videoUrl"],"description":"Referral metadata when the message originated from Click-to-WhatsApp."}},"required":["attachments"],"description":"The structured detail payload associated with the message."},"externalId":{"type":"string","nullable":true,"minLength":3,"maxLength":250,"description":"External reference in the integrated system."},"rawContent":{"type":"string","nullable":true,"minLength":0,"maxLength":100000,"description":"The raw content of the message as it was generated by the assistant."},"role":{"type":"string","enum":["user","assistant","support","system"],"description":"The role of the actor that produced the message."},"senderId":{"type":"string","nullable":true,"format":"uuid","description":"The super identity ID of the sender (agents, squads, users or external users) of the message."},"senderSuperIdentity":{"type":"object","nullable":true,"properties":{"createdAt":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"updatedAt":{"type":"string","format":"date-time"},"entity":{"type":"string","enum":["agents","squads","users","externalUsers","workflows"]},"sender":{"anyOf":[{"type":"object","properties":{"createdAt":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"isRemoved":{"type":"boolean"},"referenceId":{"type":"string","nullable":true,"format":"uuid","description":"The ID of the original entity in production."},"updatedAt":{"type":"string","format":"date-time"},"versionId":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"codeRuntime":{"type":"boolean","description":"Whether the agent should be able to execute JavaScript code using the Code Runtime tool."},"internalName":{"type":"string","nullable":true,"minLength":3,"maxLength":50,"description":"The internal name of the agent. For internal use only."},"iterations":{"type":"number","minimum":2,"maximum":100,"description":"The number of iterations (steps) the agent can execute in a single execution."},"llm":{"type":"string","enum":["claude-haiku-4-5","claude-opus-4-8","claude-opus-4-6","claude-opus-4-5","claude-sonnet-4-6","claude-sonnet-4-5","gpt-5.2","gpt-5.5","gpt-5.4","gpt-5.4-mini","gpt-5.4-nano","gemini-2.5-flash","gemini-2.5-pro","gemini-3.5-flash","gemini-3-flash","gemini-3-pro","gemini-3.1-pro","kimi-k2.5","kimi-k2.6","grok-4.3"],"description":"The LLM model key to use for the agent."},"llmProviderId":{"type":"string","nullable":true,"format":"uuid","description":"The id of the LLM provider to use for the agent."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The name of the agent."},"picture":{"type":"string","nullable":true,"description":"The picture of the agent."},"planning":{"type":"boolean","description":"Whether the agent should plan before each execution."},"prompt":{"type":"string","minLength":1,"maxLength":10000,"description":"The main description of the agent's behavior."},"reasoningMode":{"type":"string","nullable":true,"enum":["low","medium","high","xhigh",null],"description":"The reasoning mode to use for the agent. If null, reasoning will be disabled."},"role":{"type":"string","minLength":1,"maxLength":250,"description":"The role of the agent. Particularly useful to give other agents context of what the agent does."},"superIdentityId":{"type":"string","format":"uuid","description":"The super identity ID associated with the agent."},"temperature":{"type":"number","minimum":0,"maximum":2,"description":"The temperature to use for the agent. The lower the more deterministic. The higher the more creative."},"timezone":{"type":"string","nullable":true,"enum":["Africa/Cairo","Africa/Johannesburg","America/Chicago","America/Denver","America/Los_Angeles","America/New_York","America/Sao_Paulo","America/Manaus","Asia/Dubai","Asia/Kolkata","Asia/Shanghai","Asia/Singapore","Asia/Tokyo","Australia/Sydney","Europe/Berlin","Europe/London","Europe/Moscow","Europe/Paris","Pacific/Auckland","Pacific/Auckland2","UTC","auto",null],"description":"The timezone to use for the agent. If null, no timezone will be used."},"toolCount":{"type":"integer","minimum":0,"description":"The number of tools currently associated with the agent."},"voiceId":{"type":"string","nullable":true,"format":"uuid","description":"The TTS voice to use for audio responses. Null when disabled for the agent."},"workspaceId":{"type":"string","format":"uuid","description":"The workspace ID that owns the agent."}},"required":["createdAt","id","isRemoved","referenceId","updatedAt","versionId","codeRuntime","internalName","iterations","llm","llmProviderId","name","picture","planning","prompt","reasoningMode","role","superIdentityId","temperature","timezone","toolCount","voiceId","workspaceId"]},{"type":"object","properties":{"createdAt":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"isRemoved":{"type":"boolean"},"referenceId":{"type":"string","nullable":true,"format":"uuid","description":"The ID of the original entity in production."},"updatedAt":{"type":"string","format":"date-time"},"versionId":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":{"type":"string","nullable":true,"minLength":3,"maxLength":250,"description":"The internal description of the squad."},"mode":{"type":"string","enum":["hierarchical","flat"],"description":"The management mode. In flat, agents redirect the chat to one another. In hierarchical, all iterations are intermediated by the manager."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The display name of the squad."},"picture":{"type":"string","nullable":true,"description":"The picture associated with the squad."},"superIdentityId":{"type":"string","format":"uuid","description":"The super identity ID associated with the squad."},"workspaceId":{"type":"string","format":"uuid","description":"The workspace ID that owns the squad."}},"required":["createdAt","id","isRemoved","referenceId","updatedAt","versionId","description","mode","name","picture","superIdentityId","workspaceId"]},{"type":"object","properties":{"createdAt":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"updatedAt":{"type":"string","format":"date-time"},"brandId":{"type":"string","nullable":true,"format":"uuid","description":"The brand ID associated with the user."},"clientReferenceId":{"type":"string","nullable":true,"description":"The external client reference ID associated with the user."},"email":{"type":"string","format":"email","description":"The email address of the user."},"emailStatus":{"type":"string","enum":["pending","verified"],"description":"The email verification status of the user."},"firstAccessAt":{"type":"string","nullable":true,"format":"date-time","description":"When the user first accessed the platform."},"gtm":{"type":"object","nullable":true,"additionalProperties":{"type":"string"},"description":"The GTM parameters to be used in tracking events for the user."},"language":{"type":"string","enum":["enUs","esEs","ptBr"],"description":"The preferred language configured for the user."},"lastAuthenticationAt":{"type":"string","nullable":true,"format":"date-time","description":"When the user last authenticated."},"metadata":{"type":"object","nullable":true,"additionalProperties":{"type":"string"},"description":"Metadata to be used in tracking events for the user."},"name":{"type":"string","nullable":true,"minLength":3,"maxLength":50,"description":"The display name of the user."},"phoneNumber":{"type":"string","nullable":true,"minLength":6,"maxLength":15},"picture":{"type":"string","nullable":true,"description":"The picture associated with the user."},"superIdentityId":{"type":"string","format":"uuid","description":"The super identity ID associated with the user."},"whiteLabelId":{"type":"string","nullable":true,"format":"uuid","description":"The white label ID associated with the user, when one exists."}},"required":["createdAt","id","updatedAt","brandId","clientReferenceId","email","emailStatus","firstAccessAt","gtm","language","lastAuthenticationAt","metadata","name","phoneNumber","picture","superIdentityId","whiteLabelId"]},{"type":"object","properties":{"createdAt":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"updatedAt":{"type":"string","format":"date-time"},"blocked":{"type":"boolean","description":"Whether the external user is blocked."},"channelId":{"type":"string","format":"uuid","description":"The ID of the channel associated with the external user."},"externalId":{"type":"string","nullable":true,"minLength":3,"maxLength":250,"description":"External reference in the integrated system."},"externalUserGroupId":{"type":"string","nullable":true,"format":"uuid","description":"The ID of the external user group associated with the external user."},"identifier":{"type":"string","nullable":true,"description":"A unique identifier of the external user (usernames, emails, phone numbers and etc)."},"name":{"type":"string","nullable":true,"minLength":3,"maxLength":50,"description":"The display name of the external user."},"superIdentityId":{"type":"string","format":"uuid","description":"The ID of the super identity associated with the external user."},"tierId":{"type":"string","nullable":true,"format":"uuid","description":"The ID of the tier associated with the external user."},"workspaceId":{"type":"string","format":"uuid","description":"The ID of the workspace associated with the external user."}},"required":["createdAt","id","updatedAt","blocked","channelId","externalId","externalUserGroupId","identifier","name","superIdentityId","tierId","workspaceId"]}]}},"required":["createdAt","id","updatedAt","entity","sender"]}},"required":["createdAt","id","updatedAt","chatId","chatThreadId","content","detail","externalId","rawContent","role","senderId","senderSuperIdentity"]}},{"type":"array","items":{"type":"object","properties":{"createdAt":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"updatedAt":{"type":"string","format":"date-time"},"chatId":{"type":"string","format":"uuid","description":"The chat ID associated with the message."},"chatThreadId":{"type":"string","nullable":true,"format":"uuid","description":"The id of the chat thread that the message belongs to."},"content":{"type":"string","minLength":0,"maxLength":100000,"description":"The content of the message."},"detail":{"type":"object","properties":{"attachments":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"id":{"type":"string","format":"uuid","description":"The attachment ID associated with this payload."},"description":{"type":"string","minLength":3,"maxLength":250,"description":"The description of the PNG image."},"extension":{"type":"string","enum":["png"],"description":"The attachment subtype represented by this payload."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The display name of the PNG file."}},"required":["file","id","description","extension","name"]},{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"id":{"type":"string","format":"uuid","description":"The attachment ID associated with this payload."},"description":{"type":"string","minLength":3,"maxLength":250,"description":"The description of the PDF file."},"extension":{"type":"string","enum":["pdf"],"description":"The attachment subtype represented by this payload."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The display name of the PDF file."}},"required":["file","id","description","extension","name"]},{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"id":{"type":"string","format":"uuid","description":"The attachment ID associated with this payload."},"extension":{"type":"string","enum":["wav"],"description":"The attachment subtype represented by this payload."},"mode":{"type":"string","enum":["attachment","message"],"description":"The mode of the audio attachment. \"attachment\" sends it as an attachment and \"message\" sends it as the main message."},"summary":{"type":"string","maxLength":1000,"description":"The summary of the audio file."},"transcription":{"type":"string","description":"The transcription of the audio file."}},"required":["file","id","extension","mode","summary","transcription"]},{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"id":{"type":"string","format":"uuid","description":"The attachment ID associated with this payload."},"description":{"type":"string","minLength":3,"maxLength":250,"description":"The description of the markdown file."},"extension":{"type":"string","enum":["md"],"description":"The attachment subtype represented by this payload."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The display name of the markdown file."}},"required":["file","id","description","extension","name"]},{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"id":{"type":"string","format":"uuid","description":"The attachment ID associated with this payload."},"description":{"type":"string","minLength":3,"maxLength":250,"description":"The description of the text file."},"extension":{"type":"string","enum":["txt"],"description":"The attachment subtype represented by this payload."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The display name of the text file."}},"required":["file","id","description","extension","name"]}]},"description":"The attachments associated with the chat message."},"delivery":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"content":{"anyOf":[{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."},"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["attachmentsIds","text"]},{"type":"object","properties":{"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["text"]},{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."}},"required":["attachmentsIds"]}],"description":"The content payload delivered through the external provider."},"id":{"type":"string","format":"uuid","description":"The stable identifier of this delivery entry."},"provider":{"type":"string","enum":["waha","whatsapp","instagram"],"description":"The external provider that received the delivery payload."},"timestamp":{"type":"string","nullable":true,"format":"date-time","description":"When the delivery payload was recorded."},"externalId":{"type":"string","minLength":3,"maxLength":250,"description":"External reference in the integrated system."},"status":{"type":"string","enum":["sent"],"description":"The delivery status represented by this payload."}},"required":["content","id","provider","timestamp","externalId","status"]},{"type":"object","properties":{"content":{"anyOf":[{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."},"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["attachmentsIds","text"]},{"type":"object","properties":{"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["text"]},{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."}},"required":["attachmentsIds"]}],"description":"The content payload delivered through the external provider."},"id":{"type":"string","format":"uuid","description":"The stable identifier of this delivery entry."},"provider":{"type":"string","enum":["waha","whatsapp","instagram"],"description":"The external provider that received the delivery payload."},"timestamp":{"type":"string","nullable":true,"format":"date-time","description":"When the delivery payload was recorded."},"error":{"nullable":true,"description":"The error payload returned when the delivery failed."},"status":{"type":"string","enum":["failed"],"description":"The delivery status represented by this payload."}},"required":["content","id","provider","timestamp","status"]},{"type":"object","properties":{"content":{"anyOf":[{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."},"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["attachmentsIds","text"]},{"type":"object","properties":{"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["text"]},{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."}},"required":["attachmentsIds"]}],"description":"The content payload delivered through the external provider."},"id":{"type":"string","format":"uuid","description":"The stable identifier of this delivery entry."},"provider":{"type":"string","enum":["waha","whatsapp","instagram"],"description":"The external provider that received the delivery payload."},"timestamp":{"type":"string","nullable":true,"format":"date-time","description":"When the delivery payload was recorded."},"status":{"type":"string","enum":["pending"],"description":"The delivery status represented by this payload."}},"required":["content","id","provider","timestamp","status"]}]},"default":[],"description":"The delivery status for external channel messages."},"referral":{"type":"object","nullable":true,"properties":{"body":{"type":"string","nullable":true,"description":"The primary text from the ad or post."},"ctwaClid":{"type":"string","nullable":true,"description":"The Click-to-WhatsApp click identifier."},"headline":{"type":"string","nullable":true,"description":"The headline from the ad or post."},"imageUrl":{"type":"string","nullable":true,"description":"The image URL when the ad uses image media."},"mediaType":{"type":"string","nullable":true,"enum":["image","video",null],"description":"The media type used in the ad or post."},"sourceId":{"type":"string","description":"The Meta ID for the ad or post."},"sourceType":{"type":"string","enum":["ad","post"],"description":"Whether the referral came from an ad or a post."},"sourceUrl":{"type":"string","description":"The URL of the ad or post."},"thumbnailUrl":{"type":"string","nullable":true,"description":"The thumbnail URL when the ad uses video media."},"videoUrl":{"type":"string","nullable":true,"description":"The video URL when the ad uses video media."}},"default":null,"required":["body","ctwaClid","headline","imageUrl","mediaType","sourceId","sourceType","sourceUrl","thumbnailUrl","videoUrl"],"description":"Referral metadata when the message originated from Click-to-WhatsApp."}},"required":["attachments"],"description":"The structured detail payload associated with the message."},"externalId":{"type":"string","nullable":true,"minLength":3,"maxLength":250,"description":"External reference in the integrated system."},"rawContent":{"type":"string","nullable":true,"minLength":0,"maxLength":100000,"description":"The raw content of the message as it was generated by the assistant."},"role":{"type":"string","enum":["user","assistant","support","system"],"description":"The role of the actor that produced the message."},"senderId":{"type":"string","nullable":true,"format":"uuid","description":"The super identity ID of the sender (agents, squads, users or external users) of the message."},"chatMessageFollowUp":{"type":"object","nullable":true,"properties":{"createdAt":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"updatedAt":{"type":"string","format":"date-time"},"chatId":{"type":"string","format":"uuid","description":"The id of the chat this follow-up belongs to."},"chatMessageId":{"type":"string","nullable":true,"format":"uuid","description":"The id of the chat message this follow-up belongs to."},"dueDate":{"type":"string","format":"date-time","description":"The date and time when the follow-up message should be sent."},"finishedAt":{"type":"string","nullable":true,"format":"date-time","description":"The date and time when the follow-up went from pending to any other status."},"message":{"type":"string","minLength":1,"description":"The follow-up message content."},"reason":{"type":"string","nullable":true,"description":"The reason why the follow-up failed."},"status":{"type":"string","enum":["pending","sent","failed","cancelled"],"description":"The current status of the follow-up."},"triggerChatMessageId":{"type":"string","format":"uuid","description":"The id of the chat message that triggered the follow-up."}},"required":["createdAt","id","updatedAt","chatId","chatMessageId","dueDate","finishedAt","message","reason","status","triggerChatMessageId"]}},"required":["createdAt","id","updatedAt","chatId","chatThreadId","content","detail","externalId","rawContent","role","senderId","chatMessageFollowUp"]}},{"type":"array","items":{"type":"object","properties":{"createdAt":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"updatedAt":{"type":"string","format":"date-time"},"chatId":{"type":"string","format":"uuid","description":"The chat ID associated with the message."},"chatThreadId":{"type":"string","nullable":true,"format":"uuid","description":"The id of the chat thread that the message belongs to."},"content":{"type":"string","minLength":0,"maxLength":100000,"description":"The content of the message."},"detail":{"type":"object","properties":{"attachments":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"id":{"type":"string","format":"uuid","description":"The attachment ID associated with this payload."},"description":{"type":"string","minLength":3,"maxLength":250,"description":"The description of the PNG image."},"extension":{"type":"string","enum":["png"],"description":"The attachment subtype represented by this payload."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The display name of the PNG file."}},"required":["file","id","description","extension","name"]},{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"id":{"type":"string","format":"uuid","description":"The attachment ID associated with this payload."},"description":{"type":"string","minLength":3,"maxLength":250,"description":"The description of the PDF file."},"extension":{"type":"string","enum":["pdf"],"description":"The attachment subtype represented by this payload."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The display name of the PDF file."}},"required":["file","id","description","extension","name"]},{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"id":{"type":"string","format":"uuid","description":"The attachment ID associated with this payload."},"extension":{"type":"string","enum":["wav"],"description":"The attachment subtype represented by this payload."},"mode":{"type":"string","enum":["attachment","message"],"description":"The mode of the audio attachment. \"attachment\" sends it as an attachment and \"message\" sends it as the main message."},"summary":{"type":"string","maxLength":1000,"description":"The summary of the audio file."},"transcription":{"type":"string","description":"The transcription of the audio file."}},"required":["file","id","extension","mode","summary","transcription"]},{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"id":{"type":"string","format":"uuid","description":"The attachment ID associated with this payload."},"description":{"type":"string","minLength":3,"maxLength":250,"description":"The description of the markdown file."},"extension":{"type":"string","enum":["md"],"description":"The attachment subtype represented by this payload."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The display name of the markdown file."}},"required":["file","id","description","extension","name"]},{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"id":{"type":"string","format":"uuid","description":"The attachment ID associated with this payload."},"description":{"type":"string","minLength":3,"maxLength":250,"description":"The description of the text file."},"extension":{"type":"string","enum":["txt"],"description":"The attachment subtype represented by this payload."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The display name of the text file."}},"required":["file","id","description","extension","name"]}]},"description":"The attachments associated with the chat message."},"delivery":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"content":{"anyOf":[{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."},"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["attachmentsIds","text"]},{"type":"object","properties":{"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["text"]},{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."}},"required":["attachmentsIds"]}],"description":"The content payload delivered through the external provider."},"id":{"type":"string","format":"uuid","description":"The stable identifier of this delivery entry."},"provider":{"type":"string","enum":["waha","whatsapp","instagram"],"description":"The external provider that received the delivery payload."},"timestamp":{"type":"string","nullable":true,"format":"date-time","description":"When the delivery payload was recorded."},"externalId":{"type":"string","minLength":3,"maxLength":250,"description":"External reference in the integrated system."},"status":{"type":"string","enum":["sent"],"description":"The delivery status represented by this payload."}},"required":["content","id","provider","timestamp","externalId","status"]},{"type":"object","properties":{"content":{"anyOf":[{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."},"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["attachmentsIds","text"]},{"type":"object","properties":{"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["text"]},{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."}},"required":["attachmentsIds"]}],"description":"The content payload delivered through the external provider."},"id":{"type":"string","format":"uuid","description":"The stable identifier of this delivery entry."},"provider":{"type":"string","enum":["waha","whatsapp","instagram"],"description":"The external provider that received the delivery payload."},"timestamp":{"type":"string","nullable":true,"format":"date-time","description":"When the delivery payload was recorded."},"error":{"nullable":true,"description":"The error payload returned when the delivery failed."},"status":{"type":"string","enum":["failed"],"description":"The delivery status represented by this payload."}},"required":["content","id","provider","timestamp","status"]},{"type":"object","properties":{"content":{"anyOf":[{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."},"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["attachmentsIds","text"]},{"type":"object","properties":{"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["text"]},{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."}},"required":["attachmentsIds"]}],"description":"The content payload delivered through the external provider."},"id":{"type":"string","format":"uuid","description":"The stable identifier of this delivery entry."},"provider":{"type":"string","enum":["waha","whatsapp","instagram"],"description":"The external provider that received the delivery payload."},"timestamp":{"type":"string","nullable":true,"format":"date-time","description":"When the delivery payload was recorded."},"status":{"type":"string","enum":["pending"],"description":"The delivery status represented by this payload."}},"required":["content","id","provider","timestamp","status"]}]},"default":[],"description":"The delivery status for external channel messages."},"referral":{"type":"object","nullable":true,"properties":{"body":{"type":"string","nullable":true,"description":"The primary text from the ad or post."},"ctwaClid":{"type":"string","nullable":true,"description":"The Click-to-WhatsApp click identifier."},"headline":{"type":"string","nullable":true,"description":"The headline from the ad or post."},"imageUrl":{"type":"string","nullable":true,"description":"The image URL when the ad uses image media."},"mediaType":{"type":"string","nullable":true,"enum":["image","video",null],"description":"The media type used in the ad or post."},"sourceId":{"type":"string","description":"The Meta ID for the ad or post."},"sourceType":{"type":"string","enum":["ad","post"],"description":"Whether the referral came from an ad or a post."},"sourceUrl":{"type":"string","description":"The URL of the ad or post."},"thumbnailUrl":{"type":"string","nullable":true,"description":"The thumbnail URL when the ad uses video media."},"videoUrl":{"type":"string","nullable":true,"description":"The video URL when the ad uses video media."}},"default":null,"required":["body","ctwaClid","headline","imageUrl","mediaType","sourceId","sourceType","sourceUrl","thumbnailUrl","videoUrl"],"description":"Referral metadata when the message originated from Click-to-WhatsApp."}},"required":["attachments"],"description":"The structured detail payload associated with the message."},"externalId":{"type":"string","nullable":true,"minLength":3,"maxLength":250,"description":"External reference in the integrated system."},"rawContent":{"type":"string","nullable":true,"minLength":0,"maxLength":100000,"description":"The raw content of the message as it was generated by the assistant."},"role":{"type":"string","enum":["user","assistant","support","system"],"description":"The role of the actor that produced the message."},"senderId":{"type":"string","nullable":true,"format":"uuid","description":"The super identity ID of the sender (agents, squads, users or external users) of the message."}},"required":["createdAt","id","updatedAt","chatId","chatThreadId","content","detail","externalId","rawContent","role","senderId"]}}]}}}},"401":{"description":"Unauthorized.","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","description":"The error code."},"cta":{"type":"object","properties":{"type":{"type":"string","enum":["support-contact"]},"url":{"type":"string","format":"uri"}},"required":["type","url"],"description":"The error call-to-action."},"feedback":{"type":"object","properties":{"enUs":{"type":"string"},"esEs":{"type":"string"},"ptBr":{"type":"string"}},"description":"The error feedback."},"message":{"type":"string","description":"The error message."},"name":{"type":"string","description":"The error name."}},"required":["feedback","message","name"],"description":"The description of a known exception."}}}},"404":{"description":"Chat not found.","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","description":"The error code."},"cta":{"type":"object","properties":{"type":{"type":"string","enum":["support-contact"]},"url":{"type":"string","format":"uri"}},"required":["type","url"],"description":"The error call-to-action."},"feedback":{"type":"object","properties":{"enUs":{"type":"string"},"esEs":{"type":"string"},"ptBr":{"type":"string"}},"description":"The error feedback."},"message":{"type":"string","description":"The error message."},"name":{"type":"string","description":"The error name."}},"required":["feedback","message","name"],"description":"The description of a known exception."}}}}}}}}}
```

## POST /api/v1/chat-messages

> Creates a new chat message.

```json
{"openapi":"3.1.0","info":{"title":"Public API","version":"1.0.0"},"servers":[{"description":"API Server","url":"https://api.endless.zaia.app"}],"paths":{"/api/v1/chat-messages":{"post":{"description":"Creates a new chat message.","tags":["Chat Messages"],"parameters":[{"schema":{"type":"string","description":"The API key to use for authentication. Can be created in the api keys section on the workspace settings page."},"required":true,"description":"The API key to use for authentication. Can be created in the api keys section on the workspace settings page.","name":"authorization","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"chatId":{"type":"string","format":"uuid","description":"The chat ID associated with the message."},"chatThreadId":{"type":"string","nullable":true,"format":"uuid","description":"The id of the chat thread that the message belongs to."},"content":{"type":"string","maxLength":4000},"externalId":{"type":"string","nullable":true,"minLength":3,"maxLength":250,"description":"External reference in the integrated system."},"senderId":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"detail":{"type":"object","properties":{"attachments":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"extension":{"type":"string","enum":["png"],"description":"The attachment subtype represented by this payload."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The display name of the PNG file."}},"required":["file","extension","name"]},{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"extension":{"type":"string","enum":["pdf"],"description":"The attachment subtype represented by this payload."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The display name of the PDF file."}},"required":["file","extension","name"]},{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"extension":{"type":"string","enum":["wav"],"description":"The attachment subtype represented by this payload."},"mode":{"type":"string","enum":["attachment","message"],"description":"The mode of the audio attachment. \"attachment\" sends it as an attachment and \"message\" sends it as the main message."}},"required":["file","extension","mode"]},{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"extension":{"type":"string","enum":["md"],"description":"The attachment subtype represented by this payload."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The display name of the markdown file."}},"required":["file","extension","name"]},{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"extension":{"type":"string","enum":["txt"],"description":"The attachment subtype represented by this payload."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The display name of the text file."}},"required":["file","extension","name"]}]},"description":"The attachments submitted when creating the chat message."}},"required":["attachments"]},"role":{"type":"string","enum":["user","support"],"description":"The role allowed when creating the chat message."}},"required":["chatId","chatThreadId","content","externalId","senderId","detail","role"]}}}},"responses":{"200":{"description":"The chat message was created.","content":{"application/json":{"schema":{"type":"object","properties":{"createdAt":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"updatedAt":{"type":"string","format":"date-time"},"chatId":{"type":"string","format":"uuid","description":"The chat ID associated with the message."},"chatThreadId":{"type":"string","nullable":true,"format":"uuid","description":"The id of the chat thread that the message belongs to."},"content":{"type":"string","minLength":0,"maxLength":100000,"description":"The content of the message."},"detail":{"type":"object","properties":{"attachments":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"id":{"type":"string","format":"uuid","description":"The attachment ID associated with this payload."},"description":{"type":"string","minLength":3,"maxLength":250,"description":"The description of the PNG image."},"extension":{"type":"string","enum":["png"],"description":"The attachment subtype represented by this payload."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The display name of the PNG file."}},"required":["file","id","description","extension","name"]},{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"id":{"type":"string","format":"uuid","description":"The attachment ID associated with this payload."},"description":{"type":"string","minLength":3,"maxLength":250,"description":"The description of the PDF file."},"extension":{"type":"string","enum":["pdf"],"description":"The attachment subtype represented by this payload."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The display name of the PDF file."}},"required":["file","id","description","extension","name"]},{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"id":{"type":"string","format":"uuid","description":"The attachment ID associated with this payload."},"extension":{"type":"string","enum":["wav"],"description":"The attachment subtype represented by this payload."},"mode":{"type":"string","enum":["attachment","message"],"description":"The mode of the audio attachment. \"attachment\" sends it as an attachment and \"message\" sends it as the main message."},"summary":{"type":"string","maxLength":1000,"description":"The summary of the audio file."},"transcription":{"type":"string","description":"The transcription of the audio file."}},"required":["file","id","extension","mode","summary","transcription"]},{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"id":{"type":"string","format":"uuid","description":"The attachment ID associated with this payload."},"description":{"type":"string","minLength":3,"maxLength":250,"description":"The description of the markdown file."},"extension":{"type":"string","enum":["md"],"description":"The attachment subtype represented by this payload."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The display name of the markdown file."}},"required":["file","id","description","extension","name"]},{"type":"object","properties":{"file":{"type":"string","minLength":1,"description":"The file identifier or path."},"id":{"type":"string","format":"uuid","description":"The attachment ID associated with this payload."},"description":{"type":"string","minLength":3,"maxLength":250,"description":"The description of the text file."},"extension":{"type":"string","enum":["txt"],"description":"The attachment subtype represented by this payload."},"name":{"type":"string","minLength":3,"maxLength":50,"description":"The display name of the text file."}},"required":["file","id","description","extension","name"]}]},"description":"The attachments associated with the chat message."},"delivery":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"content":{"anyOf":[{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."},"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["attachmentsIds","text"]},{"type":"object","properties":{"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["text"]},{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."}},"required":["attachmentsIds"]}],"description":"The content payload delivered through the external provider."},"id":{"type":"string","format":"uuid","description":"The stable identifier of this delivery entry."},"provider":{"type":"string","enum":["waha","whatsapp","instagram"],"description":"The external provider that received the delivery payload."},"timestamp":{"type":"string","nullable":true,"format":"date-time","description":"When the delivery payload was recorded."},"externalId":{"type":"string","minLength":3,"maxLength":250,"description":"External reference in the integrated system."},"status":{"type":"string","enum":["sent"],"description":"The delivery status represented by this payload."}},"required":["content","id","provider","timestamp","externalId","status"]},{"type":"object","properties":{"content":{"anyOf":[{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."},"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["attachmentsIds","text"]},{"type":"object","properties":{"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["text"]},{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."}},"required":["attachmentsIds"]}],"description":"The content payload delivered through the external provider."},"id":{"type":"string","format":"uuid","description":"The stable identifier of this delivery entry."},"provider":{"type":"string","enum":["waha","whatsapp","instagram"],"description":"The external provider that received the delivery payload."},"timestamp":{"type":"string","nullable":true,"format":"date-time","description":"When the delivery payload was recorded."},"error":{"nullable":true,"description":"The error payload returned when the delivery failed."},"status":{"type":"string","enum":["failed"],"description":"The delivery status represented by this payload."}},"required":["content","id","provider","timestamp","status"]},{"type":"object","properties":{"content":{"anyOf":[{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."},"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["attachmentsIds","text"]},{"type":"object","properties":{"text":{"type":"string","description":"The text chunk included in the delivery payload."}},"required":["text"]},{"type":"object","properties":{"attachmentsIds":{"type":"array","items":{"type":"string","format":"uuid","description":"A UUID v4 string that identifies an entity."},"description":"The attachment IDs included in the delivery payload."}},"required":["attachmentsIds"]}],"description":"The content payload delivered through the external provider."},"id":{"type":"string","format":"uuid","description":"The stable identifier of this delivery entry."},"provider":{"type":"string","enum":["waha","whatsapp","instagram"],"description":"The external provider that received the delivery payload."},"timestamp":{"type":"string","nullable":true,"format":"date-time","description":"When the delivery payload was recorded."},"status":{"type":"string","enum":["pending"],"description":"The delivery status represented by this payload."}},"required":["content","id","provider","timestamp","status"]}]},"default":[],"description":"The delivery status for external channel messages."},"referral":{"type":"object","nullable":true,"properties":{"body":{"type":"string","nullable":true,"description":"The primary text from the ad or post."},"ctwaClid":{"type":"string","nullable":true,"description":"The Click-to-WhatsApp click identifier."},"headline":{"type":"string","nullable":true,"description":"The headline from the ad or post."},"imageUrl":{"type":"string","nullable":true,"description":"The image URL when the ad uses image media."},"mediaType":{"type":"string","nullable":true,"enum":["image","video",null],"description":"The media type used in the ad or post."},"sourceId":{"type":"string","description":"The Meta ID for the ad or post."},"sourceType":{"type":"string","enum":["ad","post"],"description":"Whether the referral came from an ad or a post."},"sourceUrl":{"type":"string","description":"The URL of the ad or post."},"thumbnailUrl":{"type":"string","nullable":true,"description":"The thumbnail URL when the ad uses video media."},"videoUrl":{"type":"string","nullable":true,"description":"The video URL when the ad uses video media."}},"default":null,"required":["body","ctwaClid","headline","imageUrl","mediaType","sourceId","sourceType","sourceUrl","thumbnailUrl","videoUrl"],"description":"Referral metadata when the message originated from Click-to-WhatsApp."}},"required":["attachments"],"description":"The structured detail payload associated with the message."},"externalId":{"type":"string","nullable":true,"minLength":3,"maxLength":250,"description":"External reference in the integrated system."},"rawContent":{"type":"string","nullable":true,"minLength":0,"maxLength":100000,"description":"The raw content of the message as it was generated by the assistant."},"role":{"type":"string","enum":["user","assistant","support","system"],"description":"The role of the actor that produced the message."},"senderId":{"type":"string","nullable":true,"format":"uuid","description":"The super identity ID of the sender (agents, squads, users or external users) of the message."}},"required":["createdAt","id","updatedAt","chatId","chatThreadId","content","detail","externalId","rawContent","role","senderId"]}}}},"400":{"description":"Invalid data provided.","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","description":"The error code."},"cta":{"type":"object","properties":{"type":{"type":"string","enum":["support-contact"]},"url":{"type":"string","format":"uri"}},"required":["type","url"],"description":"The error call-to-action."},"feedback":{"type":"object","properties":{"enUs":{"type":"string"},"esEs":{"type":"string"},"ptBr":{"type":"string"}},"description":"The error feedback."},"message":{"type":"string","description":"The error message."},"name":{"type":"string","description":"The error name."}},"required":["feedback","message","name"],"description":"The description of a known exception."}}}},"403":{"description":"You are not authorized to create the chat message.","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","description":"The error code."},"cta":{"type":"object","properties":{"type":{"type":"string","enum":["support-contact"]},"url":{"type":"string","format":"uri"}},"required":["type","url"],"description":"The error call-to-action."},"feedback":{"type":"object","properties":{"enUs":{"type":"string"},"esEs":{"type":"string"},"ptBr":{"type":"string"}},"description":"The error feedback."},"message":{"type":"string","description":"The error message."},"name":{"type":"string","description":"The error name."}},"required":["feedback","message","name"],"description":"The description of a known exception."}}}},"404":{"description":"Chat not found.","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","description":"The error code."},"cta":{"type":"object","properties":{"type":{"type":"string","enum":["support-contact"]},"url":{"type":"string","format":"uri"}},"required":["type","url"],"description":"The error call-to-action."},"feedback":{"type":"object","properties":{"enUs":{"type":"string"},"esEs":{"type":"string"},"ptBr":{"type":"string"}},"description":"The error feedback."},"message":{"type":"string","description":"The error message."},"name":{"type":"string","description":"The error name."}},"required":["feedback","message","name"],"description":"The description of a known exception."}}}}}}}}}
```

## POST /api/v1/chat-messages/export

> Exports chat messages for a given period.

```json
{"openapi":"3.1.0","info":{"title":"Public API","version":"1.0.0"},"servers":[{"description":"API Server","url":"https://api.endless.zaia.app"}],"paths":{"/api/v1/chat-messages/export":{"post":{"description":"Exports chat messages for a given period.","tags":["Chat Messages"],"parameters":[{"schema":{"type":"string","description":"The API key to use for authentication. Can be created in the api keys section on the workspace settings page."},"required":true,"description":"The API key to use for authentication. Can be created in the api keys section on the workspace settings page.","name":"authorization","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"rangeEnd":{"type":"string","nullable":true,"format":"date-time","description":"The end date of the export period. Defaults to current date."},"rangeStart":{"type":"string","nullable":true,"format":"date-time","description":"The start date of the export period."},"callbackUrl":{"type":"string","format":"uri","description":"A safe callback URL that must be HTTPS and point to a public server."},"language":{"type":"string","enum":["enUs","esEs","ptBr"],"default":"enUs"}},"required":["rangeStart","callbackUrl"]}}}},"responses":{"200":{"description":"Export started. A POST will be made to callbackUrl when ready.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}}},"412":{"description":"The export period exceeds the maximum of 6 months.","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","description":"The error code."},"cta":{"type":"object","properties":{"type":{"type":"string","enum":["support-contact"]},"url":{"type":"string","format":"uri"}},"required":["type","url"],"description":"The error call-to-action."},"feedback":{"type":"object","properties":{"enUs":{"type":"string"},"esEs":{"type":"string"},"ptBr":{"type":"string"}},"description":"The error feedback."},"message":{"type":"string","description":"The error message."},"name":{"type":"string","description":"The error name."}},"required":["feedback","message","name"],"description":"The description of a known exception."}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zaia.app/documentation/api-reference-alpha/reference/chat-messages.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
