API keys
Create a key, protect a geoservice with it, and call the interfaces of the server from other software.
An API key lets software access your tenant without a user logging in. You need one in two cases:
- You publish a geoservice with My Geoservices and want only certain clients to use it.
- Another application calls the interfaces of the server, for example a controller of your own.
You manage the keys of a tenant in Studio under Security → API Keys.
Create a key
- Click
New. - Enter a
Name. Letters, digits and underscores are allowed, up to 64 characters. Name the key after the system that will use it. - The
Tokenis filled in for you. It is the secret that the other system sends. - Save.
You can look up the token at any time by opening the key again. So can every other user with access to Studio. Treat the token like a password.
Protect a geoservice
In the form of a geoservice under Content → My Geoservices, select one or more keys. From then on the service only answers requests that carry one of these keys. A service without a key is open to everyone who can reach the server.
The client adds the key to the address of the service:
https://<server>/api/v1/geoservices/wms/<tenant>/<service>?apiKey=<token>
If exactly one key is assigned, the addresses that Studio shows for the service already contain it.
Call the interfaces of the server
The calling system sends two headers with every request:
Tenant: <name of the tenant>
Authorization: ApiKey <token>
Both are required. Without the header Tenant the key is not recognized.
Replace or withdraw a key
A key has no expiry date and cannot be limited to certain interfaces. To withdraw it, delete it.
To replace a key without an interruption:
- Create a new key.
- Add it to the geoservices that use the old one, and give it to the systems that call the server.
- When all of them use the new key, remove the old key from the geoservices and delete it.
Two things to know:
- A change can take up to four hours to take effect. The server remembers accepted keys for a while. A deleted key, or a key you removed from a geoservice, can still be accepted during that time. If it must stop working at once, restart the web application on the server.
- Remove a key from its geoservices before you delete it. Studio does not warn you that a key is still in use.
How requests with a key count as usage
Requests to a geoservice are not counted.
Requests that load the configuration of an app, a Map View or a legend with a key are counted. For each day, 25 such requests count as one session. See License, charges and usage.