Usage
The Usage APIs give you the usage data that shows in the usage dashboard. This is the usage that Tray compares with the allowances in your contract.
All Usage endpoints use the POST method. You send the query in the JSON body.
Key terms
- Task: One execution of one step in a workflow run. If a step is in a loop, each iteration is one task. Tray counts tasks from all steps, also from steps that had an error. Refer to What is a task?
- Workflow tasks: Tasks from the workflows in your workspaces.
- End user tasks: Tasks from the workflows of your solution instances (Embedded).
- Connectivity API tasks: Calls to Call connector. Each call is one task.
- Tokens: The input and output tokens of the AI connectors that Tray supplies, for example Merlin Text Generation. Tokens from AI models that you connect with your own account are not included.
- Token task equivalents: The number of tasks that Tray calculates from your tokens. The conversion rate is in your contract.
- IDP pages processed: The number of pages that Merlin Intelligent Document Processing (IDP) processed.
- End user (Embedded): An end user that had one or more tasks in the month. An end user of a solution instance counts if a production workflow run has tasks. A Connectivity API end user counts if a call to Call connector uses a token of that end user.
The total task usage is the sum of workflow tasks, end user tasks, Connectivity API tasks and all token task equivalents.
Usage types
Use usageType to select the usage:
usageType |
Usage |
|---|---|
Tasks |
All tasks, including token task equivalents. |
WorkflowTasks |
Workflow tasks. |
EmbeddedTasks |
End user tasks. |
CAPITasks |
Connectivity API tasks. |
Tokens |
All tokens. |
WorkflowTokens, EmbeddedTokens, CAPITokens |
Tokens from workflows, end user workflows or the Connectivity API. |
WorkflowTokenTaskEquivalents, EmbeddedTokenTaskEquivalents, CAPITokenTaskEquivalents |
Token task equivalents from workflows, end user workflows or the Connectivity API. |
IDPPagesProcessed |
All IDP pages processed. |
EmbeddedIDPPagesProcessed, CAPIIDPPagesProcessed |
IDP pages processed from end user workflows or the Connectivity API. |
EndUsers |
All end users. |
EmbeddedEndUsers |
End users of solution instances. |
CAPIEndUsers |
Connectivity API end users. |
Workflows |
Workflows that had one or more workflow runs. Solution instance copies of workflows are not included. |
Organizations and regions
Usage is for your contract, not for one organization. The response includes usage from all organizations that are on the same contract as your organization.
Each Tray region keeps its data separately. Thus, there are two versions of each endpoint:
- The endpoints with
/accountgive usage from all regions. Use these endpoints to compare usage with your allowance. - The other endpoints give usage only from the region of the base URL that you use.
For example, if you have organizations in the US and the EU, send POST https://api.tray.io/insights/v1/usage/account to get the usage of both regions.
Time period
startPeriod and endPeriod are optional. Use ISO 8601 format in UTC, for example 2026-10-01T00:00:00Z.
Tray uses only the date. Tray includes all of the start day and all of the end day.
The default time period is different for each endpoint. Refer to the endpoint descriptions.
Billing months
Tray counts usage in billing months. A billing month starts on the same day of the month as your contract. For example, if your contract starts on 15 March, each billing month starts on the 15th.
Data delay
New usage shows approximately 20 minutes after a task completes.
Permissions
Use the token of an API user with the Owner or Admin organization role. Refer to API users and tokens.
Only an organization Owner or Admin can give an API user this role. A token of an API user with a different role gets a 403 response.
Trial organizations cannot use these endpoints.
Allowance values
Allowance values are strings. A value is a number, for example "150000", or "Unlimited".
Rate limits
Tray limits the number of requests to the Usage endpoints: 300 requests each minute and 5,000 requests each hour.
Each response has headers that show the limit and the number of requests that remain, for example RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset. RateLimit-Reset is the number of seconds before the limit for the minute starts again.
If you go above a limit, the response is 429. Wait, then send the request again.
Get Usage
Gets the usage for each billing month, and your allowance. This is the chart in the usage dashboard.
This endpoint gives usage only from the region of the base URL. To get usage from all regions, use Get Account Usage.
If you do not set a time period, Tray uses your current contract period. If you set only startPeriod, the time period ends today. If you set only endPeriod, the time period starts one year before endPeriod.
Response
timeseries contains one item for each billing month:
startPeriodandendPeriodare the first day and the last day of the billing month.valueis the usage in the billing month.monthlyAllowanceis your allowance for each billing month. The response contains this value only forTasks,WorkflowsandEndUsers.allowanceBreakdownshows the parts of your task allowance. The response contains this value only forTasks.
contractAllowance is the total allowance of the packages and add-ons that are active in the time period. If you have no usage in the time period, timeseries is empty.
Workflows
For usageType Workflows, use billableTypes to select the workflows:
Billable: Workflows that Tray bills.NonBillable: Workflows that Tray does not bill. These are workflows with a callable trigger, an alerting trigger or no trigger, and the source workflows of solutions.SandBox: Workflows in sandbox workspaces.
If you do not send billableTypes, the response includes all workflows. The response contains the allowance only if billableTypes contains Billable.
Do not use billableTypes with other usage types.
Request Examples
{
"usageType": "Tasks"
}Response Examples
{
"data": {
"contractAllowance": "1200000",
"timeseries": [
{
"startPeriod": "2026-09-15T00:00:00Z",
"endPeriod": "2026-10-14T00:00:00Z",
"value": 84210,
"monthlyAllowance": 100000,
"allowanceBreakdown": [
{
"name": "Task",
"allowance": 100000
}
]
},
{
"startPeriod": "2026-10-15T00:00:00Z",
"endPeriod": "2026-10-29T00:00:00Z",
"value": 37950,
"monthlyAllowance": 100000,
"allowanceBreakdown": [
{
"name": "Task",
"allowance": 100000
}
]
}
]
}
}Get Usage Details
Gets a table with the details of your usage, for example the tasks of each workflow. This is the table in the usage dashboard.
This endpoint gives usage only from the region of the base URL. To get usage from all regions, use Get Account Usage Details.
If you do not set a time period, Tray uses the current calendar month. If you set only startPeriod or only endPeriod, Tray uses only that day.
Columns
The columns are different for each usageType. To get the columns, use Get Usage Columns.
usageType |
One row for each | Usage column |
|---|---|---|
Tasks, Tokens, IDPPagesProcessed, EndUsers |
Category, for example "Workflow Tasks" | task_runs, tokens, idp_pages_processed or end_users |
Workflows |
Workflow | workflow_runs |
WorkflowTasks |
Workflow, and sandbox or production | task_runs |
WorkflowTokens, WorkflowTokenTaskEquivalents |
Workflow and AI model | tokens or token_task_equivalents |
EmbeddedTasks, EmbeddedEndUsers |
End user | task_runs |
EmbeddedTokens, EmbeddedTokenTaskEquivalents, EmbeddedIDPPagesProcessed |
End user | tokens, token_task_equivalents or idp_pages_processed |
CAPITasks |
Connector operation | connector_calls |
CAPIEndUsers |
End user | connector_calls |
CAPITokens, CAPITokenTaskEquivalents, CAPIIDPPagesProcessed |
Connector operation | tokens, token_task_equivalents or idp_pages_processed |
All rows also contain organization, the name and ID of the organization.
Column values
| Column | Value |
|---|---|
workflow_id, workflow_name |
The workflow. |
workflow_runs |
The number of workflow runs. |
workflow_type |
Billable, or the reason that Tray does not bill the workflow. |
task_runs |
The number of tasks. |
task_type |
Production or Sandbox. |
workspace_name |
The workspace of the workflow. |
end_user |
The name and ID of the end user. |
external_user_id |
The external user ID that you set for the end user. |
connector_title, connector_operation |
The connector and the operation. |
connector_calls |
The number of calls to Call connector. |
model |
The AI model. |
category |
The usage category. |
region |
US, EU, AP or AP2. Only in the /account endpoints. |
Rows
Each row is a list of objects with columnName and value. All values are strings, also for numbers.
Pagination and sort order
The default page size is 100. To get the next page, send the same request with after set to pageInfo.endCursor. Do this until hasNextPage is false. When the last page is full, hasNextPage can be true. In this case, the next page is empty.
To change the sort order, set orderBy to one column and a direction (Asc or Desc). If a column is not in the table, Tray does not use it.
Request Examples
{
"usageType": "WorkflowTasks",
"startPeriod": "2026-10-15T00:00:00Z",
"endPeriod": "2026-10-29T00:00:00Z",
"orderBy": [
{
"column": "task_runs",
"direction": "Desc"
}
],
"first": 100
}Response Examples
{
"data": {
"pageInfo": {
"hasPreviousPage": false,
"hasNextPage": false,
"orderBy": "Descending"
},
"rows": [
[
{
"columnName": "workflow_id",
"value": "6a1f0c7e-1d1b-4c55-9d43-0c5f2a8e4b11"
},
{
"columnName": "workflow_name",
"value": "Sync new leads to Slack"
},
{
"columnName": "task_runs",
"value": "21480"
},
{
"columnName": "workflow_runs",
"value": "1240"
},
{
"columnName": "task_type",
"value": "Production"
},
{
"columnName": "workspace_name",
"value": "Sales"
},
{
"columnName": "organization",
"value": "Acme (3f2a9c4e-0b1d-4e8f-a6c7-5d9e1f2a3b4c)"
}
]
]
}
}Get Account Usage Details
Gets a table with the details of your usage from all regions. The request and the response are the same as Get Usage Details.
For Tasks, Tokens, IDPPagesProcessed and EndUsers, the response contains one row for each region, with the region column. For other usage types, the response contains usage only from the region of the base URL.
Note: Tray gets one page from each region and sorts the rows together. If the data has more than one page, use a page size that is larger than the number of rows.
Request Examples
{
"usageType": "Tasks",
"startPeriod": "2026-10-15T00:00:00Z",
"endPeriod": "2026-10-29T00:00:00Z"
}Response Examples
{
"data": {
"pageInfo": {
"hasPreviousPage": false,
"hasNextPage": false,
"orderBy": "Descending"
},
"rows": [
[
{
"columnName": "category",
"value": "Workflow Tasks"
},
{
"columnName": "task_runs",
"value": "30100"
},
{
"columnName": "organization",
"value": "Acme (3f2a9c4e-0b1d-4e8f-a6c7-5d9e1f2a3b4c)"
},
{
"columnName": "region",
"value": "US"
}
],
[
{
"columnName": "category",
"value": "Workflow Tasks"
},
{
"columnName": "task_runs",
"value": "7850"
},
{
"columnName": "organization",
"value": "Acme EU (8c7b6a5d-4e3f-4a2b-9c1d-0e9f8a7b6c5d)"
},
{
"columnName": "region",
"value": "EU"
}
]
]
}
}Get Usage Columns
Gets the columns of the table from Get Usage Details for a usageType. Use this endpoint to make the headers of a table in your tool.
nameis the column code. Use this code inorderBy.headerNameis the text for the column header.columnTypetells you how to show the value.hiddenis for ID columns that you do not show.
The /account version also gives the region column for Tasks, Tokens, IDPPagesProcessed and EndUsers.
Request Examples
{
"usageType": "WorkflowTasks"
}Response Examples
{
"data": {
"columns": [
{
"headerName": "Workflow ID",
"name": "workflow_id",
"columnType": "hidden"
},
{
"headerName": "Workflow",
"name": "workflow_name",
"columnType": "string"
},
{
"headerName": "Task runs",
"name": "task_runs",
"columnType": "number"
}
]
}
}Get Account Usage Columns
Gets the columns of the table from Get Usage Details for a usageType. Use this endpoint to make the headers of a table in your tool.
nameis the column code. Use this code inorderBy.headerNameis the text for the column header.columnTypetells you how to show the value.hiddenis for ID columns that you do not show.
The /account version also gives the region column for Tasks, Tokens, IDPPagesProcessed and EndUsers.
Request Examples
{
"usageType": "Tasks"
}Response Examples
{
"data": {
"columns": [
{
"headerName": "Category",
"name": "category",
"columnType": "string"
},
{
"headerName": "Task runs",
"name": "task_runs",
"columnType": "number"
},
{
"headerName": "Organization",
"name": "organization",
"columnType": "string"
},
{
"headerName": "Region",
"name": "region",
"columnType": "string"
}
]
}
}Get Usage Row Count
Gets the number of items in the usage details for the time period. Send the same usageType and time period that you send to Get Usage Details.
used is:
- For
Workflows: the number of workflows that had one or more workflow runs. - For
EmbeddedEndUsersandCAPIEndUsers: the number of end users. - For all other usage types: the number of rows in the table. This value is not the usage. To get the usage, use Get Usage.
The /account version gives the total of all regions in used, and the value for each region in usUsed, euUsed, apUsed and ap2Used.
Request Examples
{
"usageType": "Workflows",
"billableTypes": [
"Billable"
]
}Response Examples
{
"data": {
"used": 37
}
}Get Account Usage Row Count
Gets the number of items in the usage details for the time period. Send the same usageType and time period that you send to Get Usage Details.
used is:
- For
Workflows: the number of workflows that had one or more workflow runs. - For
EmbeddedEndUsersandCAPIEndUsers: the number of end users. - For all other usage types: the number of rows in the table. This value is not the usage. To get the usage, use Get Usage.
The /account version gives the total of all regions in used, and the value for each region in usUsed, euUsed, apUsed and ap2Used.
Request Examples
{
"usageType": "Workflows",
"billableTypes": [
"Billable"
]
}Response Examples
{
"data": {
"used": 52,
"usUsed": 37,
"euUsed": 15,
"apUsed": 0,
"ap2Used": 0
}
}Get Account Usage
Gets the usage for each billing month from all regions, and your allowance. This is the chart in the usage dashboard.
The request and the response are the same as Get Usage, with these changes:
valueis the total usage of all regions.usValue,euValue,apValueandap2Valueare the usage in each region. If a region has no usage, the response does not contain the value for that region.
If one region does not respond, the request fails. Send the request again.
Request Examples
{
"usageType": "Tasks",
"startPeriod": "2026-10-15T00:00:00Z"
}Response Examples
{
"data": {
"contractAllowance": "1200000",
"timeseries": [
{
"startPeriod": "2026-10-15T00:00:00Z",
"endPeriod": "2026-10-29T00:00:00Z",
"value": 37950,
"usValue": 30100,
"euValue": 7850,
"monthlyAllowance": 100000,
"allowanceBreakdown": [
{
"name": "Task",
"allowance": 100000
}
]
}
]
}
}