Workflow Test API (Update / Release)
Allows developers to use AI tools such as CodeX and Claude (with the GPTBots Agent Skill installed) to import the .flow file configuration generated by Skills into a target Workflow on the GPTBots platform and release it to production.
⚠️ Only Workflows in "test mode" can be called. Calling a Workflow in production mode returns
403200. Test mode is selected when creating a Workflow and cannot be changed after creation.
Workflow Update API (Import .flow to replace the current version)
Imports the .flow file into the target Workflow (test mode), and saves the replaced current configuration as a new draft version (which also becomes the "current version"). The specific rules are as follows:
- Knowledge bases (data groups) / database tables / knowledge documents in nodes: scoped by WorkflowID; those still belonging to the target Workflow are retained, otherwise discarded;
- Linked workflows / tools (plugins): scoped by organization; those still valid are retained, otherwise discarded;
- Third-party credentials: when importing into an existing Workflow, credentials already configured on the target are backfilled by "identical node/plugin ID", without clearing already-authenticated nodes, to ensure availability;
Request Method
POST
Request URL
https://api-${endpoint}.gptbots.ai/v1/workflow/version/import
Request
Request Example
curl -X POST 'https://api-${endpoint}.gptbots.ai/v1/workflow/version/import' \
-H 'Authorization: Bearer {WORKFLOW_API_KEY}' \
-H 'Content-Type: multipart/form-data' \
-F 'file=@my-workflow.flow' \
-F 'versionDesc=Imported by AI tool'
Request Headers
| Field | Type | Description |
|---|---|---|
| Authorization | Bearer {API Key} | Use Authorization: Bearer {API Key} for authentication. Get the key from the target Workflow's "Integration / API" channel as the API Key. |
| Content-Type | multipart/form-data | Data type, set to multipart/form-data. |
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| file | file | Yes | Binary .flow file. |
| versionDesc | text | No | Version description. |
The version number is generated automatically by the server (the last segment of the latest version +1; if there is no version history, it is
1.0.0).
Response
Response Example
{
"code": 0,
"msg": "OK",
"data": {
"botId": "xxx",
"botType": "Workflow",
"version": "1.0.3"
}
}
Success Response
| Field | Type | Description |
|---|---|---|
| botId | string | Target Workflow ID. |
| botType | string | Fixed as Workflow. |
| version | string | The version number saved this time (i.e. the current version). |
Failure Response
| Field | Type | Description |
|---|---|---|
| code | int | Error code. |
| msg | string | Error details. |
Workflow Release API (Release a version number to production)
Releases the specified version number of the target Workflow (test mode) as the live production version (that version becomes "live", and the other versions revert to draft state).
Request Method
POST
Request URL
https://api-${endpoint}.gptbots.ai/v1/workflow/version/release
Request
Request Example
curl -X POST 'https://api-${endpoint}.gptbots.ai/v1/workflow/version/release' \
-H 'Authorization: Bearer {WORKFLOW_API_KEY}' \
-H 'Content-Type: application/json' \
-d '{
"version": "1.0.3"
}'
Request Headers
| Field | Type | Description |
|---|---|---|
| Authorization | Bearer {API Key} | Use Authorization: Bearer {API Key} for authentication. Get the key from the target Workflow's "Integration / API" channel as the API Key. |
| Content-Type | application/json | Data type, set to application/json. |
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| version | string | Yes | The version number to release as live (e.g. 1.0.3), usually the version returned by the "Update" API. |
Response
Response Example
{
"code": 0,
"msg": "OK"
}
Success Response
No data body; a code of 0 means the release succeeded.
Failure Response
| Field | Type | Description |
|---|---|---|
| code | int | Error code. |
| msg | string | Error details. |
Error Codes
The Update and Release APIs share the same set of error codes:
| Code | Message |
|---|---|
| 0 | Success |
| 40348 | Workflow does not exist |
| 403200 | Not in test mode: only Workflows in test mode can be updated or released by this API |
| 403201 | The imported file type does not match the target Workflow type |
| 403202 | Failed to parse the imported .flow file |
| 403203 | The specified version number does not exist |
| 403204 | API Key type does not match the API: this API only accepts a Workflow Key |
| 40353 | Published count exceeds the plan limit |
