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

Issue an immutable itemized usage statement

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

POST /api/v1/organizations/{organization}/projects/{project}/billing/invoices

Installation only. Half-open UTC dispatch interval [from_ms, to_ms), maximum 366 days, one currency. Includes text and media charges. Rejects unresolved priced usage, unsettled media balance debits, overlapping periods and empty periods. Exact idempotent retries return the same invoice. Does not collect money or calculate tax. Cache-Control is no-store.

Operation: issueCustomerUsageInvoice.

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 POST "$NIU_ORIGIN/api/v1/organizations/{organization}/projects/{project}/billing/invoices" \
-H "Authorization: Bearer $NIU_BEARER_TOKEN" \
-H 'Content-Type: application/json' \
--data @request.json

Location: path. Required.

JSON
{
"type": "string",
"format": "uuid"
}

Location: path. Required.

JSON
{
"type": "string",
"format": "uuid"
}

Required.

JSON
{
"type": "object",
"additionalProperties": false,
"required": [
"from_ms",
"to_ms",
"currency",
"idempotency_key"
],
"properties": {
"from_ms": {
"type": "integer",
"format": "int64",
"minimum": 0
},
"to_ms": {
"type": "integer",
"format": "int64"
},
"currency": {
"type": "string",
"pattern": "^[A-Z]{3}$"
},
"idempotency_key": {
"type": "string",
"format": "uuid"
}
}
}

Invoice identity, including an exact idempotent replay

Content type: application/json.

JSON
{
"type": "object",
"required": [
"data"
],
"properties": {
"data": {
"type": "object",
"required": [
"id"
],
"properties": {
"id": {
"type": "string",
"format": "uuid"
}
}
}
}
}

Invalid period or currency

Invalid or expired administrative credential.

Installation authority required

Workspace outside authorized scope.

Unresolved usage, overlapping or empty period, or changed idempotency payload

Installation only. Half-open UTC dispatch interval [from_ms, to_ms), maximum 366 days, one currency. Includes text and media charges. Rejects unresolved priced usage, unsettled media balance debits, overlapping periods and empty periods. Exact idempotent retries return the same invoice. Does not collect money or calculate tax. Cache-Control is no-store.

Supported scope: implemented