Skip to main content

Update Prefix

This request updates a prefix, targeted by secure ID.

patch /phonenumber/prefixes/{prefix_sid}
put /phonenumber/prefixes/{prefix_sid}

Sample

A sample PATCH request to update the Prefix object, targeted by secure ID, with the values in the request body:

curl -X PATCH \
'https://api.carrierx.com/core/v2/phonenumber/prefixes/cc367acb-94c8-418f-b247-85dce5806ef4' \
-H 'Content-Type: application/json' \
--data-binary '{"name":"main prefix"}' \
-H 'Authorization: Bearer 5ebc03d6-8b2b-44ad-bf65-72d4f1491dda'

Response

200 status code with a serialized copy of the updated Prefix object:

{
"attributes": {},
"callback_url": null,
"lrn_sid": null,
"name": "main prefix",
"partner_sid": "e00430c3-a7d0-4666-ab5c-f7202448382f",
"prefix": "51625",
"prefix_sid": "cc367acb-94c8-418f-b247-85dce5806ef4",
"source_trunk_group_sid": null,
"string_key_1": null,
"string_key_2": null,
"transformations": [],
"trunk_group_sid": null
}

A Prefix object can be updated using either a PATCH or PUT request.

  • A PATCH request can be used to update one or more attribute values. When using a PATCH request, only the attributes specified in the request payload will be updated, all other attributes and values will remain the same. The prefix secure ID is passed in the query URL, and the values to be modified are passed in the request body.

    The Prefix object also contains nested Attributes and Transformations objects. Refer to this section to learn how nested objects can be updated using the PATCH request.

  • A PUT request can be used to update an entire Prefix object. The prefix secure ID is passed in the query URL, and the entire Prefix object is passed in the request body.

note

Note, while all fields must be present in a PUT request, not all the attributes values may be modified after the initial creation.

Required Scopes

To update a Prefix object, the partner must have one of the following scopes enabled:

  • phonenumber.manage
  • phonenumber.update

Path Arguments

ParameterData TypeDescription
did_sid requiredstringThe prefix secure ID.

Body Arguments

JSON representation of the fields and values to be updated.

Fields that can be modified are:

  • attributes
  • callback_url
  • name
  • prefix
  • source_trunk_group_sid
  • string_key_1
  • string_key_2
  • transformations

Refer to this table to view all fields that appear in the Prefix object.