# Create Support Ticket — NinjaOne

> Creates a new support ticket in NinjaOne. See the documentation

- Key: `ninjaone-create-ticket`
- Type: Action (Write)
- Version: 0.0.2
- App: NinjaOne (`ninjaone`) — https://pipedream.com/apps/ninjaone.md
- This page (HTML): https://pipedream.com/apps/ninjaone/actions/create-ticket
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/ninjaone/actions/create-ticket/create-ticket.mjs

## Description

Creates a new support ticket in NinjaOne. [See the documentation](https://app.ninjarmm.com/apidocs/?links.active=core#/ticketing/create)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `clientId` | `string` | Yes | The ID of the client related to the ticket Options are loaded from the connected account. |
| `ticketFormId` | `string` | Yes | The ID of the ticket form to the ticket Options are loaded from the connected account. |
| `organizationId` | `string` | No | The ID of the organization Options are loaded from the connected account. |
| `locationId` | `string` | No | The ID of the location to the ticket Options are loaded from the connected account. |
| `nodeId` | `string` | No | The ID of the device to the ticket Options are loaded from the connected account. |
| `subject` | `string` | Yes | The subject of the ticket |
| `descriptionPublic` | `boolean` | Yes | Whether the ticket's description is public or not |
| `descriptionBody` | `string` | No | The description of the ticket |
| `descriptionHTML` | `string` | No | The description HTML of the ticket |
| `descriptiontimeTracked` | `integer` | No | Time in seconds |
| `descriptionDuplicateInIncidents` | `boolean` | No | Whether the ticket will duplicate in the same incident |
| `status` | `string` | Yes | The status of the ticket Options are loaded from the connected account. |
| `type` | `string` | No | The type of the ticket |
| `cc` | `string[]` | No | A list of emails to be copied in the notification email |
| `assignedAppUserId` | `string` | No | User ID that will be assigned to the ticket Options are loaded from the connected account. |
| `severity` | `string` | No | The severity's level of the ticket |
| `priority` | `string` | No | The priority's level of the ticket |
| `tags` | `string[]` | No | A list of tags related to ticket. Options are loaded from the connected account. |

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

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: "ninjaone-create-ticket",
  arguments: {
    clientId: "Client ID",
    ticketFormId: "Ticket Form ID",
  },
})
```

**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: "ninjaone-create-ticket",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    ninjaone: { authProvisionId: "apn_xxxxxxx" },
    clientId: "Client ID",
    ticketFormId: "Ticket Form ID",
  },
})

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": "ninjaone-create-ticket",
    "configured_props": {
      "ninjaone": { "authProvisionId": "apn_xxxxxxx" },
      "clientId": "Client ID",
      "ticketFormId": "Ticket Form ID"
    }
  }'
```

---

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