Organizations

List the organization's workspaces

GET/api/v1/organizations/{id}/workspaces

GET /organizations/{id}/workspaces
# API: no generated example for GET https://www.unitpost.com/api/v1/organizations/:id/workspaces
Response · 200
{
  "object": "list",
  "has_more": false,
  "data": [
    {
      "object": "workspace",
      "id": "id_123",
      "name": "Example",
      "slug": "string",
      "external_id": "external_123",
      "plan": "string",
      "paid_by": "workspace",
      "requires_paid_plan": false,
      "closed_at": "2026-01-01T00:00:00.000Z",
      "restorable_until": "2026-01-01T00:00:00.000Z",
      "created_at": "2026-01-01T00:00:00.000Z",
      "hosted_invoice_url": "https://example.com"
    }
  ]
}

The organization's workspaces, newest first and cursor-paginated (limit, after, before). external_id narrows to the workspace you gave that id. Takes an organization key (ok_live_…) with organizations:read.

Parameters5 fields
FieldTypeDescription
idrequiredstring · pathThe organization's id (`org_…`), from `GET /whoami` or Organization → API.
limitinteger · query—
afterstring · query—
beforestring · query—
external_idstring · query—
Response · 200 fields12 fields
FieldTypeDescription
objectrequiredenumworkspace—
idrequiredstring`ws_…`
namerequiredstring—
slugrequiredstring—
external_idrequiredstringYour own id for it, unique in the organization.
planrequiredstring`free`, or the paid plan's key.
paid_byrequiredenumworkspace | organization—
requires_paid_planrequiredbooleanNo free allowance: the Owner already has a free workspace, so it sends once a plan is bought.
closed_atrequiredstring—
restorable_untilrequiredstring—
created_atrequiredstring—
hosted_invoice_urlstringOn create only: the card asked for authentication; paying here starts the plan.
200401403404429

Create a workspace

POST/api/v1/organizations/{id}/workspaces

POST /organizations/{id}/workspaces
# API: no generated example for POST https://www.unitpost.com/api/v1/organizations/:id/workspaces
Response · 201
{
  "object": "workspace",
  "id": "id_123",
  "name": "Example",
  "slug": "string",
  "external_id": "external_123",
  "plan": "string",
  "paid_by": "workspace",
  "requires_paid_plan": false,
  "closed_at": "2026-01-01T00:00:00.000Z",
  "restorable_until": "2026-01-01T00:00:00.000Z",
  "created_at": "2026-01-01T00:00:00.000Z",
  "hosted_invoice_url": "https://example.com"
}

Create a workspace in the organization. Its Owner is the person who made the key. The plan follows the Owner's API rules (Organization → API): free, or a paid plan they allowed, billed to the organization's card within its workspace limit. Idempotency-Key is required; a retry with it returns the first result. Takes an organization key (ok_live_…) with organizations:write.

Parameters2 fields
FieldTypeDescription
idrequiredstring · pathThe organization's id (`org_…`), from `GET /whoami` or Organization → API.
Idempotency-Keyrequiredstring · headerAny unique string (1–256 characters, e.g. a UUID). Retrying with the same key and the same body within 24 hours returns the first result instead of sending again; the same key with a different body is `409 invalid_idempotent_request`, and one still in flight is `409 concurrent_idempotent_requests`.
Request body4 fields
FieldTypeDescription
namerequiredstring—
external_idstring—
planstringDefault: the Owner's default plan, else `free`.
tier_indexintegerThe paid plan's tier (default 0).
Response · 201 fields12 fields
FieldTypeDescription
objectrequiredenumworkspace—
idrequiredstring`ws_…`
namerequiredstring—
slugrequiredstring—
external_idrequiredstringYour own id for it, unique in the organization.
planrequiredstring`free`, or the paid plan's key.
paid_byrequiredenumworkspace | organization—
requires_paid_planrequiredbooleanNo free allowance: the Owner already has a free workspace, so it sends once a plan is bought.
closed_atrequiredstring—
restorable_untilrequiredstring—
created_atrequiredstring—
hosted_invoice_urlstringOn create only: the card asked for authentication; paying here starts the plan.
201400401403404409422429

Get a workspace

GET/api/v1/organizations/{id}/workspaces/{workspace_id}

