VYG Docs

API keys

GET/v1/keys

Requires sign-in (OAuth). Scope: keys:manage.

View API keys and their details. Full key values are not shown.

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Query Parameters

key_class?string

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/v1/keys"
{  "data": [    {      "id": "string",      "key_prefix": "string",      "brand_id": "string",      "scopes": [        "string"      ],      "created_at": "string",      "last_used_at": "string",      "expires_at": "string",      "revoked_at": "string",      "name": "string",      "created_by": "string",      "last_used_ip": "string",      "last_used_via": "string",      "requests_7d": 0    }  ],  "next_cursor": "string"}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
POST/v1/keys

Requires sign-in (OAuth). Scope: keys:manage.

Create an API key with the permissions your integration needs. Copy the key when it is returned; it is shown once.

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/keys" \  -H "Content-Type: application/json" \  -d '{    "scopes": [      "string"    ]  }'
{  "id": "string",  "key_prefix": "string",  "brand_id": "string",  "scopes": [    "string"  ],  "created_at": "string",  "last_used_at": "string",  "expires_at": "string",  "revoked_at": "string",  "name": "string",  "created_by": "string",  "last_used_ip": "string",  "last_used_via": "string",  "requests_7d": 0,  "plaintext": "string"}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
GET/v1/key-scopes

Requires sign-in (OAuth). Scope: keys:manage.

The scopes this brand can give an API key right now. Creating or editing a key with any other scope fails.

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Query Parameters

key_class?string

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/v1/key-scopes"
{  "scopes": [    "string"  ]}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
GET/v1/keys/{id}

Requires sign-in (OAuth). Scope: keys:manage.

View one API key with its daily request counts for the last 30 days and its change history.

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

id*string

Query Parameters

key_class?string

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/v1/keys/string"
{  "id": "string",  "key_prefix": "string",  "brand_id": "string",  "scopes": [    "string"  ],  "created_at": "string",  "last_used_at": "string",  "expires_at": "string",  "revoked_at": "string",  "name": "string",  "created_by": "string",  "last_used_ip": "string",  "last_used_via": "string",  "requests_7d": 0,  "usage": [    {      "day": "string",      "requests": 0    }  ],  "history": [    {      "action": "string",      "actor": "string",      "created_at": "string",      "details": {        "property1": null,        "property2": null      }    }  ]}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
PATCH/v1/keys/{id}

Requires sign-in (OAuth). Scope: keys:manage.

Rename an API key, change its permissions or change when it expires. The key value does not change, so anything using it keeps working with the new permissions.

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X PATCH "https://example.com/v1/keys/string" \  -H "Content-Type: application/json" \  -d '{}'
{  "id": "string",  "key_prefix": "string",  "brand_id": "string",  "scopes": [    "string"  ],  "created_at": "string",  "last_used_at": "string",  "expires_at": "string",  "revoked_at": "string",  "name": "string",  "created_by": "string",  "last_used_ip": "string",  "last_used_via": "string",  "requests_7d": 0}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
DELETE/v1/keys/{id}

Requires sign-in (OAuth). Scope: keys:manage.

Revoke an API key. Returns 404 if it cannot be found or has already been revoked.

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

id*string

Query Parameters

key_class?string

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X DELETE "https://example.com/v1/keys/string"
{  "id": "string",  "key_prefix": "string",  "brand_id": "string",  "scopes": [    "string"  ],  "created_at": "string",  "last_used_at": "string",  "expires_at": "string",  "revoked_at": "string",  "name": "string",  "created_by": "string",  "last_used_ip": "string",  "last_used_via": "string",  "requests_7d": 0}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
POST/v1/keys/{id}/rotate

Requires sign-in (OAuth). Scope: keys:manage.

Replace an API key, keeping its name, expiry and permissions or choosing new permissions. The previous key stops working immediately, or after grace_seconds (up to 7 days) so you can swap it without downtime.

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/keys/string/rotate" \  -H "Content-Type: application/json" \  -d '{}'
{  "id": "string",  "key_prefix": "string",  "brand_id": "string",  "scopes": [    "string"  ],  "created_at": "string",  "last_used_at": "string",  "expires_at": "string",  "revoked_at": "string",  "name": "string",  "created_by": "string",  "last_used_ip": "string",  "last_used_via": "string",  "requests_7d": 0,  "plaintext": "string"}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}
{  "error": {    "code": "bad_request",    "message": "string"  }}