# createPipeline

Create a deal pipeline in your organization. Requires a title; optionally a description and an ordered list of initial stages (each: name, plus optional description, order, isTerminal, terminalType WON|LOST|NEUTRAL, winProbability 0-100). Returns the created pipeline: its id, name, description and stages in order.

- Call: `POST https://server.goliathdata.com/api/v1/call` with `{ "operationId": "createPipeline", "variables": {...} }`
- Scope: `WRITE`
- Type: mutation
- Idempotency: honors `Idempotency-Key` (24 h)
- Rate-limited: no

## Variables

- `title`: `String!` (required)
- `description`: `String`
- `stages`: `[PipelineStageCreateInput!]`
  - `name`: `String!` (required)
  - `description`: `String`
  - `order`: `Float`
  - `isTerminal`: `Boolean`
  - `terminalType`: `PipelineStageTerminalType` (one of `WON`, `LOST`, `NEUTRAL`)
  - `winProbability`: `Int`

## Response (data, an example)

```json
{
  "dealMutation": {
    "createPipeline": {
      "id": "<ID>",
      "name": "…",
      "description": "…",
      "stages": [
        {
          "id": "<ID>",
          "name": "…",
          "order": 0,
          "isTerminal": true,
          "terminalType": "WON",
          "winProbability": 0
        }
      ]
    }
  }
}
```

## Example

```bash
curl https://server.goliathdata.com/api/v1/call \
  -H "Authorization: Bearer $GOLIATH_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "operationId": "createPipeline",
    "variables": {
      "title": "<String>"
    }
  }'
```