GET /organizations/{id}/workspaces/{workspace_id}
# API: no generated example for GET https://www.unitpost.com/api/v1/organizations/:id/workspaces/:workspace_id
Response · 200
{
  "object": "workspace",
  "id": "id_123",
  "name": "Example",
  "slug": "string",
  "external_id": "external_123",
  "plan": "string",
  "paid_by": "workspace",
  "requires_paid_plan": false,
  "closed_at": "2026-01-01T00:00:00.000Z",
  "restorable_until": "2026-01-01T00:00:00.000Z",
  "created_at": "2026-01-01T00:00:00.000Z",
  "hosted_invoice_url": "https://example.com"
}

One of the organization's workspaces. Takes an organization key (ok_live_…) with organizations:read.

Parameters2 fields
FieldTypeDescription
idrequiredstring · pathThe organization's id (`org_…`), from `GET /whoami` or Organization → API.
workspace_idrequiredstring · pathThe workspace's id (`ws_…`).
Response · 200 fields12 fields
FieldTypeDescription
objectrequiredenumworkspace—
idrequiredstring`ws_…`
namerequiredstring—
slugrequiredstring—
external_idrequiredstringYour own id for it, unique in the organization.
planrequiredstring`free`, or the paid plan's key.
paid_byrequiredenumworkspace | organization—
requires_paid_planrequiredbooleanNo free allowance: the Owner already has a free workspace, so it sends once a plan is bought.
closed_atrequiredstring—
restorable_untilrequiredstring—
created_atrequiredstring—
hosted_invoice_urlstringOn create only: the card asked for authentication; paying here starts the plan.
200401403404429

Update a workspace

PATCH/api/v1/organizations/{id}/workspaces/{workspace_id}

PATCH /organizations/{id}/workspaces/{workspace_id}
# API: no generated example for PATCH https://www.unitpost.com/api/v1/organizations/:id/workspaces/:workspace_id
Response · 200
{
  "object": "workspace",
  "id": "id_123",
  "name": "Example",
  "slug": "string",
  "external_id": "external_123",
  "plan": "string",
  "paid_by": "workspace",
  "requires_paid_plan": false,
  "closed_at": "2026-01-01T00:00:00.000Z",
  "restorable_until": "2026-01-01T00:00:00.000Z",
  "created_at": "2026-01-01T00:00:00.000Z",
  "hosted_invoice_url": "https://example.com"
}

Rename a workspace or change its external_id (null clears it). Takes an organization key (ok_live_…) with organizations:write.

Parameters2 fields
FieldTypeDescription
idrequiredstring · pathThe organization's id (`org_…`), from `GET /whoami` or Organization → API.
workspace_idrequiredstring · pathThe workspace's id (`ws_…`).
Request body2 fields
FieldTypeDescription
namestring—
external_idstring—
Response · 200 fields12 fields
FieldTypeDescription
objectrequiredenumworkspace—
idrequiredstring`ws_…`
namerequiredstring—
slugrequiredstring—
external_idrequiredstringYour own id for it, unique in the organization.
planrequiredstring`free`, or the paid plan's key.
paid_byrequiredenumworkspace | organization—
requires_paid_planrequiredbooleanNo free allowance: the Owner already has a free workspace, so it sends once a plan is bought.
closed_atrequiredstring—
restorable_untilrequiredstring—
created_atrequiredstring—
hosted_invoice_urlstringOn create only: the card asked for authentication; paying here starts the plan.
200401403404409422429

Close a workspace

POST/api/v1/organizations/{id}/workspaces/{workspace_id}/close

POST /organizations/{id}/workspaces/{workspace_id}/close
# API: no generated example for POST https://www.unitpost.com/api/v1/organizations/:id/workspaces/:workspace_id/close
Response · 200
{
  "object": "workspace",
  "id": "id_123",
  "name": "Example",
  "slug": "string",
  "external_id": "external_123",
  "plan": "string",
  "paid_by": "workspace",
  "requires_paid_plan": false,
  "closed_at": "2026-01-01T00:00:00.000Z",
  "restorable_until": "2026-01-01T00:00:00.000Z",
  "created_at": "2026-01-01T00:00:00.000Z",
  "hosted_invoice_url": "https://example.com"
}

