Skip to content
Terra WalletDevelopers

Early access. The Terra API and SDKs may change before launch, and the SDK packages are not published yet.

View as Markdown

API reference

Early access

API keys

Secret keys for your server and publishable keys for the browser, per project and environment.

Authentication: Dashboard session.

Guide: Authentication

MethodPathSummary
GET/v1/projects/{id}/keysKeys of a project (metadata only)
POST/v1/projects/{id}/keysCreate 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}/rotateRotate 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#

NameTypeRequiredNotes
X-Terra-OrgstringnoDashboard sessions: the organization to act for (org_...). API keys carry their own.

Path parameters#

NameTypeRequiredNotes
idstringyesproj_...

Query parameters#

NameTypeRequiredNotes
limitintegerno
starting_afterstringno

Response#

Status 200.

NameTypeRequiredNotes
dataarray of objectyes
has_morebooleanyes
next_cursorstringyes

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#

NameTypeRequiredNotes
X-Terra-OrgstringnoDashboard sessions: the organization to act for (org_...). API keys carry their own.
Idempotency-Keystringyes8 to 128 characters, kept 24 hours.

Path parameters#

NameTypeRequiredNotes
idstringyesproj_...

Request body#

NameTypeRequiredNotes
environmentstring (test | live)yes
typestring (secret | publishable)yes
labelstringyeslength 1 to 80
scopesarray of stringyes

Response#

Status 201.

NameTypeRequiredNotes
idstringyes
objectstring (api_key)yes
project_idstringyes
environmentstring (test | live)yes
typestring (secret | publishable)yes
labelstringyes
scopesarray of stringyes
prefixstringyes
statusstring (active | expiring | expired | revoked)yes
created_atstring (date-time)yes
last_used_atstring (date-time)yes
expires_atstring (date-time)yes
revoked_atstring (date-time)yes
rotated_fromstringyes
secretstringyesThe 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#

NameTypeRequiredNotes
X-Terra-OrgstringnoDashboard sessions: the organization to act for (org_...). API keys carry their own.

Path parameters#

NameTypeRequiredNotes
idstringyeskey_...

Response#

Status 200.

NameTypeRequiredNotes
idstringyes
objectstring (api_key)yes
project_idstringyes
environmentstring (test | live)yes
typestring (secret | publishable)yes
labelstringyes
scopesarray of stringyes
prefixstringyes
statusstring (active | expiring | expired | revoked)yes
created_atstring (date-time)yes
last_used_atstring (date-time)yes
expires_atstring (date-time)yes
revoked_atstring (date-time)yes
rotated_fromstringyes

DELETE/v1/keys/{id}#

Revoke a key (takes effect on the next request)

  • Operation id: PlatformKeysController_revoke (contract name: revokeApiKey)
  • Authentication: Dashboard session

Headers#

NameTypeRequiredNotes
X-Terra-OrgstringnoDashboard sessions: the organization to act for (org_...). API keys carry their own.

Path parameters#

NameTypeRequiredNotes
idstringyeskey_...

Response#

Status 200.

NameTypeRequiredNotes
idstringyes
objectstring (api_key)yes
project_idstringyes
environmentstring (test | live)yes
typestring (secret | publishable)yes
labelstringyes
scopesarray of stringyes
prefixstringyes
statusstring (active | expiring | expired | revoked)yes
created_atstring (date-time)yes
last_used_atstring (date-time)yes
expires_atstring (date-time)yes
revoked_atstring (date-time)yes
rotated_fromstringyes

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#

NameTypeRequiredNotes
X-Terra-OrgstringnoDashboard sessions: the organization to act for (org_...). API keys carry their own.
Idempotency-Keystringyes8 to 128 characters, kept 24 hours.

Path parameters#

NameTypeRequiredNotes
idstringyeskey_...

Request body#

NameTypeRequiredNotes
grace_period_sintegerno0 to 604800

Response#

Status 201.

NameTypeRequiredNotes
idstringyes
objectstring (api_key)yes
project_idstringyes
environmentstring (test | live)yes
typestring (secret | publishable)yes
labelstringyes
scopesarray of stringyes
prefixstringyes
statusstring (active | expiring | expired | revoked)yes
created_atstring (date-time)yes
last_used_atstring (date-time)yes
expires_atstring (date-time)yes
revoked_atstring (date-time)yes
rotated_fromstringyes
secretstringyesThe full key. Returned only in this answer and never again (null on an Idempotency-Key replay).