Admiral

Users

Create an API key

POST
/v1/users/{user}/apiKeys
  • ALREADY_EXISTS when the caller already has an active, unexpired key with that name.
    • PERMISSION_DENIED when parent is not the caller.

Scope: apikey:write

Authorization

bearerAuth
AuthorizationBearer <token>

An API key, or an access token minted from one. Pass it in the Authorization header: Bearer admp_...

In: header

Path Parameters

user*string

The user id.

Request Body

application/json

The key to create: name and scopes, and optionally display_name and expires_at. Output-only fields and resource_name are ignored.

TypeScript Definitions

Use the request body type in TypeScript.

The key to create: name and scopes, and optionally display_name and expires_at. Output-only fields and resource_name are ignored. api_key.name.required // an API key needs a name

Response Body

application/json

curl -X POST "https://example.com/v1/users/string/apiKeys" \  -H "Content-Type: application/json" \  -d '{    "name": "string"  }'
{  "api_key": {    "id": "string",    "name": "string",    "display_name": "string",    "resource_name": "string",    "owner_id": "string",    "scopes": [      "string"    ],    "expires_at": "2023-01-15T01:30:15.01Z",    "status": "API_KEY_STATUS_UNSPECIFIED",    "last_used_at": "2023-01-15T01:30:15.01Z",    "revoked_at": "2023-01-15T01:30:15.01Z",    "etag": "string",    "created_by": {      "id": "string",      "display_name": "string",      "email": "string"    },    "created_at": "2023-01-15T01:30:15.01Z",    "updated_at": "2023-01-15T01:30:15.01Z"  },  "secret": "string"}