curl --request GET \
--url https://{region}.affinda.com/v3/usage \
--header 'Authorization: Bearer <token>'import requests
url = "https://{region}.affinda.com/v3/usage"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{region}.affinda.com/v3/usage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"scope": "organization",
"scopeIdentifier": "<string>",
"start": "2025-04-01",
"end": "2025-04-30",
"total": 4320,
"items": [
{
"date": "2025-04-15",
"count": 123
}
]
}{
"type": "validation_error",
"errors": [
{
"attr": "non_field_errors",
"code": "unique",
"detail": "This index name has already been used"
}
]
}{
"type": "validation_error",
"errors": [
{
"attr": "non_field_errors",
"code": "unique",
"detail": "This index name has already been used"
}
]
}{
"type": "validation_error",
"errors": [
{
"attr": "non_field_errors",
"code": "unique",
"detail": "This index name has already been used"
}
]
}Get usage
Returns daily credits consumption for an organization over a date range. Optionally scope the report to a single workspace, a single document type, or a single (workspace × document type) pair by supplying both workspace and document_type.
curl --request GET \
--url https://{region}.affinda.com/v3/usage \
--header 'Authorization: Bearer <token>'import requests
url = "https://{region}.affinda.com/v3/usage"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{region}.affinda.com/v3/usage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"scope": "organization",
"scopeIdentifier": "<string>",
"start": "2025-04-01",
"end": "2025-04-30",
"total": 4320,
"items": [
{
"date": "2025-04-15",
"count": 123
}
]
}{
"type": "validation_error",
"errors": [
{
"attr": "non_field_errors",
"code": "unique",
"detail": "This index name has already been used"
}
]
}{
"type": "validation_error",
"errors": [
{
"attr": "non_field_errors",
"code": "unique",
"detail": "This index name has already been used"
}
]
}{
"type": "validation_error",
"errors": [
{
"attr": "non_field_errors",
"code": "unique",
"detail": "This index name has already been used"
}
]
}Authorizations
Basic authentication using an API key, e.g. {Authorization: Bearer aff_0bb4fbdf97b7e4111ff6c0015471094155f91}.
You can find your API key within the Settings page of the Affinda web app. You can obtain an API key by signing up for a free trial.
Query Parameters
Organization to report usage for. The caller must be an admin or owner. Uniquely identify an organization.
"mEFayXdO"
Optionally scope the report to a single workspace within the organization. Combine with document_type to scope to a single (workspace × document type) pair.
Uniquely identify a workspace.
"mEFayXdO"
Optionally scope the report to a single document type within the organization. Combine with workspace to scope to a single (workspace × document type) pair.
Uniquely identify a collection.
"mEFayXdO"
Inclusive start date of the report (YYYY-MM-DD). Defaults to 365 days before end.
Inclusive end date of the report (YYYY-MM-DD). Defaults to today.
Response
Daily credits consumption for the requested scope.
Daily credits consumption for an organization over a date range, optionally scoped to a single workspace, a single document type, or a single (workspace × document type) pair.
What the usage was scoped to.
organization, workspace, documentType, workspaceAndDocumentType Identifier of the scoped entity: the organization, workspace, or document type identifier. When scoped to a (workspace × document type) pair, it is the workspace and document type identifiers joined by a colon ({workspaceIdentifier}:{documentTypeIdentifier}).
Inclusive start of the reported period (YYYY-MM-DD).
"2025-04-01"
Inclusive end of the reported period (YYYY-MM-DD).
"2025-04-30"
Total credits consumed over the period.
4320
Per-day breakdown. Days with zero usage are omitted.
Show child attributes
Show child attributes
Was this page helpful?