Skip to main content

Assistant API Integration

4. Assistant API Integration

API integration allows the assistant to be called programmatically through code, webhooks, or external systems.

After selecting the integration method, use Get Started to proceed with the API configuration.

This opens the API Keys screen for the selected assistant.

From this screen, you can view and copy the API key, configure request timeout and rate limit settings, and access the relevant API documentation.

4.1. API Key

The API Key is the authentication credential used to call the selected assistant from external systems.

The generated API key is valid only for the selected assistant. The Scope field displays which assistant the API key belongs to.

The API key can be displayed using the view option or copied using the copy option.

The API key must be kept confidential. Anyone with access to the key can call the relevant assistant and consume workspace usage. Therefore, the API key should not be included in browser-side code, public source code repositories, or environments accessible to unauthorized users.

4.2. Request Timeout

Request Timeout determines the maximum amount of time a request will wait for a server response before being canceled.

This value can be configured from the Request Timeout field. An appropriate timeout value can be selected based on the duration of the operations performed by the assistant.

4.3. Rate Limit and Burst Tolerance

Rate Limit determines the number of requests that can be made per second through the API.

This value can be configured from the Rate Limit field.

Burst Tolerance specifies the additional request capacity allowed during short periods of increased request volume.

The Rate Limit and Burst Tolerance values help ensure that requests made through the API are managed in a controlled manner.

4.4. Using the Assistant API

The Assistant API allows the selected assistant to be called from external applications, webhooks, or other systems.

When sending an API request, use the key generated on the API Keys screen.

4.4.1. API Connection Information

FieldValue
MethodPOST
URLhttps://skystudio.skymod.tech/api/v2
AuthorizationBearer Token
Content-Typetext/plain
BodyRaw JSON

4.4.2. Authorization

The API key must be added to the request's Authorization header as a Bearer Token.

Authorization: Bearer YOUR_API_KEY
Content-Type: text/plain

Replace YOUR_API_KEY with the key obtained from the API Keys screen.

4.4.3. Usage Without a File

To ask the assistant a question without sending a file, use the following request body:

{
"query": "Why is the email signature not visible?",
"isStream": false,
"citationType": "html"
}

4.4.4. Usage with a File

To ask a question about a file that has already been uploaded to SkyStudio, send the file name or identifier in the file field:

{
"query": "What is this file about?",
"file": "HR_dataset_100.csv",
"isStream": false,
"citationType": "html"
}

The specified file must already be uploaded and accessible to the relevant assistant or workspace.

4.4.5. Usage with an Image URL

To analyze an image that is accessible over the internet, include the image URL in the query:

{
"query": "https://example.com/image.png What do you see in this image?",
"isStream": false,
"citationType": "html"
}

The image URL must be publicly accessible.

4.4.6. Request Parameters

ParameterDescription
queryQuestion or request to send to the assistant
fileName or identifier of the file to use
isStreamDetermines whether the response is returned as a stream
citationTypeDetermines the format in which sources are returned

4.4.7. Troubleshooting

If the API request fails, check the following:

  • Make sure the endpoint address is correct.
  • Verify that the Method is set to POST.
  • Verify that the API key is valid and belongs to the correct assistant.
  • Make sure the Authorization header includes Bearer.
  • Verify that the correct Content-Type value is being sent.
  • Make sure the request body contains valid JSON.
  • For requests that use files, verify that the file has been uploaded to the system and is accessible.
  • Make sure the request does not exceed the configured timeout or rate limit values.

If the issue persists, review the returned HTTP status code and error message.