๐ Access Control in SPACE
SPACE implements a hierarchical Role-Based Access Control (RBAC) model. The system distinguishes between platform-level access (User API Keys) and tenant-level access (Organization API Keys and Member Roles).
Access is managed through two distinct credential types:
- User API Keys: Assigned to individuals for manual management via the SPACE UI.
- Organization API Keys: Assigned to microservices or components for programmatic integration.
๐ Authentication Typesโ
All requests to the SPACE API (excluding healthchecks and authentication endpoints) must include the x-api-key header.
1. User API Keys (usr_...)โ
Obtained via POST /users/authenticate using a username and password. These keys are used to manage the platform infrastructure.
- Purpose: Manage user accounts, organizations, services and pricing from the SPACE UI.
- Obtaining: Authenticate via
POST /users/authenticateendpoint with username and password - Usage: Include in
x-api-keyheader for requests - Accessible Roles:
ADMIN: Global system access. Can manage all users, organizations, and system-wide configurations (e.g., cache).USER: Restricted access. Can manage their own account and organizations where they hold a membership.
- Access Pattern: Can access
/users/**and/organizations/**routes - Example Use Cases:
- Creating services
- Managing organizations and their members
- Viewing analytics
2. Organization API Keys (org_...)โ
Generated within an organization's settings for service-to-service communication. They are restricted to the context of a single organization.
- Purpose: Perform programmatic operations within an organization's context
- Obtaining: Created by organization owners/admins/managers via
POST /organizations/:organizationId/api-keys - Usage: Include in
x-api-keyheader for requests - Accessible Scopes:
ALL: Full access to organization resources and management operationsMANAGEMENT: Full access to organization resources and limited management operationsEVALUATION: Read-only access to services/pricings and feature evaluation
- Access Pattern: Can access
/services/**,/contracts/**,/features/**routes
๐ฅ Organization Member Rolesโ
When a platform USER is added to an organization, they are assigned one of the following roles. These roles determine UI permissions and User-Key API access within that organization.
| Role | Permissions |
|---|---|
| OWNER | Absolute control: Add/remove members, manage all API keys, delete the organization, and transfer ownership. |
| ADMIN | Full control: Same as OWNER, except cannot transfer organization ownership. |
| MANAGER | Operational control: Manage services and contracts. Can add/remove members with MANAGER or EVALUATOR roles. |
| EVALUATOR | Read-only access: View services, pricings, and perform feature evaluations. |
๐ Permission Matrix by Categoryโ
๐ค User Managementโ
Requires a User API Key.
| Endpoint | Public | USER Role | ADMIN Role |
|---|---|---|---|
POST /users/authenticate | โ | โ | โ |
POST /users | โ | โ | โ |
GET /users (List) | โ | โ | โ |
GET /users/me | โ | โ | โ |
GET /users/{username} | โ | โ | โ |
PUT /users/{username}/api-key | โ | โ | โ |
PUT /users/{username}/role | โ | โ | โ |
DELETE /users/{username} | โ | โ | โ |
๐ข Organization Managementโ
Requires a User API Key.
| Endpoint | Public | USER Role | ADMIN Role |
|---|---|---|---|
GET /organizations | โ | โ (Own) | โ (All) |
POST /organizations | โ | โ | โ |
GET /organizations/{id} | โ | โ (Own) | โ (All) |
PUT /organizations/{id} | โ | โ (Own) | โ (All) |
DELETE /organizations/{id} | โ | โ (Own) | โ (All) |
Only if the user is an OWNER, ADMIN or MANAGER of that organization.
Only if the user is an OWNER of that organization, and the organization is not the default one.
๐ฅ Organization Members & ๐ API Keysโ
Requires a User API Key
1. Permissions Matrix (Who can call what)โ
| Endpoint | EVALUATOR | MANAGER | OWNER / ADMIN | SPACE ADMIN |
|---|---|---|---|---|
POST /organizations/{id}/members | โ | โ | โ | โ |
PUT /organizations/{id}/members/{username} | โ | โ | โ | โ |
POST /organizations/{id}/api-keys | โ | โ | โ | โ |
DELETE /organizations/{id}/api-keys/{apiKeyId} | โ | โ | โ | โ |
2. Role-Specific Constraints (What each role is allowed to do)โ
MANAGER
- Can manage only
MANAGERandEVALUATORmembers - Cannot assign
ADMINorOWNERroles - API keys:
- Can create keys with
EVALUATIONandMANAGEMENTscopes - Can delete only non-
ALLscope keys
- Can create keys with
ADMIN
- Can manage non-
OWNERmembers - Cannot assign
ADMINorOWNERroles - Can add:
MANAGER,EVALUATOR - API keys:
- Can create and delete any key
OWNER
- Can manage all members except themselves
- Can assign any role except
OWNER - Can add:
ADMIN,MANAGER,EVALUATOR - API keys:
- Can create and delete any key
SPACE ADMIN
- Can manage any organization
- Cannot assign or modify
OWNERrole - API keys:
- Can create and delete any key
3. Endpoint-Specific Rulesโ
POST /organizations/{id}/members
- Target roles must comply with caller permissions
PUT /organizations/{id}/members/{username}
- Target user must already belong to the organization
- New role must differ from current role
OWNERrole cannot be assigned- Existing
OWNERcannot be modified
POST /organizations/{id}/api-keys
- Scope must comply with caller permissions
DELETE /organizations/{id}/api-keys/{apiKeyId}
MANAGERcan only delete API keys that do not haveALLscope- All other roles with access can delete any API key
๐ ๏ธ Services & ๐ Contractsโ
User API Key โ /organizations/{id}/** ยท Organization API Key โ /services/**, /contracts/**
| Endpoint | EVALUATOR / Scope EVAL | MANAGER / Scope MGMT | ADMIN / Scope ALL |
|---|---|---|---|
GET /organizations/{id}/services | โ | โ | โ |
POST /organizations/{id}/services | โ | โ | โ |
DELETE /organizations/{id}/services | โ | โ | โ |
GET /organizations/{id}/services/{serviceName} | โ | โ | โ |
PUT /organizations/{id}/services/{serviceName} | โ | โ | โ |
DELETE /organizations/{id}/services/{serviceName} | โ | โ | โ |
GET /organizations/{id}/services/{serviceName}/pricings | โ | โ | โ |
POST /organizations/{id}/services/{serviceName}/pricings | โ | โ | โ |
GET /organizations/{id}/services/{serviceName}/pricings/{pricingVersion} | โ | โ | โ |
PUT /organizations/{id}/services/{serviceName}/pricings/{pricingVersion} | โ | โ | โ |
DELETE /organizations/{id}/services/{serviceName}/pricings/{pricingVersion} | โ | โ | โ |
GET /organizations/{id}/contracts | โ | โ | โ |
POST /organizations/{id}/contracts | โ | โ | โ |
PUT /organizations/{id}/contracts | โ | โ | โ (User ADMIN / Org Key) |
DELETE /organizations/{id}/contracts | โ | โ | โ |
GET /organizations/{id}/contracts/{userId} | โ | โ | โ |
PUT /organizations/{id}/contracts/{userId} | โ | โ | โ |
DELETE /organizations/{id}/contracts/{userId} | โ | โ | โ |
GET /services | โ (User Key) / โ (Org Key) | โ (User Key) / โ (Org Key) | โ (User ADMIN / Org Key) |
POST /services | โ | โ (Org Key) | โ (Org Key) |
DELETE /services | โ | โ | โ (Org Key ALL / User ADMIN) |
GET /services/{serviceName} | โ | โ (Org Key) | โ (Org Key) |
PUT /services/{serviceName} | โ | โ (Org Key) | โ (Org Key) |
DELETE /services/{serviceName} | โ | โ | โ (Org Key ALL) |
GET /services/{serviceName}/pricings | โ | โ (Org Key) | โ (Org Key) |
POST /services/{serviceName}/pricings | โ | โ (Org Key) | โ (Org Key) |
GET /services/{serviceName}/pricings/{pricingVersion} | โ | โ (Org Key) | โ (Org Key) |
PUT /services/{serviceName}/pricings/{pricingVersion} | โ | โ (Org Key) | โ (Org Key) |
DELETE /services/{serviceName}/pricings/{pricingVersion} | โ | โ | โ (Org Key ALL) |
GET /contracts | โ | โ (Org Key) | โ (Org Key / User ADMIN) |
POST /contracts | โ | โ (Org Key) | โ (Org Key / User ADMIN) |
PUT /contracts | โ | โ (Org Key) | โ (Org Key / User ADMIN) |
DELETE /contracts | โ | โ | โ (Org Key ALL / User ADMIN) |
PUT /contracts/billingPeriod | โ | โ (Org Key) | โ (Org Key / User ADMIN) |
GET /contracts/{userId} | โ | โ (Org Key) | โ (Org Key / User ADMIN) |
PUT /contracts/{userId} | โ | โ (Org Key) | โ (Org Key / User ADMIN) |
DELETE /contracts/{userId} | โ | โ | โ (Org Key ALL / User ADMIN) |
PUT /contracts/{userId}/usageLevels | โ | โ (Org Key) | โ (Org Key / User ADMIN) |
PUT /contracts/{userId}/userContact | โ | โ (Org Key) | โ (Org Key / User ADMIN) |
PUT /contracts/{userId}/billingPeriod | โ | โ (Org Key) | โ (Org Key / User ADMIN) |
๐๏ธ Feature Evaluationโ
Strictly restricted to Organization API Keys to ensure enforcement by the consuming SaaS components.
| Endpoint | Scope EVALUATION | Scope MANAGEMENT | Scope ALL |
|---|---|---|---|
GET /features | โ | โ | โ |
POST /features/{userId} | โ | โ | โ |
POST /features/{userId}/pricing-token | โ | โ | โ |
POST /features/{userId}/{featureId} | โ | โ | โ |
๐ System & Analyticsโ
- Analytics: Accessible by
USER/ADMIN(User Keys) and allOrganization Keys. - Cache Management: Restricted exclusively to platform ADMIN roles.
- Healthcheck & Events: Public endpoints โ .
For backend microservices performing access evaluation, it is recommended to use an Organization API Key with EVALUATION scope by default.
Exceptions apply to microservices responsible for subscription management or authentication, which require MANAGEMENT scope due to their need to perform state-modifying operations.
This approach enforces the principle of least privilege by restricting write capabilities to only those components that strictly require them.