POST
/
get_completion
curl --request POST \
  --url https://agency-swarm-app-japboyzddq-uc.a.run.app/get_completion \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "message": "<string>",
  "apiIntegrationId": "<string>",
  "chatId": "<string>",
  "attachments": [
    {
      "file_id": "<string>",
      "tools": [
        {
          "type": "<string>"
        }
      ]
    }
  ],
  "additionalInstructions": "<string>",
  "aliasChatId": "<string>"
}'
{
  "chatId": "<string>",
  "createdAt": "2023-11-07T05:31:56Z",
  "threadId": "<string>",
  "assistantId": "<string>",
  "name": "<string>",
  "message": {
    "id": "<string>",
    "content": "<string>",
    "role": "<string>",
    "type": "<string>",
    "createdAt": "2023-11-07T05:31:56Z",
    "references": [
      "<string>"
    ],
    "fileIds": [
      "<string>"
    ],
    "assistantData": {},
    "functions": {}
  },
  "numMessages": 123,
  "aliasChatId": "<string>"
}

Authorizations

Authorization
string
header
required

Platform token required for authentication. Find or create one inside Profile Icon > API Keys. Example: Bearer sk-agencii-...

Body

application/json

Request body for the /get_completion endpoint.

message
string
required

The message content to be processed by the agent. Example: "Hey! How are you?"

apiIntegrationId
string
required

The unique identifier for the API integration being used. Example: "dpCD7snQ0tCWrdtp6UhZ"

chatId
string | null

The unique identifier for the chat session. If provided, continues the chat with the previous context. Example: "plOQeH3hW7UKiACqEdAx"

attachments
object[] | null

An array of attachment objects to include files and specify tools for processing. Example: [{"file_id": "file-123", "tools": [{"type": "file_search"}]}]

Object representing a file attachment.

additionalInstructions
string | null

Appends additional instructions at the end of the agent's instructions for the run. Useful for modifying behavior per-run. Example: "User name: John Smith"

aliasChatId
string | null

An alternative to chatId which allows using custom identifiers for persisting chats through third party integrations. Example: "custom-identifier"

Response

200
application/json
Successful response. The format varies depending on the `textOnly` mode configured for the API Integration. If `textOnly` is enabled, the response is plain text. Otherwise, it's application/json.

Response body for the /get_completion endpoint when textOnly mode is disabled.

chatId
string

The unique identifier for the chat session. Example: "FVfA971B3fnBH4S1OKlo"

createdAt
string

The timestamp when the response was created (ISO 8601 format). Example: "2024-08-06T02:02:37.533913"

threadId
string

The unique identifier for the underlying thread. Example: "thread_ruUj69CyW2STm8Zog0HXkvIJ"

assistantId
string

The unique identifier for the assistant that responded. Example: "J3NQwdHxqm9jvWFpOwFk"

name
string

The name of the API integration used. Example: "Test API Integration"

message
object

The message object containing the agent's response details.

numMessages
integer

The total number of messages in the chat thread. Example: 2

aliasChatId
string

Alternative chat identifier used for persisting chats through third party integrations. Example: "r14ud3CyX21Tm8Zog0HKJkvZJ"