| 400 | Request body is invalid. | start_date and end_date are required in YYYY-MM-DD format. start_date must be before or equal to end_date. |
| 400 | Provider ID is invalid. | The X-Scrubs-Clinic-Provider header does not map to a known organisation. |
| 401 | API key authentication failed. | The API key or provider header is missing, or the supplied API key is invalid for the provider. |
| 500 | Unexpected server failure. | Repository, database, or service errors while reading or mutating API key data. |
| 403 | Root API key is required. | The authenticated key is valid but does not have root-level permission for this operation. |
| 403 | Target API key is outside the organisation. | A requested api_key_id belongs to a different organisation than the authenticated root key. |
| 404 | Target API key or clinic was not found. | The requested api_key_id does not exist, or the key exists without a linked clinic record. |
1https://usescrubs.com



1curl --location --request POST 'https://usescrubs.com/api/v1/usage-analytics' \
2--header 'X-Scrubs-Clinic-Api-Key: your_root_api_key_here' \
3--header 'X-Scrubs-Clinic-Provider: your_provider_id' \
4--header 'Content-Type: application/json' \
5--data '{
6 "start_date": "2024-01-01",
7 "end_date": "2024-01-31"
8}'
9
10# To query specific API key:
11curl --location --request POST 'https://usescrubs.com/api/v1/usage-analytics' \
12--header 'X-Scrubs-Clinic-Api-Key: your_root_api_key_here' \
13--header 'X-Scrubs-Clinic-Provider: your_provider_id' \
14--header 'Content-Type: application/json' \
15--data '{
16 "api_key_id": "key_uuid_here",
17 "start_date": "2024-01-01",
18 "end_date": "2024-01-31"
19}'1{
2 "api_key": null,
3 "total": {
4 "stt_duration": 120,
5 "tokens": 5000000,
6 "usage": 150
7 },
8 "deltas": {
9 "2024-01-15": {
10 "tokens": 1000000,
11 "usage": 25,
12 "stt_duration": 30
13 },
14 "2024-01-16": {
15 "tokens": 800000,
16 "usage": 20,
17 "stt_duration": 25
18 }
19 }
20}