Admiral

Users

Update an API key

PATCH
/v1/users/{user}/apiKeys/{apiKey}
  • INVALID_ARGUMENT when the mask names a field that can't be updated.
    • FAILED_PRECONDITION when the key is revoked.
    • ABORTED when etag is set and the key changed since it was read.

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.

apiKey*string

The apiKey id.

Query Parameters

update_mask?string

The fields to update: display_name and scopes.

Request Body

application/json

The key with updated fields. Its resource_name identifies the key, and only the fields named in update_mask are applied. Its etag, when set, must match the key's current one.

TypeScript Definitions

Use the request body type in TypeScript.

The key with updated fields. Its resource_name identifies the key, and only the fields named in update_mask are applied. Its etag, when set, must match the key's current one.

Response Body

application/json

curl -X PATCH "https://example.com/v1/users/string/apiKeys/string" \  -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"  }}