Skip to main content

REST: workspaces

All endpoints require a valid bearer token. Workspace resource endpoints also require membership in the selected workspace.

Discover access before using IDs​

Use GET /api/workspaces to discover this account's memberships. Workspace IDs are not account IDs and clients must not derive one from the other. Capacity belongs to the workspace rather than to the member who imported a route.

For repeatable automation, send an explicit X-Workspace-ID on operational resource requests. POST /workspaces/{id}/select changes an account-wide default selection; an explicit header avoids relying on that mutable preference.

WorkflowRequests
Find/read a workspaceGET /workspaces, then GET /workspaces/{id}.
Create and select onePOST /workspaces, then POST /workspaces/{id}/select.
Invite an existing accountCreate outgoing invitation, then the recipient reads /invitations and accepts.
Open an accepted workspaceRead memberships and select explicitly. Acceptance itself does not select it.
Transfer shared ownershipPromote an existing member to owner before removing the final old owner.

All paths in this table are under /api. The endpoint sections below contain request bodies and role restrictions. Workspace workflows explain the same operations in the UI.

Workspace selection​

Send a positive workspace ID on workspace-scoped requests:

Authorization: Bearer <token>
X-Workspace-ID: 42

If X-Workspace-ID is omitted, Maglane selects the membership marked as the account's default. If no membership is marked as default, it uses the earliest membership. A malformed ID returns 400; an ID for which the account has no membership returns 403.

The workspace-management endpoints use the {id} path value for authorization and do not require the selection header.

GET /api/workspaces​

Lists every workspace membership for the authenticated account. The default workspace is first.

{
"workspaces": [
{
"id": 42,
"name": "Edge operations",
"personal": false,
"role": "operator",
"billing_admin": false,
"is_default": true,
"capacity": {
"active_routes": 1842,
"stored_routes": 1910,
"included_routes": 2000,
"additional_routes": 0,
"overage_routes": 0,
"activation_limit": 2000,
"overage_mode": "disabled"
},
"subscription": {
"plan_code": "self-hosted",
"status": "active",
"included_operators": 0,
"statistics_retention_days": 0,
"minimum_check_interval_seconds": 0,
"monthly_checks": 0,
"monthly_scrapes": 0,
"unlimited_checks": false,
"unlimited_scrapes": false,
"cancel_at_period_end": false
},
"allowances": {
"unlimited_checks": false,
"unlimited_scrapes": false,
"needs_check_interval": false,
"needs_scrape_interval": false,
"monthly_checks": 1500000,
"used_checks": 412880,
"checks_per_cycle": 1842,
"check_interval_seconds": 5530,
"checks_exhausted": false,
"monthly_scrapes": 3000,
"used_scrapes": 310,
"scrapes_per_cycle": 6,
"scrape_interval_seconds": 6030,
"scrapes_exhausted": false,
"requested_check_interval_seconds": 0,
"requested_scrape_interval_seconds": 0,
"minimum_check_interval_seconds": 60,
"minimum_scrape_interval_seconds": 900,
"projected_monthly_checks": 1500000,
"projected_monthly_scrapes": 3000,
"inherits_checks": true,
"inherits_scrapes": true,
"period_start": "2026-11-01T00:00:00Z",
"period_end": "2026-12-01T00:00:00Z",
"computed_at": "2026-11-12T08:31:00Z"
},
"created_at": "2026-08-24T10:00:00Z"
}
]
}

activation_limit is null for unlimited workspaces. Billing-provider customer and subscription identifiers are never returned.

subscription.monthly_checks and subscription.monthly_scrapes hold the workspace's own allowances. 0 means the workspace uses the instance default. subscription.unlimited_checks and unlimited_scrapes remove the workspace's limit. allowances.unlimited_* is the effective value, including an unlimited instance default. When it is true, monthly_* is not enforced, no run-out is reported, and needs_*_interval is true until the workspace chooses a fixed interval. Until then it runs hourly. allowances reports the effective allowance, this month's metered use and the cadence derived from them. used_checks counts every request to a judge, retries included. checks_per_cycle is active routes × enabled protocols (including tag rules on active routes) × the average requests per protocol test measured this month. These values come from the allowance snapshot each instance refreshes once a minute, plus the responding instance's own checks since then, so they can lag slightly behind other instances' use. Saving an interval or allowance refreshes the snapshot before responding. computed_at is absent until the first snapshot includes the workspace. The interval fields are 0 when an allowance is exhausted. requested_*_interval_seconds is the workspace's fixed interval, or 0 for automatic. projected_monthly_* estimates a full month's use at the current cadence. checks_run_out_at and scrapes_run_out_at appear only when a fixed interval uses up the remaining allowance before the month ends.

PUT /api/workspace/cadence​

Requires operator or higher in the selected workspace. Sets fixed check and scrape intervals in seconds. 0 means automatic.

{"check_interval_seconds": 600, "scrape_interval_seconds": 0}

Intervals below the workspace minimum (minimum_check_interval_seconds, or 900 for scrapes) or above 31 days return 400. So does 0 for an interval whose allowance has no limit, because automatic spreading needs a limit. A fixed interval runs until the monthly allowance is used up. The 200 response echoes the intervals and lists warnings when an interval needs more than the allowance:

{
"check_interval_seconds": 600,
"scrape_interval_seconds": 0,
"warnings": ["This interval needs about 3240000 checks a month, more than the allowance of 1500000. Checks stop when the allowance is used up."]
}

See Check and scrape allowances.

POST /api/workspaces​

