curl --request POST --fail-with-body --max-time 30 \
"${AMLOK_API_BASE_URL}/v1/billing/reports" \
--header "Authorization: Bearer ${AMLOK_API_KEY}" \
--header "Accept: application/json" \
--header 'Idempotency-Key: idem_example_1001' \
--header 'Content-Type: application/json' \
--data '{
"from": "2026-10-01T00:00:00Z",
"to": "2026-11-01T00:00:00Z",
"report_type": "usage",
"format": "csv",
"time_basis": "posted_at",
"snapshot_id": "billing_snapshot_example",
"filters": {}
}'import os
import requests
base_url = os.environ["AMLOK_API_BASE_URL"].rstrip("/")
headers = {'Accept': 'application/json',
'Idempotency-Key': 'idem_example_1001',
'Content-Type': 'application/json'}
headers["Authorization"] = "Bearer " + os.environ["AMLOK_API_KEY"]
response = requests.request(
"POST", base_url + "/v1/billing/reports",
headers=headers, timeout=30, allow_redirects=False,
json={'from': '2026-10-01T00:00:00Z',
'to': '2026-11-01T00:00:00Z',
'report_type': 'usage',
'format': 'csv',
'time_basis': 'posted_at',
'snapshot_id': 'billing_snapshot_example',
'filters': {}},
)
response.raise_for_status()
print(response.json())
const baseUrl = process.env.AMLOK_API_BASE_URL;
const apiKey = process.env.AMLOK_API_KEY;
if (!baseUrl || !apiKey) throw new Error("Configure AMLOK_API_BASE_URL and AMLOK_API_KEY");
const headers = {
"Accept": "application/json",
"Idempotency-Key": "idem_example_1001",
"Content-Type": "application/json"
};
headers.Authorization = `Bearer ${apiKey}`;
const response = await fetch(baseUrl.replace(/\/$/, "") + "/v1/billing/reports", {
method: "POST", headers,
redirect: "error", signal: AbortSignal.timeout(30000),
body: JSON.stringify({
"from": "2026-10-01T00:00:00Z",
"to": "2026-11-01T00:00:00Z",
"report_type": "usage",
"format": "csv",
"time_basis": "posted_at",
"snapshot_id": "billing_snapshot_example",
"filters": {}
}),
});
if (!response.ok) throw new Error(`AMLOK returned HTTP ${response.status}`);
console.log(await response.json());{
"data": {
"id": "billing_report_example",
"object": "billing_report",
"record_version": 1,
"created_at": "2026-10-23T14:00:00Z",
"updated_at": "2026-10-23T14:00:00Z",
"workspace_id": "wsp_example",
"from": "2026-10-01T00:00:00Z",
"to": "2026-11-01T00:00:00Z",
"report_type": "usage",
"format": "csv",
"time_basis": "posted_at",
"billing_account_id": "billing_account_example",
"status": "queued",
"as_of": "2026-10-23T14:00:00Z",
"row_count": null,
"expires_at": null,
"failure_code": null,
"snapshot_id": "billing_snapshot_example",
"filters": {}
},
"meta": {
"request_id": "req_example",
"schema_version": "1.4.2",
"generated_at": "2026-10-23T14:00:00Z",
"data_status": "pending"
}
}Create billing report
Generate a read-only snapshot export asynchronously. This does not change credits or payment settings. Dates are UTC [from,to); from must precede to. Poll until ready. CSV cells that could execute spreadsheet formulas are escaped.
Required scope: billing:export. The API key is bound to exactly one workspace, institution and environment. There is no workspace override; this binding applies to every read and export. Accepted commands have a durable request receipt. Full response replay lasts 24 hours; afterward the same key and target return 409 idempotency_result_expired without re-execution. Different payloads return 409 idempotency_conflict. Use GET /v1/request-receipts/lookup to find the original resource. The fingerprint includes the resolved target path and intended payload; a key used on another target is rejected rather than replayed onto it. Pre-execution validation or insufficient-credit rejection creates no accepted receipt.
curl --request POST --fail-with-body --max-time 30 \
"${AMLOK_API_BASE_URL}/v1/billing/reports" \
--header "Authorization: Bearer ${AMLOK_API_KEY}" \
--header "Accept: application/json" \
--header 'Idempotency-Key: idem_example_1001' \
--header 'Content-Type: application/json' \
--data '{
"from": "2026-10-01T00:00:00Z",
"to": "2026-11-01T00:00:00Z",
"report_type": "usage",
"format": "csv",
"time_basis": "posted_at",
"snapshot_id": "billing_snapshot_example",
"filters": {}
}'import os
import requests
base_url = os.environ["AMLOK_API_BASE_URL"].rstrip("/")
headers = {'Accept': 'application/json',
'Idempotency-Key': 'idem_example_1001',
'Content-Type': 'application/json'}
headers["Authorization"] = "Bearer " + os.environ["AMLOK_API_KEY"]
response = requests.request(
"POST", base_url + "/v1/billing/reports",
headers=headers, timeout=30, allow_redirects=False,
json={'from': '2026-10-01T00:00:00Z',
'to': '2026-11-01T00:00:00Z',
'report_type': 'usage',
'format': 'csv',
'time_basis': 'posted_at',
'snapshot_id': 'billing_snapshot_example',
'filters': {}},
)
response.raise_for_status()
print(response.json())
const baseUrl = process.env.AMLOK_API_BASE_URL;
const apiKey = process.env.AMLOK_API_KEY;
if (!baseUrl || !apiKey) throw new Error("Configure AMLOK_API_BASE_URL and AMLOK_API_KEY");
const headers = {
"Accept": "application/json",
"Idempotency-Key": "idem_example_1001",
"Content-Type": "application/json"
};
headers.Authorization = `Bearer ${apiKey}`;
const response = await fetch(baseUrl.replace(/\/$/, "") + "/v1/billing/reports", {
method: "POST", headers,
redirect: "error", signal: AbortSignal.timeout(30000),
body: JSON.stringify({
"from": "2026-10-01T00:00:00Z",
"to": "2026-11-01T00:00:00Z",
"report_type": "usage",
"format": "csv",
"time_basis": "posted_at",
"snapshot_id": "billing_snapshot_example",
"filters": {}
}),
});
if (!response.ok) throw new Error(`AMLOK returned HTTP ${response.status}`);
console.log(await response.json());{
"data": {
"id": "billing_report_example",
"object": "billing_report",
"record_version": 1,
"created_at": "2026-10-23T14:00:00Z",
"updated_at": "2026-10-23T14:00:00Z",
"workspace_id": "wsp_example",
"from": "2026-10-01T00:00:00Z",
"to": "2026-11-01T00:00:00Z",
"report_type": "usage",
"format": "csv",
"time_basis": "posted_at",
"billing_account_id": "billing_account_example",
"status": "queued",
"as_of": "2026-10-23T14:00:00Z",
"row_count": null,
"expires_at": null,
"failure_code": null,
"snapshot_id": "billing_snapshot_example",
"filters": {}
},
"meta": {
"request_id": "req_example",
"schema_version": "1.4.2",
"generated_at": "2026-10-23T14:00:00Z",
"data_status": "pending"
}
}billing:export
Generate a read-only snapshot export asynchronously. This does not change credits or payment settings. Dates are UTC [from,to); from must precede to. Poll until ready. CSV cells that could execute spreadsheet formulas are escaped.
Required scope: billing:export. The API key is bound to exactly one workspace, institution and environment. There is no workspace override; this binding applies to every read and export. Accepted commands have a durable request receipt. Full response replay lasts 24 hours; afterward the same key and target return 409 idempotency_result_expired without re-execution. Different payloads return 409 idempotency_conflict. Use GET /v1/request-receipts/lookup to find the original resource. The fingerprint includes the resolved target path and intended payload; a key used on another target is rejected rather than replayed onto it. Pre-execution validation or insufficient-credit rejection creates no accepted receipt.
Product scope · Processing lifecycle · ErrorsAuthorizations
Server-to-server API key bound to exactly one workspace, institution tenant and environment. No caller-supplied workspace override is accepted. Do not use in public browser code.
Headers
Stable key for this intended action; retain across retries.
Body
usage, ledger, statement, funding csv, json occurred_at, posted_at, initiated_at Reuse a snapshot returned by a financial read. If omitted, freeze a snapshot at acceptance.
1Show child attributes
Show child attributes