Create, Update, and Delete Phone Numbers via API
Do you want to easily create, update, and delete phone numbers in your engageSPARK account? engageSPARK’s super fast and powerful contacts API allows you to do just that. For now, this article will show you how to create or add contacts to your account – updating and deleting contacts will be added soon.
Create Contacts API
Our API docs are moving! Please find the new Create Contacts API docs here.
Update Contacts API
HTTP Method & Headers
The HTTP method is PUT using the URL below:
https://api.engagespark.com/v1/organizations/{orgid}/contacts/{id}/
You’ll need to set the following HTTP Headers:
Key | Value |
Authorization | Token {apikey} |
Content-type | application/json |
- Replace {orgid} with your actual organization ID which you can find here: Account (Avatar icon) > Organization > Info > Organization ID https://app.engagespark.com/account/organization/info. Don’t forget to remove the curly braces { }.
- Replace {API_KEY} with your actual API Key which you can find here: Account (Avatar icon) > Profile > Info > API Key https://app.engagespark.com/account/profile/info. Don’t forget to remove the curly braces { }.
- Replace {id} with the contact ID created on Create Contacts API (on example above it would be “id”: 987654)
Request Body Definition
The details you need to provide to successfully update contacts using the Contacts API are the same as the ones used to create contacts (see above)
OR
Provide only the details of the information you want to change
Sample JSON (if you only wanted to change the language):
{
"language": "Spanish"
}
Sample JSON (if you wanted to change all previous information):
{
"firstName": "Annie",
"lastName": "Jones-Smith",
"phoneNumber": "19123456789",
"phoneNumberCountry": "US",
"language": "Spanish",
"customFields": {
"5678": "41",
"1236": "Other"
},
"groups": [125,126]
}
Response Body Definition
The details that will be returned after every update contacts API request are the same as the details from create contacts API (see above):
List of Possible HTTP Status Codes
Success:
200 – everything’s fine.
Failed:
400 – there’s something wrong with the request. Please see the error field in the response body.
401 – authentication problems.
500 – engageSPARK internal service error.
Delete Contacts API
HTTP Method & Headers
The HTTP method is DELETE using the URL below:
https://api.engagespark.com/v1/organizations/{orgid}/contacts/{id}/
You’ll need to set the following HTTP Headers:
Key | Value |
Authorization | Token {apikey} |
Content-type | application/json |
- Replace {orgid} with your actual organization ID which you can find here: Account (Avatar icon) > Organization > Info > Organization ID https://app.engagespark.com/account/organization/info. Don’t forget to remove the curly braces { }.
- Replace {API_KEY} with your actual API Key which you can find here: Account (Avatar icon) > Profile > Info > API Key https://app.engagespark.com/account/profile/info. Don’t forget to remove the curly braces { }.
- Replace {id} with the contact ID created on Create Contacts API (on example above from the Create Contacts API it would be “id”: 987654)
Request Body Definition
Below are the only details you need to provide in order for you to successfully delete contacts using the Contacts API:
Key | Description | Data Type | Example |
id | This is a system-generated ID for your contact | Integer |
“987654”
|
Sample JSON:
No body is necessary for this request.
Response Body Definition
An empty body will be returned after every successful delete contacts API request:
Sample JSON Response:
{}
List of Possible HTTP Status Codes
Success:
200 – everything’s fine.
Failed:
400 – there’s something wrong with the request. Please see the error field in the response body.
401 – authentication problems.
404 – if the contact is not found.
500 – engageSPARK internal service error.
Have questions or need a little extra help?