The Contact API provides endpoints that enable you to retrieve and update Customer Service Management (CSM) contact records.

In addition, you can generate new social media profile records when creating a contact.

The Contact API requires the Customer Service plugin (com.sn_customerservice) and is provided within the now namespace.

Users need the csm_ws_integration role for full API access.

Contact - GET /now/contact

Retrieves a specified set of Customer Service Management (CSM) contacts.

URL format

Versioned URL: /api/now/{api_version}/contact

Default URL: /api/now/contact

Supported request parameters

Table 1. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

Table 2. Query parameters
Name Description
sysparm_limit
Maximum number of records to return. For requests that exceed this number of records, use the sysparm_offset parameter to paginate record retrieval.

In the response, the boolean parameter hasMore is returned. It indicates whether there are more records to return that meet the filter criteria.

Data type: Number

Default: 10

sysparm_offset
Starting record index for which to begin retrieving records. Use this value to paginate record retrieval. This functionality enables the retrieval of all records, regardless of the number of records, in small manageable chunks.

For example, the first time you call this endpoint, sysparm_offset is set to "0". To simply page through all available records, use sysparm_offset=sysparm_offset+sysparm_limit, until you reach the end of all records.

Do not pass a negative number in the sysparm_offset parameter.

Data type: Number

Default: 0

sysparm_query Encoded query used to filter the result set.

For example:

sysparm_query=caller_id=javascript:gs.getUserID()^active=true

The encoded query supports order by. To sort responses based on certain fields, use the ORDERBY and ORDERBYDESC clauses in sysparm_query. For example, sysparm_query=active=true^ORDERBYnumber^ORDERBYDESCcategory filters all active records and orders the results in ascending order by number first, and then in descending order by category.

If part of the query is invalid, such as by specifying an invalid field name, the instance ignores the invalid part. It then returns rows using only the valid portion of the query. You can control this behavior using the property glide.invalid_query.returns_no_rows. Set this property to true to return no rows on an invalid query.
Note: The glide.invalid_query.returns_no_rows property controls the behavior of all queries across the instance, such as in lists, scripts (GlideRecord.query()), and web service APIs.

Data type: String

Table 3. Request body parameters (XML or JSON)
Name Description
None

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Table 4. Request headers
Header Description
Accept Data format of the response body. Supported types: application/json or application/xml.

Default: application/json

Table 5. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Table 6. Status codes
Status code Description
200 Successful. The request was successfully processed.
500 Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error.
500 Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error.

Response body parameters (JSON or XML)

The endpoint may return the following JSON or XML elements in the response body. In addition to the list of elements defined below (which define the elements in a base system), the endpoint also returns any custom fields added to the Contact [customer_contact] table. For additional information on these elements, refer to your specific table definition [System Definition > Tables].

Example: cURL request

