Create Workspace Resource Export Task¶
POST /api/v1/workspace/resource/export/task/create
Overview¶
Create a ZIP export task for the current workspace's resource configuration.
Before Calling and Usage Steps¶
- Use a Key that has the
workspace.setManagepermission for the current workspace; create the export task without a Body or by submitting{}. - Save
content.taskIdand use the same Key to call Resource Task Progress. - Wait for
content.status=ok, check the export failure and skipped summary, then download fromcontent.url; keep the download URL and archive as a sensitive backup.
The current Key must have workspace.setManage. A task belongs only to the current workspace and the resource UUID of the initiating Key. Another Key in the same workspace cannot read/cancel the task even if it has the same role; rotating the same Key retains the resource UUID. Do not confuse taskId with the API Key value.
No Body is required, or submit {}; non-empty JSON objects are rejected. You cannot pass resourceType/sloUUIDs or specify partial modules for export. For SLO-specific export, use its dedicated API. The task attempts to export configurations in the supported catalog, including dashboards, monitors, explorers, notification targets, SLOs, security monitoring, alert policies, data forwarding, workspace attribute claims, field configurations, tags, environment variables, roles, log indexes, blocklists, Pipelines, regular expressions, field masking rules, sensitive data scanning rules, and other configurations. It does not include raw business data such as logs or metrics, nor is it a full database backup.
On success, only taskId is returned. Use Resource Task Progress to poll; a URL may only exist after status=ok. You must also check import_info.exportInfo.result, exportFailedInfo, and the resource failure summary: ok may mean that some resources were skipped due to permission or serialization failures, and not all objects are guaranteed to be in the package. The permission context at task creation is preserved, and some resources controlled by custom operation permissions are filtered according to rules.
The resource package may contain sensitive configurations such as recoverable external storage access keys, connection configurations, and environment variables. Keep it as a sensitive backup and do not disclose the download URL. Tasks and temporary files are time-limited. By default, the code caches tasks for about 10 minutes, which is configurable per site; download as soon as possible after ok. If the cache does not exist at all, status=null may be returned. After a long task exceeds the cache time limit, a status record lacking ownership information may remain and a 403 may be returned. Retain the taskId, ask the administrator to check the task logs/resources, and then decide whether to recreate it. Task creation is not idempotent. After a network failure, verify the returned taskId before retrying.
Request Headers¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| DF-API-KEY | string | Y | OpenAPI authentication credential for the workspace. Example: <DF-API-KEY>How to obtain or fill in: Obtain an OpenAPI Key with this operation permission from the API Key management of the target workspace. |
Additional Parameter Description¶
1. API Purpose
Start a resource export task for the current workspace.
This is an asynchronous task API. After a successful call, only taskId is returned; the archive content is not returned immediately.
The recommended call flow is as follows:
- Call this API to obtain
taskId - Call
GET /api/v1/workspace/resource/query_action_statusto poll the task status - After the status becomes
ok, obtain the export file information from the result returned by the status API
2. Request Description
By default, when no request body is passed, all resources in the workspace to which DF-API-KEY belongs are exported.
To export an SLO resource package, call POST /api/v1/slo/export/task/create; this API is only used to export all workspace resources.
3. Response Description
Success response example:
Notes:
- As long as the task is created successfully,
taskIdis returned - Subsequent export execution failures and partial resource export failures must be viewed through the task status API
4. Current Resource Boundaries
The current workspace resource import/export has the following boundaries:
- Environment variables do not include
scope=rum - Log indexes do not include external indexes and
default - Field management only handles workspace custom fields
- Data access currently does not support workspace import/export
5. Additional Export Result Description
If export of a single object in a resource fails, the entire export task is not interrupted.
The import_info.exportInfo.resourceFailureInfo in the task status API returns deduplicated resource-level failure details, including resource type, resource UUID, resource name, stable failure reason, and affected SLOs; it does not return resource configurations, permission members, exception stacks, or sensitive fields.
The legacy import_info.exportFailedInfo is retained for compatibility with old clients, but displaying the raw exception information in it directly is not recommended.
Request Example¶
curl --request POST 'https://openapi.guance.com/api/v1/workspace/resource/export/task/create' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{}'
Response¶
HTTP 200, application/json. The following example shows the main fields that can be read directly.
| Field | Type | Description |
|---|---|---|
| content.taskId | string | Asynchronous task ID, subsequently used to query/cancel by taskId; it is not a ZIP download URL or a Celery execution completion flag. |
| content.declaration | object or null | Workspace public declaration attached to non-empty content; may be null or an empty object when not configured. |
{
"code": 200,
"content": {
"taskId": "resource_task_example",
"declaration": {}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Responses¶
For authentication, rate limiting, and common request errors, see Common Error Definitions.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Handling |
|---|---|---|---|---|
| 400 | ft.ParamsValidateError | Sending a non-empty JSON object; this endpoint does not accept filtered export parameters | Parameter validation failed: {} | Omit Body or send {}; do not mix in SLO-specific parameters. |
| 500 | ft.InternalServerError | Task cache/queue, file system, database, or unhandled task status/JSON processing failure | Internal error | First query the task and current resource state with the same Key in the same workspace to confirm whether it has been enqueued/partially saved before retrying. Do not blindly repeat the import or overwrite. |