What you’ll learn
- How to create a developer API key programmatically
- How to apply a character usage limit to a key
- How to retrieve an organization-wide usage report broken down by key
- What the response objects look like at each step
Prerequisites
- An API Growth or API Enterprise subscription, or a Pro API subscription with Admin API access
- An admin API key for your DeepL organization. Regular developer keys cannot access Admin API endpoints.
curlinstalled on your machine
Building with an AI coding agent?
Wire it up to the DeepL Docs MCP Server so it can search and read this documentation while it writes code. In Claude Code:Step 1: List existing developer keys
Before creating a new key, let’s see what’s already in the organization. This gives us a baseline and confirms that authentication is working.key_id field, composed of two GUIDs separated by a : symbol. You’ll use it to target specific keys in later steps. null usage limits mean no cap is set on that key.
If you get a 403 Forbidden response here, double-check that you’re using an admin key with an :adm suffix, not a developer key.
Step 2: Create a new developer key
Now let’s create a key for a new team or service. We’ll give it a descriptive label so it’s easy to identify later.key_id from this response. You’ll need it in the next step.
Step 3: Set a character usage limit
By default, a new key has no usage cap. Let’s set a character limit so the staging key can’t consume more quota than intended. ReplaceKEY_ID with the key_id from the previous step.
usage_limits.characters now shows 500000:
456 Quota exceeded errors until the next usage period starts or you raise the limit.
Step 4: Pull a usage report by key
After the team has started using the key, let’s retrieve a usage report to see how much quota each key has consumed. We’ll group the results by API key so we can see per-key totals. Replace the dates with a range that covers the period you want to inspect. Date ranges can span up to 366 days, and data is available up to and including the previous UTC calendar day.usage_report object with per-key breakdowns and an organization-wide total:
api_key values are partially masked in the response for security. You can match keys to their labels using the api_key_label field.
You have now created a key, capped its usage, and confirmed activity through the analytics endpoint.
What’s next
- Rename or reorganize keys: Use the rename endpoint to update a key’s label as teams or services change.
- Deactivate a key: When a key is no longer needed, deactivate it. Deactivation is permanent, but deactivated keys remain visible in your key list.
- Daily usage breakdowns: Change
group_bytokey_and_dayto see per-key usage broken down by day, which is useful for spotting spikes. - Custom tag analytics: If you annotate API requests with custom tags, use the custom tag analytics endpoint to break down usage by tag.
- Other data sources: See Retrieving Usage Data for a comparison of all the ways to monitor your DeepL API usage.