Workspaces
List the workspaces an API key or OAuth sign-in can act in, pick one per request with the X-Workspace-Id header, and create or delete workspaces of your organization.
https://post.adaptlypost.com/post/api/v1/workspacesLists the workspaces the calling key or OAuth sign-in can act in, with your role and what you can do in each. Any valid key can call it, whatever its role.
When to call it
Call it when an integration starts, before it reads or writes anything. An OAuth connection, such as the Claude or ChatGPT connector, reaches every workspace its member belongs to, across organizations. An API key reaches only its own workspace, so the list has one entry.
Response fields
| Field | Description |
|---|---|
id | The workspace ID. Send it in the X-Workspace-Id header to act in this workspace. |
name | The workspace name. |
organization | The organization that owns the workspace, with its id and name. |
role | Your role in this workspace: key is one of admin, editor, contributor, viewer; name is the label in your language. For an API key, the key's role. |
permissions | Every permission you hold in this workspace. For an API key, the key's permissions after its creator's current role is applied. |
isDefault | True for the workspace a call lands in when it sends no X-Workspace-Id header. |
current | True for the workspace this call landed in. |
can | Three booleans, draft, schedule and publish, for what your role allows with posts in this workspace. |
Choose a workspace with X-Workspace-Id
Every endpoint accepts an optional X-Workspace-Id header. Set it to an id from this list and the call runs in that workspace, with your role there. Without it the call lands in the default workspace.
1X-Workspace-Id: ag_02k7mA workspace the caller cannot reach answers 403 with code workspace_access_denied and the workspaceId it refused. An API key belongs to one workspace, so it gets the same 403 for any other workspace's id: send the key's own workspace id or leave the header out.
1{2 "statusCode": 403,3 "error": "Forbidden",4 "code": "workspace_access_denied",5 "workspaceId": "ag_03p4r",6 "message": "You have no access to workspace ag_03p4r. Call GET /workspaces to list the workspaces you can use, and send one of those ids in the X-Workspace-Id header."Create a workspace
https://post.adaptlypost.com/post/api/v1/workspacesCreates a workspace in your organization. Every organization owner and admin becomes its admin.
The key's creator must also be an organization owner or admin when the call is made. Otherwise it answers 403 permission_denied.
Request body
| Parameter | Type | Description |
|---|---|---|
nameREQUIRED | string | 1 to 100 characters, without < or >. No other workspace in the organization may have this name. |
description | string | Up to 500 characters, without < or >. |
connectionLimit | number | 0 to 10000. The most social accounts the workspace may connect. Leave it out for no limit. |
Answers 201 with the new workspace. An invalid body, or a name another workspace in the organization already has, answers 400. A plan with no room for another workspace answers 403 subscription_required.
1{2 "id": "ag_04q8s",3 "name": "Client C",4 "description": "Retail client",5 "organizationId": "org_01hzq",6 "isDefault": false,| Field | Description |
|---|---|
id | The new workspace ID. Send it in X-Workspace-Id to act in the workspace. |
name | The workspace name. |
description | The description, or null. |
organizationId | The organization that owns the workspace. |
isDefault | Whether this is the organization's default workspace. |
connectionLimit | The most social accounts the workspace may connect, or null for no limit. |
createdAt | When the workspace was created. |
Delete a workspace
https://post.adaptlypost.com/post/api/v1/workspaces/:idDeletes a workspace of your organization with everything it holds: posts, feeds, inbox items, API keys and connect links. It cannot be undone.
The key's creator must also be an organization owner or admin when the call is made. Otherwise it answers 403 permission_denied.
Answers 200 with { "success": true }. The default workspace, the last workspace of the organization and a workspace that still has connected social accounts cannot be deleted, and each answers 400. Remove the accounts first. An id that is not a workspace of your organization answers 404.
Refusals
403 with code permission_denied means the key's role lacks the permission, or the key's creator is not an organization owner or admin where the call needs one. The answer is final, so do not retry. Ask the user to have an organization admin make the change.
403 with code subscription_required means the plan is not active or has reached a limit: no room for another workspace, or no team seat left for an invitation. The body also carries errorCode, limitKey, limit and currentUsage. Tell the user to upgrade the plan, and do not retry.
1{2 "statusCode": 403,3 "error": "Forbidden",4 "code": "subscription_required",5 "errorCode": "LIMIT_EXCEEDED",6 "limitKey": "max_workspaces",A 429 means you hit the rate limit. Wait for the time in Retry-After before you call again.
1curl --request GET \2 --url https://post.adaptlypost.com/post/api/v1/workspaces \3 --header 'Authorization: Bearer <api-key>'3 lines