Skip to content
Niu DocsNiu 牛元文档
Dashboard控制台

Publish a preview-confirmed installation billing mode

Generated from the checked-in source. Do not edit this reference by hand.

PUT /api/v1/platform/units/mode

Platform administration required and rechecked under lock. Requires an unexpired originally compatible saved preview, its matching current revision and a distinct target mode. Rechecks customer obligations atomically while holding financial-table locks. Concurrent financial activity returns a retryable 409; re-read compatibility if state changed. Balances, prices, monetary limits and historical records are never converted. A successful publication creates an immutable change receipt and advances the installation revision once. Identical idempotent retry returns the original receipt even after subsequent mode changes; it does not reapply the old mode. Mode activation alone does not establish configured unit prices, compatible spending limits, model availability or media readiness. Existing monetary limits require explicit compatible configuration before affected Credits admission. New monetary grants/funding require currency mode and new unit issuance requires Credits mode.

Operation: publishCustomerUnitMode.

Use the credential and permission scope described above. Each object below is an alternative; schemes within one object are required together.

JSON
[
{
"bearerAuth": []
}
]

Set NIU_ORIGIN to your installation origin (without /v1). Replace path, query and header placeholders with the required values. Query examples use curl 7.87 or newer to encode values with --url-query. Use the credential scope described above; a bearer token must have the authority required by this operation.

Shell
curl --fail-with-body -X PUT "$NIU_ORIGIN/api/v1/platform/units/mode" \
-H "Authorization: Bearer $NIU_BEARER_TOKEN" \
-H 'Content-Type: application/json' \
--data @request.json

No path, query, or header parameters are declared.

Required.

JSON
{
"type": "object",
"additionalProperties": false,
"required": [
"preview_id",
"expected_revision",
"idempotency_key"
],
"properties": {
"preview_id": {
"type": "string",
"format": "uuid"
},
"expected_revision": {
"type": "string",
"pattern": "^(0|[1-9][0-9]*)$"
},
"idempotency_key": {
"type": "string",
"format": "uuid"
}
}
}

Original durable result

Content type: application/json.

JSON
{
"type": "object",
"additionalProperties": false,
"required": [
"data"
],
"properties": {
"data": {
"type": "object",
"additionalProperties": false,
"required": [
"revision",
"previous_mode",
"billing_mode",
"preview_id",
"created_at"
],
"properties": {
"revision": {
"type": "string",
"pattern": "^(0|[1-9][0-9]*)$"
},
"previous_mode": {
"type": "string",
"enum": [
"currency",
"credits"
]
},
"billing_mode": {
"type": "string",
"enum": [
"currency",
"credits"
]
},
"preview_id": {
"type": "string",
"format": "uuid"
},
"created_at": {
"type": "string",
"format": "date-time"
}
}
}
}
}

Invalid input

Authentication required or revoked

Platform administration required

Stale, incompatible, expired or conflicting intent; concurrent financial activity

Malformed request

Storage unavailable

Platform administration required and rechecked under lock. Requires an unexpired originally compatible saved preview, its matching current revision and a distinct target mode. Rechecks customer obligations atomically while holding financial-table locks. Concurrent financial activity returns a retryable 409; re-read compatibility if state changed. Balances, prices, monetary limits and historical records are never converted. A successful publication creates an immutable change receipt and advances the installation revision once. Identical idempotent retry returns the original receipt even after subsequent mode changes; it does not reapply the old mode. Mode activation alone does not establish configured unit prices, compatible spending limits, model availability or media readiness. Existing monetary limits require explicit compatible configuration before affected Credits admission. New monetary grants/funding require currency mode and new unit issuance requires Credits mode.

Supported scope: implemented