Skip to main content
Version: 2.0.1

๐Ÿ” 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).

Core Architecture

Access is managed through two distinct credential types:

  1. User API Keys: Assigned to individuals for manual management via the SPACE UI.
  2. 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/authenticate endpoint with username and password
  • Usage: Include in x-api-key header 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-key header for requests
  • Accessible Scopes:
    • ALL: Full access to organization resources and management operations
    • MANAGEMENT: Full access to organization resources and limited management operations
    • EVALUATION: 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.

RolePermissions
OWNERAbsolute control: Add/remove members, manage all API keys, delete the organization, and transfer ownership.
ADMINFull control: Same as OWNER, except cannot transfer organization ownership.
MANAGEROperational control: Manage services and contracts. Can add/remove members with MANAGER or EVALUATOR roles.
EVALUATORRead-only access: View services, pricings, and perform feature evaluations.

๐Ÿ“Š Permission Matrix by Categoryโ€‹

๐Ÿ‘ค User Managementโ€‹

Requires a User API Key.

EndpointPublicUSER RoleADMIN 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.

EndpointPublicUSER RoleADMIN Role
GET /organizationsโŒโœ… (Own)โœ… (All)
POST /organizationsโŒโœ…โœ…
GET /organizations/{id}โŒโœ… (Own)โœ… (All)
PUT /organizations/{id}โŒโœ… (Own1^1)โœ… (All)
DELETE /organizations/{id}โŒโœ… (Own2^2)โœ… (All)

1^1 Only if the user is an OWNER, ADMIN or MANAGER of that organization.

2^2 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)โ€‹

EndpointEVALUATORMANAGEROWNER / ADMINSPACE 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 MANAGER and EVALUATOR members
  • Cannot assign ADMIN or OWNER roles
  • API keys:
    • Can create keys with EVALUATION and MANAGEMENT scopes
    • Can delete only non-ALL scope keys

ADMIN

  • Can manage non-OWNER members
  • Cannot assign ADMIN or OWNER roles
  • 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 OWNER role
  • 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
  • OWNER role cannot be assigned
  • Existing OWNER cannot be modified

POST /organizations/{id}/api-keys

  • Scope must comply with caller permissions

DELETE /organizations/{id}/api-keys/{apiKeyId}

  • MANAGER can only delete API keys that do not have ALL scope
  • All other roles with access can delete any API key

๐Ÿ› ๏ธ Services & ๐Ÿ“„ Contractsโ€‹

User API Key โ†’ /organizations/{id}/** ยท Organization API Key โ†’ /services/**, /contracts/**

EndpointEVALUATOR / Scope EVALMANAGER / Scope MGMTADMIN / 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.

EndpointScope EVALUATIONScope MANAGEMENTScope 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 all Organization Keys.
  • Cache Management: Restricted exclusively to platform ADMIN roles.
  • Healthcheck & Events: Public endpoints โœ….

Quick Implementation Note

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.