Create a key

POST /keys

Create a key

application/json

Body

Create a key

  • name string Required
  • scopes array[string]

    An authorization scope associated with a key. Any request that is signed by a JWT with this key will have access to the scopes associated with that key.

    Values are events.write, events.read, state.read, instances.read, instances.write, instances.admin, machines.read, machines.write, machines.admin, machine-versions.read, machine-versions.write, analytics.read, org.read, org.write, org.keys.write, org-members.write, logs.read, or tokens.admin.

  • use string

    The intended use for this key. This is a shorthand way to set a reasonable set of scopes. You must either pass scopes or use.

    Values are production or ci.

Responses

  • 200

    New key

    Hide response attributes Show response attributes object
    • id string Required

      An identifier for a key

    • key string Required
POST /keys
curl \
 -X POST https://api.statebacked.dev/keys \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"name":"string","scopes":["events.write"],"use":"production"}'
Request example
{
  "name": "string",
  "scopes": [
    "events.write"
  ],
  "use": "production"
}
Response examples (200)
{
  "id": "sbk_nXzdtCxESemgtxS5JX-LrA",
  "key": "string"
}