Assign a CNAM Record to Your Phone Number

Lets you associate an approved CNAM record with a specified long code number on your account. Note that CNAM records take up to 48 hours to be approved on your account and association with a phone number takes an additional 5-7 business days.

Endpoint

PATCH /numbers/:number_id/relationships/cnams/:cnam_id

Path Parameters

  • number_id
    integer REQUIRED

    Your Flowroute longcode phone number to be associated with the approved CNAM record.

  • cnam_id
    integer REQUIRED

    The unique identifier of the approved CNAM record to be assigned to your Flowroute longcode phone number.

Response Fields

On success, the HTTP status code in the response header is 202 Accepted and the response body contains an attributes dictionary containing the date_created field and the assigned cnam object in JSON format. This request will fail if the CNAM has not yet been approved. On error, the header status code is an error code and the response body contains an array of error objects.


Example Request

PATCH /v2/numbers/12066417659/relationships/cnams/22671 HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

                        

Example Request

curl https://api.flowroute.com/v2/numbers/12066417659/relationships/cnams/22671 -X PATCH \
-u accessKey:secretKey 

                        

Example Request

This assumes that you have the Python API Wrapper installed and set up. The following example is from cnam_demo.py. Please make sure to use neutral (vertical) quotes in your request. Smart quotes are known to cause errors.


# Instantiate the API client and create a controller for Messages
client = FlowroutenumbersandmessagingClient(basic_auth_user_name, basic_auth_password)
cnams_controller = client.cnams
#Buggy, needs fixing
print("\n--Associate a CNAM Record to a DID")
result = cnams_controller.associate_cnam(cnam_id, '12066417659')
pprint.pprint(result)

                        

Example Response

202 Accepted

{
    "data": {
        "id": "22671",
        "type": "cnam",
        "attributes": {
            "date_created": "Mon, 22 Aug 2022 07:23:53 GMT",
        },
    },
}

            

401 Unauthorized

{
  "errors": [
    {
      "detail": "Authentication failed.",
      "id": "7fc8c70a-ca58-430c-b383-b89df84f8083",
      "status": 401,
      "title": "Unauthorized"
    }
  ]
}

                

403 Forbidden

{
  "errors": [
    {
      "id": "2b3f53d3-828f-4f55-b161-b837391d301a",
      "status": 403,
      "title": "Invalid Resource Action",
      "description": "CNAM must be approved before it can be associated to a number in your account."
    }
  ]
}