Start free
Docs · Organizations and workspaces

Developer docs

Organizations and workspaces in the Beplan API

Beplan data lives in organizations, and most of it in their workspaces. Paths name both by id, and a token only reaches the ones it was given.

Read as Markdown

On this page
  1. Organizations and workspaces
  2. Start with GET /v1/me
  3. Workspaces and time zones
  4. What a narrowed connection sees
  5. Roles still apply
  6. Related

Organizations and workspaces

An organization is a team in Beplan: its members and their roles, its plan, its policy for integrations. A workspace is a brand or client inside it, with its own social accounts, calendar, posts, media library and insights. A person can belong to several organizations.

Every path of the API names its organization, and most name a workspace:

https://api.beplan.io/v1/organizations/{organizationId}/workspaces/{workspaceId}/posts

Organization ids are opaque strings; workspace ids are UUIDs. Never build one yourself: read them from the API.

Start with GET /v1/me

GET /v1/me needs no id and only profile:read, which every token has. It answers who the token acts for, the connection behind it, and every organization it was given:

  • state: active, pending (an admin of that organization must approve the connection first; calls there answer INTEGRATION_PENDING_APPROVAL) or blocked (with a reason, the same values as details.reason of INTEGRATION_BLOCKED_BY_ORGANIZATION).
  • allWorkspaces: whether the connection reaches every workspace the person can see there, including ones created later, or only a list.
  • workspaces: the ones it reaches, each with id, name and timezone.

Call it when your integration starts and whenever an organization or workspace answers 404: the person may have changed what your connection reaches.

curl
curl -X GET "https://api.beplan.io/v1/me" \
  -H "Authorization: Bearer beplan_pat_…"
TypeScript
const response = await fetch("https://api.beplan.io/v1/me", {
  method: "GET",
  headers: {
    Authorization: "Bearer beplan_pat_…",
  },
});
if (!response.ok) throw new Error((await response.json()).error.code);
const { data } = await response.json();
Python
import requests

response = requests.get(
    "https://api.beplan.io/v1/me",
    headers={"Authorization": "Bearer beplan_pat_…"},
)
response.raise_for_status()
data = response.json()["data"]
Answers 200
{
  "data": {
    "user": {
      "id": "user_2x8Kq",
      "name": "Alex Martin"
    },
    "connection": {
      "id": "3c9d1e2f-4a5b-4c6d-8e7f-9a0b1c2d3e4f",
      "kind": "personal_token",
      "name": "n8n weekly report",
      "clientId": null,
      "scopes": [
        "profile:read",
        "posts:read",
        "media:read"
      ],
      "expiresAt": "2027-02-17T10:00:00.000Z"
    },
    "organizations": [
      {
        "id": "org_8Hq2LmN4",
        "name": "Studio Halden",
        "state": "active",
        "reason": null,
        "allWorkspaces": true,
        "workspaces": [
          {
            "id": "5d2e8f14-3a6b-4c7d-9e0f-1a2b3c4d5e60",
            "name": "Studio Halden",
            "timezone": "Europe/Paris"
          }
        ]
      }
    ]
  }
}

Workspaces and time zones

GET …/workspaces lists an organization's workspaces your token can reach, each with its timezone (an IANA name). A workspace's calendar, posting slots and "Thursday at 9:00" live in that zone; the API's dates are ISO 8601 instants. Convert a wall time in the workspace's zone to an instant before you send it, and back before you show it.

curl
curl -X GET "https://api.beplan.io/v1/organizations/Yx0k2N7mQf3bA9cRz1LwP/workspaces" \
  -H "Authorization: Bearer beplan_pat_…"
TypeScript
const response = await fetch("https://api.beplan.io/v1/organizations/Yx0k2N7mQf3bA9cRz1LwP/workspaces", {
  method: "GET",
  headers: {
    Authorization: "Bearer beplan_pat_…",
  },
});
if (!response.ok) throw new Error((await response.json()).error.code);
const { data } = await response.json();
Python
import requests

response = requests.get(
    "https://api.beplan.io/v1/organizations/Yx0k2N7mQf3bA9cRz1LwP/workspaces",
    headers={"Authorization": "Bearer beplan_pat_…"},
)
response.raise_for_status()
data = response.json()["data"]
Answers 200
{
  "data": [
    {
      "id": "3f6c2a8e-91b4-4d7e-a2c5-7e0b9d1f4a62",
      "name": "Northwind",
      "avatarUrl": null,
      "timezone": "Europe/Paris",
      "defaultAccountIds": []
    }
  ]
}

What a narrowed connection sees

When a person gives your connection some workspaces of an organization rather than all of them:

  • A workspace outside the list answers 404 WORKSPACE_NOT_FOUND, exactly like a workspace that does not exist.
  • Organization-level lists (workspaces, people pickers, team workspaces, Deals across workspaces) show only the workspaces in the list, on top of what the person's teams let them see.
  • Workspace ids you send in a body are checked against the list.
  • Organization-wide writes (members:write, roles:write, organization:write, workspaces:manage, which creates and deletes workspaces, and the organization's Deals settings, companies and contacts) answer INTEGRATION_SELECTION_TOO_NARROW. Deals in the chosen workspaces still work with deals:write.
  • The organization's usage meters (GET …/usage) stay organization-wide: they are the plan's allowance, and name no workspace.

A person's teams apply too: even with "all workspaces", a connection reaches only the workspaces its person can see.

Design for it

  • Treat a 404 on an organization or workspace as "not available to this connection", not as an error to retry or report. Read GET /v1/me again and update what you show.
  • Don't cache the list of workspaces forever. People narrow and widen their connections from Integrations in their settings, admins revoke them, workspaces are created and deleted. An app hears about it through connection.updated and connection.revoked (webhooks).
  • If your feature needs an organization-wide scope, ask the person for all workspaces of that organization and say why.
  • One connection can span several organizations on different plans. Each organization's plan sets its own rate limits and features: a 402 PLAN_UPGRADE_REQUIRED in one organization says nothing about another.

Roles still apply

The connection is the most a token can do; the person's role decides what they can do now. A member whose role can't publish gets 403 MISSING_PERMISSION from POST …/posts/{postId}/schedule through the API exactly as in the app, whatever the token's scopes. Role changes take effect on the next request.