Create Service Key
Create a new service API key.
Creates a service account key that can be used for service-to-service authentication. The plaintext key is only returned in this response and cannot be retrieved later.
Args: request: Key creation parameters (name, multi_tenant, permissions) admin_key: Validated admin API key (from dependency) db: Database session
Returns: CreateServiceKeyResponse with key details including plaintext
Raises: 409: If key with same name already exists
Parameters
Section titled “ Parameters ”Header Parameters
Section titled “Header Parameters ”Request Body required
Section titled “Request Body required ”Request schema for creating a service API key (FR-CREATE-001, FR-CREATE-002).
Attributes: name: Human-readable key name (e.g., ‘n8n-integration’) multi_tenant: Enable multi-tenant token requests permissions: Service permissions (e.g., [‘admin:keys’]) business_id: Business context UUID (defaults to system business)
Responses
Section titled “ Responses ”Service key created successfully
Response schema for service key creation (FR-CREATE-003).
NOTE: api_key is only returned at creation time and cannot be retrieved later.
Attributes: id: Key UUID name: Key name api_key: Plaintext key (shown once - store securely!) created_at: Creation timestamp multi_tenant: Multi-tenant enabled permissions: Service permissions
object
Key UUID
Key name
Plaintext key (shown once - store securely!)
Creation timestamp
Multi-tenant enabled
Service permissions
Invalid API key
Standard error response for Admin API.
Attributes: error: Error code (e.g., ‘key_exists’, ‘permission_denied’) message: Human-readable error message
object
Error code
Human-readable error message
Missing admin:keys permission
Standard error response for Admin API.
Attributes: error: Error code (e.g., ‘key_exists’, ‘permission_denied’) message: Human-readable error message
object
Error code
Human-readable error message
Key with name already exists
Standard error response for Admin API.
Attributes: error: Error code (e.g., ‘key_exists’, ‘permission_denied’) message: Human-readable error message
object
Error code
Human-readable error message
Validation Error
object
object
object
Rate limited
Standard error response for Admin API.
Attributes: error: Error code (e.g., ‘key_exists’, ‘permission_denied’) message: Human-readable error message
object
Error code
Human-readable error message