# List Locations — Bonusly

> List the distinct locations configured for users in the authenticated caller's company, with a user count for each. Call this first to discover the exact location names accepted by List Users In Location, which matches exactly and returns…

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

## Description

List the distinct locations configured for users in the authenticated caller's company, with a user count for each. Call this first to discover the exact location names accepted by **List Users In Location**, which matches exactly and returns nothing for a misspelled or differently-cased name. [See the documentation](https://docs.bonus.ly/reference/listlocations)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `search` | `string` | No | Narrow the results to locations whose name starts with this text, e.g. Ber matches Berlin. This is a prefix match, so it will not match text in the middle of a name. Omit to return every location. |
| `pageSize` | `integer` | No | Maximum number of locations to return in this page. Defaults to Bonusly's standard page size if omitted. |
| `cursor` | `string` | No | Opaque pagination cursor for fetching the next page of results. Use the next_cursor value returned in the previous response. Omit to fetch the first page. |

## 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": "bonusly",
      },
    },
  },
)

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: "bonusly-list-locations",
  arguments: {
    search: "Search",
    pageSize: 10,
  },
})
```

**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: "bonusly-list-locations",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    bonusly: { authProvisionId: "apn_xxxxxxx" },
    search: "Search",
    pageSize: 10,
  },
})

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": "bonusly-list-locations",
    "configured_props": {
      "bonusly": { "authProvisionId": "apn_xxxxxxx" },
      "search": "Search",
      "pageSize": 10
    }
  }'
```

---

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