|
1 | 1 | --- |
2 | | -title: "Accessing organization usage analytics" |
| 2 | +title: "Accessing usage analytics" |
3 | 3 | description: "Learn how admins can retrieve and analyze usage data across their organization." |
4 | 4 | public: true |
5 | 5 | --- |
6 | 6 |
|
7 | | -The Admin API allows admins to retrieve detailed usage statistics for their organization through the [Get usage analytics](/api-reference/admin-api/get-usage-analytics) endpoint. |
| 7 | +The Admin API provides two endpoints for monitoring usage across your organization: |
8 | 8 |
|
9 | | -This analytics functionality enables you to: |
10 | | -* Track character usage across your entire organization |
11 | | -* Monitor usage by individual API keys |
12 | | -* Analyze usage patterns over time |
13 | | -* Generate reports for specific date ranges |
14 | | -* Break down usage by service type (text translation, document translation, text improvement) |
| 9 | +- [Get usage analytics](/api-reference/admin-api/get-usage-analytics): retrieves total usage statistics, optionally grouped by API key or day |
| 10 | +- [Get custom tag usage analytics](/api-reference/admin-api/get-custom-tag-usage-analytics): retrieves usage statistics broken down by custom tags |
15 | 11 |
|
16 | | -## Usage statistics endpoint |
| 12 | +## Organization usage |
17 | 13 |
|
18 | | -The analytics endpoint provides detailed usage information for a specified date range with flexible grouping options. |
| 14 | +The [Get usage analytics](/api-reference/admin-api/get-usage-analytics) endpoint returns usage statistics for a specified date range with flexible grouping options. It covers all services: text translation, document translation, text improvement, and speech-to-text. |
19 | 15 |
|
20 | | -### Date range queries |
| 16 | +## Custom tag usage |
21 | 17 |
|
22 | | -Retrieve usage statistics by specifying a start and end date. Both `start_date` and `end_date` parameters are required and support the following formats (all in UTC): |
23 | | -* `YYYY-MM-DD` - Simple date format (e.g., `2025-09-29`) |
24 | | -* `YYYY-MM-DDTHH:MM:SS` - Full datetime format (e.g., `2025-09-29T14:30:00`) |
| 18 | +Custom tags are an optional dimension for breaking down usage. If your organization wants to track consumption by team, project, or any other category, you can attach a single tag to individual API requests using the `X-DeepL-Reporting-Tag` header. Each request accepts one tag. |
25 | 19 |
|
26 | | -The maximum date range is 366 days. |
| 20 | +The [Get custom tag usage analytics](/api-reference/admin-api/get-custom-tag-usage-analytics) endpoint only returns usage from tagged requests. Untagged requests are not included, so the results will reflect a subset of your organization's total usage unless all API requests are tagged. |
27 | 21 |
|
28 | | -### Grouping options |
| 22 | +```bash |
| 23 | +curl --request POST \ |
| 24 | + --url https://api.deepl.com/v2/translate \ |
| 25 | + --header 'Authorization: DeepL-Auth-Key YOUR_AUTH_KEY' \ |
| 26 | + --header 'X-DeepL-Reporting-Tag: your-custom-tag' \ |
| 27 | + --header 'Content-Type: application/json' \ |
| 28 | + --data '{ |
| 29 | + "text": ["Hello, world!"], |
| 30 | + "target_lang": "DE" |
| 31 | + }' |
| 32 | +``` |
29 | 33 |
|
30 | | -The optional `group_by` parameter allows you to organize usage data in different ways: |
31 | | - |
32 | | -* **No grouping** (default): Returns total usage for the entire date range across all API keys |
33 | | -* **`key`**: Groups usage by individual API key, showing totals for each key over the entire date range |
34 | | -* **`key_and_day`**: Groups usage by both API key and day, providing daily breakdowns for each key |
35 | | - |
36 | | -### Usage breakdown |
37 | | - |
38 | | -All responses include a breakdown of usage by service type: |
39 | | -* **Total characters**: Combined usage across all services |
40 | | -* **Text translation characters**: Characters used for text translation |
41 | | -* **Document translation characters**: Characters used for document translation |
42 | | -* **Text improvement characters**: Characters used for text improvement (rephrasing) |
43 | | -* **Speech-to-text minutes**: Duration of speech-to-text usage in minutes |
44 | | - |
45 | | -## Use cases |
46 | | - |
47 | | -The account-level analytics endpoint is particularly useful for: |
48 | | - |
49 | | -* **Cost monitoring**: Track usage to stay within budget limits and forecast costs |
50 | | -* **Resource allocation**: Identify which teams or projects (represented by API keys) are using the most resources |
51 | | -* **Usage trends**: Analyze daily or weekly usage patterns to optimize resource planning |
52 | | -* **Compliance and auditing**: Generate detailed usage reports for compliance requirements |
53 | | -* **Performance tracking**: Monitor adoption and usage of different DeepL services within your organization |
| 34 | +<Warning> |
| 35 | +Custom tag data is currently supported for text translation. Support for additional request types will be added in a future update. |
| 36 | +</Warning> |
54 | 37 |
|
| 38 | +Once tags are in place, query [Get custom tag usage analytics](/api-reference/admin-api/get-custom-tag-usage-analytics) to retrieve usage broken down by tag. |
0 commit comments