This is the API V2 documentation. To switch out of beta revert back to our API V1.

Open SidemenuAPI Reference
API Reference
Close Sidemenu

Short Codes

List all short codeslistShortCodes

get https://api.telnyx.com/v2/short_codes

List all short codes

curl -X GET \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --globoff "https://api.telnyx.com/v2/short_codes?page[size]=10"
Parameters
In query
page[number]
integer (1)
optional

The page number to load

Default: 1
page[size]
integer (1 - 250)
optional

The size of the page

Default: 20
filter[messaging_profile_id]
string
optional

Filter by Messaging Profile ID. Use the string `null` for phone numbers without assigned profiles. A synonym for the `/messaging_profiles/{id}/short_codes` endpoint when querying about an extant profile.

Responses
200

A paginated array of the short codes

default

Unexpected error

Success Response
{
  "data": [
    {
      "country_code": "US",
      "created_at": "2019-01-23T18:10:02.574Z",
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "messaging_profile_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "record_type": "short_code",
      "short_code": "12345",
      "updated_at": "2019-01-23T18:10:02.574Z"
    }
  ],
  "meta": {
    "page_number": 2,
    "page_size": 25,
    "total_pages": 3,
    "total_results": 55
  }
}

Retrieve a short coderetrieveShortCode

get https://api.telnyx.com/v2/short_codes/{id}

Retrieve a short code

curl -X GET \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --globoff "https://api.telnyx.com/v2/short_codes/{id}"
Parameters
In path
id
string (uuid)
required

The id of the short code

Responses
200

Expected short code detail response to a valid request

default

Unexpected error

Success Response
{
  "data": {
    "country_code": "US",
    "created_at": "2019-01-23T18:10:02.574Z",
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "messaging_profile_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "record_type": "short_code",
    "short_code": "12345",
    "updated_at": "2019-01-23T18:10:02.574Z"
  }
}

Update short codeupdateShortCode

patch https://api.telnyx.com/v2/short_codes/{id}

Update the settings for a specific short code. To unbind a short code from a profile, set the messaging_profile_id to null or an empty string.

curl -X PATCH \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --data '{"messaging_profile_id": "uuid"}' \
  https://api.telnyx.com/v2/short_codes/{id}
Parameters
In path
id
string (uuid)
required

The id of the short code

In body
messaging_profile_id
string (uuid)
required

Unique identifier for a messaging profile.

Responses
200

Expected update response

default

Unexpected error

Success Response
{
  "data": {
    "country_code": "US",
    "created_at": "2019-01-23T18:10:02.574Z",
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "messaging_profile_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "record_type": "short_code",
    "short_code": "12345",
    "updated_at": "2019-01-23T18:10:02.574Z"
  }
}
Previous: Phone Numbers
Next: Twexit

Was this section helpful?was-this-page-helpful