API Key
This topic describes the REST APIs to manage API keys.
info
Across our documentation, we refer to the workspace as the slice workspace. The two terms are used interchangeably.
Create an API Key
Use this API to create admin API key using an API token.
Method and URL
POST /api/v1/api-key
Parameters
Parameter | Parameter Type | Description | Required |
---|---|---|---|
name | String | This is the name of the API key. | Mandatory |
userName | String | The user associated with the key. The default value is admin . | Optional |
description | String | Description for the API key. | Optional |
role | String | This is the role for the API key. The supported values are Owner , Editor , and Viewer . | Mandatory |
validUntil | String | This is the validity period of the API key. | Mandatory |
workspaceName | String | The name of the workspace name if applicable. For Editor and Viewer roles, the workspace name is mandatory. | Optional |
Example Request
curl -X POST http://127.0.0.1:8080/api/v1/api-key
--data '{
"name": "test",
"userName": "username",
"description": "Tiger Editor",
"role": "Editor",
"validUntil": "2025-12-31",
"workspaceName": "Tiger"
}'
Example Response
{
"statusCode": 200,
"status": "OK",
"message": "Success",
"data": {
"apiKey": "06de7aa7-01db-4510-91f6-ba591aad70a9"
}
}
List API Keys
Use this API to get the API keys for a given workspace.
Method and URL
GET /api/v1/api-key/list?workspace=<workspace-name>
Parameters
Parameter | Parameter Type | Description | Required |
---|---|---|---|
workspace | String | The workspace for which you want to get the API keys. | Optional |
Example Request
CURL -X GET http://127.0.0.1:8080/api/v1/api-key/list?workspace=andromeda
Example Response
{
"statusCode": 200,
"status": "OK",
"message": "Success",
"data": {
"data": [
{
"id": "030b514f342dcf5ac94f3f39726c247e",
"apiKey": "45338461-ec42-49d2-aef3-ff39099950c5",
"description": "GPR Template Use",
"name": "API-Token-1",
"role": "Editor",
"saName": "kubeslice-rbac-rw-slice-andromeda",
"workspaceName": "andromeda",
"tokenTtlSeconds": "900",
"userName": "Admin",
"validity": "2025-03-31"
}
]
}
}
Delete an API Key
Use this API to delete an API key created for a given workspace.
Method and URL
DELETE /api/v1/api-key
Parameters
Parameter | Parameter Type | Description | Required |
---|---|---|---|
api-key | String | The API key that you want to delete. | Mandatory |
Example Request
CURL -X DELETE http://127.0.0.1:8080/api/v1/api-key
--data '{
"apiKey": "06de7aa7-01db-4510-91f6-ba591aad70a9"
}'
Example Response
The response object is null.