Add the Contact Phone Based on ContactId

From docs
Revision as of 09:03, 17 July 2026 by Ashley DeBon (talk | contribs) (Successful Response (200))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Add Contact Phone

Base URL

https://apimobile.callproof.com

Endpoint

/api/contacts/{id}/phone

Purpose

Adds a phone number to a contact. Optionally links the number to one or more people (personnel) under that contact, including per-person extensions. If the same number already exists for the contact, the existing phone record is updated instead of creating a duplicate.

HTTP Method

POST

Headers

Header Required Description
Authorization Yes Bearer access token

Security

  • Yes – Requires Bearer Token authentication.

Parameters

Path Parameters

Parameter Type Required Description
id integer Yes Unique identifier of the contact that will receive the phone number

Query Parameters

None.

Request Body

Parameter Type Required Description
phone_number string No Phone number to add (digits only after processing; when provided, length must be between 10 and 15 characters; letters are not allowed)
phone_type_id integer No Phone type identifier (for example, Cell, Work, Home)
extension string No Main extension for the phone number (maximum 6 characters)
country_code string No Country code associated with the phone number
associated_contacts string (JSON array) No JSON array of personnel IDs to associate with this phone number (for example, [12,34])
associated_contacts_extension string (JSON array) No JSON array of extensions corresponding to each personnel ID in associated_contacts (same order)

cURL Example for Android

curl --location --request POST 'https://apimobile.callproof.com/api/contacts/{id}/phone' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--form 'phone_number=YOUR_PHONE_NUMBER' \
--form 'phone_type_id=1'

cURL Example for iOS

curl --location --request POST 'https://apimobile.callproof.com/api/contacts/{id}/phone' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--form 'phone_number=YOUR_PHONE_NUMBER' \
--form 'phone_type_id=1'

Successful Response (200)

Indicates that the phone number was added (or an existing matching number was updated) successfully.

Field Type Description
clientStatusCode integer Status indicator for the client (for example, 200)
user_id integer Identifier of the authenticated user
company_id integer Identifier of the authenticated user’s company
message string Confirmation message (for example, "New phone number has been added." or "Contact phone was updated successfully.")
uri string Requested resource URI

Error Responses

Status Code Meaning
200 Validation failed – response body uses clientStatusCode 401 with the first validation error message
400 Bad Request – the contact was not found, or the phone could not be added
401 Unauthorized – missing, invalid, or expired Bearer token
  • Validation (HTTP 200, clientStatusCode 401) – Invalid phone_type_id, invalid phone_number format/length, or extension longer than 6 characters.
  • 400 – Contact not found (for example, "Contact Not Found"), or another error while adding the phone (for example, "Error While Adding Contact Phone").
  • 401 – Authentication failed or the access token is missing/expired.