Link a resource to a phone number
Links a resource to an unassigned channel of a phone number you own, so inbound calls or messages to that number reach the resource. Reference the number by phone_number_id or by its E.164 number, and pick the channel with handler_type. The address for that channel already exists, so this operation sets its resource rather than creating a new address, and it never purchases a number. Assign Resource to phone route does the same from the resource’s side.
A 422 response names the problem in its code:
missing_required_parameter:resource_idorhandler_typeis blank, or neitherphone_number_idnornumberwas provided.invalid_parameter:handler_typeis notcallingormessaging.provided_id_is_unrecognized: the number is not owned by your project, orresource_idis not a resource in it.invalid_resource_type: the resource can’t handle the chosen channel.already_assigned: the channel already has a resource. Use Update the resource for a phone number to re-point it instead.
Permissions
The API token used to authenticate must have the following scope(s) enabled to make a successful request: Calling, Fax, Messaging, or Video.
Authentication
SignalWire Basic Authentication using Project ID and API Token.
The client sends HTTP requests with the Authorization header containing the word Basic followed by a space and a base64-encoded string of project_id:token. The project ID will be used as the username and the API token as the password.
Example:
Authorization: Basic base64(project_id:token)
Request
ID of the resource that should handle the channel. Must be a resource in your project of a type that can handle the chosen channel — for example, only messaging-capable resources can handle messaging.
The channel to link the resource to: calling for inbound calls or messaging for inbound messages. The channel must not already have a resource assigned.
ID of a phone number your project owns. Provide this or number.
A phone number your project owns, in E.164 format. Other common formats are accepted and normalized to E.164. Provide this or phone_number_id.
Response
The object type. Always phone.
The channel this address represents: calling for inbound calls or messaging for inbound messages. A phone number has one address per channel.
ID of the resource that handles this channel. null when no resource is assigned.