Generate report output
curl --request POST \
--url https://clarus-api.com/api/reports/{id}/generate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Clarus-Subdomain: <api-key>' \
--data '{}'import requests
url = "https://clarus-api.com/api/reports/{id}/generate"
payload = {}
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({})
};
fetch('https://clarus-api.com/api/reports/{id}/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": 123,
"type": "documents",
"attributes": {
"category": "report",
"file_name": null,
"file_path": null,
"file_type": null,
"status": "queued",
"user_id": 1
}
}
}{
"error": "<string>"
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}Reports
Generate report output
Queue asynchronous report generation. Returns a Document record that can be polled for status and downloaded when complete.
POST
/
api
/
reports
/
{id}
/
generate
Generate report output
curl --request POST \
--url https://clarus-api.com/api/reports/{id}/generate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Clarus-Subdomain: <api-key>' \
--data '{}'import requests
url = "https://clarus-api.com/api/reports/{id}/generate"
payload = {}
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({})
};
fetch('https://clarus-api.com/api/reports/{id}/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": 123,
"type": "documents",
"attributes": {
"category": "report",
"file_name": null,
"file_path": null,
"file_type": null,
"status": "queued",
"user_id": 1
}
}
}{
"error": "<string>"
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}Workflow
- Call this endpoint — returns a Document with
status: queued - Poll the document status via GraphQL until
statusbecomesavailable(orfailed) - Download the file via
GET /documents/{id}/downloadto get a presigned S3 URL - Use the presigned URL to download the generated report file
Request Body (Optional)
You can optionally passvariables to override the report’s stored variable values:
{
"variables": [
{ "name": "date_from", "value": "2024-01-01 00:00:00" },
{ "name": "date_to", "value": "2024-01-31 23:59:59" }
]
}
Variable Values
Variables support Chronic-style date parsing:today 00:00:00— start of today3 days ago— 3 days before nowbeginning of month— first day of current month2024-01-15 09:00:00— explicit date/time
Access Control
Only the report owner can generate it. Returns 403 if the authenticated user is not the owner.Authorizations
Body
application/json

