# API keys

Source: https://docs.globagift.io/docs/api/reference/api-keys
Description: Create, list and revoke merchant API keys.


## Create an API key

`POST /v1/api-keys`

Authentication: Merchant API key (`Authorization: Bearer gg_...`)

Retries: not idempotent. After an unclear failure, read the current state before trying again.

Request body:

- `environment` (string: test, live, required)
- `scopes` (array of string, required)

Responses:

- 201: Key created
- 400: Ungrantable scopes
- 401: Authentication failed
- 403: Authenticated caller lacks permission or the account is unavailable
- default: Unexpected server error

## List API keys for the authenticated merchant

`GET /v1/api-keys`

Authentication: Merchant API key (`Authorization: Bearer gg_...`)

Responses:

- 200: API keys
- 401: Authentication failed
- 403: Authenticated caller lacks permission or the account is unavailable
- default: Unexpected server error

## Revoke an API key

`DELETE /v1/api-keys/{id}`

Authentication: Merchant API key (`Authorization: Bearer gg_...`)

Retries: not idempotent. After an unclear failure, read the current state before trying again.

Parameters:

- `id` (path, required, string)

Responses:

- 204: Revoked
- 401: Authentication failed
- 403: Authenticated caller lacks permission or the account is unavailable
- 404: Not found
- default: Unexpected server error
