# List Spaces — Confluence

> List all spaces in Confluence. See the documentation

- Key: `confluence-list-spaces`
- Type: Action (Read-only)
- Version: 0.0.2
- App: Confluence (`confluence`) — https://pipedream.com/apps/confluence.md
- This page (HTML): https://pipedream.com/apps/confluence/actions/list-spaces
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/confluence/actions/list-spaces/list-spaces.mjs

## Description

List all spaces in Confluence. [See the documentation](https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-space/#api-spaces-get)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `ids` | `string[]` | No | Filter results to spaces with these numeric IDs. Accepts up to 250 IDs. Example: [123456, 789012] Options are loaded from the connected account. |
| `keys` | `string[]` | No | Filter results to spaces with these space keys. Accepts up to 250 keys. Example: ["ENG", "MKTG"] |
| `type` | `string` | No | Filter results to spaces of this type. Example: "global" |
| `spaceStatus` | `string` | No | Filter results to spaces with this status. Use current for active spaces or archived for archived ones. Example: "current" |
| `labels` | `string[]` | No | Filter results to spaces that have all of these labels applied. Accepts up to 250 labels. Example: ["team-docs", "public"] |
| `sort` | `string` | No | Field to sort results by. Prefix with - for descending order. Example: "-name" (Z to A by name) |
| `descriptionFormat` | `string` | No | Content format for the description field in the response. Use plain for plain text or view for rendered HTML. Example: "plain" |
| `includeIcon` | `boolean` | No | Whether to include the space icon in the response. Example: true |
| `cursor` | `string` | No | Used for pagination, this opaque cursor will be returned in the next URL in the Link response header. Use the relative URL in the Link header to retrieve the next set of results. |
| `limit` | `integer` | No | Maximum number of spaces to return per request (1–250). Use the cursor from the Link response header to retrieve the next page. Example: 25 |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "confluence",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "confluence-list-spaces",
  arguments: {
    ids: ["IDs"],
    keys: ["Keys"],
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "confluence-list-spaces",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    confluence: { authProvisionId: "apn_xxxxxxx" },
    ids: ["IDs"],
    keys: ["Keys"],
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "confluence-list-spaces",
    "configured_props": {
      "confluence": { "authProvisionId": "apn_xxxxxxx" },
      "ids": ["IDs"],
      "keys": ["Keys"]
    }
  }'
```

---

- App: https://pipedream.com/apps/confluence.md · All apps: https://pipedream.com/apps
