curl -X POST "https://developer.encrata.com/api/account/keys" \
-H "Authorization: Bearer enc_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"name": "Production"}'
{
"id": "a1b2c3d4-0000-4000-8000-000000000000",
"name": "Production",
"key": "enc_1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d",
"key_prefix": "enc_1a2b3c4d",
"is_active": true
}
{
"success": false,
"result": { "code": "conflict" },
"message": "An API key with that name already exists.",
"request_id": "req_7f3a9c21",
"error": "An API key with that name already exists."
}
API Keys
Create API Key
Create a new API key for the authenticated user.
POST
/
api
/
account
/
keys
curl -X POST "https://developer.encrata.com/api/account/keys" \
-H "Authorization: Bearer enc_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"name": "Production"}'
{
"id": "a1b2c3d4-0000-4000-8000-000000000000",
"name": "Production",
"key": "enc_1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d",
"key_prefix": "enc_1a2b3c4d",
"is_active": true
}
{
"success": false,
"result": { "code": "conflict" },
"message": "An API key with that name already exists.",
"request_id": "req_7f3a9c21",
"error": "An API key with that name already exists."
}
Authentication
Requires an API key in theAuthorization header.
Authorization: Bearer enc_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Request
A display name for the key (e.g.
Production, Development). Trimmed,
non-blank, and at most 100 bytes.A workspace can create 50 keys per day. Past that, the request returns
429.Example request
curl -X POST "https://developer.encrata.com/api/account/keys" \
-H "Authorization: Bearer enc_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"name": "Production"}'
Response
Treat the key as a secret from the moment it is created. A non-readonly
member of the workspace can read a revealable key again with
GET /api/account/keys/reveal?id={id}.Errors
Errors return the shared envelope withsuccess, result.code, message, and
request_id. A legacy error key is included alongside it.
| Status | result.code | Cause |
|---|---|---|
400 | bad_request | name is missing, blank, or longer than 100 bytes |
405 | method_not_allowed | The request did not use POST |
409 | conflict | The request conflicts with the current key state |
curl -X POST "https://developer.encrata.com/api/account/keys" \
-H "Authorization: Bearer enc_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"name": "Production"}'
{
"id": "a1b2c3d4-0000-4000-8000-000000000000",
"name": "Production",
"key": "enc_1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d",
"key_prefix": "enc_1a2b3c4d",
"is_active": true
}
{
"success": false,
"result": { "code": "conflict" },
"message": "An API key with that name already exists.",
"request_id": "req_7f3a9c21",
"error": "An API key with that name already exists."
}
Was this page helpful?