Skip to main content
Version: 1.13.0

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

ParameterParameter TypeDescriptionRequired
nameStringThis is the name of the API key.Mandatory
userNameStringThe user associated with the key. The default value is admin.Optional
descriptionStringDescription for the API key.Optional
roleStringThis is the role for the API key. The supported values are Owner, Editor, and Viewer.Mandatory
validUntilStringThis is the validity period of the API key.Mandatory
workspaceNameStringThe name of the workspace name if applicable. For Editorand 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

ParameterParameter TypeDescriptionRequired
workspaceStringThe 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

ParameterParameter TypeDescriptionRequired
api-keyStringThe 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.