---
docId: doc_8c1d779684964f6bad0d025058c72571
title: List workspaces
description: "Retrieves the workspaces available to your credential and their permissions."
api:
  group: workspaces
  auth: bearer
  operations:
    - operationId: listWorkspaces
      method: GET
      path: /v1/workspaces
      postmanName: List workspaces
---

<script>
  import { Note, Ways } from '$lib/components';
</script>

# List workspaces

Get the IDs of the workspaces you can use and choose one for your next calls. Send its `id` as `?workspace=` when the operation needs a specific workspace.

## Example

<Ways tabs="api,sdk">
<Ways.Way name="api">

```bash
curl https://api.platic.ai/v1/workspaces \
  -H "Authorization: Bearer $PLATIC_API_KEY"
```

</Ways.Way>
<Ways.Way name="sdk">

```ts
await platic.workspaces.list();
```

</Ways.Way>
</Ways>

The MCP tool [`list_workspaces`](/mcp/tools#workspaces) queries the same directory.

It does not require permission for a workspace module. Use it to find available workspaces before calling their resources.

It accepts both Bearer credentials: an OAuth access token (`pl_at_…`) or an API Key (`pl_key_…`). See [Authentication](/authentication).

---

## Response

```json
{
  "status": "success",
  "data": [
    {
      "id": "g6yCA16pkWl5eXo7KszB",
      "name": "Acme Norte",
      "role": "admin",
      "modules": "all"
    },
    {
      "id": "k2pL90vQmN4sHxYwR8cD",
      "name": "Acme Support",
      "role": "operator",
      "modules": ["dashboard", "conversations", "agents", "campaigns", "contacts", "chat"]
    }
  ],
  "active": null,
  "requires_workspace_argument": true,
  "credential": {
    "type": "oauth",
    "scopes": ["platica:read", "platica:write", "offline_access"]
  }
}
```

`data` is the list of workspaces this credential can reach right now. To know how many there are, use `data.length`. `active`, `requires_workspace_argument`, and `credential` are top-level fields, next to `data`.

| Field | Type | Description |
|-------|------|-------------|
| `data[].id` | string | Value of `?workspace=` (or the `workspace` argument in MCP). |
| `data[].name` | string | Company name in Platica. |
| `data[].role` | string \| null | The user's role in that workspace. |
| `data[].modules` | `"all"` \| string[] | Modules with access. For OAuth they come from the **live** role; for an API Key they are `"all"`. |
| `active` | string \| null | If the credential covers **one** workspace, its `id`. If it covers several, `null`. |
| `requires_workspace_argument` | boolean | `true` if the credential covers several workspaces. For operations that require one specific workspace, send `?workspace=` (or `workspace` in MCP). |
| `credential.type` | string | `"apiKey"`, `"oauth"`, or `"internal"`. |
| `credential.scopes` | string[] | OAuth only. The scopes granted at consent. |

<Note type="note">

For OAuth tokens, the API checks your current membership on every request. If you leave a team, it disappears from the list and the token loses access without revoking the grant.

If you omit `?workspace=`, these calls can use multiple workspaces:

- List contacts, conversations or messages; read a conversation; list a contact’s conversations.
- Send messages or email.
- Send a template if its channel identifies one workspace. If more than one matches, you must choose it.

Getting a contact requires choosing one workspace. With OAuth, these calls include only workspaces where you have the required module.

</Note>

---

## Errors

| Status | `details.code` | When it happens |
|--------|----------------|-----------------|
| `401` | `UNAUTHENTICATED` | Missing Bearer, or the token/key is not valid |
| `404` | `WORKSPACE_NOT_FOUND` | The credential has no reachable workspace |

```json
{
  "code": 404,
  "error": "Not Found - The resource doesn't exist",
  "details": {
    "code": "WORKSPACE_NOT_FOUND",
    "message": "No workspaces found for this credential"
  }
}
```

The general error format is in [Errors](/api-reference/errors).
