Docs
Account, keys and webhooks ›

Get api key

GET/v1/api-keys/{id}

One key.

RequestTypeScript
  1. import { Agental } from "agental-sdk";
  2. const agental = new Agental();
  3. const key = await agental.apiKeys.get("key_9b1c7e2f4a6d8053");
Answer200 OK · ApiKey
  1. {
  2. "id": string,
  3. "name": string,
  4. "prefix": string | null,
  5. "createdAt": string,
  6. "seesAll": boolean,
  7. "preset": "read-only" | "full-sandbox" | "ci" | "admin" | "null" | null,
  8. "actions": string[],
  9. "sandboxIds": string[],
  10. "templateIds": string[],
  11. … 6 more
  12. }

The key.

Path

idrequired
string
e.g. "key_38b536dc2eabdb52"

Headers

Authorizationrequired
Bearer key
An API key that may make this call.

Returns

200 The key. The secret is never returned.

ApiKey15 fields
id
string
name
string
prefix
stringnull
The first characters of the secret, to tell keys apart by.
More Null for a key from before they were kept.
createdAt
string
seesAll
boolean
True for a key of whoever runs the service, which sees every account.
preset
read-onlyfull-sandboxciadminnullnull
The preset the key was made with.
More Null for one made with its actions named.
actions
string[]
What the key may do, as it was made: a preset is written out into its actions then, so a preset that grows later does not widen it.
More * is everything.
sandboxIds
string[]
The sandboxes the key is limited to, with templateIds.
More Empty, with templateIds empty too, is every sandbox of the account.
templateIds
string[]
The templates the key is limited to: it reaches them and every sandbox on them.
More Empty is every template, and, with sandboxIds empty too, every sandbox.
expiresAt
stringnull
When the key stops working.
More Null is never.
allowFrom
string[]
The addresses and ranges the key may be used from.
More Empty is anywhere.
lastUsedAt
stringnull
When the key was last used, to the minute: it is written once a minute at most.
More Null if never.
lastUsedFrom
stringnull
The address it was last used from.
organizationId
stringnull
The organization the key acts in: the one it was made in, for good.
More Null for a key of whoever runs the service.
createdBy
stringnull
The account that made it.
More In a team, its owners and admins see every key of the team, and a member only those they made.

Errors and other answers

404 not_found.

Every error answers { "error": { "code", "message" } }; a key without the action a call needs answers 403 key_action_forbidden, naming it.