# Create Incident — LinearB

> Create a new incident within the LinearB platform. See the documentation

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

## Description

Create a new incident within the LinearB platform. [See the documentation](https://docs.linearb.io/api-incidents/#create-incident)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `providerId` | `string` | Yes | The unique identifier of the incident in your incident management provider. Eg. provider_internal_id1 |
| `httpUrl` | `string` | Yes | The URL of your incident management provider. The combination http_url/provider_key should open the incident in your PM provider. Eg. http://myprovider.io/1 |
| `title` | `string` | Yes | The title of the incident |
| `issuedAt` | `string` | Yes | The specific time when the incident was logged and officially opened. (timestamp ISO 8601 format). Eg. 2019-09-26T07:58:30.996 |
| `startedAt` | `string` | No | The specific time when work on the incident commenced. (timestamp ISO 8601 format). Eg. 2019-09-26T07:58:30.996 |
| `endedAt` | `string` | No | The specific time when the incident was successfully resolved. (timestamp ISO 8601 format). Eg. 2019-09-26T07:58:30.996 |
| `gitRef` | `string` | No | The Git reference of the release responsible for causing this incident, Eg. commit short or long sha or tag name (Eg. commit short or long sha/tag name). |
| `teams` | `string[]` | No | The list of LinearB teams names related to this incident. (lowercase only) Options are loaded from the connected account. |
| `services` | `string[]` | No | The list of LinearB services related to this incident. (lowercase only) Options are loaded from the connected account. |
| `repositoryUrls` | `string[]` | No | The list of repos urls related to this incident. Eg. https://github.com/myorg/repo1.git |

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

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: "linearb-create-incident",
  arguments: {
    providerId: "Provider ID",
    httpUrl: "HTTP URL",
  },
})
```

**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: "linearb-create-incident",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    linearb: { authProvisionId: "apn_xxxxxxx" },
    providerId: "Provider ID",
    httpUrl: "HTTP URL",
  },
})

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": "linearb-create-incident",
    "configured_props": {
      "linearb": { "authProvisionId": "apn_xxxxxxx" },
      "providerId": "Provider ID",
      "httpUrl": "HTTP URL"
    }
  }'
```

---

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