v1

latestOpenAPI 3.0.0Apache 2.0 License2026-07-1425156138.7 KB

Creates a Grafana API key for the workspace. This key can be used to authenticate requests sent to the workspace's HTTP API. See https://docs.aws.amazon.com/grafana/latest/userguide/Using-Grafana-APIs.html for available APIs and example requests.

In workspaces compatible with Grafana version 9 or above, use workspace service accounts instead of API keys. API keys will be removed in a future release.

post/workspaces/{workspaceId}/apikeys

Path parameters

workspaceIdstring required

The ID of the workspace to create an API key.

Request body

keyNamestring required

Specifies the name of the key. Keynames must be unique to the workspace.

keyRolestring required
<p>Specifies the permission level of the key.</p> <p> Valid values: <code>ADMIN</code>|<code>EDITOR</code>|<code>VIEWER</code> </p>
secondsToLiveinteger required

Specifies the time in seconds until the key expires. Keys can be valid for up to 30 days.

Response

Success

keyNamestring required

The name of the key that was created.

keystring password required

The key token. Use this value as a bearer token to authenticate HTTP requests to the workspace.

workspaceIdstring required

The ID of the workspace that the key is valid for.