API Reference
All APIs on this page use POST with a JSON request body. Every request uses the Common request headers, which are not repeated for each API. The outer response structure is described in Unified response structure; the "Response" section of each API lists only the business fields inside data.
Domains
| Region | Domain |
|---|---|
| Chinese Mainland | https://open-api-gw.xgrids.cloud/ |
| Outside Chinese Mainland (including Hong Kong, Macao, and Taiwan) | https://open-api-gw.xgrids.com/ |
Common request headers
Every API requires the following header parameters.
| Parameter | Meaning | Rule | Required | Default |
|---|---|---|---|---|
| APP-ID | Application ID | Obtained when applying for the application | Yes | None |
| X-Timestamp | Request timestamp | Timestamp in seconds | Yes | None |
| X-Nonce | Random string | Letters and digits only, 16 to 32 characters. Regex ^[A-Za-z0-9]{16,32}$. UUID.randomUUID() with - removed is recommended | Yes | None |
| X-Sign | Request signature | Verifies the request has not been tampered with and prevents replay. See Signature mechanism | Yes | None |
| Content-Type | Content type | Always application/json | Yes | None |
| language | Response message language | zh-CN or en-US | No | zh-CN |
Unified response structure
All APIs return the same outer structure. The outer code reflects only the API-layer result; read data.bizCode for the business result.
| Name | Meaning | Rule |
|---|---|---|
| code | API result code | 0 success, 401 authentication failed, 429 too many requests |
| msg | API result description | — |
| data | Business data | — |
| data.bizCode | Business result code | 0 means success; see Error Codes for other values |
| data.bizMsg | Business error message | — |
Note: A call is successful only when both
code == 0anddata.bizCode == 0.
Create Task and Get Upload Credentials
Creates a modeling task and issues temporary cloud storage credentials for uploading the input data.
Endpoint
POST /open-apis/spatial-model/v1/model/create
Limits
| Item | Limit |
|---|---|
| Concurrency | 10 requests / second |
| Temporary credential validity | 12 hours |
| Data storage region | Bound when applying for the application; no need to pass it |
Request parameters
| Parameter | Meaning | Rule | Required | Default |
|---|---|---|---|---|
| modelName | Modeling task name | Fewer than 50 characters | Yes | None |
| modelDes | Task description | Fewer than 200 characters | No | Empty |
| quality | Modeling quality | "1" fast, "2" standard, "3" slow | No | "2" |
| autoRebuild | Start modeling automatically after upload | 0 upload only, 1 model automatically after upload | No | 1 |
| tags | Task tags | List<String>, fewer than 20 elements | No | Empty |
Response
| Name | Type | Meaning |
|---|---|---|
| data.modelId | Long | Modeling task ID generated by the server |
| data.params | Object | Temporary credential parameters for data upload |
| data.params.cloudService | String | Cloud provider that receives the upload. OSS Alibaba Cloud, AWS Amazon, KS3 Kingsoft Cloud. Each integrator normally works with only one fixed provider, so you do not need to support all of them |
| data.params.endpoint | String | Upload endpoint of the cloud storage provider |
| data.params.region | String | Storage region of the cloud storage provider |
| data.params.bucket | String | Upload bucket of the cloud storage provider |
| data.params.savePath | String | Target directory Key for uploaded files. This is the input directory prefix; append each file's relative path to form its actual Key |
| data.params.accessKeyId | String | Temporary AccessKeyId |
| data.params.accessKeySecret | String | Temporary AccessKeySecret |
| data.params.securityToken | String | Upload SecurityToken |
| data.params.requestId | String | ID of this request |
Request example
POST /open-apis/spatial-model/v1/model/create HTTP/1.1
Host: open-api-gw.xgrids.com
APP-ID: your_app_id
X-Timestamp: 1791763200
X-Nonce: a3f91c2d8e7b4a6590fd12cb77ae40d1
X-Sign: 9mQk7xL2vTbR4pNw8sYcA1dHfZ3eJgU6oIyK0rVnBsM=
Content-Type: application/json
{
"modelName": "Design Commune C Facade",
"modelDes": "Nanshan, Shenzhen, LCC2 scene package",
"quality": "2",
"autoRebuild": 1,
"tags": ["facade", "nanshan"]
}
Response example
{
"code": 0,
"msg": "success",
"data": {
"bizCode": 0,
"bizMsg": "",
"modelId": 100231987,
"params": {
"cloudService": "AWS",
"endpoint": "s3.ap-southeast-1.amazonaws.com",
"region": "ap-southeast-1",
"bucket": "your-bucket-name",
"savePath": "prd/spatial-model/{accountId}/{taskCode}/input/",
"accessKeyId": "ASIA****************",
"accessKeySecret": "wJalrXUtnFEMI/K7MDENG/bPxRfiCY****",
"securityToken": "IQoJb3JpZ2luX2VjE****",
"requestId": "b7f1e2a9-5c43-4d8e-9a10-6f2c3b84d517"
}
}
}
Start Task
Starts modeling manually.
Endpoint
POST /open-apis/spatial-model/v1/model/start
Limits
| Item | Limit |
|---|---|
| When to use | Only when the task was created with autoRebuild = 0:① Only tasks in Upload completed (3) status can be started; otherwise 100041018 is returned;② The input directory must contain at least one .lcc2 / .ply / .las file; otherwise 100041019 is returned;③ Starting freezes credits; if the balance is insufficient, a credit error code is returned |
| Rate limit | 3-second rate limit per modelId |
| Concurrency | 10 requests / second |
Request parameters
| Parameter | Meaning | Rule | Required | Default |
|---|---|---|---|---|
| modelId | Modeling task ID | Returned when the task is created | Yes | None |
Response
Returns only the Unified response structure.
Request example
{
"modelId": 100231987
}
Get Upload Credentials Again
Obtains new temporary upload credentials when an upload is interrupted or the temporary credentials have expired.
Endpoint
POST /open-apis/spatial-model/v1/model/sts
Limits
| Item | Limit |
|---|---|
| Temporary credential validity | 12 hours |
| Rate limit | 3-second rate limit per modelId; 10000003 is returned if called too often |
| Concurrency | 10 requests / second |
Request parameters
| Parameter | Meaning | Rule | Required | Default |
|---|---|---|---|---|
| modelId | Modeling task ID | — | Yes | None |
Response
Same as the response of Create Task and Get Upload Credentials (data.modelId and data.params.*).
Request example
{
"modelId": 100231987
}
Update Upload Status
Reports the upload status of the input data. You must call this API after the upload completes; otherwise modeling will not start.
Endpoint
POST /open-apis/spatial-model/v1/model/upload_status/update
Limits
| Item | Limit |
|---|---|
| Concurrency | 10 requests / second |
Request parameters
| Parameter | Meaning | Rule | Required | Default |
|---|---|---|---|---|
| modelId | Modeling task ID | — | Yes | None |
| status | Upload status | 1 uploading, 2 paused, 3 succeeded, 4 failed | Yes | None |
| uploadTime | Upload duration | In milliseconds; recommended when the upload succeeds | No | Empty |
| failedReason | Failure reason | Recommended when the upload fails | No | Empty |
Response
Returns only the Unified response structure.
Request example
{
"modelId": 100231987,
"status": 3,
"uploadTime": 184620
}
Cancel Modeling
Can only be called for tasks that are being modeled.
- Only tasks in Modeling status can be canceled. After cancellation, the task status changes to Modeling failed.
- Cancellation deducts credits for the usage already consumed; any extra frozen credits are returned to the balance.
- Credits are usually settled within a few minutes, at most about 10 minutes.
Endpoint
POST /open-apis/spatial-model/v1/model/cancel
Limits
| Item | Limit |
|---|---|
| Status restriction | Only tasks in Modeling (7) status can be canceled; other statuses return 100041017 |
| Concurrency | 10 requests / second; 3-second rate limit per modelId, 10000003 is returned if called too often |
Request parameters
| Parameter | Meaning | Rule | Required | Default |
|---|---|---|---|---|
| modelId | Modeling task ID | — | Yes | None |
Response
Returns only the Unified response structure.
Request example
{
"modelId": 100231987
}
Paginated Task List
Queries modeling tasks page by page with filters.
Endpoint
POST /open-apis/spatial-model/v1/model/list
Limits
| Item | Limit |
|---|---|
| Data scope | Returns only tasks under the account associated with the current appId |
| Polling | Interval no less than 5 seconds |
| Concurrency | 10 requests / second |
Request parameters
| Parameter | Meaning | Rule | Required | Default |
|---|---|---|---|---|
| modelName | Task name | Fewer than 50 characters, fuzzy match | No | Any |
| statusList | Task statuses | Values in Task state machine | No | Any |
| startTime | Start time | Millisecond timestamp; filters records created at or after startTime | No | Any |
| endTime | End time | Millisecond timestamp; filters records created at or before endTime | No | Any |
| page.page | Page number | — | No | 1 |
| page.limit | Page size | — | No | Defined by the server |
| page.order | Sort order | ASC ascending, DESC descending, by creation time | No | DESC |
Response
| Name | Type | Meaning |
|---|---|---|
| data.page | Integer | Page number |
| data.limit | Integer | Page size |
| data.total | Long | Total count |
| data.data | List | Data list |
| data.data[].modelId | Long | Modeling task ID |
| data.data[].modelName | String | Task name |
| data.data[].modelDes | String | Task description |
| data.data[].cover | String | Cover URL; after modeling completes, it is the overall rendered preview of the model. Signed temporary link, do not persist it |
| data.data[].percent | Double | Modeling progress |
| data.data[].tags | List | Tags |
| data.data[].status | Integer | Task status; values in Task state machine |
| data.data[].errorCode | String | Error code |
| data.data[].failedReason | String | Failure reason |
| data.data[].createTime | Long | Creation time, millisecond timestamp |
| data.data[].taskSuccessAt | Long | Modeling completion time, millisecond timestamp |
Request example
{
"modelName": "Design Commune",
"statusList": [7, 8],
"startTime": 1790899200000,
"endTime": 1791763200000,
"page": {
"page": 1,
"limit": 20,
"order": "DESC"
}
}
Task Details
Queries details of modeling tasks in batches, including statistics such as modeling duration.
Endpoint
POST /open-apis/spatial-model/v1/model/detail
Limits
| Item | Limit |
|---|---|
| Batch query | Up to 50 modelIds per request |
| Concurrency | 10 requests / second |
Request parameters
| Parameter | Meaning | Rule | Required | Default |
|---|---|---|---|---|
| modelIdList | Modeling task IDs | List<Long>, up to 50 at a time | Yes | None |
Response
| Name | Type | Meaning |
|---|---|---|
| data.dataList | List | Task details |
| data.dataList[].modelId | Long | Modeling task ID |
| data.dataList[].modelName | String | Task name |
| data.dataList[].modelDes | String | Task description |
| data.dataList[].cover | String | Cover URL. Signed temporary link, do not persist it |
| data.dataList[].percent | Double | Modeling progress |
| data.dataList[].tags | List | Tags |
| data.dataList[].status | Integer | Task status; values in Task state machine |
| data.dataList[].errorCode | String | Error code |
| data.dataList[].failedReason | String | Failure reason |
| data.dataList[].createTime | Long | Creation time, millisecond timestamp |
| data.dataList[].rebuildInfo | Object | Modeling information |
| data.dataList[].rebuildInfo.quality | String | Modeling quality. 1 fast, 2 standard, 3 slow |
| data.dataList[].rebuildInfo.autoRebuild | Integer | Automatic modeling flag. 0 upload only, 1 model automatically after upload |
| data.dataList[].rebuildInfo.inputTotalSize | Long | Input data size, in bytes |
| data.dataList[].rebuildInfo.outputTotalSize | Long | Modeling output size, in bytes |
| data.dataList[].rebuildInfo.uploadTime | Long | Upload duration, in milliseconds |
| data.dataList[].rebuildInfo.buildTime | Long | Modeling duration, in milliseconds |
| data.dataList[].rebuildInfo.taskStartAt | Long | Modeling start time, millisecond timestamp |
| data.dataList[].rebuildInfo.taskSuccessAt | Long | Modeling success time, millisecond timestamp |
| data.dataList[].rebuildInfo.credit | Object | Credit billing information (read-only), used to verify the charge for this modeling run. This object is always returned; its fields are null before any billing data exists |
| data.dataList[].rebuildInfo.credit.freezeNo | String | Credit freeze number, format SPATIAL_MODELING_{modelId}_{attempt}. Has a value only after Start Task freezes credits successfully; null before that |
| data.dataList[].rebuildInfo.credit.frozenCredit | Long | Credits frozen for this round. An estimate is frozen when modeling starts; if the algorithm later estimates an area that requires more credits, additional credits are frozen, and this field shows the total after the increase |
| data.dataList[].rebuildInfo.credit.actualCredit | Long | Credits actually deducted. Null before settlement; after modeling succeeds or is canceled, filled with the charge based on actual usage; 0 when released after modeling fails |
| data.dataList[].rebuildInfo.credit.settleStatus | String | Settlement status. FROZEN frozen, pending settlement; SETTLED settled and charged (modeling succeeded or canceled); RELEASED released, credits fully refunded (modeling failed, etc.). Null when not frozen |
| data.dataList[].rebuildInfo.credit.attempt | Integer | Modeling round, starting from 1. Increases by 1 only when Start Task is called again; internal re-dispatch by the platform does not change it. Each round has its own freezeNo |
| data.dataList[].rebuildInfo.credit.areaM2 | Double | Modeling area estimated by the algorithm, in square meters; the basis for additional freezing. Null until the algorithm reports it |
Request example
{
"modelIdList": [100231987, 100231988]
}
Account Credits
Queries the credit balance of the account associated with the appId.
Endpoint
POST /open-apis/spatial-model/v1/credit/info
Limits
| Item | Limit |
|---|---|
| Query target | The credit account of the account associated with the appId; no user identifier is needed |
| Account not opened | If credits have never been issued, all balances return 0; this is not treated as an error |
| Freshness | Returns the real-time balance at query time, without caching |
| Concurrency | 10 requests / second |
Request parameters
No business parameters. Pass an empty object {}.
Response
| Name | Type | Meaning |
|---|---|---|
| data.availableCredit | Long | Available credits that can currently be used |
| data.frozenCredit | Long | Frozen credits, reserved but not yet settled |
| data.totalCredit | Long | Total credits, equal to availableCredit plus frozenCredit |
Response example
{
"code": 0,
"msg": "success",
"data": {
"bizCode": 0,
"bizMsg": "",
"availableCredit": 8500,
"frozenCredit": 1500,
"totalCredit": 10000
}
}
Note: This API only queries the account credit balance. The credit billing rules for modeling tasks (deduction timing and billing basis) will be defined and documented in a later version. In the current version, calls to the modeling APIs are not affected by the values returned here.
Download Modeling Results
Gets temporary download links for the modeling outputs. See Modeling outputs for what they contain.
Endpoint
POST /open-apis/spatial-model/v1/model/data/download
Limits
| Item | Limit |
|---|---|
| Precondition | Task status must be Modeling completed (8) |
| Link validity | Signed temporary links; download soon after obtaining them and do not persist them |
| Concurrency | 10 requests / second |
Request parameters
| Parameter | Meaning | Rule | Required | Default |
|---|---|---|---|---|
| modelId | Modeling task ID | — | Yes | None |
| type | Output type | DXF, GLB, BLEND, RVT | No | If omitted, all generated outputs are returned: DXF / GLB / BLEND, plus RVT if available |
Response
| Name | Type | Meaning |
|---|---|---|
| data.dataList | List<String> | Download links of the modeling outputs. Signed temporary links, do not persist them |
Request example
{
"modelId": 100231987,
"type": "GLB"
}
Delete Task
Deletes a modeling task and its associated data.
Endpoint
POST /open-apis/spatial-model/v1/model/del
Limits
| Item | Limit |
|---|---|
| Status restriction | Tasks in Modeling (7) status cannot be deleted |
| Impact | Also removes the uploaded input data and the modeling outputs; cannot be undone |
| Concurrency | 10 requests / second |
Request parameters
| Parameter | Meaning | Rule | Required | Default |
|---|---|---|---|---|
| modelId | Modeling task ID | — | Yes | None |
Response
Returns only the Unified response structure.
Request example
{
"modelId": 100231987
}
Note: Deletion cannot be undone; input data and modeling outputs are removed together. Add a second confirmation on your side.