curl "https://instance.servicenow.com/api/now/contact?sysparm_query=account=86837a386f0331003b3c498f5d3ee4ca&sysparm_limit=2&sysparm_offset=2>;rel="next" \
--request GET \
--header "Accept:application/json" \
--user "username":"password"
{
  "result": [
    {
      "country": "",
      "calendar_integration": "1",
      "last_position_update": "",
      "last_login_time": "2018-03-10 21:48:11",
      "last_login_device": "",
      "source": "",
      "sys_updated_on": "2019-01-03 05:49:34",
      "building": "",
      "web_service_access_only": "false",
      "notification": "2",
      "sys_updated_by": "system",
      "enable_multifactor_authn": "false",
      "sys_created_on": "2018-03-04 20:26:32",
      "sys_domain": "global",
      "agent_status": "",
      "state": "",
      "vip": "false",
      "sys_created_by": "admin",
      "longitude": "",
      "zip": "",
      "home_phone": "",
      "time_format": "",
      "last_login": "",
      "default_perspective": "",
      "geolocation_tracked": "false",
      "active": "true",
      "time_sheet_policy": "",
      "sys_domain_path": "/",
      "phone": "+1 858 287 7834",
      "cost_center": "",
      "name": "George Warren",
      "employee_number": "",
      "gender": "",
      "city": "",
      "user_name": "george.warren",
      "failed_attempts": "",
      "edu_status": "",
      "latitude": "",
      "roles": "",
      "title": "Network Administrator",
      "sys_class_name": "customer_contact",
      "sys_id": "ddce70866f9331003b3c498f5d3ee417",
      "internal_integration_user": "false",
      "ldap_server": "",
      "mobile_phone": "+1 858 867 7857",
      "street": "",
      "company": "86837a386f0331003b3c498f5d3ee4ca",
      "department": "",
      "first_name": "George",
      "preferred_language": "",
      "introduction": "",
      "email": "geo.warren@mailinator.com",
      "manager": "",
      "locked_out": "false",
      "sys_mod_count": "3",
      "last_name": "Warren",
      "photo": "",
      "sys_tags": "",
      "middle_name": "",
      "time_zone": "",
      "schedule": "",
      "on_schedule": "",
      "date_format": "",
      "location": "25ab8e460a0a0bb300857304ff811af5",
      "account": "86837a386f0331003b3c498f5d3ee4ca"
    },
    {
      "country": "",
      "calendar_integration": "1",
      "last_position_update": "",
      "last_login_time": "2019-01-03 15:08:57",
      "last_login_device": "73.71.157.241",
      "source": "",
      "sys_updated_on": "2019-01-03 23:26:12",
      "building": "",
      "web_service_access_only": "false",
      "notification": "2",
      "sys_updated_by": "admin",
      "enable_multifactor_authn": "false",
      "sys_created_on": "2019-01-03 15:07:25",
      "sys_domain": "global",
      "agent_status": "",
      "state": "",
      "vip": "false",
      "sys_created_by": "carl.customer",
      "longitude": "",
      "zip": "",
      "home_phone": "",
      "time_format": "",
      "last_login": "",
      "default_perspective": "",
      "geolocation_tracked": "false",
      "active": "true",
      "time_sheet_policy": "",
      "sys_domain_path": "/",
      "phone": "+16692627777",
      "cost_center": "",
      "name": "Jane Contact",
      "employee_number": "",
      "gender": "",
      "city": "",
      "user_name": "Jane.Contact",
      "failed_attempts": "",
      "edu_status": "faculty",
      "latitude": "",
      "roles": "",
      "title": "",
      "sys_class_name": "customer_contact",
      "sys_id": "0a232a0013691200042ab3173244b075",
      "internal_integration_user": "false",
      "ldap_server": "",
      "mobile_phone": "",
      "street": "",
      "company": "86837a386f0331003b3c498f5d3ee4ca",
      "department": "",
      "first_name": "Jane",
      "preferred_language": "",
      "introduction": "",
      "email": "jane.contact@mailinator.com",
      "manager": "",
      "locked_out": "false",
      "sys_mod_count": "3",
      "last_name": "Contact",
      "photo": "",
      "sys_tags": "",
      "middle_name": "",
      "time_zone": "",
      "schedule": "",
      "on_schedule": "",
      "date_format": "",
      "location": "",
      "account": "86837a386f0331003b3c498f5d3ee4ca"
    }
  ]
}

Contact - GET /now/contact/{id}

Retrieves the specified Customer Service Management (CSM) contact.

URL format

Versioned URL: /api/now/{api_version}/contact/{id}

Default URL: /api/now/contact/{id}

Supported request parameters

Table 7. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

id Sys_id of the contact to retrieve. Located in the Contact [customer_contact] table.
Table 8. Query parameters
Name Description
None
Table 9. Request body parameters (XML or JSON)
Name Description
None

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Table 10. Request headers
Header Description
Accept Data format of the response body. Supported types: application/json or application/xml.

Default: application/json

Table 11. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Response body parameters (JSON or XML)

The endpoint may return the following JSON or XML elements in the response body. In addition to the list of elements defined below (which define the elements in a base system), the endpoint also returns any custom fields added to the Contact [customer_contact] table. For additional information on these elements, refer to your specific table definition [System Definition > Tables].

Example: cURL request

