Skip to content
TREN
Atlıhan Harita

Structured Spatial Modeling User Manual

API Reference

Chapter 03 / 05Manual version v1.0.0.0English

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

RegionDomain
Chinese Mainlandhttps://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.

ParameterMeaningRuleRequiredDefault
APP-IDApplication IDObtained when applying for the applicationYesNone
X-TimestampRequest timestampTimestamp in secondsYesNone
X-NonceRandom stringLetters and digits only, 16 to 32 characters. Regex ^[A-Za-z0-9]{16,32}$. UUID.randomUUID() with - removed is recommendedYesNone
X-SignRequest signatureVerifies the request has not been tampered with and prevents replay. See Signature mechanismYesNone
Content-TypeContent typeAlways application/jsonYesNone
languageResponse message languagezh-CN or en-USNozh-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.

NameMeaningRule
codeAPI result code0 success, 401 authentication failed, 429 too many requests
msgAPI result description—
dataBusiness data—
data.bizCodeBusiness result code0 means success; see Error Codes for other values
data.bizMsgBusiness error message—

Note: A call is successful only when both code == 0 and data.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

ItemLimit
Concurrency10 requests / second
Temporary credential validity12 hours
Data storage regionBound when applying for the application; no need to pass it

Request parameters

ParameterMeaningRuleRequiredDefault
modelNameModeling task nameFewer than 50 charactersYesNone
modelDesTask descriptionFewer than 200 charactersNoEmpty
qualityModeling quality"1" fast, "2" standard, "3" slowNo"2"
autoRebuildStart modeling automatically after upload0 upload only, 1 model automatically after uploadNo1
tagsTask tagsList<String>, fewer than 20 elementsNoEmpty

Response

NameTypeMeaning
data.modelIdLongModeling task ID generated by the server
data.paramsObjectTemporary credential parameters for data upload
data.params.cloudServiceStringCloud 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.endpointStringUpload endpoint of the cloud storage provider
data.params.regionStringStorage region of the cloud storage provider
data.params.bucketStringUpload bucket of the cloud storage provider
data.params.savePathStringTarget directory Key for uploaded files. This is the input directory prefix; append each file's relative path to form its actual Key
data.params.accessKeyIdStringTemporary AccessKeyId
data.params.accessKeySecretStringTemporary AccessKeySecret
data.params.securityTokenStringUpload SecurityToken
data.params.requestIdStringID 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

ItemLimit
When to useOnly 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 limit3-second rate limit per modelId
Concurrency10 requests / second

Request parameters

ParameterMeaningRuleRequiredDefault
modelIdModeling task IDReturned when the task is createdYesNone

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

ItemLimit
Temporary credential validity12 hours
Rate limit3-second rate limit per modelId; 10000003 is returned if called too often
Concurrency10 requests / second

Request parameters

ParameterMeaningRuleRequiredDefault
modelIdModeling task ID—YesNone

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

ItemLimit
Concurrency10 requests / second

Request parameters

ParameterMeaningRuleRequiredDefault
modelIdModeling task ID—YesNone
statusUpload status1 uploading, 2 paused, 3 succeeded, 4 failedYesNone
uploadTimeUpload durationIn milliseconds; recommended when the upload succeedsNoEmpty
failedReasonFailure reasonRecommended when the upload failsNoEmpty

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

ItemLimit
Status restrictionOnly tasks in Modeling (7) status can be canceled; other statuses return 100041017
Concurrency10 requests / second; 3-second rate limit per modelId, 10000003 is returned if called too often

Request parameters

ParameterMeaningRuleRequiredDefault
modelIdModeling task ID—YesNone

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

ItemLimit
Data scopeReturns only tasks under the account associated with the current appId
PollingInterval no less than 5 seconds
Concurrency10 requests / second

Request parameters

ParameterMeaningRuleRequiredDefault
modelNameTask nameFewer than 50 characters, fuzzy matchNoAny
statusListTask statusesValues in Task state machineNoAny
startTimeStart timeMillisecond timestamp; filters records created at or after startTimeNoAny
endTimeEnd timeMillisecond timestamp; filters records created at or before endTimeNoAny
page.pagePage number—No1
page.limitPage size—NoDefined by the server
page.orderSort orderASC ascending, DESC descending, by creation timeNoDESC

Response

