- 21 May 2024
- 1 Minute to read
- Print
- PDF
API Keys for the Wasabi AiR API
- Updated on 21 May 2024
- 1 Minute to read
- Print
- PDF
API keys enable you to write applications that interact with Wasabi AiR. Normally, you will use Wasabi AiR to manage keys, but you may also manage them with API keys.
An API key inherits the permissions of the user who created it.
Using a Key
To use an API key in a request to Wasabi AiR, set the Authorization header:
Authorization: Bearer {KEY}
- {KEY} - The API key.
Creating a Key
To create a key, make the following request:
POST /api/data/api-keys
{
"name": "Name of key"
}
- name - Optional. A human-readable label for the API key (for example, Slack Integration).
If no name is specified, a default name is provided.
Here is a sample response:
{
"id": "abc123",
"jwt": "APIKEY",
"active": true,
"user_id": "591481bf1940f20c341b9386a9a192f4",
"created_at": "2017-05-31T20:56:04.002433Z",
"updated_at": "2017-05-31T20:56:04.002433Z"
}
- id - (string) The internal ID of the key. This is not the key, but a reference for the key.
- jwt - (string) The JSON Web Token (JWT) API key that should be used in the Authorization header.
- active - (bool) An indication of whether or not the key is active.
- user_id - (string) The ID of the user who owns this key.
- created_at - (datetime) The date-time when the key was created.
- updated_at - (datetime) The date-time when the key was last updated.
Updating the Name of a Key
API keys have names so that users can remember which key is used in each context. Names may be changed or updated.
PATCH /api/data/api-keys/{key-id}
{
"name": "New name"
}
- key-id - (string) The API key ID (not the JWT).
- name - (string) The name of the key.
Listing All Keys for a User
To list all the keys that exist for a specific user, make the following request:
GET /api/data/api-keys
The response lists every available key:
{
"api-keys": [
{
"id": "abc123",
"jwt": "APIKEY",
"active": true,
"user_id": "591481bf1940f20c341b9386a9a192f4",
"created_at": "2017-05-31T20:56:04.002433Z",
"updated_at": "2017-05-31T20:56:04.002433Z"
},
{
"id": "abc124",
"jwt": "APIKEY",
"active": true,
"user_id": "591481bf1940f20c341b9386a9a192f4",
"created_at": "2017-05-31T20:56:04.002433Z",
"updated_at": "2017-05-31T20:56:04.002433Z"
},
{
"id": "abc125",
"jwt": "APIKEY",
"active": false,
"user_id": "591481bf1940f20c341b9386a9a192f4",
"created_at": "2017-05-31T20:56:04.002433Z",
"updated_at": "2017-05-31T20:56:04.002433Z"
}
]
}
Disabling a Key Temporarily
PATCH /api/data/api-keys/{key-id}
{
"active": false
}
- key-id - (string) The API key ID (not the JWT).
- active - (bool) An indication of whether or not the key is active.
Requests using this key will not work until the key has been re-enabled (set active to true).
Deleting a Key Permanently
When you are no longer using an API key, it is recommended that you revoke it:
DELETE /api/data/api-keys/{key-id}
- key-id - (string) The API key ID (not the JWT).
Future requests using that key will not work.