{ "openapi": "3.0.2", "info": { "title": "Message API", "version": "1.5.0", "description": "Send and receive email messages via your epilot organization\n" }, "security": [ { "EpilotAuth": [] }, { "EpilotOrg": [] } ], "tags": [ { "name": "Messages" }, { "name": "Threads" }, { "name": "Drafts" }, { "name": "message_schema", "x-displayName": "Message", "description": "\n" }, { "name": "thread_schema", "x-displayName": "Thread", "description": "\n" } ], "x-tagGroups": [ { "name": "APIs", "tags": [ "Messages", "Threads", "Drafts" ] }, { "name": "Schemas", "tags": [ "message_schema", "thread_schema" ] } ], "paths": { "/v1/message/messages": { "post": { "operationId": "sendMessage", "x-epilot-permissions": [ { "action": "message:send" }, { "action": "entity:create", "resource": "message" }, { "action": "entity:create", "resource": "thread" } ], "summary": "sendMessage", "description": "Send an email message\n\nRequires `message:send` and `entity:create` on `message`; `entity:create` on `thread` only when the\nrequest starts a new thread (a `thread` and no `parent_id`). With `do_not_create_entities=true` only\n`message:send` is required. Checked with the caller's token before the send is queued (403).\n", "tags": [ "Messages" ], "parameters": [ { "in": "query", "name": "do_not_create_entities", "description": "When true, this flag lets the caller to send only the message and by-pass creating the thread & message entities.", "schema": { "type": "boolean", "default": false } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MessageRequestParams" } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MessageRequestParams" } } } }, "403": { "description": "Forbidden" } } }, "put": { "operationId": "updateMessage", "x-epilot-permissions": [ { "action": "entity:edit", "resource": "message" }, { "action": "entity:view", "resource": "thread" } ], "summary": "updateMessage", "description": "Update message metadata", "tags": [ "Messages" ], "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "allOf": [ { "$ref": "#/components/schemas/BaseEntity" }, { "$ref": "#/components/schemas/Message" } ] } } } }, "403": { "description": "Forbidden" }, "409": { "description": "Conflict - the draft was edited by someone else since it was loaded", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string", "description": "Human-readable conflict message", "example": "This draft was edited by someone else. Please reload and try again." }, "current_message": { "description": "The current server version of the message (includes updated_by / _updated_at)", "allOf": [ { "$ref": "#/components/schemas/BaseEntity" }, { "$ref": "#/components/schemas/Message" } ] } } } } } } } } }, "/v1/message/messages/{id}": { "get": { "operationId": "getMessage", "x-epilot-permissions": [ { "action": "entity:view", "resource": "message" } ], "summary": "getMessage", "description": "Get an email message by id", "tags": [ "Messages" ], "parameters": [ { "name": "id", "description": "Message ID", "in": "path", "required": true, "schema": { "type": "string", "example": "4d74976d-fb64-47fd-85e2-65eea140f5eb" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "allOf": [ { "$ref": "#/components/schemas/BaseEntity" }, { "$ref": "#/components/schemas/Message" } ] } } } }, "302": { "description": "Redirect to V2 API to fetch the download URL", "headers": { "Location": { "description": "V2 API", "schema": { "type": "string", "example": "https://message.sls.epilot.io/v2/messages/4d74976d-fb64-47fd-85e2-65eea140f5eb" } } } }, "403": { "description": "Forbidden" } } }, "delete": { "operationId": "deleteMessage", "x-epilot-permissions": [ { "action": "entity:view", "resource": "message" }, { "action": "entity:delete", "resource": "message" } ], "summary": "deleteMessage", "description": "Immediately and permanently delete a message. This operation cannot be undone.", "tags": [ "Messages" ], "parameters": [ { "name": "id", "description": "Message ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "204": { "description": "Success" }, "403": { "description": "Forbidden" } } } }, "/v1/message/messages/{id}/eml": { "get": { "operationId": "getMessageEml", "x-epilot-permissions": [ { "action": "entity:view", "resource": "message" } ], "summary": "getMessageEml", "description": "Download a message as an EML file.\nReturns a 302 redirect to a pre-signed S3 URL where the EML file can be downloaded.\nBrowsers cannot read the target of a redirect, so pass `redirect=false` to get the same URL\nas JSON instead (200).\n", "tags": [ "Messages" ], "parameters": [ { "name": "id", "description": "Message entity ID", "in": "path", "required": true, "schema": { "type": "string", "example": "4d74976d-fb64-47fd-85e2-65eea140f5eb" } }, { "name": "redirect", "description": "Set to `false` to receive the download URL as JSON instead of a 302 redirect.", "in": "query", "required": false, "schema": { "type": "boolean", "default": true } } ], "responses": { "200": { "description": "The pre-signed download URL (only when `redirect=false`)", "content": { "application/json": { "schema": { "type": "object", "required": [ "download_url" ], "properties": { "download_url": { "type": "string", "description": "Pre-signed S3 URL to download the EML file (expires in 15 minutes)" } } } } } }, "302": { "description": "Redirect to EML file download URL", "headers": { "Location": { "description": "Pre-signed S3 URL to download the EML file (expires in 15 minutes)", "schema": { "type": "string" } } } }, "403": { "description": "Forbidden" }, "404": { "description": "Message not found" } } } }, "/v1/message/messages:search": { "post": { "operationId": "searchMessages", "x-epilot-permissions": [ { "action": "entity:view", "resource": "message", "filter": true } ], "summary": "searchMessages", "description": "Search Messages", "tags": [ "Messages" ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SearchParamsV2" } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "required": [ "hits", "results" ], "properties": { "hits": { "type": "number", "description": "Total of matched messages", "example": 14 }, "results": { "type": "array", "description": "Matched messages", "items": { "allOf": [ { "$ref": "#/components/schemas/BaseEntity" }, { "$ref": "#/components/schemas/Message" } ] } } } } } } }, "403": { "description": "Forbidden" } } } }, "/v1/message/messages/{id}/trash": { "post": { "operationId": "trashMessage", "x-epilot-permissions": [ { "action": "entity:view", "resource": "message" }, { "action": "entity:edit", "resource": "message" }, { "action": "entity:edit", "resource": "thread" } ], "summary": "trashMessage", "description": "Move a message to the trash", "tags": [ "Messages" ], "parameters": [ { "name": "id", "description": "Message ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "204": { "description": "Success" }, "403": { "description": "Forbidden" } } } }, "/v1/message/messages/{id}/untrash": { "post": { "operationId": "untrashMessage", "x-epilot-permissions": [ { "action": "entity:view", "resource": "message" }, { "action": "entity:edit", "resource": "message" }, { "action": "entity:edit", "resource": "thread" } ], "summary": "untrashMessage", "description": "Restore a trashed message", "tags": [ "Messages" ], "parameters": [ { "name": "id", "description": "Message ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "204": { "description": "Success" }, "403": { "description": "Forbidden" } } } }, "/v1/message/messages/{id}/read": { "post": { "operationId": "markReadMessage", "x-epilot-permissions": [ { "action": "entity:view", "resource": "message" }, { "action": "entity:edit", "resource": "message" } ], "summary": "markReadMessage", "description": "Mark message as read", "tags": [ "Messages" ], "parameters": [ { "name": "id", "description": "Message ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "204": { "description": "Success" }, "403": { "description": "Forbidden" } } } }, "/v2/message/messages/{id}/read": { "post": { "operationId": "markReadMessageV2", "x-epilot-permissions": [ { "action": "entity:view", "resource": "message" }, { "action": "entity:edit", "resource": "message" } ], "summary": "markReadMessageV2", "description": "Mark message as read within a scope", "tags": [ "Messages" ], "parameters": [ { "name": "id", "description": "Message ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ReadMessagePayload" } } } }, "responses": { "204": { "description": "Success" }, "403": { "description": "Forbidden" } } } }, "/v1/message/messages/{id}/unread": { "post": { "operationId": "markUnreadMessage", "x-epilot-permissions": [ { "action": "entity:view", "resource": "message" }, { "action": "entity:edit", "resource": "message" } ], "summary": "markUnreadMessage", "description": "Mark message as unread", "tags": [ "Messages" ], "parameters": [ { "name": "id", "description": "Message ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "204": { "description": "Success" }, "403": { "description": "Forbidden" } } } }, "/v1/message/messages/unread/{actor}": { "get": { "operationId": "getUnread", "x-epilot-permissions": [ { "action": "entity:view", "resource": "message", "filter": true } ], "summary": "getUnread", "description": "Get all unread messages by actor", "tags": [ "Messages" ], "parameters": [ { "name": "actor", "description": "Actor performing call, can be user or organization", "in": "path", "required": true, "schema": { "type": "string", "enum": [ "organization", "user" ] } }, { "in": "query", "name": "email_filter", "description": "emails to filter by", "schema": { "oneOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "string" } ] } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "required": [ "count" ], "properties": { "count": { "type": "number", "description": "Total of unread messages", "example": 14 }, "unread": { "type": "number", "description": "Total of unread messages", "example": 0 }, "drafts": { "type": "number", "description": "Total of drafts messages", "example": 12 }, "unassigned": { "type": "number", "description": "Total of unassigned messages", "example": 1 }, "spam": { "type": "number", "description": "Total of spam messages", "example": 3 } } } } } }, "403": { "description": "Forbidden" } } } }, "/v1/message/unread:counts": { "post": { "operationId": "getUnreadCounts", "x-epilot-permissions": [ { "action": "entity:view", "resource": "message", "filter": true } ], "summary": "getUnreadCounts", "description": "Unread counts for several named scopes in one request.\n\nA scope names a saved view (`view_id`), a shared inbox (`inbox_id`), or the organization's\nfolders. Each compiles to the query its thread list runs, plus the read-state condition, so a\ncount matches the list beneath it. A `saved_view` scope may send its own `q` instead.\n\nThe `organization` scope takes no `q`; each bucket compiles from the folder it badges.\n\nWhich buckets come back varies by scope type and actor. Every scope other than `organization`\nreturns `unread` alone. An `organization` scope returns all four (`unread`, `drafts`,\n`unassigned`, `spam`) for `actor: organization`, and `unread` and `drafts` only for\n`actor: user`. `getUnread` returns all four for both actors; this endpoint omits the two that\nno per-user surface renders, since each costs an aggregation.\n", "tags": [ "Messages" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UnreadCountsPayload" } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UnreadCountsResult" } } } }, "400": { "description": "The request names more scopes than the cap allows, repeats a scope name, or omits both\n`q` and `view` on a scope type that needs a predicate. Over-cap requests are refused rather than truncated:\na silently dropped scope renders as a missing badge, which is indistinguishable from\nzero unread.\n" }, "403": { "description": "Forbidden" } } } }, "/v2/message/messages/{id}/unread": { "post": { "operationId": "markUnreadMessageV2", "x-epilot-permissions": [ { "action": "entity:view", "resource": "message" }, { "action": "entity:edit", "resource": "message" } ], "summary": "markUnreadMessageV2", "description": "Mark message as unread within a scope", "tags": [ "Messages" ], "parameters": [ { "name": "id", "description": "Message ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ReadMessagePayload" } } } }, "responses": { "204": { "description": "Success" }, "403": { "description": "Forbidden" } } } }, "/v1/message/threads:search": { "post": { "operationId": "searchThreads", "x-epilot-permissions": [ { "action": "entity:view", "resource": "message", "filter": true }, { "action": "entity:view", "resource": "thread", "filter": true } ], "summary": "searchThreads", "description": "Search for threads of email messages.\n\nMessages with no replies yet are treated as threads with single message.\n\nLucene syntax supported.\n", "tags": [ "Threads" ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SearchParams" } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "required": [ "hits", "results" ], "properties": { "hits": { "type": "number", "description": "Total of matched threads", "example": 14 }, "results": { "type": "array", "description": "Matched threads", "items": { "allOf": [ { "$ref": "#/components/schemas/BaseEntity" }, { "$ref": "#/components/schemas/Thread" } ] } } } } } } }, "403": { "description": "Forbidden" } } } }, "/v2/message/threads:search": { "post": { "operationId": "searchThreadsV2", "x-epilot-permissions": [ { "action": "entity:view", "resource": "message", "filter": true }, { "action": "entity:view", "resource": "thread", "filter": true } ], "summary": "searchThreadsV2", "description": "Search for threads of email messages.\n\nMessages with no replies yet are treated as threads with single message.\n\nLucene syntax supported.\n", "tags": [ "Threads" ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SearchParamsV2" } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "required": [ "hits", "results" ], "properties": { "hits": { "type": "number", "description": "Total of matched threads", "example": 14 }, "results": { "type": "array", "description": "Matched threads", "items": { "allOf": [ { "$ref": "#/components/schemas/BaseEntity" }, { "$ref": "#/components/schemas/Thread" } ] } } } } } } }, "403": { "description": "Forbidden" } } } }, "/v1/message/threads:searchIds": { "post": { "operationId": "searchIds", "x-epilot-permissions": [ { "action": "entity:view", "resource": "message", "filter": true }, { "action": "entity:view", "resource": "thread", "filter": true } ], "summary": "Search threads and return all id's", "description": "Return all thread id's that match a criteria\n\nLucene syntax supported.\n", "tags": [ "Threads" ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SearchIDParams" } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "required": [ "hits", "results" ], "properties": { "hits": { "type": "number", "description": "Total of matched threads", "example": 14 }, "results": { "type": "array", "description": "Matched threads ids", "items": { "type": "string" } } } } } } }, "403": { "description": "Forbidden" } } } }, "/v2/message/threads:workload": { "post": { "operationId": "getAssigneeWorkload", "x-epilot-permissions": [ { "action": "entity:view", "resource": "message", "filter": true } ], "summary": "getAssigneeWorkload", "description": "Return the open-thread workload for a set of user ids.\n\nFor each requested user id, returns the number of *open* threads assigned\ndirectly to that user — matching what the user sees in their central-inbox\nopen view: in inbox, not trashed, not done, and excluding notification-only\nand spam threads.\n\nOnly threads assigned directly to a user are counted; threads assigned to a\ngroup the user belongs to are not. Intended for assignment load-balancing\n(e.g. even-distribution automations) that need a consistent, inbox-aligned\nworkload per user.\n", "tags": [ "Threads" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AssigneeWorkloadParams" } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AssigneeWorkloadResults" } } } }, "403": { "description": "Forbidden" } } } }, "/v1/message/threads": { "put": { "operationId": "updateThread", "x-epilot-permissions": [ { "action": "entity:edit", "resource": "thread" }, { "action": "entity:edit", "resource": "message" } ], "summary": "updateThread", "description": "Modify thread metadata", "tags": [ "Threads" ], "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "allOf": [ { "$ref": "#/components/schemas/BaseEntity" }, { "$ref": "#/components/schemas/Thread" } ] } } } }, "403": { "description": "Forbidden" } } } }, "/v1/message/threads/{id}": { "delete": { "operationId": "deleteThread", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:delete", "resource": "message" }, { "action": "entity:delete", "resource": "thread" } ], "summary": "deleteThread", "description": "Immediately and permanently delete a thread. This operation cannot be undone.", "tags": [ "Threads" ], "parameters": [ { "name": "id", "description": "Thread ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "204": { "description": "Success" }, "403": { "description": "Forbidden" } } } }, "/v1/message/threads/{id}:move": { "post": { "operationId": "moveThread", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" }, { "action": "entity:edit", "resource": "message" } ], "summary": "moveThread", "description": "Move thread to a different Inbox", "tags": [ "Threads" ], "parameters": [ { "name": "id", "description": "Thread ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MoveThreadPayload" } } } }, "responses": { "204": { "description": "Success" }, "400": { "$ref": "#/components/responses/BadRequest" }, "403": { "$ref": "#/components/responses/Forbidden" }, "404": { "$ref": "#/components/responses/NotFound" }, "409": { "$ref": "#/components/responses/Conflict" }, "500": { "$ref": "#/components/responses/InternalServerError" } } } }, "/v1/message/threads/{id}:markAsDone": { "post": { "operationId": "markThreadAsDone", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" }, { "action": "entity:edit", "resource": "message" } ], "summary": "markThreadAsDone", "description": "Mark thread as done", "tags": [ "Threads" ], "parameters": [ { "name": "id", "description": "Thread ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "204": { "description": "Success" }, "400": { "description": "Bad Request" } } } }, "/v1/message/threads/{id}:markAsOpen": { "post": { "operationId": "markThreadAsOpen", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" }, { "action": "entity:edit", "resource": "message" } ], "summary": "markThreadAsOpen", "description": "Mark thread as open", "tags": [ "Threads" ], "parameters": [ { "name": "id", "description": "Thread ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "204": { "description": "Success" }, "400": { "description": "Bad Request" } } } }, "/v1/message/threads/{id}/timeline": { "get": { "operationId": "getThreadTimeline", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" } ], "summary": "getThreadTimeline", "description": "Get thread timeline", "tags": [ "Threads" ], "parameters": [ { "name": "id", "description": "Thread ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ThreadTimeline" } } } }, "403": { "description": "Forbidden" } } } }, "/v1/message/threads/{id}/summary": { "get": { "operationId": "getThreadSummary", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" } ], "summary": "getThreadSummary", "description": "AI summary of a thread. Returns `202` while it is generated; poll until `jobStatus.status` is `COMPLETED` or `FAILED`.\n", "tags": [ "Threads" ], "parameters": [ { "name": "id", "description": "Thread ID", "in": "path", "required": true, "schema": { "type": "string" } }, { "name": "message_id", "description": "Message to summarize the thread up to. Defaults to the latest message of the thread.", "in": "query", "required": false, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Summary job of the message", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ThreadSummary" } } } }, "202": { "description": "Summary generation started", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ThreadSummary" } } } }, "400": { "description": "Thread can't be summarized (e.g. too short or only automated messages)" }, "403": { "description": "Forbidden" }, "404": { "description": "Thread has no messages, or no summary exists for the message" } } } }, "/v1/message/threads/{id}/trash": { "post": { "operationId": "trashThread", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" }, { "action": "entity:edit", "resource": "message" } ], "summary": "trashThread", "description": "Move a thread to trash", "tags": [ "Threads" ], "parameters": [ { "name": "id", "description": "Thread ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Success" }, "403": { "description": "Forbidden" } } } }, "/v1/message/threads/{id}/untrash": { "post": { "operationId": "untrashThread", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" }, { "action": "entity:edit", "resource": "message" } ], "summary": "untrashThread", "description": "Restore a trashed thread", "tags": [ "Threads" ], "parameters": [ { "name": "id", "description": "Thread ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Success" }, "403": { "description": "Forbidden" } } } }, "/v1/message/threads/{id}/spam": { "post": { "operationId": "spamThread", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" }, { "action": "entity:edit", "resource": "message" } ], "summary": "spamThread", "description": "Mark a thread as spam", "tags": [ "Threads" ], "parameters": [ { "name": "id", "description": "Thread ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Success" }, "403": { "description": "Forbidden" }, "404": { "description": "Not Found" } } } }, "/v1/message/threads/{id}/unspam": { "post": { "operationId": "unspamThread", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" }, { "action": "entity:edit", "resource": "message" } ], "summary": "unspamThread", "description": "Remove spam marking from a thread", "tags": [ "Threads" ], "parameters": [ { "name": "id", "description": "Thread ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Success" }, "403": { "description": "Forbidden" }, "404": { "description": "Not Found" } } } }, "/v1/message/messages/{id}/spam": { "post": { "operationId": "spamMessage", "x-epilot-permissions": [ { "action": "entity:view", "resource": "message" }, { "action": "entity:edit", "resource": "message" }, { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" } ], "summary": "spamMessage", "description": "Mark a single message as spam. Also marks the parent thread as spam if all messages in the thread are spam.", "tags": [ "Messages" ], "parameters": [ { "name": "id", "description": "Message ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "204": { "description": "Success" }, "403": { "description": "Forbidden" }, "404": { "description": "Not Found" } } } }, "/v1/message/messages/{id}/unspam": { "post": { "operationId": "unspamMessage", "x-epilot-permissions": [ { "action": "entity:view", "resource": "message" }, { "action": "entity:edit", "resource": "message" }, { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" } ], "summary": "unspamMessage", "description": "Remove spam marking from a single message. Also removes spam from the parent thread if no other messages are spam.", "tags": [ "Messages" ], "parameters": [ { "name": "id", "description": "Message ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "204": { "description": "Success" }, "403": { "description": "Forbidden" }, "404": { "description": "Not Found" } } } }, "/v1/message/threads/bulk:move": { "post": { "operationId": "bulkMoveThreads", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" }, { "action": "entity:edit", "resource": "message" } ], "summary": "bulkMoveThreads", "description": "Move many threads to a different inbox", "tags": [ "Threads" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BulkActionsPayloadWithScopes" } } } }, "responses": { "200": { "description": "Success. When only some threads failed, `failedIds` lists them.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BulkActionsResponse" } } } }, "403": { "description": "Forbidden" }, "422": { "description": "None of the threads could be processed (an already-done / already-moved thread counts as processed). `failedIds` lists them.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BulkActionsResponse" } } } } } } }, "/v1/message/threads/bulk:assign": { "post": { "operationId": "bulkAssignThreads", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" }, { "action": "entity:edit", "resource": "message" } ], "summary": "bulkAssignThreads", "description": "Assign many threads", "tags": [ "Threads" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BulkActionsPayloadWithScopes" } } } }, "responses": { "200": { "description": "Success" }, "403": { "description": "Forbidden" } } } }, "/v1/message/threads/bulk:read": { "post": { "operationId": "threadBulkActionsRead", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" } ], "summary": "threadBulkActionsRead", "description": "Perform a bulk action of marking an array of thread ids as read", "tags": [ "Threads" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BulkActionsPayloadWithScopes" } } } }, "responses": { "200": { "description": "Success" }, "403": { "description": "Forbidden" } } } }, "/v1/message/threads/bulk:unread": { "post": { "operationId": "threadBulkActionsUnread", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" } ], "summary": "threadBulkActionsUnread", "description": "Perform a bulk action of marking an array of thread ids as unread", "tags": [ "Threads" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BulkActionsPayloadWithScopes" } } } }, "responses": { "200": { "description": "Success" }, "403": { "description": "Forbidden" } } } }, "/v1/message/threads/bulk:favorite": { "post": { "operationId": "threadBulkActionsFavorite", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" }, { "action": "entity:edit", "resource": "message" } ], "summary": "threadBulkActionsFavorite", "description": "Perform a bulk action of marking an array of thread ids favorite", "tags": [ "Threads" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BulkActionsPayload" } } } }, "responses": { "200": { "description": "Success" }, "403": { "description": "Forbidden" } } } }, "/v1/message/threads/bulk:unfavorite": { "post": { "operationId": "threadBulkActionsUnfavorite", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" }, { "action": "entity:edit", "resource": "message" } ], "summary": "threadBulkActionsUnfavorite", "description": "Perform a bulk action of marking an array of thread ids unfavorited", "tags": [ "Threads" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BulkActionsPayload" } } } }, "responses": { "200": { "description": "Success" }, "403": { "description": "Forbidden" } } } }, "/v1/message/threads/bulk:trash": { "post": { "operationId": "threadBulkActionsTrash", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" }, { "action": "entity:edit", "resource": "message" } ], "summary": "threadBulkActionsTrash", "description": "Perform a bulk action of trashing an array of threads", "tags": [ "Threads" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BulkActionsPayload" } } } }, "responses": { "200": { "description": "Success" }, "403": { "description": "Forbidden" } } } }, "/v1/message/threads/bulk:untrash": { "post": { "operationId": "threadBulkActionsUntrash", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" }, { "action": "entity:edit", "resource": "message" } ], "summary": "threadBulkActionsUntrash", "description": "Perform a bulk action of untrashing an array of threads", "tags": [ "Threads" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BulkActionsPayload" } } } }, "responses": { "200": { "description": "Success" }, "403": { "description": "Forbidden" } } } }, "/v1/message/threads/bulk:delete": { "post": { "operationId": "threadBulkActionsDelete", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:delete", "resource": "message" }, { "action": "entity:delete", "resource": "thread" } ], "summary": "threadBulkActionsDelete", "description": "Performs a bulk permanent delete for all threads", "tags": [ "Threads" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BulkActionsPayload" } } } }, "responses": { "200": { "description": "Success" }, "403": { "description": "Forbidden" } } } }, "/v1/message/threads/bulk:done": { "post": { "operationId": "threadBulkActionsDone", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" }, { "action": "entity:edit", "resource": "message" } ], "summary": "threadBulkActionsDone", "description": "Perform a bulk action of marking an array of threads as done", "tags": [ "Threads" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BulkActionsPayload" } } } }, "responses": { "200": { "description": "Success. When only some threads failed, `failedIds` lists them.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BulkActionsResponse" } } } }, "403": { "description": "Forbidden" }, "422": { "description": "None of the threads could be processed (an already-done / already-moved thread counts as processed). `failedIds` lists them.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BulkActionsResponse" } } } } } } }, "/v1/message/threads/bulk:open": { "post": { "operationId": "threadBulkActionsOpen", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" }, { "action": "entity:edit", "resource": "message" } ], "summary": "threadBulkActionsOpen", "description": "Perform a bulk action of marking an array of threads as open", "tags": [ "Threads" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BulkActionsPayload" } } } }, "responses": { "200": { "description": "Success. When only some threads failed, `failedIds` lists them.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BulkActionsResponse" } } } }, "403": { "description": "Forbidden" }, "422": { "description": "None of the threads could be processed (an already-done / already-moved thread counts as processed). `failedIds` lists them.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BulkActionsResponse" } } } } } } }, "/v1/message/threads/{id}/read": { "post": { "operationId": "markReadThread", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" } ], "summary": "markReadThread", "description": "Mark thread as read", "tags": [ "Threads" ], "parameters": [ { "name": "id", "description": "Thread ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Success" }, "403": { "description": "Forbidden" } } } }, "/v2/message/threads/{id}/read": { "post": { "operationId": "markReadThreadV2", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" } ], "summary": "markReadThreadV2", "description": "Mark thread as read within a scope", "tags": [ "Threads" ], "parameters": [ { "name": "id", "description": "Thread ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ReadMessagePayload" } } } }, "responses": { "200": { "description": "Success" }, "403": { "description": "Forbidden" } } } }, "/v1/message/threads/{id}/unread": { "post": { "operationId": "markUnreadThread", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" } ], "summary": "markUnreadThread", "description": "Mark thread as unread", "tags": [ "Threads" ], "parameters": [ { "name": "id", "description": "Thread ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Success" }, "403": { "description": "Forbidden" } } } }, "/v2/message/threads/{id}/unread": { "post": { "operationId": "markUnreadThreadV2", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" } ], "summary": "markUnreadThreadV2", "description": "Mark thread as unread within a scope", "tags": [ "Threads" ], "parameters": [ { "name": "id", "description": "Thread ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ReadMessagePayload" } } } }, "responses": { "200": { "description": "Success" }, "403": { "description": "Forbidden" } } } }, "/v1/message/threads/{id}/assign": { "post": { "operationId": "assignThread", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" }, { "action": "entity:edit", "resource": "message" } ], "summary": "assignThread", "description": "Assign thread to entities", "tags": [ "Threads" ], "parameters": [ { "name": "id", "description": "Thread ID", "in": "path", "required": true, "schema": { "type": "string" } }, { "name": "confirmed_warning", "description": "The user confirmed a warning that the thread is already linked to another record of the same type (e.g. another opportunity). Only recorded in logs.", "in": "query", "required": false, "schema": { "type": "boolean" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "description": "Entities which thread is assigned to", "type": "array", "items": { "type": "object", "properties": { "slug": { "description": "Entity slug", "type": "string", "example": "contact" }, "entity_id": { "description": "Entity ID", "type": "string", "example": "3f34ce73-089c-4d45-a5ee-c161234e41c3" }, "org_id": { "description": "Organization ID", "type": "string", "example": "206801" }, "is_main_entity": { "description": "To indicate this is main entity", "type": "boolean", "example": true } } } } } } }, "responses": { "204": { "description": "Success" }, "403": { "description": "Forbidden" } } } }, "/v1/message/threads/{id}/link-suggestions/dismiss": { "post": { "operationId": "dismissThreadLinkSuggestions", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" }, { "action": "entity:edit", "resource": "message" } ], "summary": "dismissThreadLinkSuggestions", "description": "Dismiss pending candidates of entity-link suggestions on a thread. A suggestion is recorded on a message when an identifier in it matched entities of different customers, so nothing was linked automatically. Each candidate is resolved on its own: linking one (assignThread) leaves the others suggested until they are linked or dismissed. A suggestion whose candidates are all resolved is not suggested again for the thread.", "tags": [ "Threads" ], "parameters": [ { "name": "id", "description": "Thread ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "requestBody": { "required": false, "content": { "application/json": { "schema": { "type": "object", "properties": { "suggestion_ids": { "description": "Suggestions to dismiss candidates of. Omit for every pending suggestion on the thread.", "type": "array", "items": { "type": "string" } }, "entity_ids": { "description": "Candidates to dismiss. Omit to dismiss every pending candidate of the selected suggestions.", "type": "array", "items": { "type": "string" } } } } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "required": [ "dismissed" ], "properties": { "dismissed": { "description": "IDs of the suggestions that had at least one candidate dismissed", "type": "array", "items": { "type": "string" } } } } } } }, "403": { "description": "Forbidden" }, "404": { "description": "Thread not found" } } } }, "/v1/message/threads/{id}/link-suggestions/restore": { "post": { "operationId": "restoreThreadLinkSuggestions", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" }, { "action": "entity:edit", "resource": "message" } ], "summary": "restoreThreadLinkSuggestions", "description": "Restore dismissed candidates of entity-link suggestions on a thread, e.g. to undo a dismissal. Their suggestions are pending again. Unlinking an entity that was linked from a suggestion (unassignThread) reopens its candidate the same way.", "tags": [ "Threads" ], "parameters": [ { "name": "id", "description": "Thread ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "requestBody": { "required": false, "content": { "application/json": { "schema": { "type": "object", "properties": { "suggestion_ids": { "description": "Suggestions to restore candidates of. Omit for every suggestion on the thread.", "type": "array", "items": { "type": "string" } }, "entity_ids": { "description": "Candidates to restore. Omit to restore every dismissed candidate of the selected suggestions.", "type": "array", "items": { "type": "string" } } } } } } }, "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "required": [ "restored" ], "properties": { "restored": { "description": "IDs of the suggestions that had at least one candidate restored", "type": "array", "items": { "type": "string" } } } } } } }, "403": { "description": "Forbidden" }, "404": { "description": "Thread not found" } } } }, "/v1/message/threads/{id}/unassign": { "post": { "operationId": "unassignThread", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" }, { "action": "entity:edit", "resource": "message" } ], "summary": "unassignThread", "description": "Unassign thread from entities", "tags": [ "Threads" ], "parameters": [ { "name": "id", "description": "Thread ID", "in": "path", "required": true, "schema": { "type": "string" } }, { "name": "unlink_mapped_entities", "description": "When true, also removes unassigned entities from mapped_entities on related source entities", "in": "query", "required": false, "schema": { "type": "boolean", "default": false } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "description": "Entities which thread is unassigned from", "type": "array", "items": { "type": "object", "properties": { "slug": { "description": "Entity slug", "type": "string", "example": "contact" }, "entity_id": { "description": "Entity ID", "type": "string", "example": "3f34ce73-089c-4d45-a5ee-c161234e41c3" } } } } } } }, "responses": { "204": { "description": "Success" }, "403": { "description": "Forbidden" } } } }, "/v1/message/threads/{id}/assign:users": { "post": { "operationId": "assignUsers", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" }, { "action": "entity:edit", "resource": "message" } ], "summary": "assignUsers", "description": "Assign users to thread for receiving notifications.\nThe operation replaces all existing assigned users in thread.\n", "tags": [ "Threads" ], "parameters": [ { "name": "id", "description": "Thread ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "description": "User IDs of users assigned to thread", "type": "object", "properties": { "assigned_to": { "type": "array", "description": "IDs of users assigned to thread", "items": { "type": "string", "example": "206801" } } } } } } }, "responses": { "204": { "description": "Success" }, "403": { "description": "Forbidden" } } } }, "/v2/message/threads/{id}/assign:users": { "post": { "operationId": "assignUsersV2", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" }, { "action": "entity:edit", "resource": "message" } ], "summary": "assignUsersV2", "description": "Assign users to thread.\n", "tags": [ "Threads" ], "parameters": [ { "name": "id", "description": "Thread ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "add", "remove" ], "properties": { "add": { "type": "array", "description": "User IDs of users to add to thread", "items": { "type": "string", "example": "206801" } }, "remove": { "type": "array", "description": "User IDs of users to remove from thread", "items": { "type": "string", "example": "206801" } } } } } } }, "responses": { "204": { "description": "Success" }, "403": { "description": "Forbidden" } } } }, "/v1/message/threads/{id}:pin": { "post": { "operationId": "pinThread", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" }, { "action": "entity:edit", "resource": "message" } ], "summary": "Pin a single thread", "description": "Pin a single thread", "tags": [ "Threads" ], "parameters": [ { "name": "id", "description": "Thread ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "204": { "description": "Success" }, "400": { "description": "Bad request" }, "404": { "description": "Thread not found" }, "409": { "description": "Concurrent update error" }, "500": { "description": "Internal server error" } } }, "delete": { "operationId": "unpinThread", "x-epilot-permissions": [ { "action": "entity:view", "resource": "thread" }, { "action": "entity:edit", "resource": "thread" }, { "action": "entity:edit", "resource": "message" } ], "summary": "Unpin a single thread", "description": "Unpin a single thread", "tags": [ "Threads" ], "parameters": [ { "name": "id", "description": "Thread ID", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "204": { "description": "Success" }, "400": { "description": "Bad request" }, "404": { "description": "Thread not found" }, "409": { "description": "Concurrent update error" }, "500": { "description": "Internal server error" } } } }, "/v1/message/drafts": { "post": { "operationId": "createDraft", "x-epilot-permissions": [ { "action": "entity:create", "resource": "message" } ], "summary": "createDraft", "description": "Create a new draft\n\nRequires `entity:create` on `message`, checked with the caller's token before anything is created (403).\n", "tags": [ "Drafts" ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MessageRequestParams" } } } }, "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "allOf": [ { "$ref": "#/components/schemas/BaseEntity" }, { "$ref": "#/components/schemas/Message" } ] } } } }, "403": { "description": "Forbidden" } } } }, "/v1/message/drafts:send": { "post": { "operationId": "sendDraft", "x-epilot-permissions": [ { "action": "message:send" }, { "action": "entity:create", "resource": "message" }, { "action": "entity:edit", "resource": "message" } ], "summary": "sendDraft", "description": "Send the existing draft to the recipients.\n\nRequires `message:send`, `entity:create` on `message` and `entity:edit` on the draft, checked with the\ncaller's token (403). The id must be a DRAFT of the given thread (409).\n", "tags": [ "Drafts" ], "responses": { "201": { "description": "Success", "content": { "application/json": { "schema": { "allOf": [ { "$ref": "#/components/schemas/BaseEntity" }, { "$ref": "#/components/schemas/Message" } ] } } } }, "403": { "description": "Forbidden – the caller is not the draft's author and cannot view the draft" }, "409": { "description": "The message is not a draft of the given thread (e.g. already sent)" } } } }, "/v2/message/messages/{id}": { "get": { "operationId": "getMessageV2", "x-epilot-permissions": [ { "action": "entity:view", "resource": "message" } ], "summary": "getMessageV2", "description": "- Fetches message by ID\n- If the message html is omitted on the entity, then it keeps the content on the message as a signed url\n {\n ...\n _id: \"4d74976d-fb64-47fd-85e2-65eea140f5eb\",\n _schema: \"message\",\n _org: \"org-123\",\n html_omitted: true,\n html_download_url: \"https://s3.eu-central-1.amazonaws.com/epilot-attachments/3f34ce73-089c-4d45-a5ee-c161234e41c3/3f34ce73-089c-4d45-a5ee-c161234e41c3.html\"\n }\n", "tags": [ "Messages" ], "parameters": [ { "name": "id", "description": "Message ID", "in": "path", "required": true, "schema": { "type": "string", "example": "4d74976d-fb64-47fd-85e2-65eea140f5eb" } } ], "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "allOf": [ { "$ref": "#/components/schemas/MessageV2" } ] } } } }, "403": { "description": "Forbidden" } } } } }, "components": { "responses": { "NotFound": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "Conflict": { "description": "Conflict", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "InternalServerError": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "BadRequest": { "description": "Bad request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "Forbidden": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "securitySchemes": { "EpilotAuth": { "type": "http", "scheme": "bearer", "description": "Authorization header with epilot OAuth2 bearer token", "bearerFormat": "JWT" }, "EpilotOrg": { "description": "Overrides the target organization to allow shared tenant access", "name": "x-epilot-org-id", "in": "header", "type": "apiKey" } }, "schemas": { "ErrorResponse": { "type": "object", "properties": { "error": { "type": "string", "description": "Error message", "example": "Thread not found" } } }, "MoveThreadPayload": { "type": "object", "required": [ "inbox_id" ], "properties": { "inbox_id": { "type": "string", "description": "Inbox ID", "example": "3f34ce73-089c-4d45-a5ee-c161234e41c3" }, "reason": { "$ref": "#/components/schemas/ThreadMoveReason" } } }, "ThreadMoveReason": { "type": "object", "description": "Why the thread is being moved, recorded on its \"moved to inbox\" activity. Only accepted from\ninternal callers (the inbox deletion job); ignored for user requests.\n", "required": [ "type", "source_inbox_id" ], "properties": { "type": { "type": "string", "enum": [ "inbox_deleted" ] }, "source_inbox_id": { "type": "string", "description": "ID of the deleted inbox the thread was in" }, "source_inbox_name": { "type": "string", "description": "Name of the deleted inbox the thread was in" } } }, "BaseEntity": { "type": "object", "required": [ "_id", "_title", "_org", "_schema", "_created_at", "_updated_at" ], "properties": { "_id": { "type": "string", "description": "Entity ID", "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6" }, "_title": { "type": "string", "description": "Entity title" }, "_org": { "type": "string", "description": "Organization ID the entity belongs to", "example": "206801" }, "_schema": { "type": "string", "description": "URL-friendly identifier for the entity schema", "example": "message" }, "_tags": { "type": "array", "description": "Entity tags", "items": { "type": "string" }, "example": [ "pricing", "INBOX" ] }, "_created_at": { "type": "string", "description": "Created date", "format": "date-time", "example": "2021-02-09T12:41:43.662Z" }, "_updated_at": { "type": "string", "description": "Updated date", "format": "date-time", "example": "2021-02-10T09:14:31.990Z" } } }, "Thread": { "description": "Thread properties depend on API caller as it's not pre-defined. We do recommend having at least `topic` property for categorizing.", "required": [ "topic" ], "properties": { "topic": { "type": "string", "description": "Message topic (e.g. which service sends the message or message category)", "example": "CUSTOMER_MESSAGE" }, "assigned_to": { "type": "array", "description": "User ID of who the message is assigned to. Default is the user who sends message.", "items": { "type": "string" }, "example": [ "206801", "200109" ] }, "org_read_message": { "type": "array", "description": "Organization ID of organization read the message.", "items": { "type": "string" }, "example": [ "789372", "210291" ] }, "done": { "type": "boolean", "description": "Whether the thread is marked as Done", "example": false }, "latest_message": { "$ref": "#/components/schemas/Message" }, "latest_trash_message": { "$ref": "#/components/schemas/Message" }, "latest_message_at": { "type": "string", "description": "The date of the latest message time in the thread", "example": "2024-02-10T09:14:31.990Z" }, "view_latest_message": { "$ref": "#/components/schemas/Message" } } }, "Message": { "type": "object", "required": [ "subject", "from" ], "properties": { "message_id": { "type": "string", "description": "Message ID which is from email provider. If you provide `message-id`, API overrides by its own value.", "example": "<0102017b97a502f8-a67f01c2-68cc-4928-b91b-45853f34e259-000000@eu-west-1.amazonses.com>" }, "sender": { "type": "string", "description": "User ID of user sends the message.", "example": "206801" }, "updated_by": { "type": "string", "description": "User ID of the user who last updated (edited) the message. Set for drafts on each save.", "example": "206801" }, "subject": { "type": "string", "description": "Subject", "example": "Request for solar panel price" }, "html": { "type": "string", "description": "HTML body", "example": "
We at ABC GmbH would like to request a price quote for the solar panel.
" }, "text": { "type": "string", "description": "Text body", "example": "We at ABC GmbH would like to request a price quote for the solar panel." }, "from": { "$ref": "#/components/schemas/Address" }, "reply_to": { "$ref": "#/components/schemas/Address" }, "to": { "type": "array", "description": "To email addresses", "items": { "$ref": "#/components/schemas/Address" } }, "cc": { "type": "array", "description": "Cc email addresses", "items": { "$ref": "#/components/schemas/Address" } }, "bcc": { "type": "array", "description": "Bcc email addresses", "items": { "$ref": "#/components/schemas/Address" } }, "file": { "$ref": "#/components/schemas/AttachmentsRelation" }, "references": { "type": "string", "description": "References header. Value is the series of `message_id` which is reparated by space to indicate that message has parent. The last message ID in references identifies the parent. The first message ID in references identifies the first message in the thread. The basic idea is that sender should copy `references` from the parent and append the parent's `message_id` when replying.\n", "example": "<0102017b97a502f8-a67f01c2-68cc-4928-b91b-45853f34e259-000000@eu-west-1.amazonses.com> " }, "in_reply_to": { "type": "string", "description": "In-Reply-To header. Value is the `message_id` of parent message.\n", "example": "" }, "user_read_message": { "type": "array", "description": "User ID of user read the message.", "items": { "type": "string" }, "example": [ "206801", "200109" ] }, "org_read_message": { "type": "array", "description": "Organization ID of organization read the message.", "items": { "type": "string" }, "example": [ "789372", "210291" ] }, "send_status": { "type": "array", "description": "Sent message status. The array contains sending message status corresponding to all recipients. For more detail, check `send_status` of each recipient in `to`, `cc`, `bcc` Reference at \n", "items": { "type": "string", "enum": [ "SEND", "DELIVERY", "REJECT", "COMPLAINT", "BOUNCE", "ERROR" ] } }, "type": { "type": "string", "description": "Message type", "enum": [ "SENT", "RECEIVED" ] }, "template_id": { "type": "string", "description": "Template ID used for sending message.", "example": "3f34ce73-089c-4d45-a5ee-c161234e41c3" } } }, "MessageV2": { "allOf": [ { "$ref": "#/components/schemas/BaseEntity" }, { "$ref": "#/components/schemas/Message" } ], "properties": { "link_suggestions": { "type": "array", "description": "Entity-link suggestions recorded when the message arrived: identifiers that matched entities of different customers, so none was linked automatically.", "items": { "$ref": "#/components/schemas/LinkSuggestion" } }, "auto_link_fields": { "type": "array", "description": "The identifier fields this message was auto-linked by, as `:` (e.g. `contact:customer_number`). Recorded once linking ran with expanded identifiers, so the settings can show how often each field links emails.", "items": { "type": "string" }, "example": [ "contact:customer_number", "contract:lima_contract_ref" ] }, "html_omitted": { "type": "boolean", "description": "If true then html is not provided and must be downloaded using the html_download_url", "default": false }, "html_download_url": { "type": "string", "description": "HTML body download URL", "example": "https://s3.eu-central-1.amazonaws.com/epilot-attachments/3f34ce73-089c-4d45-a5ee-c161234e41c3/3f34ce73-089c-4d45-a5ee-c161234e41c3.html" } } }, "Address": { "type": "object", "required": [ "address" ], "properties": { "name": { "type": "string", "description": "Email address alias", "example": "epilot" }, "address": { "type": "string", "description": "Email address", "example": "messaging@epilot.cloud" }, "email_type": { "type": "string", "description": "Type of the email, Internal (360 Agents), Partners, External users(Customers)\n", "nullable": true, "enum": [ "INTERNAL", "EXTERNAL", "PARTNER" ] }, "send_status": { "type": "string", "description": "Sent message status regarding to this recipient. Reference at \n", "enum": [ "SEND", "DELIVERY", "REJECT", "COMPLAINT", "BOUNCE", "ERROR" ] }, "send_error": { "type": "object", "description": "Information about reject, complaint or bounce event. Only available if `send_status` is REJECT, COMPLAINT, BOUNCE or ERROR. JSON object is defined by AWS SES. Reference at \n" } } }, "AttachmentsRelation": { "type": "object", "description": "Message attachments", "properties": { "$relation": { "type": "array", "description": "It's normal entity relation with some additional properties for sending message attachment.", "items": { "$ref": "#/components/schemas/File" } } } }, "File": { "type": "object", "required": [ "entity_id" ], "properties": { "entity_id": { "type": "string", "description": "File entity ID", "example": "f820ce3b-07b0-45ae-bcc6-babb2f53f79f" }, "filename": { "type": "string", "description": "File name", "example": "Produktinformationen_epilot360_Double_Opt_in.pdf" }, "is_message_attachment": { "type": "boolean", "description": "To indicate this file relation is message attachment. If false then this file will not be sent and simply kept as a file relation." }, "may_be_signature_attachment": { "type": "boolean", "description": "To indicate this file relation may be signature attachment. If true then this file will be sent as signature attachment and not related to any entity." }, "cid": { "type": "string", "description": "Content ID (for inline)", "example": "fb222496-a1a5-4639-94f2-07b5e35e4068" }, "inline": { "type": "boolean", "description": "If true then this attachment should not be offered for download (at least not in the main attachments list). The usecase is CID embedded image (aka inline image).\n", "default": false }, "send_as_link": { "type": "boolean", "description": "If true then this attachment is sent via link. The link have to be inserted to email body by API caller. In this case, service doesn't process this attachment.\n", "default": false }, "save_to_entity": { "type": "boolean", "description": "If false, this file relation is kept on the message (e.g. for CID/inline rendering) but is NOT propagated to the entity the email is sent from. Used for inline images such as logos, signatures and social icons. Defaults to true.\n", "default": true } } }, "MessageRequestParams": { "required": [ "subject", "from" ], "additionalProperties": true, "properties": { "complete_thread": { "type": "boolean", "description": "Whether the thread is marked as Done immediately after sending the message", "default": false }, "mark_thread_as_read": { "type": "boolean", "description": "When true (default), replying marks the whole thread read for the sender: every message on the\nthread is marked read, so the thread is read without leaving any message unread under it. When\nfalse, no message is marked and the thread's read-state reflects its messages — a message still\nunread keeps the thread unread (e.g. an automated reply-in-thread stays unread for a human to\npick up). Only applies to replies (`parent_id` set); a new thread always reflects its single\nmessage. Defaults to true.\n", "default": true }, "category": { "type": "string", "enum": [ "transactional", "promotional" ], "description": "Type of email, either transactional or promotional." }, "thread": { "type": "object", "required": [ "topic" ], "description": "Open new thread when sending the very first message in conversation. Thread should contains context related to all messages in it (eg. topic, brand_id, opportunity_id, assigned_to,...). Thread properties depend on API caller as it's not pre-defined. We do recommend having at least `topic` property for categorizing. `thread` or `parent_id` must be provided either.\n", "properties": { "topic": { "type": "string", "description": "Message topic (e.g. which service sends the message or message category)" }, "assigned_to": { "type": "array", "description": "User ID of who the message is assigned to. Default is the user who sends message.", "items": { "type": "string" } } }, "example": { "topic": "CUSTOMER_MESSAGE", "assigned_to": [ "206801", "200109" ], "opportunity_id": 829072 } }, "parent_id": { "type": "string", "description": "Entity ID of parent message which this message replies to or forwards from. If both `parent_id` and `thread` are provided, `thread` is discarded.\n", "example": "44d7a3eb-0cce-4bd3-a7cd-0b3e652de0c2" }, "subject": { "type": "string", "description": "Subject", "example": "Request for solar panel price" }, "html": { "type": "string", "description": "HTML body", "example": "
We at ABC GmbH would like to request a price quote for the solar panel.
" }, "text": { "type": "string", "description": "Text body. If not provided, text body is converted from HTML body using [html-to-text](https://www.npmjs.com/package/html-to-text)", "example": "We at ABC GmbH would like to request a price quote for the solar panel." }, "from": { "$ref": "#/components/schemas/Address" }, "reply_to": { "$ref": "#/components/schemas/Address" }, "to": { "type": "array", "description": "To email addresses", "items": { "$ref": "#/components/schemas/Address" } }, "cc": { "type": "array", "description": "Cc email addresses", "items": { "$ref": "#/components/schemas/Address" } }, "bcc": { "type": "array", "description": "Bcc email addresses", "items": { "$ref": "#/components/schemas/Address" } }, "file": { "$ref": "#/components/schemas/AttachmentsRelation" }, "template_id": { "type": "string", "description": "Template ID used for sending message.", "example": "3f34ce73-089c-4d45-a5ee-c161234e41c3" }, "source": { "type": "string", "description": "Identifies who triggered the send so server-side policy can branch on it.\nFor `manual` sends, the caller's curated `_tags` are trusted as-is and no\nserver-side enrichment from the referenced `template_id` (e.g. merging the\ntemplate's `email_tags`) is performed. Any non-manual value (or omitting the\nfield) opts into template-derived enrichment.\n", "enum": [ "manual", "automation", "workflow", "partner", "bulk", "system" ], "example": "manual" } } }, "ThreadView": { "type": "object", "additionalProperties": true, "description": "A central-inbox view, described structurally so the server compiles the query for it. Both the\nthread list and the unread count for a view are compiled from the same description, so the two\ncannot disagree about what the view means.\n\nEvery field is optional and an omitted field adds no condition, so a view narrows the whole\nmailbox rather than being a template with required holes. Unknown fields are ignored.\n", "properties": { "folder": { "type": "string", "enum": [ "inbox", "favorite", "sent", "trash", "spam", "unassignable", "draft" ], "description": "Which sidebar folder's membership predicate to apply." }, "mailbox": { "type": "string", "enum": [ "organization", "agent" ], "description": "Whose mailbox this is. `agent` scopes to threads assigned to the caller or their groups;\n`organization` scopes to the org and is the only mailbox that carries address filtering.\n" }, "labels": { "type": "array", "items": { "type": "string" }, "description": "Saved-filter labels, joined by `labels_operator`. Matched exactly against the tag rather than\nagainst its tokens, so a label whose words overlap a folder tag no longer lands in that folder.\n" }, "labels_operator": { "type": "string", "enum": [ "and", "or" ], "default": "and", "description": "How `labels` combine. `and`: the email carries every label. `or`: it carries at least one.\nAbsent means `and`, which is how every view matched before this field existed.\n" }, "purposes": { "type": "array", "items": { "type": "string" }, "description": "Purpose ids on linked entities, ANDed." }, "filters": { "type": "array", "items": { "type": "string", "enum": [ "unread", "resolved", "trash" ] }, "description": "State filters, independent of the folder. `resolved` and `trash` reach the Inbox folder\nonly and are mutually exclusive there; `unread` applies anywhere.\n" }, "from": { "type": "array", "items": { "type": "string" }, "description": "Sender addresses to filter on." }, "to": { "type": "array", "items": { "type": "string" }, "description": "Recipient addresses to filter on." }, "assigned_to": { "type": "array", "items": { "type": "string" }, "description": "Assignee user ids." }, "include_unassigned": { "type": "boolean", "description": "Whether threads with no assignee join the `assigned_to` set. A separate flag rather than a\nsentinel entry in that list, so `assigned_to` holds user ids and nothing else.\n" }, "date_from_days_ago": { "type": "integer", "minimum": 0, "description": "Lower bound of the date range, in days before now. Omitted means the epoch." }, "date_to_days_ago": { "type": "integer", "minimum": 0, "description": "Upper bound of the date range, in days before now. Omitted means now." }, "email_filter": { "type": "array", "items": { "type": "string" }, "description": "Addresses the user selected in the address filter. Absent and empty differ, and the\ndifference is a real UI state: absent is \"not filtering by address\", empty is \"every\naddress deselected\", which matches nothing.\n\nDistinct from the permission restriction, which the server derives and a caller cannot\nauthor.\n" }, "text": { "type": "string", "description": "The user's search string, as typed. Expanded across the searched fields server-side and\nnever interpreted as query syntax, so a typed operator or a stray bracket cannot\nre-associate the predicate around it.\n" }, "thread_ids": { "type": "array", "items": { "type": "string" }, "description": "Restrict the view to these threads. Exists because \"would this thread appear in the view\nthe user is looking at?\" is a real question the inbox asks when a new thread arrives, and\nit is a membership test against the view rather than a different view.\n" }, "pinned_by": { "type": "string", "description": "Restrict the view to threads this user pinned. The pinned strip above the list is the same\nview with this one extra condition.\n" }, "has_link_suggestion": { "type": "boolean", "description": "Restrict the view to threads with a message whose auto-link suggestion still waits for a\ndecision. Omitted or false adds no condition.\n\nLike every other condition, it is matched per message: a thread is included when one of\nits messages has a pending suggestion and also meets the rest of the view.\n" } } }, "UnreadCountScope": { "type": "object", "required": [ "name", "type" ], "properties": { "name": { "type": "string", "description": "Caller-chosen key for this scope. Echoed back as the key in `counts`, so it is how the\ncaller matches a number to the sidebar row it belongs to. Must be unique within the\nrequest; duplicates are refused rather than silently collapsed.\n", "example": "inbox-support" }, "type": { "type": "string", "enum": [ "organization", "shared_inbox", "saved_view" ], "description": "Decides which buckets come back, and whether `q` is required. `organization` returns all\nfour buckets, each compiled from its folder, and takes no `q`. `shared_inbox` and `saved_view`\nreturn `unread` alone. A `saved_view` scope names its view with `view_id`;\na `shared_inbox` scope needs only its `inbox_id`, since the query follows from the type.\n\nA `shared_inbox` scope additionally requires `actor: organization` and is refused with a\n400 otherwise. A shared inbox is an organization-level construct — selecting one always\nswitches the mailbox to the organization — so it has no per-user read state and the\ncombination would compute a number no surface renders. `saved_view` accepts either actor,\nbecause a view's own configuration names its mailbox.\n" }, "q": { "type": "string", "description": "The scope's query, in Lucene syntax, as passed to `threads:search` for the same scope. The\nserver adds the read-state condition and nothing else, so the count matches that list.\n\nAccepted for `shared_inbox` and `saved_view`; rejected for `organization`.\n\nIgnored for `shared_inbox`, and for a `saved_view` whose `view_id` resolves.\n", "example": "_tags.keyword:inbox AND !_tags.keyword:trash" }, "view_id": { "type": "string", "description": "The id of the saved view this scope counts. The server reads that view and compiles the same\nquery the thread list runs for it, so the count and the list cannot describe the view\ndifferently.\n\nRequired for `saved_view` scopes unless `q` is supplied instead; rejected for the other two\ntypes. A `shared_inbox` scope needs no predicate field at all, because its query follows from\nthe type and its `inbox_id`. An `organization` scope compiles from its folders.\n\nThe view's own shared-inbox filter is read from the stored view, so `inbox_id` need not be\nsent alongside this.\n\nA view that is missing or unreadable, sent without a `q`, puts the scope in `omitted`.\n", "example": "3f34ce73-089c-4d45-a5ee-c161234e41c3" }, "inbox_id": { "description": "Shared inbox ids, resolved to bucket ids the same way `threads:search` resolves them.", "oneOf": [ { "type": "string", "example": "3f34ce73-089c-4d45-a5ee-c161234e41c3" }, { "type": "array", "items": { "type": "string" } } ] } } }, "UnreadCountsPayload": { "type": "object", "required": [ "actor", "scopes" ], "properties": { "actor": { "type": "string", "enum": [ "organization", "user" ], "description": "Which read state to count against — the org's or the calling user's. Same meaning as\n`getUnread`'s path parameter, and unrelated to a scope's `type`.\n" }, "email_filter": { "type": "array", "items": { "type": "string" }, "description": "The addresses selected in the address filter, applied to the `organization` scope only.\n\nNot a request-level restriction, despite arriving at request level. A `shared_inbox`\nscope's badge belongs to the sidebar inbox, whose list sends no address filter, and a\n`saved_view` ignores the address lens entirely. Applying this to\neither would make the badge answer a narrower question than the list beneath it.\n" }, "user_groups": { "type": "array", "items": { "type": "string" }, "description": "The caller's group ids, as `group_`, with the same meaning and constraints as on\n`threads:search`. Read when a scope carries a `view` or an organization scope is present. Entries not matching\n`group_` are dropped. Not an authorization input.\n" }, "scopes": { "type": "array", "minItems": 1, "maxItems": 25, "items": { "$ref": "#/components/schemas/UnreadCountScope" } } } }, "UnreadCountsResult": { "type": "object", "required": [ "enabled", "counts" ], "properties": { "enabled": { "type": "boolean", "deprecated": true, "description": "Always `true`; kept because older clients hide every badge when it is false or missing.\n", "example": true }, "counts": { "type": "object", "description": "One entry per scope, keyed by the scope's `name`. A scope whose predicate could not be\nbuilt is **absent** rather than zero, because a zero badge is a claim about the mailbox\nand an absent one is a claim about the request.\n", "additionalProperties": { "$ref": "#/components/schemas/UnreadCountBuckets" } }, "omitted": { "type": "array", "description": "Names of scopes that were accepted but could not be counted. Each appears here and is\nabsent from `counts`, so an omission is distinguishable from a mis-spelled scope name.\n\nCauses, not distinguishable from this field: a `shared_inbox` scope whose ids matched no\nbucket, or a missing or unreadable `view_id` sent without a `q`.\n", "items": { "type": "string" } } } }, "UnreadCountBuckets": { "type": "object", "required": [ "unread" ], "properties": { "unread": { "type": "number", "example": 14 }, "drafts": { "type": "number", "description": "Organization scope only.", "example": 12 }, "unassigned": { "type": "number", "description": "Organization scope only.", "example": 1 }, "spam": { "type": "number", "description": "Organization scope only.", "example": 3 } } }, "SearchParamsV2": { "type": "object", "properties": { "inbox_id": { "oneOf": [ { "type": "string", "description": "Inbox ID", "example": "3f34ce73-089c-4d45-a5ee-c161234e41c3" }, { "type": "array", "items": { "type": "string" }, "description": "Inbox IDs", "example": [ "3f34ce73-089c-4d45-a5ee-c161234e41c3", "3f34ce73-089c-4d45-a5ee-c161234e41c4" ] } ] }, "q": { "description": "Lucene query syntax supported with ElasticSearch.\n\nSend this or `view`, not both. At least one is required; a request with neither is refused\nwith a 400. An empty string is accepted and returns no hits.\n", "type": "string", "example": "subject:\"Request for solar panel price\" AND _tags:INBOX" }, "view": { "allOf": [ { "$ref": "#/components/schemas/ThreadView" } ], "description": "A view for the server to compile into the query, instead of supplying `q`. When present, `q`\nis ignored.\n\nRead by `threads:search` and `threads:searchIds` only. This schema is shared with\n`messages:search`, which compiles no view and ignores the field, so a request there must\nsupply `q`.\n" }, "user_groups": { "type": "array", "items": { "type": "string" }, "description": "The caller's group ids, as `group_`. Read only when a `view` is compiled, where they\ndetermine the agent mailbox's assignee condition and which shared inboxes, and therefore\nwhich addresses, are reachable. Required for those conditions to be correct, because group\nmembership is not present on the id token this service parses.\n\nEntries not matching `group_` are dropped.\n\nNot an authorization input, and not treated as one: naming groups the caller is not in\nwidens what the response includes, exactly as supplying a broader `q` does. Access control\nis enforced elsewhere.\n" }, "fields": { "$ref": "#/components/schemas/FieldsParam" }, "from": { "type": "integer", "minimum": 0, "default": 0 }, "size": { "type": "integer", "minimum": 1, "default": 10 }, "hydrate": { "type": "boolean", "default": false }, "include_scores": { "type": "boolean", "default": false }, "sort": { "type": "string" }, "highlight": {} } }, "SearchParams": { "type": "object", "required": [ "q" ], "properties": { "q": { "description": "Lucene query syntax supported with ElasticSearch", "type": "string", "example": "subject:\"Request for solar panel price\" AND _tags:INBOX" }, "from": { "type": "integer", "minimum": 0, "default": 0 }, "size": { "type": "integer", "minimum": 1, "default": 10 }, "hydrate": { "type": "boolean", "default": false } } }, "SearchIDParams": { "type": "object", "properties": { "view": { "allOf": [ { "$ref": "#/components/schemas/ThreadView" } ], "description": "The view to compile, with the same meaning as on `threads:search`. Present here because\nthis endpoint returns the ordered id set *for that list*: if one compiled its view and the\nother ran an authored `q`, the two would disagree inside a single feature, which is the\ndrift this replaces.\n" }, "user_groups": { "type": "array", "items": { "type": "string" }, "description": "The caller's group ids, with the same meaning and caveats as on `threads:search`." }, "inbox_id": { "oneOf": [ { "type": "string", "description": "Inbox ID", "example": "3f34ce73-089c-4d45-a5ee-c161234e41c3" }, { "type": "array", "items": { "type": "string" }, "description": "Inbox IDs", "example": [ "3f34ce73-089c-4d45-a5ee-c161234e41c3", "3f34ce73-089c-4d45-a5ee-c161234e41c4" ] } ] }, "q": { "description": "Lucene query syntax supported with ElasticSearch", "type": "string", "example": "subject:\"Request for solar panel price\" AND _tags:INBOX" } } }, "AssigneeWorkloadParams": { "type": "object", "required": [ "user_ids" ], "properties": { "user_ids": { "type": "array", "description": "User ids to compute the open-thread workload for. At most 100 per request; larger requests are rejected with 422.", "minItems": 1, "items": { "type": "string" }, "example": [ "11000902", "11001053" ] } } }, "AssigneeWorkload": { "type": "object", "required": [ "user_id", "open_threads" ], "properties": { "user_id": { "type": "string", "description": "The user id.", "example": "11000902" }, "open_threads": { "type": "number", "description": "Number of open threads assigned directly to the user.", "example": 2 } } }, "AssigneeWorkloadResults": { "type": "object", "required": [ "workloads" ], "properties": { "workloads": { "type": "array", "description": "Open-thread workload per requested user id, in request order.", "items": { "$ref": "#/components/schemas/AssigneeWorkload" } } } }, "ReadMessagePayload": { "type": "object", "required": [ "scopes" ], "properties": { "scopes": { "description": "The scopes to be used when marking an item as read or unread. The read status will be synced for all provided scopes.", "example": [ "organization", "user" ], "type": "array", "default": [ "organization", "user" ], "items": { "$ref": "#/components/schemas/ReadingScope" } } } }, "ReadingScope": { "description": "Who is marking an item as read or unread.", "type": "string", "enum": [ "organization", "user" ] }, "ThreadReplyContext": { "type": "object", "required": [ "thread_id", "messages", "related_entities" ], "properties": { "thread_id": { "type": "string" }, "topic": { "type": "string" }, "reply_to_message_id": { "type": "string", "description": "ID of the latest received message, i.e. the one a reply would answer. Absent if none." }, "messages": { "type": "array", "description": "Conversation oldest first, cleaned for prompting", "items": { "$ref": "#/components/schemas/ReplyContextMessage" } }, "related_entities": { "type": "array", "description": "Entities linked to the conversation (recipients, message relations), not hydrated", "items": { "$ref": "#/components/schemas/ReplyContextEntityRef" } } } }, "ReplyContextMessage": { "type": "object", "required": [ "id", "type", "role", "text" ], "properties": { "id": { "type": "string" }, "created_at": { "type": "string", "format": "date-time" }, "type": { "type": "string", "enum": [ "RECEIVED", "SENT" ] }, "role": { "type": "string", "description": "Who wrote the message from the organization's point of view", "enum": [ "customer", "agent", "partner" ] }, "subject": { "type": "string" }, "from": { "type": "object", "properties": { "address": { "type": "string" }, "name": { "type": "string" } } }, "text": { "type": "string", "description": "Plain text body with quotes, forwarded content, reply headers and links removed" } } }, "ReplyContextEntityRef": { "type": "object", "required": [ "_id", "_schema" ], "properties": { "_id": { "type": "string" }, "_schema": { "type": "string" } } }, "ThreadSummary": { "type": "object", "required": [ "orgId", "jobId", "jobStatus", "createdAt", "updatedAt" ], "properties": { "orgId": { "type": "string" }, "jobId": { "type": "string", "description": "Opaque ID of the summary job" }, "executionId": { "type": "string", "description": "ID of the AI agent execution generating the summary. Absent until generation has started." }, "jobStatus": { "type": "object", "required": [ "status" ], "properties": { "status": { "type": "string", "enum": [ "INITIATED", "IN_PROGRESS", "COMPLETED", "FAILED" ] }, "error": { "type": "string", "description": "Error message if the job failed" } } }, "payload": { "$ref": "#/components/schemas/ThreadSummaryPayload" }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" } } }, "ThreadSummaryPayload": { "type": "object", "description": "Present once the summary is generated", "properties": { "summary": { "type": "array", "description": "Bullet points summarizing the thread", "nullable": true, "items": { "type": "string" } }, "topics": { "type": "array", "description": "Main topics of the thread", "nullable": true, "items": { "type": "string" } }, "next_steps": { "type": "array", "description": "Recommended next steps for the agent", "nullable": true, "items": { "type": "string" } }, "refs": { "type": "array", "description": "Entities whose IDs can appear in the summary, topics and next steps", "items": { "$ref": "#/components/schemas/ThreadSummaryEntityRef" } } } }, "ThreadSummaryEntityRef": { "type": "object", "required": [ "id", "displayText", "schema" ], "properties": { "id": { "type": "string" }, "displayText": { "type": "string", "example": "Raven GmbH" }, "schema": { "type": "string", "description": "Entity schema, or `internal` for a user of the organization", "example": "contact" } } }, "ThreadSummaryContext": { "type": "object", "required": [ "thread_id", "message_id", "subject", "conversation", "entity_context" ], "properties": { "thread_id": { "type": "string" }, "message_id": { "type": "string", "description": "Message the summary is generated for" }, "subject": { "type": "string", "description": "Subject of the first message, \"No subject\" if empty" }, "conversation": { "type": "string", "description": "Messages formatted as blocks, ready to insert into the prompt" }, "entity_context": { "type": "string", "description": "Entities of the conversation formatted as lines, ready to insert into the prompt" } } }, "ThreadValidationContext": { "type": "object", "required": [ "thread_id", "message_id", "subject", "message", "earlier_messages", "attachments", "entities" ], "properties": { "thread_id": { "type": "string" }, "message_id": { "type": "string", "description": "The triggering message" }, "subject": { "type": "string", "description": "Subject of the triggering message, or of the first one" }, "message": { "$ref": "#/components/schemas/ThreadValidationMessage" }, "earlier_messages": { "type": "array", "description": "Messages before the triggering one, oldest first; drafts, trashed, spam and empty messages left out", "items": { "$ref": "#/components/schemas/ThreadValidationMessage" } }, "attachments": { "type": "array", "description": "Attachments of the messages up to the triggering one, newest first, each file once", "items": { "$ref": "#/components/schemas/ThreadValidationAttachment" } }, "entities": { "type": "array", "description": "Entities linked to the thread or the triggering message, main entity first; suggestions left out", "items": { "$ref": "#/components/schemas/ThreadValidationEntity" } } } }, "ThreadValidationMessage": { "type": "object", "required": [ "message_id", "type", "sent_at", "text" ], "properties": { "message_id": { "type": "string" }, "type": { "type": "string", "enum": [ "RECEIVED", "SENT", "DRAFT" ] }, "sent_at": { "type": "string", "format": "date-time" }, "subject": { "type": "string" }, "from": { "type": "object", "required": [ "address" ], "properties": { "address": { "type": "string" }, "name": { "type": "string" }, "email_type": { "type": "string", "enum": [ "INTERNAL", "EXTERNAL", "PARTNER" ] } } }, "text": { "type": "string", "description": "Plain text with quoted history, reply headers and links removed (the thread summary's cleaning). Earlier\nmessages also lose text that repeats an earlier message; the triggering message keeps all of its own text.\n" } } }, "ThreadValidationAttachment": { "type": "object", "required": [ "file_id", "message_id", "sent_at", "inline", "likely_signature", "eligible" ], "properties": { "file_id": { "type": "string" }, "filename": { "type": "string" }, "message_id": { "type": "string", "description": "Latest message the file is attached to" }, "sent_at": { "type": "string", "format": "date-time" }, "inline": { "type": "boolean", "description": "Embedded in the email body (CID image)" }, "likely_signature": { "type": "boolean", "description": "Ingestion marked it as a probable signature image" }, "eligible": { "type": "boolean", "description": "Worth reading for validation; false when inline, a signature, or beyond max_attachments" }, "reason": { "type": "string", "enum": [ "inline", "signature", "limit" ], "description": "Why the file is not eligible" } } }, "ThreadValidationEntity": { "type": "object", "required": [ "entity_id", "schema", "is_main_entity", "source" ], "properties": { "entity_id": { "type": "string" }, "schema": { "type": "string" }, "title": { "type": "string" }, "is_main_entity": { "type": "boolean" }, "source": { "type": "string", "enum": [ "thread", "message" ], "description": "Where the link was found first" } } }, "SimilarSentMessagesRequest": { "type": "object", "required": [ "queries" ], "properties": { "queries": { "type": "array", "description": "Texts to search with. Results are merged across queries, best score per message wins.", "minItems": 1, "maxItems": 5, "items": { "type": "string", "minLength": 1, "maxLength": 20000 } }, "limit": { "type": "integer", "description": "Maximum number of messages to return", "minimum": 1, "maximum": 10, "default": 3 }, "min_score": { "type": "number", "description": "Minimum similarity (0-1, cosine certainty) a message must reach to be returned", "minimum": 0, "maximum": 1, "default": 0.6 } } }, "SimilarSentMessagesResponse": { "type": "object", "required": [ "results" ], "properties": { "results": { "type": "array", "items": { "$ref": "#/components/schemas/SimilarSentMessage" } } } }, "SimilarSentMessage": { "type": "object", "required": [ "message_id", "text", "score" ], "properties": { "message_id": { "type": "string" }, "thread_id": { "type": "string" }, "subject": { "type": "string" }, "text": { "type": "string", "description": "Anonymized plain text of the sent message" }, "created_at": { "type": "string" }, "score": { "type": "number", "description": "Similarity in 0-1, higher is more similar" } } }, "ThreadTimeline": { "type": "object", "required": [ "events" ], "properties": { "events": { "type": "array", "items": { "$ref": "#/components/schemas/TimelineEvent" } } } }, "ThreadDoneEvent": { "type": "object", "required": [ "type", "user_id", "organization_id" ], "properties": { "type": { "type": "string", "enum": [ "THREAD_DONE" ] }, "user_id": { "type": "string", "description": "User ID of the user who marked the thread as done", "example": "123" }, "organization_id": { "type": "string", "description": "Organization ID of the organization who marked the thread as done", "example": "456" } } }, "ThreadOpenEvent": { "type": "object", "required": [ "type", "user_id", "organization_id" ], "properties": { "type": { "type": "string", "enum": [ "THREAD_OPEN" ] }, "user_id": { "type": "string", "description": "User ID of the user who marked the thread as open", "example": "123" }, "organization_id": { "type": "string", "description": "Organization ID of the organization who marked the thread as open", "example": "456" } } }, "WorkflowStartedEvent": { "type": "object", "required": [ "type" ], "properties": { "type": { "type": "string", "enum": [ "WORKFLOW_STARTED" ] }, "workflow_id": { "type": "string", "description": "ID of the workflow/flow execution that was started" }, "workflow_name": { "type": "string", "description": "Name of the workflow that was started" } } }, "ThreadUserAssignedEvent": { "type": "object", "required": [ "type" ], "properties": { "type": { "type": "string", "enum": [ "THREAD_USER_ASSIGNED" ] }, "added": { "type": "array", "description": "User IDs assigned to the thread", "items": { "type": "string" } }, "removed": { "type": "array", "description": "User IDs unassigned from the thread", "items": { "type": "string" } } } }, "MessageLabelAddedEvent": { "type": "object", "required": [ "type", "label" ], "properties": { "type": { "type": "string", "enum": [ "MESSAGE_LABEL_ADDED" ] }, "label": { "type": "string", "description": "The label that was added (raw tag slug, e.g. `sentiments:angry`)" }, "label_name": { "type": "string", "description": "Resolved taxonomy classification display name (e.g. `Verärgert`), when the label is a classification. Absent for free-form tags." } } }, "MessageLabelRemovedEvent": { "type": "object", "required": [ "type", "label" ], "properties": { "type": { "type": "string", "enum": [ "MESSAGE_LABEL_REMOVED" ] }, "label": { "type": "string", "description": "The label that was removed (raw tag slug, e.g. `sentiments:angry`)" }, "label_name": { "type": "string", "description": "Resolved taxonomy classification display name (e.g. `Verärgert`), when the label is a classification. Absent for free-form tags." } } }, "MessageEntityLinkedEvent": { "type": "object", "required": [ "type" ], "properties": { "type": { "type": "string", "enum": [ "MESSAGE_ENTITY_LINKED" ] }, "entities": { "type": "array", "items": { "$ref": "#/components/schemas/TimelineLinkedEntity" } }, "link_kind": { "type": "string", "enum": [ "manual", "auto" ] }, "from_suggestion": { "type": "boolean", "description": "The link accepted a pending entity-link suggestion" } } }, "MessageEntityUnlinkedEvent": { "type": "object", "required": [ "type" ], "properties": { "type": { "type": "string", "enum": [ "MESSAGE_ENTITY_UNLINKED" ] }, "entities": { "type": "array", "items": { "$ref": "#/components/schemas/TimelineLinkedEntity" } }, "link_kind": { "type": "string", "enum": [ "manual", "auto" ] } } }, "MessageAutoReplySentEvent": { "type": "object", "required": [ "type" ], "properties": { "type": { "type": "string", "enum": [ "MESSAGE_AUTO_REPLY_SENT" ] }, "reply_message_id": { "type": "string", "description": "ID of the message that was sent as the automatic reply" }, "parent_message_id": { "type": "string", "description": "ID of the message the automatic reply responded to" } } }, "ThreadMovedToInboxEvent": { "type": "object", "required": [ "type" ], "properties": { "type": { "type": "string", "enum": [ "THREAD_MOVED_TO_INBOX" ] }, "target_inbox_id": { "type": "string", "description": "ID of the shared inbox the thread was moved to" }, "target_inbox_name": { "type": "string", "description": "Name of the shared inbox the thread was moved to" }, "reason": { "type": "string", "enum": [ "inbox_deleted" ], "description": "Set when the move happened because the thread's inbox was deleted" }, "source_inbox_id": { "type": "string", "description": "ID of the deleted inbox, when `reason` is `inbox_deleted`" }, "source_inbox_name": { "type": "string", "description": "Name of the deleted inbox, when `reason` is `inbox_deleted`" } } }, "ThreadTrashedEvent": { "type": "object", "required": [ "type" ], "properties": { "type": { "type": "string", "enum": [ "THREAD_TRASHED" ] } } }, "ThreadRestoredEvent": { "type": "object", "required": [ "type" ], "properties": { "type": { "type": "string", "enum": [ "THREAD_RESTORED" ] } } }, "LinkSuggestionCandidate": { "type": "object", "required": [ "entity_id", "schema" ], "properties": { "entity_id": { "type": "string" }, "schema": { "type": "string", "description": "Entity schema slug, e.g. \"contract\"" }, "attribute": { "type": "string", "description": "The identifier attribute that matched, e.g. \"contract_number\", or \"email\" for an email address" }, "attribute_value": { "type": "string", "description": "The stored value that matched" }, "title": { "type": "string", "description": "Entity title when the suggestion was recorded" }, "status": { "type": "string", "description": "Resolution of this candidate. Absent on suggestions recorded before candidates were resolved individually.", "enum": [ "pending", "linked", "dismissed" ] }, "resolved_by": { "$ref": "#/components/schemas/TimelineActor" }, "resolved_at": { "type": "string", "format": "date-time" } } }, "LinkSuggestion": { "type": "object", "required": [ "id", "identifier", "status", "candidates" ], "properties": { "id": { "type": "string", "description": "Stable id of the suggestion (identifier + candidate set), shared across a thread's messages" }, "identifier": { "type": "string", "description": "The identifier found in the message, as written there" }, "found_in": { "type": "string", "description": "Where the identifier was found: \"subject\", \"text\" (the email body, or a reply's new part above the quoted earlier mail) or \"quoted\" (only in the earlier mail quoted below a reply); for an email address shared by several records, the address field: \"from\", \"to\", \"cc\" or \"bcc\"" }, "reason": { "type": "string", "description": "Why it was suggested instead of linked. ambiguous (also when absent): the identifier matched several records. other_record: it matched one record, but the thread is already linked to a different record of that type (e.g. another opportunity). quoted_only: it matched one record (an opportunity, order, contract, request, ticket or lead), but only in the earlier mail quoted below the reply.", "enum": [ "ambiguous", "other_record", "quoted_only" ] }, "status": { "type": "string", "description": "pending while any candidate is pending; once all are resolved, accepted if any candidate was linked, otherwise dismissed", "enum": [ "pending", "accepted", "dismissed" ] }, "candidates": { "type": "array", "items": { "$ref": "#/components/schemas/LinkSuggestionCandidate" } }, "accepted_entity_ids": { "type": "array", "description": "Candidates that were linked from this suggestion", "items": { "type": "string" } }, "resolved_by": { "$ref": "#/components/schemas/TimelineActor" }, "resolved_at": { "type": "string", "format": "date-time" }, "created_at": { "type": "string", "format": "date-time" } } }, "TimelineLinkSuggestion": { "type": "object", "required": [ "identifier" ], "properties": { "id": { "type": "string" }, "identifier": { "type": "string" }, "candidates": { "type": "array", "items": { "$ref": "#/components/schemas/TimelineLinkedEntity" } } } }, "MessageEntityLinkSuggestedEvent": { "type": "object", "required": [ "type" ], "properties": { "type": { "type": "string", "enum": [ "MESSAGE_ENTITY_LINK_SUGGESTED" ] }, "suggestions": { "type": "array", "items": { "$ref": "#/components/schemas/TimelineLinkSuggestion" } } } }, "MessageEntityLinkSuggestionDismissedEvent": { "type": "object", "required": [ "type" ], "properties": { "type": { "type": "string", "enum": [ "MESSAGE_ENTITY_LINK_SUGGESTION_DISMISSED" ] }, "suggestions": { "type": "array", "items": { "$ref": "#/components/schemas/TimelineLinkSuggestion" } } } }, "TimelineLinkedEntity": { "type": "object", "required": [ "entity_id" ], "properties": { "entity_id": { "type": "string" }, "schema": { "type": "string", "description": "Entity schema slug, e.g. \"opportunity\"" } } }, "TimelineActor": { "type": "object", "properties": { "user_id": { "type": "string" }, "email": { "type": "string" } } }, "TimelineEventData": { "type": "object", "discriminator": { "propertyName": "type" }, "oneOf": [ { "$ref": "#/components/schemas/ThreadDoneEvent" }, { "$ref": "#/components/schemas/ThreadOpenEvent" }, { "$ref": "#/components/schemas/WorkflowStartedEvent" }, { "$ref": "#/components/schemas/ThreadUserAssignedEvent" }, { "$ref": "#/components/schemas/MessageLabelAddedEvent" }, { "$ref": "#/components/schemas/MessageLabelRemovedEvent" }, { "$ref": "#/components/schemas/MessageEntityLinkedEvent" }, { "$ref": "#/components/schemas/MessageEntityUnlinkedEvent" }, { "$ref": "#/components/schemas/MessageEntityLinkSuggestedEvent" }, { "$ref": "#/components/schemas/MessageEntityLinkSuggestionDismissedEvent" }, { "$ref": "#/components/schemas/MessageAutoReplySentEvent" }, { "$ref": "#/components/schemas/ThreadMovedToInboxEvent" }, { "$ref": "#/components/schemas/ThreadTrashedEvent" }, { "$ref": "#/components/schemas/ThreadRestoredEvent" } ] }, "TimelineEvent": { "type": "object", "required": [ "timestamp", "data" ], "properties": { "id": { "type": "string", "description": "Activity id (ActivityItem._id), for deep-linking to the item in the activity feed" }, "data": { "$ref": "#/components/schemas/TimelineEventData" }, "timestamp": { "type": "string", "description": "Timestamp of the event", "example": "2024-01-01T00:00:00.000Z" }, "message_id": { "type": "string", "description": "For message-level events, the message the activity is anchored to" }, "source": { "type": "string", "enum": [ "user", "automation", "system" ] }, "automated": { "type": "boolean", "description": "Whether the activity was performed automatically (automation/system)" }, "actor": { "$ref": "#/components/schemas/TimelineActor" }, "automation": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" } } } } }, "BulkActionsPayloadWithScopes": { "allOf": [ { "$ref": "#/components/schemas/BulkActionsPayload" }, { "type": "object", "properties": { "assign_to": { "description": "Assignable IDs to assign the threads to", "type": "array", "items": { "type": "string", "example": "206801" } }, "inbox_id": { "description": "Inbox ID to move the threads to", "type": "string", "example": "3f34ce73-089c-4d45-a5ee-c161234e41c3" }, "scopes": { "description": "The scopes to be used when marking an item as read or unread. The read status will be synced for all provided scopes.", "example": [ "organization", "user" ], "type": "array", "default": [ "organization", "user" ], "items": { "$ref": "#/components/schemas/ReadingScope" } } } } ] }, "BulkActionsPayload": { "type": "object", "required": [ "ids" ], "properties": { "ids": { "description": "Array of threads you wish to perform bulk actions on", "example": [ "6b299eda-4018-4554-8965-c4b5598e6531" ], "type": "array", "items": { "type": "string" } } } }, "BulkActionsResponse": { "type": "object", "required": [ "success" ], "properties": { "success": { "type": "integer", "description": "Number of threads the action was applied to", "example": 2 }, "failed": { "type": "integer", "description": "Number of threads the action failed for. Only present when at least one thread failed.", "example": 1 }, "failedIds": { "type": "array", "description": "Ids of the threads the action failed for. Only present when at least one thread failed.", "items": { "type": "string" }, "example": [ "6b299eda-4018-4554-8965-c4b5598e6531" ] }, "failures": { "type": "array", "description": "Why each thread failed, one entry per id in `failedIds`. Only present when at least one thread failed.", "items": { "type": "object", "required": [ "id", "message" ], "properties": { "id": { "type": "string", "example": "6b299eda-4018-4554-8965-c4b5598e6531" }, "message": { "type": "string", "example": "Thread 6b299eda-4018-4554-8965-c4b5598e6531 was changed at the same time" }, "status": { "type": "integer", "description": "HTTP status of the failure, when there is one", "example": 409 } } } }, "error": { "description": "Per-thread outcomes (settled promises) or a message, for debugging. Only present when at least one thread failed." } } }, "FieldsParam": { "type": "array", "description": "List of entity fields to include or exclude in the response\n\nUse ! to exclude fields, e.g. `!_id` to exclude the `_id` field.\n\nGlobbing and globstart (**) is supported for nested fields.\n", "items": { "type": "string" }, "example": [ "_id", "_title", "first_name", "account", "!account.*._files", "**._product" ] } } }, "servers": [ { "url": "https://message.sls.epilot.io" } ] }