The workspace stops working at once: its keys are revoked, every request to it is refused and its campaigns pause. It is deleted after 30 days unless restored. Closing twice changes nothing. Takes an organization key (ok_live_…) with organizations:write.

Parameters2 fields
FieldTypeDescription
idrequiredstring · pathThe organization's id (`org_…`), from `GET /whoami` or Organization → API.
workspace_idrequiredstring · pathThe workspace's id (`ws_…`).
Response · 200 fields12 fields
FieldTypeDescription
objectrequiredenumworkspace—
idrequiredstring`ws_…`
namerequiredstring—
slugrequiredstring—
external_idrequiredstringYour own id for it, unique in the organization.
planrequiredstring`free`, or the paid plan's key.
paid_byrequiredenumworkspace | organization—
requires_paid_planrequiredbooleanNo free allowance: the Owner already has a free workspace, so it sends once a plan is bought.
closed_atrequiredstring—
restorable_untilrequiredstring—
created_atrequiredstring—
hosted_invoice_urlstringOn create only: the card asked for authentication; paying here starts the plan.
200401403404429

Restore a workspace

POST/api/v1/organizations/{id}/workspaces/{workspace_id}/restore

POST /organizations/{id}/workspaces/{workspace_id}/restore
# API: no generated example for POST https://www.unitpost.com/api/v1/organizations/:id/workspaces/:workspace_id/restore
Response · 200
{
  "object": "workspace",
  "id": "id_123",
  "name": "Example",
  "slug": "string",
  "external_id": "external_123",
  "plan": "string",
  "paid_by": "workspace",
  "requires_paid_plan": false,
  "closed_at": "2026-01-01T00:00:00.000Z",
  "restorable_until": "2026-01-01T00:00:00.000Z",
  "created_at": "2026-01-01T00:00:00.000Z",
  "hosted_invoice_url": "https://example.com"
}

Reopen a closed workspace within 30 days. Its old keys stay revoked: mint new ones. Takes an organization key (ok_live_…) with organizations:write.

Parameters2 fields
FieldTypeDescription
idrequiredstring · pathThe organization's id (`org_…`), from `GET /whoami` or Organization → API.
workspace_idrequiredstring · pathThe workspace's id (`ws_…`).
Response · 200 fields12 fields
FieldTypeDescription
objectrequiredenumworkspace—
idrequiredstring`ws_…`
namerequiredstring—
slugrequiredstring—
external_idrequiredstringYour own id for it, unique in the organization.
planrequiredstring`free`, or the paid plan's key.
paid_byrequiredenumworkspace | organization—
requires_paid_planrequiredbooleanNo free allowance: the Owner already has a free workspace, so it sends once a plan is bought.
closed_atrequiredstring—
restorable_untilrequiredstring—
created_atrequiredstring—
hosted_invoice_urlstringOn create only: the card asked for authentication; paying here starts the plan.
200401403404409429

Mint a workspace key

POST/api/v1/organizations/{id}/workspaces/{workspace_id}/api-keys

POST /organizations/{id}/workspaces/{workspace_id}/api-keys
# API: no generated example for POST https://www.unitpost.com/api/v1/organizations/:id/workspaces/:workspace_id/api-keys
Response · 201
{
  "object": "api_key",
  "id": "id_123",
  "key": "string",
  "prefix": "string",
  "scope": "full",
  "capabilities": [
    "string"
  ],
  "workspace_id": "workspace_123"
}

A workspace key for one of the organization's workspaces: it reaches only that workspace, can't manage keys, and is revoked with the organization key that minted it. The secret is returned once. Takes an organization key (ok_live_…) with organizations:write.

Parameters2 fields
FieldTypeDescription
idrequiredstring · pathThe organization's id (`org_…`), from `GET /whoami` or Organization → API.
workspace_idrequiredstring · pathThe workspace's id (`ws_…`).
Request body2 fields
FieldTypeDescription
namerequiredstring—
scopeenumfull | sending | read_only—
Response · 201 fields7 fields
FieldTypeDescription
objectrequiredenumapi_key—
idrequiredstring`key_…`
keyrequiredstringThe secret, shown once.
prefixrequiredstring—
scoperequiredenumfull | sending | read_only—
capabilitiesrequiredstring[]—
workspace_idrequiredstring—
201401403404422429

Search docs and guides

Search the docs and product guides.