Skip to main content

Update Short Code

This request updates a short code, targeted by secure ID.

patch /phonenumber/short_codes/{short_code_sid}
put /phonenumber/short_codes/{short_code_sid}

Sample

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

curl -X PATCH \
'https://api.carrierx.com/core/v2/phonenumber/short_codes/531f65b7-dff7-42b4-b638-597f91da9ccc' \
-H 'Content-Type: application/json' \
--data-binary '{"name":"new shortcode name"}'
-H 'Authorization: Bearer 5ebc03d6-8b2b-44ad-bf65-72d4f1491dda'

Response

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

{
"attributes": {},
"callback_url": null,
"country_code": "USA",
"did_group_sid": "9cf3c0aa-3f80-43f7-b8c2-8f88251ff562",
"locality": null,
"lrn_sid": null,
"name": "new short code name",
"partner_sid": "b9ba2c8b-2368-4a0b-9ba0-866ff2618417",
"short_code": "26399",
"short_code_sid": "531f65b7-dff7-42b4-b638-597f91da9ccc",
"state": "IL",
"string_key_1": null,
"string_key_2": null
}

A Short Code 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 short code secure ID is passed in the query URL, and the values to be modified are passed in the request body.

    The Short Code object also contains a nested Attributes object. 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 Short Code object. The short code secure ID is passed in the query URL, and the entire Short Code object is passed in the request body.

note

Note, while all the fields must be present in a PUT request, not all the attribute values may be modified after the initial creation, because when created, some of them become read-only.

Required Scopes

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

  • phonenumber.manage
  • phonenumber.update

Path Arguments

ParameterData TypeDescription
short_code_sid requiredstringThe short code secure ID.

Query Arguments

ParameterData TypeDescription
nested_objectsstringDetermines if the nested objects fields and values should be replaced. Value accepted in this field is replace.

Body Arguments

JSON representation of the fields and values to be updated.

Fields that can be modified are:

  • attributes
  • callback_url
  • did_group_sid
  • name
  • string_key_1
  • string_key_2

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