Management Keys

Keys that create, cap and revoke your API keys from a script, and never call a model.

On this page

A management key creates, caps and revokes your account's API keys over the API. It never calls a model, and an API key cannot manage keys, so a leaked key of one kind cannot do the other's job. Use one for teams, CI and agents that hand out their own keys.

Create a management key

  1. On your dashboard, open API keys and the Management keys tab.
  2. Choose Create management key and give it a name.
  3. Copy the key. It starts with dcode_mgmt_ and is shown only once.

You can revoke a management key on the same tab. The API keys it made keep working.

Endpoints

Base URL https://api.dipoleml.com. Every call sends Authorization: Bearer <management key>.

MethodPathWhat it does
GET/v1/management/keysLists your API keys, newest first, up to 100, revoked ones included.
POST/v1/management/keysCreates an API key. Answers 201.
GET/v1/management/keys/:idReturns one API key.
PATCH/v1/management/keys/:idChanges its label, cap or expiry.
DELETE/v1/management/keys/:idRevokes it at once and returns it.

Create an API key

curl

curl https://api.dipoleml.com/v1/management/keys \  -H "Authorization: Bearer $DIPOLEML_MANAGEMENT_KEY" \  -H "Content-Type: application/json" \  -d '{    "label": "staging bot",    "limit": 10,    "expires_at": "2027-06-30T23:59:59Z"  }'

python

import os, requestsresp = requests.post(    "https://api.dipoleml.com/v1/management/keys",    headers={"Authorization": "Bearer " + os.environ["DIPOLEML_MANAGEMENT_KEY"]},    json={"label": "staging bot", "limit": 10, "expires_at": "2027-06-30T23:59:59Z"},)resp.raise_for_status()created = resp.json()print(created["id"], created["key"])
201 response (shape)
{  "id": "ak_<16 hex characters>",  "object": "key",  "label": "staging bot",  "status": "active",  "created_at": "2026-11-13T15:04:05.000Z",  "expires_at": "2027-06-30T23:59:59.000Z",  "limit": 10,  "used": 0,  "limit_remaining": 10,  "last_used_at": null,  "key": "dcode_sk_<the new key>"}

The new key is in key, in this answer only. Every field of the body is optional:

FieldTypeNotes
labelstringA name, up to 80 characters (longer is cut). Left out or empty, it is API key.
limitnumber or nullA spending cap in US dollars for the key's whole life, from 0 to 1,000,000. null or left out: no cap.
expires_atstring or nullAn ISO 8601 time, such as 2027-06-30T23:59:59Z. null or left out: never expires.

The key object

FieldMeaning
idThe key's id, starting with ak_. Used in the paths above. It is not the key itself.
objectAlways key.
labelThe key's name.
statusactive, expired or revoked.
created_atWhen it was made, ISO 8601.
expires_atWhen it expires, ISO 8601, or null for never.
limitIts spending cap in US dollars, or null.
usedWhat it has spent in all, in US dollars.
limit_remainingThe cap minus what it spent (never below 0), or null with no cap.
last_used_atWhen it last made a billed request, or null.

Caps and expiry

On every model call with an API key, the API checks in this order: the key's expiry (401, key_expired), then its cap (402, key_limit_reached), then your credit balance (402, insufficient_credits). A key is refused once what it spent has reached its cap; since a request is debited after it finishes, the last one can take it slightly past the cap.

raise a cap
curl -X PATCH https://api.dipoleml.com/v1/management/keys/ak_1a2b3c4d5e6f7a8b \  -H "Authorization: Bearer $DIPOLEML_MANAGEMENT_KEY" \  -H "Content-Type: application/json" \  -d '{"limit": 25}'
remove the cap and set a new expiry
curl -X PATCH https://api.dipoleml.com/v1/management/keys/ak_1a2b3c4d5e6f7a8b \  -H "Authorization: Bearer $DIPOLEML_MANAGEMENT_KEY" \  -H "Content-Type: application/json" \  -d '{"limit": null, "expires_at": "2027-12-31T23:59:59Z"}'

A PATCH changes only the fields you send and returns the key. The same controls are on the dashboard's API keys page, under Edit, where the expiry is a choice of Never, 7, 30 or 90 days, or 1 year.

Revoke a key

curl
curl -X DELETE https://api.dipoleml.com/v1/management/keys/ak_1a2b3c4d5e6f7a8b \  -H "Authorization: Bearer $DIPOLEML_MANAGEMENT_KEY"

The answer is the key with status: "revoked". Its next request fails with 401 and invalid_api_key, and it cannot be turned back on. Revoked keys stay in the list, so your records stay complete.

Errors

Errors have the OpenAI-format shape (Errors and limits).

StatuscodeMeaning
401missing_management_keyNo key was sent.
401invalid_management_keyThe key is wrong or revoked, or it is an API key rather than a management key.
400invalid_limitlimit is not an amount from 0 to 1,000,000.
400invalid_expires_atexpires_at is not an ISO 8601 time.
400invalid_labellabel is not a string (on PATCH).
400empty_updateA PATCH with none of label, limit or expires_at.
400400The body is not valid JSON.
404key_not_foundNo API key with that id on your account.
405405A method these paths do not take.

Keeping management keys safe

  • A management key can make keys that spend your credits. Keep it in your CI's secret store, never in code.
  • If one leaks, revoke it on the dashboard and create another.
  • Give keys you hand to machines a small cap and an expiry, so a lost key cannot surprise you.