# Assign the agent that answers this number

> PATCH /phone-numbers/{id}. HeyRik API parameters and documented request and response examples.

Source: https://www.heyrik.com/docs/api-reference/phone-numbers/patch-phone-numbers-id-assign-the-agent-that-answers-this-number

PATCH https://server.heyrik.com/api/v1/phone-numbers/{id}

## Path parameters

- id (required): Replace {id} in the request URL with the value for this resource.

## Headers

Authorization: Bearer $HEYRIK_API_KEY (required). Keep your key on your server.

## Parameters

- agent_id (string, required): The agent id (from POST /agents) that should answer inbound calls. Send null to unassign. (`agency_id` also accepted.)
- name (string): Rename the number in your dashboard.
- active (boolean): false stops it receiving calls without releasing it.

## Notes

This is what makes INBOUND work: from here on, calls to this number are answered by that agent. Applies immediately.

## Request example

```sh
curl -X PATCH https://server.heyrik.com/api/v1/phone-numbers/sip_45723ca5 \
  -H "Authorization: Bearer $HEYRIK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "agent_id": "agc_9f2a1c30" }'
```

## Response example

```json
{
  "data": {
    "id": "sip_45723ca5",
    "phone_number": "+918071578563",
    "agency_id": "agc_9f2a1c30",
    "direction": "both",
    "active": true
  }
}
```