Creates a workspace with the authenticated account as owner and billing administrator. New workspaces receive the instance's default judges, scrape sources, operational settings, and self-hosted entitlement.

{"name": "Edge operations"}

Returns the workspace with 201. Names are whitespace-normalized, required, and limited to 120 characters.

GET /api/workspaces/{id}​

Requires viewer or higher. Returns one workspace in the same shape as the list response item.

PATCH /api/workspaces/{id}​

Requires admin or owner. Renames a workspace and returns 204.

{"name": "Production routes"}

POST /api/workspaces/{id}/select​

Requires viewer or higher. Marks the membership as the authenticated account's default and returns 204. This changes only that account's default selection.

Invitations​

Invitations are pending offers for existing Maglane accounts. They grant no workspace access before acceptance and do not use transferable bearer tokens.

GET /api/workspaces/{id}/invitations​

Requires admin or owner. Lists non-expired outgoing invitations owned by the workspace.

{
"invitations": [
{
"id": 91,
"workspace_id": 42,
"workspace_name": "Edge operations",
"invitee_user_id": 17,
"invitee_email": "[email protected]",
"inviter_user_id": 7,
"inviter_email": "[email protected]",
"role": "operator",
"billing_admin": false,
"notification_status": "queued",
"expires_at": "2026-08-31T10:15:00Z",
"created_at": "2026-08-24T10:15:00Z",
"updated_at": "2026-08-24T10:15:00Z"
}
]
}

notification_status is queued, not_configured, or failed. It reports the latest notification enqueue result; the invitation row is the source of truth.

POST /api/workspaces/{id}/invitations​

Requires admin or owner. The email must identify an existing Maglane account that is not already a member. Owners can invite admins, operators, or viewers and can grant billing access. Admins can invite operators or viewers without billing access.

{
"email": "[email protected]",
"role": "operator",
"billing_admin": false
}

Returns 201 with an invitation response:

{
"invitation": {
"id": 91,
"workspace_id": 42,
"workspace_name": "Edge operations",
"invitee_user_id": 17,
"invitee_email": "[email protected]",
"inviter_user_id": 7,
"inviter_email": "[email protected]",
"role": "operator",
"billing_admin": false,
"notification_status": "not_configured",
"expires_at": "2026-08-31T10:15:00Z",
"created_at": "2026-08-24T10:15:00Z",
"updated_at": "2026-08-24T10:15:00Z"
}
}

There can be one pending invitation per workspace and recipient account. An unknown account returns 404; an existing member or duplicate pending invitation returns 409.

If SMTP is configured, Maglane queues the invitation email after persistence. An enqueue failure does not roll back the invitation: the same 201 response includes a warning and notification_status is failed. If SMTP is not configured, no email is attempted and the invitation remains visible in the in-app inbox.

PATCH /api/workspaces/{id}/invitations/{invitationId}​

Requires admin or owner and replaces the role and billing flag.

{
"role": "viewer",
"billing_admin": false
}

Owners can edit any pending invitation. Admins can edit only operator/viewer invitations that do not include billing access, and can keep them only as operator or viewer. Returns 200 in the same response shape as creation.

Changing access does not renew expires_at. When SMTP is configured, an actual role or billing change queues an email with the subject Your Maglane workspace invitation changed. An unchanged request does not queue another email, and there is no resend endpoint.

DELETE /api/workspaces/{id}/invitations/{invitationId}​

Requires admin or owner and returns 204. Admins cannot revoke admin or billing-enabled invitations. Revocation deletes the invitation and sends no email.

GET /api/invitations​

Lists every non-expired invitation addressed to the authenticated account across workspaces. The response uses the same {"invitations": [...]} shape as the outgoing list. Membership in the inviting workspace is not required.

POST /api/invitations/{invitationId}/accept​

Only the addressed account can accept. Acceptance atomically creates the workspace membership and deletes the invitation.

{
"workspace_id": 42,
"workspace_name": "Edge operations"
}

Accepting does not select the workspace or change the account's default membership.

POST /api/invitations/{invitationId}/decline​

Only the addressed account can decline. Returns 204 and deletes the invitation.

Accepting, declining, revoking, or expiring an invitation creates no history row and sends no email. Expired invitations return 410 until cleanup removes them.

Members​

GET /api/workspaces/{id}/members​

Requires viewer or higher.

{
"members": [
{
"user_id": 7,
"email": "[email protected]",
"role": "operator",
"billing_admin": false,
"joined_at": "2026-08-24T10:15:00Z"
}
]
}

PATCH /api/workspaces/{id}/members/{userId}​

Requires admin or owner. Replaces the role and billing-administrator flag and returns 204.

{
"role": "admin",
"billing_admin": false
}

An owner can manage every member, change ownership, and change billing access. Admins can update operators and viewers only, and cannot promote a member to admin. Owners always become billing administrators. A workspace cannot lose its final owner.

DELETE /api/workspaces/{id}/members/{userId}​

Requires admin or owner and returns 204. Removing a membership never changes route capacity or deletes workspace resources. Admins can remove operators and viewers only; they cannot remove owners, admins, or billing administrators. The final owner cannot be removed, and the owner of an unshared personal workspace cannot be removed.

Managed-proxy lifecycle​

PUT /api/proxies/{id}/lifecycle​

Requires operator or higher in the selected workspace. Sets that workspace's management state for the proxy route.

{"state": "paused"}

Valid states are active, paused, and archived. Activating a route returns 409 Conflict when the workspace has reached its finite activation limit. Paused and archived routes remain stored and do not enter checker or rotator queues.