# upsertTeammateCommissionGoal

A teammate's plan (`userId`, ADMIN; the key owner must be an org admin who sees the team directory): upsertCommissionGoal for them; ids from getTeammateGoalPlan.

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

## Variables

- `userId`: `ID!` (required)
- `goalPlanId`: `ID!` (required)
- `id`: `ID`
- `pipelineId`: `ID`
- `metric`: `AgentCommissionGoalMetric!` (required, one of `EARNED`, `TOTAL`)
- `targetCents`: `BigInt!` (required)

## Response (data, an example)

```json
{
  "agentGoalsMutation": {
    "upsertAgentCommissionGoal": {
      "id": "<ID>",
      "goalPlanId": "<ID>",
      "pipelineId": "<ID>",
      "pipelineName": "…",
      "metric": "EARNED",
      "targetCents": "…"
    }
  }
}
```

## 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": "upsertTeammateCommissionGoal",
    "variables": {
      "userId": "<userId>",
      "goalPlanId": "<goalPlanId>",
      "metric": "EARNED",
      "targetCents": "<BigInt>"
    }
  }'
```
