Make an API key for your workspace's scripts, with buyer:read, buyer:write or stats:read, while it's active; the key is shown this once: its owner
POST
/v1/buyer/api-keys
const url = 'https://example.com/v1/buyer/api-keys';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"expires_at":"2026-04-15T12:00:00Z","name":"example","scopes":["buyer:read"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/buyer/api-keys \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "expires_at": "2026-04-15T12:00:00Z", "name": "example", "scopes": [ "buyer:read" ] }'Who: a workspace’s owner. Not for API keys.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Idempotency-Key
string
Made once per action and sent again on every retry of it, so the service acts once: the request_id of the create or money-moving call; a new one when left out
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
expires_at
required
string | null format: date-time
name
required
string
scopes
required
Array<string>
Responses
Section titled “Responses”Created
Media typeapplication/json
object
api_key
required
object
account
required
object
id
integer format: int64
kind
required
string | null
created_at
required
string format: date-time
created_by
required
expires_at
required
string | null format: date-time
id
required
string
last_used_at
required
string | null format: date-time
name
required
string
revoked_at
required
string | null format: date-time
revoked_by
required
scopes
required
Array<string>
key
required
string
Example
{ "api_key": { "account": { "kind": "network" }, "created_by": { "kind": "user" }, "revoked_by": { "kind": "user" } }}default
Section titled “default”An error, as go-commons apperr maps it
Media typeapplication/json
object
error
required
object
code
required
string
fields
object
key
additional properties
string
message
required
string
Example generated
{ "error": { "code": "example", "fields": { "additionalProperty": "example" }, "message": "example" }}