Create a report query
curl --request POST \
--url https://clarus-api.com/api/report_queries \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Clarus-Subdomain: <api-key>' \
--data '
{
"data": {
"type": "report_queries",
"attributes": {
"name": "Count of Tasks Left To Do",
"description": "Count of Tasks Left To Do by Task Type",
"graphql": "query getTasksToDo($warehouse_id: ID, $account_id: ID, $created_at_from: Chronic, $created_at_to: Chronic) { tasks { aggregation(group_by: [task_type_id], statuses: [\"AVAILABLE\", \"ALLOCATED\"], warehouse_id: $warehouse_id, account_id: $account_id, created_from: $created_at_from, created_to: $created_at_to, limit: 9999999, order: \"total_records DESC\") { task_type { code } total_records } } }",
"parameters": [
{
"name": "warehouse_id",
"type": "Integer"
},
{
"name": "account_id",
"type": "Integer"
},
{
"name": "created_at_from",
"type": "Date"
},
{
"name": "created_at_to",
"type": "Date"
}
]
}
}
}
'import requests
url = "https://clarus-api.com/api/report_queries"
payload = { "data": {
"type": "report_queries",
"attributes": {
"name": "Count of Tasks Left To Do",
"description": "Count of Tasks Left To Do by Task Type",
"graphql": "query getTasksToDo($warehouse_id: ID, $account_id: ID, $created_at_from: Chronic, $created_at_to: Chronic) { tasks { aggregation(group_by: [task_type_id], statuses: [\"AVAILABLE\", \"ALLOCATED\"], warehouse_id: $warehouse_id, account_id: $account_id, created_from: $created_at_from, created_to: $created_at_to, limit: 9999999, order: \"total_records DESC\") { task_type { code } total_records } } }",
"parameters": [
{
"name": "warehouse_id",
"type": "Integer"
},
{
"name": "account_id",
"type": "Integer"
},
{
"name": "created_at_from",
"type": "Date"
},
{
"name": "created_at_to",
"type": "Date"
}
]
}
} }
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({
data: {
type: 'report_queries',
attributes: {
name: 'Count of Tasks Left To Do',
description: 'Count of Tasks Left To Do by Task Type',
graphql: 'query getTasksToDo($warehouse_id: ID, $account_id: ID, $created_at_from: Chronic, $created_at_to: Chronic) { tasks { aggregation(group_by: [task_type_id], statuses: ["AVAILABLE", "ALLOCATED"], warehouse_id: $warehouse_id, account_id: $account_id, created_from: $created_at_from, created_to: $created_at_to, limit: 9999999, order: "total_records DESC") { task_type { code } total_records } } }',
parameters: [
{name: 'warehouse_id', type: 'Integer'},
{name: 'account_id', type: 'Integer'},
{name: 'created_at_from', type: 'Date'},
{name: 'created_at_to', type: 'Date'}
]
}
}
})
};
fetch('https://clarus-api.com/api/report_queries', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": 123,
"type": "report_queries",
"attributes": {
"name": "Count of Tasks Left To Do",
"description": "Count of Tasks Left To Do by Task Type",
"graphql": "query getTasksToDo($warehouse_id: ID, $account_id: ID, $created_at_from: Chronic, $created_at_to: Chronic) { tasks { aggregation(group_by: [task_type_id], statuses: [\"AVAILABLE\", \"ALLOCATED\"], warehouse_id: $warehouse_id, account_id: $account_id, created_from: $created_at_from, created_to: $created_at_to, limit: 9999999, order: \"total_records DESC\") { task_type { code } total_records } } }",
"parameters": [
{
"name": "warehouse_id",
"type": "Integer"
},
{
"name": "account_id",
"type": "Integer"
},
{
"name": "created_at_from",
"type": "Date"
},
{
"name": "created_at_to",
"type": "Date"
}
]
}
}
}{
"error": "<string>"
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}Report Queries
Create a report query
Create a new report query definition. Report queries allow you to save GraphQL queries for repeated execution.
POST
/
api
/
report_queries
Create a report query
curl --request POST \
--url https://clarus-api.com/api/report_queries \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Clarus-Subdomain: <api-key>' \
--data '
{
"data": {
"type": "report_queries",
"attributes": {
"name": "Count of Tasks Left To Do",
"description": "Count of Tasks Left To Do by Task Type",
"graphql": "query getTasksToDo($warehouse_id: ID, $account_id: ID, $created_at_from: Chronic, $created_at_to: Chronic) { tasks { aggregation(group_by: [task_type_id], statuses: [\"AVAILABLE\", \"ALLOCATED\"], warehouse_id: $warehouse_id, account_id: $account_id, created_from: $created_at_from, created_to: $created_at_to, limit: 9999999, order: \"total_records DESC\") { task_type { code } total_records } } }",
"parameters": [
{
"name": "warehouse_id",
"type": "Integer"
},
{
"name": "account_id",
"type": "Integer"
},
{
"name": "created_at_from",
"type": "Date"
},
{
"name": "created_at_to",
"type": "Date"
}
]
}
}
}
'import requests
url = "https://clarus-api.com/api/report_queries"
payload = { "data": {
"type": "report_queries",
"attributes": {
"name": "Count of Tasks Left To Do",
"description": "Count of Tasks Left To Do by Task Type",
"graphql": "query getTasksToDo($warehouse_id: ID, $account_id: ID, $created_at_from: Chronic, $created_at_to: Chronic) { tasks { aggregation(group_by: [task_type_id], statuses: [\"AVAILABLE\", \"ALLOCATED\"], warehouse_id: $warehouse_id, account_id: $account_id, created_from: $created_at_from, created_to: $created_at_to, limit: 9999999, order: \"total_records DESC\") { task_type { code } total_records } } }",
"parameters": [
{
"name": "warehouse_id",
"type": "Integer"
},
{
"name": "account_id",
"type": "Integer"
},
{
"name": "created_at_from",
"type": "Date"
},
{
"name": "created_at_to",
"type": "Date"
}
]
}
} }
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({
data: {
type: 'report_queries',
attributes: {
name: 'Count of Tasks Left To Do',
description: 'Count of Tasks Left To Do by Task Type',
graphql: 'query getTasksToDo($warehouse_id: ID, $account_id: ID, $created_at_from: Chronic, $created_at_to: Chronic) { tasks { aggregation(group_by: [task_type_id], statuses: ["AVAILABLE", "ALLOCATED"], warehouse_id: $warehouse_id, account_id: $account_id, created_from: $created_at_from, created_to: $created_at_to, limit: 9999999, order: "total_records DESC") { task_type { code } total_records } } }',
parameters: [
{name: 'warehouse_id', type: 'Integer'},
{name: 'account_id', type: 'Integer'},
{name: 'created_at_from', type: 'Date'},
{name: 'created_at_to', type: 'Date'}
]
}
}
})
};
fetch('https://clarus-api.com/api/report_queries', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": 123,
"type": "report_queries",
"attributes": {
"name": "Count of Tasks Left To Do",
"description": "Count of Tasks Left To Do by Task Type",
"graphql": "query getTasksToDo($warehouse_id: ID, $account_id: ID, $created_at_from: Chronic, $created_at_to: Chronic) { tasks { aggregation(group_by: [task_type_id], statuses: [\"AVAILABLE\", \"ALLOCATED\"], warehouse_id: $warehouse_id, account_id: $account_id, created_from: $created_at_from, created_to: $created_at_to, limit: 9999999, order: \"total_records DESC\") { task_type { code } total_records } } }",
"parameters": [
{
"name": "warehouse_id",
"type": "Integer"
},
{
"name": "account_id",
"type": "Integer"
},
{
"name": "created_at_from",
"type": "Date"
},
{
"name": "created_at_to",
"type": "Date"
}
]
}
}
}{
"error": "<string>"
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}Request Structure
{
"data": {
"type": "report_queries",
"attributes": {
"name": "Count of Tasks Left To Do",
"description": "Count of Tasks Left To Do by Task Type",
"graphql": "query getTasksToDo($warehouse_id: ID, $account_id: ID, $created_at_from: Chronic, $created_at_to: Chronic) { tasks { aggregation(group_by: [task_type_id], statuses: [\"AVAILABLE\", \"ALLOCATED\"], warehouse_id: $warehouse_id, account_id: $account_id, created_from: $created_at_from, created_to: $created_at_to, limit: 9999999, order: \"total_records DESC\") { task_type { code } total_records } } }",
"parameters": [
{ "name": "warehouse_id", "type": "Integer" },
{ "name": "account_id", "type": "Integer" },
{ "name": "created_at_from", "type": "Date" },
{ "name": "created_at_to", "type": "Date" }
]
}
}
}
Key Fields
| Field | Required | Description |
|---|---|---|
name | Yes | Report name for identification |
description | No | Description of what the report shows |
graphql | Yes | Named GraphQL query with typed parameters (never anonymous) |
parameters | No | Array of parameter definitions matching query variables |
GraphQL Query Rules
- Must be a named query (e.g.,
query getTasksToDo(...)) — never anonymous - Use
$variablesyntax for parameters with GraphQL types (ID,Chronic,String) - Common query patterns:
aggregation(...)for grouped/summarized data,all(...) { edges { node { ... } } }for paginated lists
Parameter Types
| Type | GraphQL Type | Description |
|---|---|---|
Integer | ID | Integer ID value |
Date | Chronic | Date/time parsed with natural language (e.g., ‘start of today’) |
String | String | Text value |
Authorizations
OAuth 2.0 authentication. Use the client credentials or authorization code flow to obtain an access token.
The subdomain/tenant name identifying which tenant's data to access. Required for all API requests.
Body
application/json
Show child attributes
Show child attributes
Response
Report query created successfully
Show child attributes
Show child attributes
⌘I

