Loading the documentation…

API authentication

The DataMind Platform API authenticates machine callers with your company's API key, sent in the x-api-key header. This page covers the header, what happens when a key is rejected, and the company settings that apply to every request you send.

Send the key with every request

Send the company key in the x-api-key header, for example x-api-key: <api_key>, on every request to the API.

A request that carries no key, an empty key or a key that DataMind does not recognise is refused before it reaches a model. It fails with status 401, code invalid_api_key and the message Invalid or missing API key. A key that was rotated or revoked is refused the same way. An Authorization: Bearer header does not authenticate a request on its own: a request that sends the key only that way is refused like one without a key.

For full request and SDK examples, see Use the API.

API keys and License Keys

The platform knows two kinds of key, and both go in the same x-api-key header:

KeyWhat it is for
API keyYour applications' direct requests to the API. Your company holds one active API key.
License KeyOne DataMind OS install: its AI features, its maps, its software downloads and its license check-ins. Each install has its own, and it starts with dm-lic-.

Use the API key for your own applications. A License Key belongs to the install it was created for: the first install that checks in with it keeps it, and another install that presents the same key is refused.

A DataMind OS server installed with the API key keeps working on it until it moves to a License Key of its own: DataMind prepares the License Key, and the DataMind Installer on that server takes it over at its next update.

An Administrator creates, rotates and revokes the API key in Settings. The full secret is shown once, when it is created or rotated, so copy it then. A rotated or revoked secret stops working at once: requests that still send the old secret are refused. Paste the new secret wherever the old one was used.

When a valid key is refused

The company's license state can refuse a request even with a valid key. Three 402 codes carry it:

All three are listed with their messages on Errors and retries. A refused key is never answered 401 for a license reason: 401 always means the key itself is missing, unknown, rotated or revoked.

Company settings that apply to every request

Two company settings shape the requests your key authenticates. An Administrator changes both in Settings.

SettingWhat it does to your requests
RegionDecides where requests are processed. With EU, requests are processed in the EU, and your company uses the models served there. Embeddings are the one exception: they always run on the global route (Embeddings).
Provider sortSets which provider DataMind tries first for pay-as-you-go requests. The default is Throughput; a single request can override it with provider.sort.

Questions, answered

Which header carries the API key?

The x-api-key header, on every request. Use the API shows full examples for your first request.

What happens when the key is missing or not recognised?

The request is refused before it reaches a model, with status 401, code invalid_api_key and the message Invalid or missing API key. Check that the request sends the current company key, then send it again.

Should my application use a License Key?

No. Use your company's API key for your own applications. A License Key belongs to one DataMind OS install, and another install that presents it is refused.

Why did my requests start failing after a key rotation?

A rotated or revoked secret stops working at once, so a request that still sends the old secret is refused with the 401 error above. Ask an Administrator to rotate the key or create a new one in Settings, then paste the new secret wherever the old one was used.

Does the Region setting change my API requests?

Yes. With Region set to EU, requests are processed in the EU, and your company uses the models served there. Embeddings are the one exception: they always run on the global route (Embeddings). An Administrator changes the setting in Settings.

Which provider order do my pay-as-you-go requests use?

Your company's Provider sort setting, which defaults to Throughput. One request can override it with provider.sort; see Use the API.

What does Last used count?

AI requests only. Last used does not count software downloads; you can see it on the key card in Settings.

Does DataMind record which client version we use?

When a request carries a version, DataMind records it for your company, so support can check which version you run. A request without a version leaves the recorded value unchanged.