---
title: "Get a file access token"
method: POST
path: "/get-sas-token"
tags: ["File Operations"]
---

# Get a file access token

`POST /get-sas-token`

## Request

- Base URL: `https://api.chat-data.com/api/v2`
- URL: `https://api.chat-data.com/api/v2/get-sas-token`
- Auth: HTTP bearer

Generate a read-only Shared Access Signature (SAS) token for accessing a specific uploaded file.

## Request body

- object
  - `chatbotId` string, required: The unique identifier allocated to the chatbot.
  - `fileUrl` string, required: The URL of the file to generate a SAS token for.

## Response `200`

Successful response. For a file that does not exist, `sasToken` is empty and `url` ends with `?`.

- object
  - `status` 'success', required
  - `url` string, required: The complete file URL with the new SAS token.
  - `sasToken` string, required: The generated read-only SAS token.

## Other responses

- `400`: `fileUrl` is missing, or it is not inside this chatbot's storage folder.
- `401`: Authentication failed: the `Authorization` header is missing or not in the `Bearer <key>` format, the API key does not exist, its workspace is unavailable or has no owner, or the workspace's plan does not include API access. `message` says which.
- `403`: The API key cannot access the requested chatbot. A chatbot-scoped key used with another chatbot's ID gets `Access denied to this chatbot`. A workspace key gets `Chatbot <id> was not found in this API key's workspace. It may have been deleted or moved to another workspace.` when the chatbot does not exist or belongs to another workspace.
- `404`: `chatbotId` was not provided.
- `429`: The workspace sent more than 600 API requests in the last minute. Wait the number of seconds given in the `Retry-After` header (and in `message`) before retrying.

---

[API](https://skmtc.dev/chat-data/apis/chat-data-api-schema-guide.md) · [All operations](https://skmtc.dev/chat-data/apis/chat-data-api-schema-guide/llms.txt) · [OpenAPI document](https://skmtc.dev/chat-data/apis/chat-data-api-schema-guide/revisions/72871007f7f0?raw)
