Create Workspace¶
POST /api/v1/workspace/create
Overview¶
Create a new workspace. It inherits the Owner of the source workspace, and an API Key can be created at the same time.
Before Calling and Usage Steps¶
- Use a Key from the source workspace that has this operation permission, and first confirm the workspace Owner, site resources, and billing conditions. The new workspace inherits the source workspace Owner; you cannot pass an arbitrary Owner to replace it.
- Submit public fields such as the new workspace
name; if you need to automatically call new workspace APIs, explicitly selectneedCreateAk=true, and prepare to securely save the returned credentials. - Save the new workspace UUID from
content.wsInfo.uuidand checkcontent.makeResourceExceptionCode; after obtaining the new workspace Key, read back the workspace and the actual storage state.
Use an API Key from the source workspace that has workspace.setManage. Create a new workspace rather than modifying the current workspace; submit only the 7 public fields on this page, and do not apply parameters such as ownerUuid, storageTypeUUID, or versionType from External/backend. By default, the new workspace Owner is inherited from the source workspace's active Owner account; the calling Key itself is not set as Owner. First confirm from members/console that the source workspace has an active Owner who can log in. If the source Owner does not exist or is disabled, the current implementation may still create a workspace with no Owner association, so you cannot rely on the API to enforce rejection.
The site configuration determines the storage engine, default version, and retention period; a SaaS default free workspace may be automatically write-locked, so creation does not guarantee immediate writability. createPayWsVersion=true takes effect only on SaaS; it requires the source workspace's Billing Center binding information, binds the new workspace to the same account, and upgrades it to pay; you must first confirm the billing impact.
When needCreateAk=true, akInfo is returned in plaintext; save it securely immediately, then use the returned keySk to access the new workspace. When the new Key has no explicit role association, authentication falls back to wsAdmin rather than zero permissions; collection tokens and API Keys cannot be used interchangeably. The response wsInfo is a snapshot at the creation stage, and final values such as tenantId may change in later stages; for resource initialization issues, check content.makeResourceExceptionCode rather than only the snapshot flags inside wsInfo, and use the new workspace Key to read the current workspace details and verify actual storage.
Creation is non-idempotent, with no name deduplication and no whole-flow rollback. The workspace, collection Token, and default resources are written to the database first, and database/notification/Billing Center processing follows, so on failure the workspace may already exist; a source workspace Key cannot automatically manage a new workspace across workspaces, and if the response is lost, the Owner should verify from the workspace list and then continue — do not retry creation unconditionally.
Request Headers¶
| Parameter | 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 API Key management in the target workspace. |
Body Request Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Y | Required string. The declaration allows a maximum of 256 characters, but the storage column holds 128 characters, so 128 or fewer is recommended; currently it is not enforced as non-empty and whitespace is not trimmed automatically. It is not an idempotency key and does not deduplicate by name. Allow null: False Maximum length: 256 Example: API示例空间How to obtain or fill in: Name it according to the business purpose, and first check in the console whether the target workspace already exists. |
| desc | string | Optional; omit for an empty string. The declaration allows null, but the storage column is non-null, so an explicit string is recommended instead of null. The storage column holds 500 characters, so 500 or fewer is recommended. Allow null: True Allow empty string: True Example: 接口文档演示工作空间How to obtain or fill in: Fill in the purpose, owner, and other notes for the new workspace. |
|
| menuStyle | string | Optional legacy style identifier; omit for an empty string. It is currently only stored and does not mean creating menu v3 configuration or adjusting actual permissions. Omitting it is recommended for new integrations. Allow null: False Allow empty string: True Example: How to obtain or fill in: Preserve it from an existing workspace's menuStyle when a legacy client requires it. |
|
| needCreateAk | boolean | Optional; defaults to false. true creates a manual Key and returns akInfo in plaintext; when this Key has no explicit role association, actual authentication falls back to wsAdmin. false does not return this akInfo, and a workspace collection token must not be treated as an API Key. Allow null: False Example: trueHow to obtain or fill in: Set to true when you need to obtain a usable API Key for the new workspace in this creation response. |
|
| createPayWsVersion | boolean | Optional; defaults to false. Deployment Plan ignores this input; on SaaS, true requires a valid Billing Center account for the source workspace, reuses its brand/settlement node, and performs binding and upgrade, which involves charges and must be confirmed in advance. false uses the site default version, which is not guaranteed to always be the same edition. Allow null: False Example: falseHow to obtain or fill in: Set to true on SaaS when you really need to connect the new workspace to the source workspace's Billing Center account and upgrade it to the Commercial Plan, after confirming the source account is already bound. |
|
| akName | string | Optional; defaults to default, and takes effect only when needCreateAk=true. It is not a Key resource UUID and does not determine roles or permissions. Allow null: False Example: automation_adminHow to obtain or fill in: Specify a purpose name for the new workspace's automation Key. |
|
| language | string | Optional; defaults to zh. An empty string is saved directly without automatic fallback; the declaration allows null, but the database column is non-null, so avoid null. Allow null: True Allow empty string: True Allowed values: ['zh', 'en', 'zh-hant', 'id', 'ja', 'ko'] Example: zhHow to obtain or fill in: Select zh/en/zh-hant/id/ja/ko for the new workspace. |
Additional Parameter Notes¶
The new workspace Owner is taken from the source workspace's active Owner, not the caller Key's role. The example uses the site default unlimited configuration; the actual engine/version/retention period is subject to the creation response and the subsequent new workspace details.
Request Example¶
curl --request POST 'https://openapi.guance.com/api/v1/workspace/create' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"name":"API示例空间","desc":"接口文档演示工作空间","needCreateAk":true,"akName":"automation_admin","language":"zh","createPayWsVersion":false}'
Response¶
HTTP 200, application/json. The example below shows the main fields that can be read directly.
| Field | Type | Description |
|---|---|---|
| content.accountInfo | array<string> |
Array of account UUIDs joining the new workspace; the current public entry point is usually the source workspace's active Owner. If no Owner is found, it may be empty, and an error is not guaranteed. |
| content.accountInfo[] | string | UUID of an account joining the new workspace. |
| content.ownerInfo | object | Summary of the active Owner found in the source workspace; if not found, the three fields may be empty strings and creation may still continue. |
| content.ownerInfo.name | string | Owner display name. |
| content.ownerInfo.email | string | Owner email. |
| content.ownerInfo.accountUUID | string | UUID of the account set as the new workspace Owner. |
| content.akInfo | object | Present only when needCreateAk=true; plaintext manual API Key for the new workspace — save it securely. |
| content.akInfo.keyId | string | The same ak value as keyAk, a legacy field name; not the wsak_ resource UUID. |
| content.akInfo.keyAk | string | Plaintext ak of the new Key. |
| content.akInfo.keySk | string | Plaintext sk of the new Key, usable as the DF-API-KEY for OpenAPI calls to this new workspace. |
| content.akInfo.name | string | Name of the new Key. |
| content.wsInfo.id | integer | Record sequence number within the site; use uuid in subsequent calls. |
| content.wsInfo.uuid | string | Workspace UUID. |
| content.wsInfo.status | integer | 0 normal, 3 marked as deleted; the snapshot returned by deletion is 3. |
| content.wsInfo.creator | string | Identity identifier of the creator; for a new creation this is usually the current calling Key resource UUID. |
| content.wsInfo.updator | string | Identity of the most recent modification; may be empty if never modified. |
| content.wsInfo.createAt | integer | Creation time, Unix seconds. |
| content.wsInfo.deleteAt | integer | Deletion time, Unix seconds; usually -1 when not deleted. |
| content.wsInfo.updateAt | integer | Update time, Unix seconds; usually -1 when not yet modified. |
| content.wsInfo.name | string | Workspace display name. |
| content.wsInfo.token | string | Default collection Token of the workspace. Store it as a credential; it is not the OpenAPI DF-API-KEY. The example uses a placeholder value. |
| content.wsInfo.cliToken | string | Workspace CLI credential; store it as a credential. The example does not contain a real value. |
| content.wsInfo.dbUUID | string | UUID of the metrics database record. |
| content.wsInfo.esInstanceUUID | string | UUID of the actual log storage instance. |
| content.wsInfo.dashboardUUID | string | Identifier of the workspace default view; empty when not set. |
| content.wsInfo.exterId | string | Workspace identifier in an external system, usually empty; not a writable field on this page. |
| content.wsInfo.rpName | string | Internal alias of the metrics retention policy; do not use it in place of durationSet.rp. |
| content.wsInfo.desc | string | Workspace description. |
| content.wsInfo.durationSet | object or null | Standard storage duration saved per data type; keys vary with engine, version, and index merge state, and values are e.g. 7d. |
| content.wsInfo.storagePolicy | object or null | Long-term storage policy saved per data type; the long-term policy here is distinct from the standard durationSet. |
| content.wsInfo.datastore | object or null | Actual storage engine saved per data type, e.g. metric=guancedb, logging=doris. |
| content.wsInfo.lastDqlDataCheckTime | object or null | Most recent DQL data check information recorded per data type; a dynamic object maintained by the system. |
| content.wsInfo.declaration | object or null | Organization and business declarations of the workspace itself, which may include organization and business; this is the workspace column, not the outer common declaration. |
| content.wsInfo.esIndexSettings | object or null | Index configuration object saved per data type; an empty object means there is no workspace-level custom template, not that no default template exists downstream. |
| content.wsInfo.bindInfo | object or null | Object overriding workspace brand text, email, and domain; for key definitions see Set Binding Information. |
| content.wsInfo.versionType | string | Workspace version, e.g. free, freeEdition, pay, enterprise, unlimited; creation uses the site configuration, and this API provides no version input. |
| content.wsInfo.billingState | string | Billing state identifier, e.g. free, normal, arrearage, expired, unlimited. |
| content.wsInfo.bossStation | string | Billing Center node identifier, e.g. CN, SG, or an empty string. |
| content.wsInfo.brandKey | string | Workspace brand identifier. |
| content.wsInfo.enablePublicDataway | integer | Whether the public Dataway is allowed; 1 enabled, 0 disabled. |
| content.wsInfo.isOpenLogMultipleIndex | integer or boolean | Whether creating multiple log indexes is allowed; 1 enabled, 0 disabled; existing indexes are not deleted because of this. |
| content.wsInfo.esIndexMerged | integer | Whether indexes are merged; 1 merged, 0 split. |
| content.wsInfo.supportJsonMessage | integer | JSON message support flag; 1 enabled, 0 disabled. |
| content.wsInfo.isLocked | integer | Workspace lock flag; 1 locked, 0 unlocked. |
| content.wsInfo.lockMode | string | Lock mode, e.g. none, writeLocked. |
| content.wsInfo.lockAt | integer | Lock time, Unix seconds; usually -1 when not set. |
| content.wsInfo.delayDeleteAt | integer | Timer point for delayed cleanup, Unix seconds; usually -1 when not in the pending-cleanup flow. |
| content.wsInfo.inviteAudit | integer | Whether member invitation review is enabled; 1 enabled, 0 disabled. |
| content.wsInfo.makeResourceExceptionCode | string | Flag for resource initialization issues, may be empty; the creation flow also returns the latest issue flag at the top level of content. |
| content.wsInfo.loggingCutSize | integer | Unit for splitting oversized logs, in bytes. |
| content.wsInfo.language | string | Workspace language identifier. |
| content.wsInfo.noviceGuide | boolean | Novice guide flag. |
| content.wsInfo.timezone | string | Workspace time zone; empty when not set. |
| content.wsInfo.menuStyle | string | Menu style identifier; empty when not set. |
| content.wsInfo.tenantId | integer | Workspace tenant ID; the creation response snapshots before the tenant ID is generated, so it may be -1; read the final value from the details later. |
| content.wsInfo.isOpenCustomMappingRule | integer | Custom mapping rule switch; 1 enabled, 0 disabled. |
| content.wsInfo.enableRumMultipleTable | integer | RUM table splitting switch; 1 enabled, 0 disabled. |
| content.wsInfo.enableMFA | boolean | Whether MFA is required. |
| content.wsInfo.disableQueryAcceleration | integer | Query acceleration disable flag; 1 disabled, 0 not disabled. |
| content.wsInfo.disableDataWrite | integer | Write disable flag; 1 disabled, 0 not disabled. |
| content.wsInfo.disableDataWriteAt | integer | Write disable time, Unix seconds; usually -1 when not set. |
| content.wsInfo.logBackupQueryTimeLimit | integer | Time range limit for querying backup logs, in hours. |
| content.wsInfo.engineSetting | object | Dynamic object of engine-specific configuration; the legacy nodegroup field is normalized to node_group in the output. |
| content.wsInfo.enableAI | boolean | Workspace AI master switch. |
| content.wsInfo.enableAPIKeySecurityDisplayPolicy | boolean | API Key secure display policy switch. |
| content.wsInfo.enableObsyAISubscriptionBilling | boolean | Obsy AI subscription billing switch. |
| content.wsInfo.tokenIpSet | object or null | Dynamic object of the IP access restriction configuration for workspace Tokens; it is only returned on this page and cannot be modified through these request parameters. |
| content.wsInfo.singleConfig | object or null | Dynamic object of workspace feature configuration; it follows the existing workspace configuration, and fixed configuration keys are not guaranteed here. |
| content.wsInfo.issueUpgrade | boolean | Incident escalation capability switch. |
| content.wsInfo.durationSet.{data type} | string | Standard retention period for that data type, such as rp, logging, keyevent, tracing, rum, apm, network, backup_log; other read-only keys may exist depending on the current configuration. |
| content.wsInfo.storagePolicy.{data type} | object | Long-term policy for that type; commonly rp, logging. |
| content.wsInfo.storagePolicy.{data type}.longStorageEnabled | boolean | Whether long-term storage is enabled. |
| content.wsInfo.storagePolicy.{data type}.longStorageDuration | string | Total long-term retention duration, e.g. 180d; usually an empty string when disabled. |
| content.wsInfo.datastore.{data type} | string | Name of the engine used by that type, e.g. es, doris, scopedb, volctls, sls, guancedb; not an instance UUID. |
| content.wsInfo.declaration.organization | string | Organization name, provided when declaration configuration exists. |
| content.wsInfo.declaration.business | string | Business description, provided when declaration configuration exists. |
| content.wsInfo.esIndexSettings.{data type} | object | Index settings for the corresponding type. |
| content.wsInfo.esIndexSettings.{data type}.number_of_shards | integer | Number of primary shards; whether it appears depends on the engine. |
| content.wsInfo.esIndexSettings.{data type}.number_of_replicas | integer | Number of replicas. |
| content.wsInfo.esIndexSettings.{data type}.rollover_max_size | integer | Shard rollover threshold; the API passes it through as defined by the engine. |
| content.wsInfo.esIndexSettings.{data type}.hot_retention | integer | Hot data retention duration, in hours. |
| content.wsInfo.esIndexSettings.{data type}.cold_retention | integer | Optional cold data retention duration, in hours. |
| content.wsInfo.esIndexSettings.{data type}.archive_retention | integer | Optional archive data retention duration, in hours. |
| content.wsInfo.esIndexSettings.{data type}.openAdvancedConfig | integer | Advanced configuration flag, usually 0 or 1. |
| content.wsInfo.engineSetting.node_group | string | Optional engine node group identifier; other configuration items are determined by the corresponding engine. |
| content.wsInfo.bindInfo.{config item} | JSON value | Existing brand override values; for key meanings refer to the Set Binding Information API. |
| content.wsInfo.lastDqlDataCheckTime.{data type} | JSON value | System-maintained check value for that type, not a query result. |
| content.wsInfo.tokenIpSet.{config item} | JSON value | Existing Token IP policy; retain its structure after reading, and do not build OpenAPI authentication headers from it. |
| content.wsInfo.singleConfig.{config item} | JSON value | Existing feature configuration value; the concrete type and keys follow the respective feature configuration conventions. |
| content.makeResourceExceptionCode | string | An empty string, noPermissionCreateProject, or addDataStoreFailure; storage issues from partially created SLS/TLS databases use this flag, which does not cover all failure types. |
| content.declaration | object or null | Response common declaration; for the new workspace's own organization information, refer to content.wsInfo.declaration. |
{
"code": 200,
"content": {
"accountInfo": [
"acnt_owner_example"
],
"ownerInfo": {
"name": "示例Owner",
"email": "xxx@guance.com",
"accountUUID": "acnt_owner_example"
},
"akInfo": {
"keyId": "<CREATED-AK>",
"keyAk": "<CREATED-AK>",
"keySk": "<CREATED-SK>",
"name": "automation_admin"
},
"wsInfo": {
"id": 1001,
"uuid": "wksp_created_example",
"status": 0,
"creator": "wsak_source",
"updator": "",
"createAt": 1785427200,
"deleteAt": -1,
"updateAt": -1,
"name": "API示例空间",
"token": "<workspace-token>",
"cliToken": "<workspace-cli-token>",
"dbUUID": "ifdb_example001",
"esInstanceUUID": "esinst_example001",
"dashboardUUID": "",
"exterId": "",
"rpName": "",
"desc": "接口文档演示工作空间",
"durationSet": {
"rp": "7d",
"logging": "7d",
"keyevent": "7d",
"tracing": "7d",
"rum": "7d",
"network": "1d"
},
"storagePolicy": {},
"datastore": {
"metric": "guancedb",
"logging": "doris",
"keyevent": "doris",
"tracing": "doris",
"rum": "doris",
"network": "doris",
"lineage": "doris"
},
"lastDqlDataCheckTime": {},
"declaration": {},
"esIndexSettings": {},
"bindInfo": {},
"versionType": "unlimited",
"billingState": "normal",
"bossStation": "",
"brandKey": "guance",
"enablePublicDataway": 1,
"isOpenLogMultipleIndex": 1,
"esIndexMerged": 0,
"supportJsonMessage": 1,
"isLocked": 0,
"lockMode": "none",
"lockAt": -1,
"delayDeleteAt": -1,
"inviteAudit": 0,
"makeResourceExceptionCode": "",
"loggingCutSize": 10240,
"language": "zh",
"noviceGuide": false,
"timezone": "",
"menuStyle": "",
"tenantId": -1,
"isOpenCustomMappingRule": 0,
"enableRumMultipleTable": 1,
"enableMFA": false,
"disableQueryAcceleration": 0,
"disableDataWrite": 0,
"disableDataWriteAt": -1,
"logBackupQueryTimeLimit": 24,
"engineSetting": {},
"enableAI": false,
"enableAPIKeySecurityDisplayPolicy": false,
"enableObsyAISubscriptionBilling": false,
"tokenIpSet": {},
"singleConfig": {},
"issueUpgrade": true
},
"makeResourceExceptionCode": "",
"declaration": {}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Response¶
For authentication, rate limiting, and common request errors, see Common Error Definitions.
Billing Center connection or request exceptions return HTTP 400 with ft.CloudCareApiError by default; explicit upstream business responses are returned with the actually mapped status code. Only mapped status codes ≥500 or other unhandled exceptions are globally normalized to 500 ft.InternalServerError. First query whether the new workspace already exists and the resource initialization result; if it has been created, handle only the unfinished steps and do not create it again.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Handling |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | Request field missing, or a field value violates the declared validation conditions | Parameter parsing failed | Verify the parameter location, field name, type, and value. |
| 400 | ft.RequestJsonFormatError | Invalid request JSON syntax | Request JSON format error | Fix the JSON according to content.reason, line, and column. |
| 400 | ft.JsonFormatError | JSON top level is not an object | Some json file format error | Submit a JSON object according to the parameters on this page. |
| 406 | ft.InvalidBrandKey | Site default brand is not in the allowed set | Brand identifier {} is invalid. |
Ask the administrator to verify the site brand configuration. |
| 400 | ft.InvalidWorkspace | Source workspace unavailable during SaaS paid creation | Invalid workspace: {} | Confirm the source workspace is valid. |
| 400 | ft.InvalidActionSourceNoBindBossAccount | SaaS paid creation requested but the source workspace is not bound to a valid Billing Center account | Invalid action, the source workspace is not bound to a Boss account | First complete the Billing Center binding for the source workspace and confirm billing. |
| 404 | ft.NoExistsTimeDbInstance | No available default time-series storage instance | Time-series database configuration not found | Ask the administrator to complete the site storage configuration. |
| 404 | ft.NamespaceDatastoreNotFound | Site default data type lacks an available storage engine | Storage type for {} not found | The administrator should verify the namespace configuration. |
| 406 | ft.CurrentVersionUnsupportRp | The retention period of the default version cannot form a valid configuration | The current version does not support rp:{} |
The administrator should verify the default version and retention period. |
| 400 | ft.ErrorBindCcAccount | Billing Center account binding failed after the workspace was created | Failed to bind [Billing Center account] | First verify that the workspace exists and its binding state, and handle only the unfinished steps. |
| 400 | ft.ErrorBindCcSettlementMethod | Billing Center settlement method binding failed | Failed to bind [Billing Center settlement method] | Verify the current state of the workspace and Billing Center to avoid creating the workspace again. |
| 500 | ft.InternalServerError | Downstream errors from database, cache/queue, or mapped status codes ≥500, or other unhandled exceptions; on failure the write may already be committed | Internal error | First query whether the new workspace already exists and the resource initialization result; if it has been created, handle only the unfinished steps and do not create it again. Keep the traceId. |
| 400 | ft.CloudCareApiError | Billing Center connection, timeout, or request exception; business errors may also be returned with upstream-mapped status codes | Billing Center API error; the specific message is returned according to the exception or upstream hint. | First query whether the new workspace already exists and the resource initialization result; if it has been created, handle only the unfinished steps and do not create it again. Keep the traceId and ask the administrator to check the Billing Center connection and processing result. |
| 406 | ft.InvalidBossNode | SaaS paid creation requires brand/node configuration for the pre-check query or subsequent Billing Center processing, but no valid node exists | Invalid Boss node | Ask the administrator to verify the brand and Billing Center node; if the first pre-check fails, nothing has been created, while a similar failure in a later stage may mean the workspace already exists, so check the current state first. |