# assignPhoneLine

Give a phone line the org already owns (listCommunicationChannels) to a teammate (`userId`, listTeammates), moving it off whoever holds it now; nothing is bought or released. `makePrimary: true` makes it their primary line. A line in the bulk-dialing rotation (getDialingPool) is refused unless `leaveDialingRotation: true`, sent only once the person agreed it leaves the rotation. Say whose line it was and who gets it before you call. Admins only; a non-admin may only make a line they already hold their primary. Returns every line the move changed, each with its holder.

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

## Variables

- `phoneLineId`: `ID!` (required)
- `userId`: `ID!` (required)
- `makePrimary`: `Boolean`
- `leaveDialingRotation`: `Boolean`

## Response (data, an example)

```json
{
  "twilioMutation": {
    "transferPhoneNumber": [
      {
        "id": "<ID>",
        "e164Number": "…",
        "isPrimary": true,
        "isDialingPoolLine": true,
        "user": {
          "id": "<ID>",
          "firstName": "…",
          "lastName": "…"
        }
      }
    ]
  }
}
```

## 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": "assignPhoneLine",
    "variables": {
      "phoneLineId": "<phoneLineId>",
      "userId": "<userId>"
    }
  }'
```
