API Documentation Introduction
Introduction to FastGPT API Documentation
Starting with 4.15.0, FastGPT API documentation is generated automatically with zod-openapi. You can view the latest endpoint status by opening the API documentation URL. The manually edited endpoint descriptions in the left sidebar of this documentation are no longer updated.
FastGPT API documentation is split into two sets:
- Dev API: all development APIs. Not every endpoint can be called with an API Key.
- System OpenAPI: all system public endpoints, callable with a system API Key.
API Documentation URL
endpoint is your FastGPT access URL. Append the corresponding path to open the documentation.
- Dev API:
{{endpoint}}/apidoc/devapi - System OpenAPI:
{{endpoint}}/apidoc/systemopenapi
Cloud API Documentation URL
Dev API:
System OpenAPI
Usage Notes
FastGPT OpenAPI endpoints let you authenticate with an API Key to operate related FastGPT services and resources, such as calling app chat endpoints, uploading Dataset data, and running search tests. For compatibility and security reasons, not all endpoints can be accessed with an API Key.
How to Get an API Key
You can find API Keys in two places:
Account-API Keys: manage your personal keys.App-Publishing Channels-API Access: switch between app keys and personal keys.
API Key Scope
App keys require FastGPT 4.18.0 or later.
| Type | Scope | Management |
|---|---|---|
| App key | Chat and chat management for its bound app, including chat logs and supporting chat file and Sandbox file endpoints. App configuration, publishing channels, and Datasets are excluded. | Only app administrators can view, create, and manage keys. Administrators can manage keys created by other administrators of the same app. |
| Personal key | Resources the member can access within the current team, subject to each endpoint's API key support. | Members manage only their own keys. |
An app key grants access independently of its owning member's app permissions. If the key, member, team, and bound app remain valid, the key continues to work when the member loses access to the app. Managing the key still requires app administrator permissions.
API key usage
- Authenticate with
Authorization: Bearer <apiKey>. - App key: omit
appIdfrom any chat or chat management endpoint that supports app keys. The server uses the key's bound app, even if a differentappIdis provided in the request or theapiKey-appIdsuffix. - Personal key: pass
body.appIdwhen callingchat/completionswhenever possible. TheAuthorization: Bearer <apiKey>-<appId>format is also supported for OpenAI SDK compatibility, withbody.appIdtaking precedence. Other endpoints that need an app target still require an explicitappId. - In the generated API documentation, select the app API key (no appId required) format to view its request parameters. The server fixes
sourceTypetoapp; omit it from the request. - Some SDKs require adding
v1to theBaseURL. If you get a 404 error, try addingv1and retry. - Personal keys support
authProxywhen the team owner enables it while creating or editing the key. The proxied member must still have permission to access the target app and session. (FastGPT >= v4.15.0) App keys do not supportauthProxy.
List sessions with an app key
With an app key, getHistories lists only API-source sessions in the bound app. You cannot use source to select another channel. Omit appId, sourceType, and source:
curl --request POST 'http://localhost:3000/api/core/chat/history/getHistories' \
--header 'Authorization: Bearer YOUR_APP_API_KEY' \
--header 'Content-Type: application/json' \
--data '{"offset": 0, "pageSize": 20}'- Offset pagination: pass
offset, starting at0. - Page pagination: omit
offsetand passpageNum, starting at1. For example:{"pageNum": 2, "pageSize": 20}. If both are provided,offsettakes precedence. pageSizedefaults to20and is capped at500. Larger values are reduced to500. Omitting pagination parameters returns the first page.- Optionally filter by time with
startCreateTime,endCreateTime,startUpdateTime, andendUpdateTime.
BaseURL is the shared root URL for API requests. Append the endpoint path before sending a request. For a local deployment, the example below uses http://localhost:3000/api.
How to find the app ID (appId)
Open the app details page and find appId in the URL in your browser's address bar.

How to find Dataset and Collection IDs
| Dataset ID (datasetId) | Collection ID (collectionId) |
|---|---|
![]() | ![]() |
Basic Configuration
In OpenAPI, all endpoints authenticate through Header.Authorization.
baseUrl: "http://localhost:3000/api"
headers: {
Authorization: "Bearer {{apikey}}"
}Last updated

