# List Tickets — Connectwise PSA

> Retrieves a list of tickets. See the documentation

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

## Description

Retrieves a list of tickets. [See the documentation](https://developer.connectwise.com/Products/ConnectWise_PSA/REST#/Tickets/getServiceTickets)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `conditions` | `string` | No | Conditions to filter the tickets. E.g., summary contains "issue" or status/name="New". See the documentation for more information. |
| `orderBy` | `string` | No | Field to order results by. E.g., id desc or summary asc |
| `fields` | `string` | No | Comma-separated list of fields to return. E.g., id,summary,status |
| `pageSize` | `integer` | No | Number of results to return per page (max 1000) |
| `page` | `integer` | No | Page number to retrieve (1-based) |

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

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: "connectwise_psa-list-tickets",
  arguments: {
    conditions: "Conditions",
    orderBy: "Order By",
  },
})
```

**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: "connectwise_psa-list-tickets",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    connectwise_psa: { authProvisionId: "apn_xxxxxxx" },
    conditions: "Conditions",
    orderBy: "Order By",
  },
})

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": "connectwise_psa-list-tickets",
    "configured_props": {
      "connectwise_psa": { "authProvisionId": "apn_xxxxxxx" },
      "conditions": "Conditions",
      "orderBy": "Order By"
    }
  }'
```

---

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