API reference
Early accessAPI keys
Secret keys for your server and publishable keys for the browser, per project and environment.
Authentication: Dashboard session.
Guide: Authentication
| Method | Path | Summary |
|---|---|---|
| GET | /v1/projects/{id}/keys | Keys of a project (metadata only) |
| POST | /v1/projects/{id}/keys | Create a key; the full key is in this answer only |
| GET | /v1/keys/{id} | One key (metadata only) |
| DELETE | /v1/keys/{id} | Revoke a key (takes effect on the next request) |
| POST | /v1/keys/{id}/rotate | Rotate a key: a new key now, the old one keeps working for the grace period (default 24 hours) |
GET/v1/projects/{id}/keys#
Keys of a project (metadata only)
- Operation id:
PlatformKeysController_list - Authentication: Secret key or dashboard session
Headers#
| Name | Type | Required | Notes |
|---|---|---|---|
X-Terra-Org | string | no | Dashboard sessions: the organization to act for (org_...). API keys carry their own. |
Path parameters#
| Name | Type | Required | Notes |
|---|---|---|---|
id | string | yes | proj_... |
Query parameters#
| Name | Type | Required | Notes |
|---|---|---|---|
limit | integer | no | |
starting_after | string | no |
Response#
Status 200.
| Name | Type | Required | Notes |
|---|---|---|---|
data | array of object | yes | |
has_more | boolean | yes | |
next_cursor | string | yes |
POST/v1/projects/{id}/keys#
Create a key; the full key is in this answer only
Live keys need an owner or admin with two-step sign-in, a step-up in the last 15 minutes, and live mode allowed.
- Operation id:
PlatformKeysController_create(contract name:createApiKey) - Authentication: Dashboard session
Idempotency-Key: required
Headers#
| Name | Type | Required | Notes |
|---|---|---|---|
X-Terra-Org | string | no | Dashboard sessions: the organization to act for (org_...). API keys carry their own. |
Idempotency-Key | string | yes | 8 to 128 characters, kept 24 hours. |
Path parameters#
| Name | Type | Required | Notes |
|---|---|---|---|
id | string | yes | proj_... |
Request body#
| Name | Type | Required | Notes |
|---|---|---|---|
environment | string (test | live) | yes | |
type | string (secret | publishable) | yes | |
label | string | yes | length 1 to 80 |
scopes | array of string | yes |
Response#
Status 201.
| Name | Type | Required | Notes |
|---|---|---|---|
id | string | yes | |
object | string (api_key) | yes | |
project_id | string | yes | |
environment | string (test | live) | yes | |
type | string (secret | publishable) | yes | |
label | string | yes | |
scopes | array of string | yes | |
prefix | string | yes | |
status | string (active | expiring | expired | revoked) | yes | |
created_at | string (date-time) | yes | |
last_used_at | string (date-time) | yes | |
expires_at | string (date-time) | yes | |
revoked_at | string (date-time) | yes | |
rotated_from | string | yes | |
secret | string | yes | The full key. Returned only in this answer and never again (null on an Idempotency-Key replay). |
Notes#
- Creating a live key needs a fresh authenticator code.
GET/v1/keys/{id}#
One key (metadata only)
- Operation id:
PlatformKeysController_get - Authentication: Secret key or dashboard session
Headers#
| Name | Type | Required | Notes |
|---|---|---|---|
X-Terra-Org | string | no | Dashboard sessions: the organization to act for (org_...). API keys carry their own. |
Path parameters#
| Name | Type | Required | Notes |
|---|---|---|---|
id | string | yes | key_... |
Response#
Status 200.
| Name | Type | Required | Notes |
|---|---|---|---|
id | string | yes | |
object | string (api_key) | yes | |
project_id | string | yes | |
environment | string (test | live) | yes | |
type | string (secret | publishable) | yes | |
label | string | yes | |
scopes | array of string | yes | |
prefix | string | yes | |
status | string (active | expiring | expired | revoked) | yes | |
created_at | string (date-time) | yes | |
last_used_at | string (date-time) | yes | |
expires_at | string (date-time) | yes | |
revoked_at | string (date-time) | yes | |
rotated_from | string | yes |
DELETE/v1/keys/{id}#
Revoke a key (takes effect on the next request)
- Operation id:
PlatformKeysController_revoke(contract name:revokeApiKey) - Authentication: Dashboard session
Headers#
| Name | Type | Required | Notes |
|---|---|---|---|
X-Terra-Org | string | no | Dashboard sessions: the organization to act for (org_...). API keys carry their own. |
Path parameters#
| Name | Type | Required | Notes |
|---|---|---|---|
id | string | yes | key_... |
Response#
Status 200.
| Name | Type | Required | Notes |
|---|---|---|---|
id | string | yes | |
object | string (api_key) | yes | |
project_id | string | yes | |
environment | string (test | live) | yes | |
type | string (secret | publishable) | yes | |
label | string | yes | |
scopes | array of string | yes | |
prefix | string | yes | |
status | string (active | expiring | expired | revoked) | yes | |
created_at | string (date-time) | yes | |
last_used_at | string (date-time) | yes | |
expires_at | string (date-time) | yes | |
revoked_at | string (date-time) | yes | |
rotated_from | string | yes |
POST/v1/keys/{id}/rotate#
Rotate a key: a new key now, the old one keeps working for the grace period (default 24 hours)
- Operation id:
PlatformKeysController_rotate(contract name:rotateApiKey) - Authentication: Dashboard session
Idempotency-Key: required
Headers#
| Name | Type | Required | Notes |
|---|---|---|---|
X-Terra-Org | string | no | Dashboard sessions: the organization to act for (org_...). API keys carry their own. |
Idempotency-Key | string | yes | 8 to 128 characters, kept 24 hours. |
Path parameters#
| Name | Type | Required | Notes |
|---|---|---|---|
id | string | yes | key_... |
Request body#
| Name | Type | Required | Notes |
|---|---|---|---|
grace_period_s | integer | no | 0 to 604800 |
Response#
Status 201.
| Name | Type | Required | Notes |
|---|---|---|---|
id | string | yes | |
object | string (api_key) | yes | |
project_id | string | yes | |
environment | string (test | live) | yes | |
type | string (secret | publishable) | yes | |
label | string | yes | |
scopes | array of string | yes | |
prefix | string | yes | |
status | string (active | expiring | expired | revoked) | yes | |
created_at | string (date-time) | yes | |
last_used_at | string (date-time) | yes | |
expires_at | string (date-time) | yes | |
revoked_at | string (date-time) | yes | |
rotated_from | string | yes | |
secret | string | yes | The full key. Returned only in this answer and never again (null on an Idempotency-Key replay). |