Organization API
API endpoints for managing organizations in multi-tenant CodeSpar deployments, including creating orgs, listing orgs, and viewing org details with projects.
Organization API
CodeSpar supports multi-tenant deployments where multiple organizations share a single instance. Each organization has isolated projects, agents, and audit trails.
List Organizations
Retrieve all organizations.
Request
Response
Response Schema
| Field | Type | Description |
|---|---|---|
id | string | Unique organization identifier |
name | string | Display name |
slug | string | URL-safe slug |
projectCount | number | Number of projects in this org |
memberCount | number | Number of members |
createdAt | string | ISO 8601 creation timestamp |
Create Organization
Create a new organization.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Organization display name |
slug | string | No | URL-safe slug (auto-generated from name if omitted) |
Request
Response
Error Responses
Duplicate slug:
Missing name:
Get Organization Details
Retrieve an organization's details including its projects.
Request
Response
Response Schema (Details)
Includes all fields from the list response, plus:
| Field | Type | Description |
|---|---|---|
projects | object[] | Array of projects in this org |
projects[].id | string | Project identifier |
projects[].name | string | Project display name |
projects[].repo | string | Linked GitHub repo |
projects[].agentId | string | Associated agent identifier |
projects[].agentStatus | string | Agent status: ACTIVE, IDLE, SUSPENDED |
projects[].autonomyLevel | number | Agent autonomy level (0–5) |
projects[].createdAt | string | ISO 8601 creation timestamp |
members | object[] | Array of org members |
members[].identityId | string | Member identity ID |
members[].displayName | string | Member display name |
members[].role | string | RBAC role within this org |
members[].joinedAt | string | When the member joined |
Error Response
File Storage Structure
Each organization gets an isolated directory under the CodeSpar storage root:
This ensures complete data isolation between organizations.
Next Steps
- Multi-Tenant Guide — Setting up organizations
- Project API — Managing projects within orgs
- Security — RBAC roles per organization