NameTypeMeaning
data.pageIntegerPage number
data.limitIntegerPage size
data.totalLongTotal count
data.dataListData list
data.data[].modelIdLongModeling task ID
data.data[].modelNameStringTask name
data.data[].modelDesStringTask description
data.data[].coverStringCover URL; after modeling completes, it is the overall rendered preview of the model. Signed temporary link, do not persist it
data.data[].percentDoubleModeling progress
data.data[].tagsListTags
data.data[].statusIntegerTask status; values in Task state machine
data.data[].errorCodeStringError code
data.data[].failedReasonStringFailure reason
data.data[].createTimeLongCreation time, millisecond timestamp
data.data[].taskSuccessAtLongModeling 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

ItemLimit
Batch queryUp to 50 modelIds per request
Concurrency10 requests / second

Request parameters

ParameterMeaningRuleRequiredDefault
modelIdListModeling task IDsList<Long>, up to 50 at a timeYesNone

Response

NameTypeMeaning
data.dataListListTask details
data.dataList[].modelIdLongModeling task ID
data.dataList[].modelNameStringTask name
data.dataList[].modelDesStringTask description
data.dataList[].coverStringCover URL. Signed temporary link, do not persist it
data.dataList[].percentDoubleModeling progress
data.dataList[].tagsListTags
data.dataList[].statusIntegerTask status; values in Task state machine
data.dataList[].errorCodeStringError code
data.dataList[].failedReasonStringFailure reason
data.dataList[].createTimeLongCreation time, millisecond timestamp
data.dataList[].rebuildInfoObjectModeling information
data.dataList[].rebuildInfo.qualityStringModeling quality. 1 fast, 2 standard, 3 slow
data.dataList[].rebuildInfo.autoRebuildIntegerAutomatic modeling flag. 0 upload only, 1 model automatically after upload
data.dataList[].rebuildInfo.inputTotalSizeLongInput data size, in bytes
data.dataList[].rebuildInfo.outputTotalSizeLongModeling output size, in bytes
data.dataList[].rebuildInfo.uploadTimeLongUpload duration, in milliseconds
data.dataList[].rebuildInfo.buildTimeLongModeling duration, in milliseconds
data.dataList[].rebuildInfo.taskStartAtLongModeling start time, millisecond timestamp
data.dataList[].rebuildInfo.taskSuccessAtLongModeling success time, millisecond timestamp
data.dataList[].rebuildInfo.creditObjectCredit 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.freezeNoStringCredit freeze number, format SPATIAL_MODELING_{modelId}_{attempt}. Has a value only after Start Task freezes credits successfully; null before that
data.dataList[].rebuildInfo.credit.frozenCreditLongCredits 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.actualCreditLongCredits 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.settleStatusStringSettlement 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.attemptIntegerModeling 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.areaM2DoubleModeling 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

ItemLimit
Query targetThe credit account of the account associated with the appId; no user identifier is needed
Account not openedIf credits have never been issued, all balances return 0; this is not treated as an error
FreshnessReturns the real-time balance at query time, without caching
Concurrency10 requests / second

Request parameters

No business parameters. Pass an empty object {}.

Response

NameTypeMeaning
data.availableCreditLongAvailable credits that can currently be used
data.frozenCreditLongFrozen credits, reserved but not yet settled
data.totalCreditLongTotal 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

ItemLimit
PreconditionTask status must be Modeling completed (8)
Link validitySigned temporary links; download soon after obtaining them and do not persist them
Concurrency10 requests / second

Request parameters

ParameterMeaningRuleRequiredDefault
modelIdModeling task ID—YesNone
typeOutput typeDXF, GLB, BLEND, RVTNoIf omitted, all generated outputs are returned: DXF / GLB / BLEND, plus RVT if available

Response

NameTypeMeaning
data.dataListList<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

ItemLimit
Status restrictionTasks in Modeling (7) status cannot be deleted
ImpactAlso removes the uploaded input data and the modeling outputs; cannot be undone
Concurrency10 requests / second

Request parameters

ParameterMeaningRuleRequiredDefault
modelIdModeling task ID—YesNone

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.

This chapter is from the official XGRIDS user manual. Official source (opens in a new tab) · Updated:

XGRIDS Türkiye

We're With You During Setup and in the Field

Atlıhan Harita provides training and technical support for device setup, firmware updates, software use, and field applications. Send us your question and our specialist will get back to you.

+90 216 546 0804