Skip to content

Entity API Keys

Entity API Keys

Manage entity-scoped API keys (ek_* prefix) for userless access to entities.

The Entity API Key object

object

Attributes

idstring

API key (ek_* prefix for entity-scoped keys)

Other attributes
entity_idstring
namestring
environmentstring
created_atstring<date-time>

Create entity API key

POST/entities/api-keys

Create a new entity-scoped API key (ek_* prefix). This key can only access this specific entity.

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Optional - defaults to the first created entity if not provided.

Body parameters

namestringoptional

Friendly name for the API key

curl -X POST "https://eu.spaceinvoices.com/entities/api-keys" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "x-entity-id: YOUR_ENTITY_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "string"
  }'

Returns

idstring

API key (ek_* prefix for entity-scoped keys)

namestring

Friendly name for the API key

Other parameters
entity_idstring
environmentstring
created_atstring<date-time>
json
{
  "id": "ek_sandbox_abc123def456789012345678abcd1234",
  "entity_id": "ent_abc123def456",
  "name": "Dashboard Access",
  "environment": "sandbox",
  "prefix_hint": "ek_sandbox_abc...234",
  "created_at": "2024-01-01T00:00:00.000Z",
  "updated_at": "2024-01-01T00:00:00.000Z"
}

List entity API keys

GET/entities/api-keys

Retrieve all API keys for the current entity. Keys are masked for security.

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Optional - defaults to the first created entity if not provided.

curl "https://eu.spaceinvoices.com/entities/api-keys" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "x-entity-id: YOUR_ENTITY_ID"

Returns

dataarray
json
{
  "data": [
    {
      "id": "ek_sandbox_abc123def456789012345678abcd1234",
      "entity_id": "ent_abc123def456",
      "name": "Dashboard Access",
      "environment": "sandbox",
      "prefix_hint": "ek_sandbox_abc...234",
      "created_at": "2024-01-01T00:00:00.000Z",
      "updated_at": "2024-01-01T00:00:00.000Z"
    }
  ]
}

Delete entity API key

DELETE/entities/api-keys/{id}

Permanently delete an entity API key. This action cannot be undone.

Header parameters

entity_idstringoptional

Optional entity ID specifying which entity context to use for this operation.

Path parameters

idstringrequired

Entity API key ID (format: ek_{environment}_{hex32})

curl -X DELETE "https://eu.spaceinvoices.com/entities/api-keys/{id}" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "x-entity-id: YOUR_ENTITY_ID"

Returns

messagestring
json
{
  "message": "API key deleted"
}