# createGoalPlan

Open a DRAFT goal plan for the month containing periodStartDate, seeded with the active plan's commission goals; an existing draft is returned instead. Only a draft is edited; publishGoalPlan makes it the active plan. Your own plan; a teammate’s is the *Teammate* op (ADMIN).

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

## Variables

- `periodStartDate`: `Date!` (required)

## Response (data, an example)

```json
{
  "agentGoalsMutation": {
    "createAgentGoalPlan": {
      "id": "<ID>",
      "userId": "<ID>",
      "periodStartDate": "…",
      "periodEndDate": "…",
      "status": "DRAFT",
      "publishedAt": "2026-01-01T00:00:00.000Z",
      "commissionGoals": [
        {
          "id": "<ID>",
          "pipelineId": "<ID>",
          "pipelineName": "…",
          "metric": "EARNED",
          "targetCents": "…"
        }
      ],
      "personalGoals": [
        {
          "id": "<ID>",
          "title": "…",
          "description": "…",
          "status": "ACTIVE",
          "displayOrder": 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": "createGoalPlan",
    "variables": {
      "periodStartDate": "2026-01-01"
    }
  }'
```
