> ## Documentation Index
> Fetch the complete documentation index at: https://docs.clickflow.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Organizations

> Multi-org support, switching orgs, and organization context.

Every ClickFlow API call operates within the context of an organization. Your API key or OAuth session determines which organizations you can access.

## Always confirm the org first

Before making changes, call `list_organizations` to see available orgs and verify you're targeting the right one.

<Tabs>
  <Tab title="MCP">
    Call the `platform_list_organizations` tool (no parameters).
  </Tab>

  <Tab title="API">
    ```bash theme={null}
    curl https://api.clickflow.com/v1/api/organizations \
      -H "Authorization: Bearer cf_ak_your_key_here"
    ```
  </Tab>
</Tabs>

**Response:**

```json theme={null}
{
  "organizations": [
    {
      "_id": "org_abc123",
      "name": "My Company",
      "domain": "example.com"
    },
    {
      "_id": "org_def456",
      "name": "Client Site",
      "domain": "client.com"
    }
  ],
  "count": 2
}
```

## Switching organizations

By default, all calls use your API key's default organization. To operate on a different org:

<Tabs>
  <Tab title="MCP">
    Call `platform_switch_organization`:

    ```json theme={null}
    {
      "organization_id": "org_def456"
    }
    ```

    All subsequent tool calls in the session will use the new org.
  </Tab>

  <Tab title="API">
    Pass the `X-Organization-Id` header on each request:

    ```bash theme={null}
    curl https://api.clickflow.com/v1/api/roadmap-items \
      -H "Authorization: Bearer cf_ak_your_key_here" \
      -H "X-Organization-Id: org_def456"
    ```

    Or use the switch endpoint for session-level switching:

    ```bash theme={null}
    curl -X POST https://api.clickflow.com/v1/api/switch-organization \
      -H "Authorization: Bearer cf_ak_your_key_here" \
      -H "Content-Type: application/json" \
      -d '{"organization_id": "org_def456"}'
    ```
  </Tab>
</Tabs>

<Warning>Operating on the wrong organization cannot be undone. Always confirm with `list_organizations` before making changes.</Warning>

## Access control

* **API keys** can only access organizations they were granted access to
* **OAuth users** can access any organization they're a member of
* Cross-org access attempts return `{"error": "Organization not found or you don't have access"}`
