workspaces API

workspaces

Organize projects into workspaces within an org.

GET /v1/workspaces

List all workspaces for the authenticated org

Auth: Admin API key

Responses

200 List of workspaces
workspaces
- Array of workspace objects
401 Missing or invalid API key

Example

Request
curl https://api.tripswitch.dev/v1/workspaces \
  -H "Authorization: Bearer YOUR_ADMIN_API_KEY"
Response
{
  "workspaces": [
    {
      "id": "770e8400-e29b-41d4-a716-446655440000",
      "name": "Production",
      "slug": "production",
      "org_id": "880e8400-e29b-41d4-a716-446655440000",
      "inserted_at": "2024-01-15T10:30:00Z"
    }
  ]
}
GET /v1/workspaces/:id

Retrieve a workspace

Auth: Admin API key

Parameters

Name In Type Required Description
id path uuid Yes Workspace ID

Responses

200 Workspace details
id
- Workspace UUID
inserted_at
- Creation timestamp
name
- Workspace name
org_id
- UUID of the owning org
slug
- Workspace slug
404 Workspace not found

Example

Request
curl https://api.tripswitch.dev/v1/workspaces/WORKSPACE_ID \
  -H "Authorization: Bearer YOUR_ADMIN_API_KEY"
Response
{
  "id": "770e8400-e29b-41d4-a716-446655440000",
  "name": "Production",
  "slug": "production",
  "org_id": "880e8400-e29b-41d4-a716-446655440000",
  "inserted_at": "2024-01-15T10:30:00Z"
}
POST /v1/workspaces

Create a new workspace

Auth: Admin API key

Request Body

name *
string Human-readable workspace name
slug *
string URL-safe identifier (lowercase, hyphens allowed)

Responses

201 Workspace created successfully
id
- UUID of the created workspace
inserted_at
- Creation timestamp
name
- Workspace name
org_id
- UUID of the owning org
slug
- Workspace slug
400 Invalid request payload
401 Missing or invalid API key
422 Validation failed (e.g. duplicate slug)

Example

Request
curl -X POST https://api.tripswitch.dev/v1/workspaces \
  -H "Authorization: Bearer YOUR_ADMIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Production", "slug": "production"}'
Response
{
  "id": "770e8400-e29b-41d4-a716-446655440000",
  "name": "Production",
  "slug": "production",
  "org_id": "880e8400-e29b-41d4-a716-446655440000",
  "inserted_at": "2024-01-15T10:30:00Z"
}
PATCH /v1/workspaces/:id

Update a workspace

Auth: Admin API key

Parameters

Name In Type Required Description
id path uuid Yes Workspace ID

Request Body

name
string New workspace name
slug
string New URL-safe slug

Responses

200 Workspace updated
id
- Workspace UUID
inserted_at
- Creation timestamp
name
- Updated name
org_id
- UUID of the owning org
slug
- Updated slug
404 Workspace not found
422 Validation failed

Example

Request
curl -X PATCH https://api.tripswitch.dev/v1/workspaces/WORKSPACE_ID \
  -H "Authorization: Bearer YOUR_ADMIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Staging"}'
Response
{
  "id": "770e8400-e29b-41d4-a716-446655440000",
  "name": "Staging",
  "slug": "production",
  "org_id": "880e8400-e29b-41d4-a716-446655440000",
  "inserted_at": "2024-01-15T10:30:00Z"
}
DELETE /v1/workspaces/:id

Delete a workspace

Auth: Admin API key

Parameters

Name In Type Required Description
id path uuid Yes Workspace ID

Responses

204 Workspace deleted
404 Workspace not found

Example

Request
curl -X DELETE https://api.tripswitch.dev/v1/workspaces/WORKSPACE_ID \
  -H "Authorization: Bearer YOUR_ADMIN_API_KEY"
Response