Entity API Keys
Entity API Keys
Manage entity-scoped API keys (ek_* prefix) for userless access to entities.
The Entity API Key object
Attributes
API key (ek_* prefix for entity-scoped keys)
Friendly name for the API key
Environment the key is valid for
Possible values: "live", "sandbox"
Create entity API key
/entities/api-keysCreate a new entity-scoped API key (ek_* prefix). This key can only access this specific entity.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Body parameters
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",
"ttl": 0
}'Returns
API key (ek_* prefix for entity-scoped keys)
Friendly name for the API key
{
"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",
"expires_at": null
}List entity API keys
/entities/api-keysRetrieve all API keys for the current entity. Keys are masked for security.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
curl "https://eu.spaceinvoices.com/entities/api-keys" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "x-entity-id: YOUR_ENTITY_ID"Returns
{
"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",
"expires_at": null
}
]
}Delete entity API key
/entities/api-keys/{id}Permanently delete an entity API key. This action cannot be undone.
Header parameters
Optional entity ID specifying which entity context to use for this operation.
Path parameters
Entity API key ID (format: ek_{environment}_{hex})
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
{
"message": "API key deleted"
}