curl "https://instance.servicenow.com/api/now/contact/ddce70866f9331003b3c498f5d3ee417 \
--request GET \
--header "Accept:application/json" \
--user "username":"password"
{
  "result": {
    "country": "",
    "calendar_integration": "1",
    "last_position_update": "",
    "last_login_time": "2018-03-10 21:48:11",
    "last_login_device": "",
    "source": "",
    "sys_updated_on": "2019-01-03 05:49:34",
    "building": "",
    "web_service_access_only": "false",
    "notification": "2",
    "sys_updated_by": "system",
    "enable_multifactor_authn": "false",
    "sys_created_on": "2018-03-04 20:26:32",
    "sys_domain": "global",
    "agent_status": "",
    "state": "",
    "vip": "false",
    "sys_created_by": "admin",
    "longitude": "",
    "zip": "",
    "home_phone": "",
    "time_format": "",
    "last_login": "",
    "default_perspective": "",
    "geolocation_tracked": "false",
    "active": "true",
    "time_sheet_policy": "",
    "sys_domain_path": "/",
    "phone": "+1 858 287 7834",
    "cost_center": "",
    "name": "George Warren",
    "employee_number": "",
    "gender": "",
    "city": "",
    "user_name": "george.warren",
    "failed_attempts": "",
    "edu_status": "",
    "latitude": "",
    "roles": "",
    "title": "Network Administrator",
    "sys_class_name": "customer_contact",
    "sys_id": "ddce70866f9331003b3c498f5d3ee417",
    "internal_integration_user": "false",
    "ldap_server": "",
    "mobile_phone": "+1 858 867 7857",
    "street": "",
    "company": "86837a386f0331003b3c498f5d3ee4ca",
    "department": "",
    "first_name": "George",
    "preferred_language": "",
    "introduction": "",
    "email": "geo.warren@mailinator.com",
    "manager": "",
    "locked_out": "false",
    "sys_mod_count": "3",
    "last_name": "Warren",
    "photo": "",
    "sys_tags": "",
    "middle_name": "",
    "time_zone": "",
    "schedule": "",
    "on_schedule": "",
    "date_format": "",
    "location": "25ab8e460a0a0bb300857304ff811af5",
    "account": "86837a386f0331003b3c498f5d3ee4ca"
  }
}

Contact - POST /now/contact

Creates a new Customer Service Management (CSM) contact.

In addition, you can create a social media profile for the contact using this endpoint. To create the profile, you must specify the following parameters in the request body:
  • social_channel
  • social_handle
  • social_handle_url
Warning: This endpoint does not perform parameter validation as doing so can create excessive overhead. If a request parameter is misspelled, is not valid, or is not supported by the endpoint, it is ignored without warning.

URL format

Versioned URL: /api/now/{api_version}/contact

Default URL: /api/now/contact

Supported request parameters

Table 13. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

Table 14. Query parameters
Name Description
None

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Table 16. Request headers
Header Description
Accept Data format of the response body. Only supports application/json.
Content-Type Data format of the request body. Only supports application/json.
Table 17. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Response body parameters (JSON or XML)

Element Description
result Sys_id of the newly created contact record.

Data type: String

Example: cURL request

curl -X POST "https://instance.servicenow.com/api/now/contact" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{ \
  "country": "USA", \
  "calendar_integration": "1", \
  "last_login_time": "2018-03-10 21:48:11", \
  "last_login_device": "tablet", \
  "building": "Cardinal West", \
  "web_service_access_only": "false", \
  "notification": "1", \
  "enable_multifactor_authn": "true", \
  "agent_status": "Travelling", \
  "state": "CA", \
  "vip": "false", \
  "longitude": "123.76", \
  "zip": "92069", \
  "home_phone": "(555)555-1234", \
  "time_format": "hh:mm:ss", \
  "geolocation_tracked": "false", \
  "active": "true", \
  "phone": "+1 858 287 7834", \
  "cost_center": "1345", \
  "name": "Dora Warren", \
  "employee_number": "546", \
  "gender": "Female", \
  "city": "Orlando", \
  "user_name": "dora.warren", \
  "failed_attempts": "2", \
  "edu_status": "current", \
  "latitude": "57.6", \
  "title": "Network Administrator", \
  "internal_integration_user": "false", \
  "ldap_server": "10.24.23.123", \
  "mobile_phone": "+1 858 867 7857", \
  "street": "123 Lagume", \
  "company": "86837a386f0331003b3c498f5d3ee4ca", \
  "department": "IT", \
  "first_name": "Dora", \
  "preferred_language": "Spanish", \
  "email": "dora.warren@mailinator.com", \
  "manager": "ddce70866f9331003b3c498f5d3ee417", \
  "locked_out": "false", \
  "last_name": "Warren", \
  "middle_name": "Dell", \
  "time_zone": "PST", \
  "schedule": "9-5", \
  "date_format": "MM/DD/YY", \
  "location": "25ab8e460a0a0bb300857304ff811af5", \
  "account": "86837a386f0331003b3c498f5d3ee4ca" \
}'
--user 'username':'password'
"result": "62fe1c97db76c3006b7a9646db961999"