Generate invoice from charge baskets
curl --request POST \
--url https://clarus-api.com/api/charge_baskets/generate_invoice \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Clarus-Subdomain: <api-key>' \
--data '
{
"ids": [
1,
2,
3
]
}
'import requests
url = "https://clarus-api.com/api/charge_baskets/generate_invoice"
payload = { "ids": [1, 2, 3] }
headers = {
"Authorization": "Bearer <token>",
"X-Clarus-Subdomain": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'X-Clarus-Subdomain': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({ids: [1, 2, 3]})
};
fetch('https://clarus-api.com/api/charge_baskets/generate_invoice', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": [
{
"id": "1",
"type": "ar_documents",
"attributes": {
"document_date": "2026-03-12",
"document_due_date": "2026-04-12",
"document_number": "INV-001",
"document_type": "invoice",
"id": 1,
"reference": null,
"tax_status": "tax_exclusive"
},
"relationships": {
"account": {
"data": {
"id": "1",
"type": "accounts"
}
}
}
}
]
}{
"error": "<string>"
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}Charging: Baskets
Generate invoice from charge baskets
Creates one AR document (invoice) per account from the selected charge baskets’ line items. All documents are created with status ‘draft’.
POST
/
api
/
charge_baskets
/
generate_invoice
Generate invoice from charge baskets
curl --request POST \
--url https://clarus-api.com/api/charge_baskets/generate_invoice \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Clarus-Subdomain: <api-key>' \
--data '
{
"ids": [
1,
2,
3
]
}
'import requests
url = "https://clarus-api.com/api/charge_baskets/generate_invoice"
payload = { "ids": [1, 2, 3] }
headers = {
"Authorization": "Bearer <token>",
"X-Clarus-Subdomain": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'X-Clarus-Subdomain': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({ids: [1, 2, 3]})
};
fetch('https://clarus-api.com/api/charge_baskets/generate_invoice', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": [
{
"id": "1",
"type": "ar_documents",
"attributes": {
"document_date": "2026-03-12",
"document_due_date": "2026-04-12",
"document_number": "INV-001",
"document_type": "invoice",
"id": 1,
"reference": null,
"tax_status": "tax_exclusive"
},
"relationships": {
"account": {
"data": {
"id": "1",
"type": "accounts"
}
}
}
}
]
}{
"error": "<string>"
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}Behavior
- Creates one AR document (invoice) per account from the charge basket line items
- All documents are created with status ‘draft’
- The request body is flat JSON (not JSON:API format)
- Returns an array of created AR documents
Important Notes
invoice_statuson charge baskets is automatically recalculated after invoice generation- Baskets must be in CLOSED status before generating invoices
Authorizations
OAuth 2.0 authentication. Use the client credentials or authorization code flow to obtain an access token.
FlowAuthorization Code
- Authorization URL
- https://clarus-api.com/oauth/authorize
- Token URL
- https://clarus-api.com/oauth/token
FlowClient Credentials
- Token URL
- https://clarus-api.com/oauth/token
The subdomain/tenant name identifying which tenant's data to access. Required for all API requests.
Body
application/json
Array of charge basket IDs to generate invoices from
Minimum array length:
1Response
Invoices generated successfully
Show child attributes
Show child attributes

