Using your technology partner authorization credentials, you can make V3 API calls to perform all or some marketing tasks on behalf of your managed client accounts.
To send a V3 API request on behalf of a managed client account, make a POST call to the /partner/accounts/{encoded_account_id}/account_operations/sync
endpoint and specify the managed client account’s encoded account ID (encoded_account_id
).
For example: /partner/accounts/a07e1lxqqqo0/account_operations/sync
encoded_account_id
for all managed client accounts under your technology partner account, make a GET call to the /partner/accounts
endpoint. Set the account_type
query parameter to managed
to return only managed client account information in the results. Constructing the Request Body
The API method and endpoint that you choose to include when making a POST call to the /partner/accounts/{encoded_account_id}/account_operations/sync
endpoint determines the request body properties to include and the structure of the request. The resulting response body schema directly corresponds to the API request you specify in the request body.
Request body parameters and properties
Because the request body is free-form, before you attempt to send an API request for a managed client account, it is important that you have a clear understanding about how the developer endpoint you choose to use works. You should know valid parameters, properties, and values for the endpoint and if they are required or not.
Under the API Reference tab, review the documentation for the endpoint you want to include in the request body to get the information that follows:
account_operation_url
Required. The API method path for the request you are sending on behalf of a managed child account. This value should be a V3 API URL that includes the path parameter names but does not include the base URL (https://api.cc.email/v3
).
For example: /emails/activities/{campaign_activity_id}
account_operation_method
Required. The method for the request you are sending on behalf of a managed child account (GET
, POST
, PUT
, DELETE
, or PATCH
).
account_operation_path_parameters
An array containing the path parameters for the request you are sending on behalf of a managed child account.
path_param_key
: The name of the path parameter (string).path_param_value
: The value of the path parameter (string).
The following example shows you how to specify the client ID as a path parameter when making a GET call to the /contacts/{contact_id}
endpoint:
"account_operation_path_parameters"`: `[ { "path_param_key": "contact_id", "path_param_value": "66eb409a-5a95-11eb-86d5-fa163e5bf31a" } ]
account_operation_headers
An array containing the headers for the request you are sending on behalf of a managed child account.
header_key
: The name of the header (string).header_value
: The value of the header (string).
For example:
"account_operation_headers": [{"header_key": "Accept", "header_value": "application/json"}]
account_operation_payload
The request payload you are sending on behalf of a managed child account. Create a valid JSON request body for the specified URL. A valid request body will depend on the documented schema requirements for that URL. You must convert the valid JSON request body to string escaped JSON so that you can provide it as a string to the account_operation_payload
request body property.
For example:
"{\"import_data\":[{\"email\":\"joe.jones@example.com\",\"first_name\":\"Joe\",\"last_name\":\"Jones\",\"job_title\":\"Chief Innovation Officer\",\"company_name\":\"RelativeGravity, Inc.\",\"birthday_month\":11,\"birthday_day\":24,\"anniversary\":\"2006-11-15\",\"phone\":\"555-555-5555\",\"street\":\"123 Maple Lane\",\"street2\":\"Apt. 337\",\"city\":\"Chicago\",\"state\":\"Illinois\",\"zip\":\"60609\",\"country\":\"United States\"}],\"list_ids\":[\"66d9b5f0-5a95-11eb-a9a2-fa163e5bf31a\"]}"
account_operation_query_parameters
An array containing the query parameters for the request you are sending on behalf of a managed child account.
query_param_key
: The name of the query parameter (string).query_param_value
: The value of the query parameter (string).
The following example shows you how to include list memberships in the response when making a GET call to the /contacts/{contact_id}
endpoint:
"account_operation_query_parameters": [ {"query_param_key": "include", "query_param_value": "list_memberships"}]
Example API Requests and Responses
The sections that follow provide examples for how you can use the POST /partner/accounts/{encoded_account_id}/account_operations/sync
endpoint to make V3 API calls to endpoints on behalf of a managed client account.
Get Details About a Contact for Managed Client Account
This example shows you how you use the POST /partner/accounts/{encoded_account_id}/account_operations/sync
endpoint to make a GET call to /contacts/{contact_id}
. This endpoint returns details for a single contact_id
and uses the include
query parameter to return list_memberships
details for the specified managed client account.
Request Body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.cc.email/v3/partner/accounts/a05e1lxtn5i0/account_operations/sync',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"account_operation_url": "/activities/contacts_json_import",
"account_operation_method": "POST",
"account_operation_payload": "{\\"import_data\\":[{\\"email\\":\\"joe.jones@example.com\\",\\"first_name\\":\\"Joe\\",\\"last_name\\":\\"Jones\\",\\"job_title\\":\\"Chief Innovation Officer\\",\\"company_name\\":\\"RelativeGravity, Inc.\\",\\"birthday_month\\":11,\\"birthday_day\\":24,\\"anniversary\\":\\"2006-11-15\\",\\"phone\\":\\"555-555-5555\\",\\"street\\":\\"123 Maple Lane\\",\\"street2\\":\\"Apt. 337\\",\\"city\\":\\"Chicago\\",\\"state\\":\\"Illinois\\",\\"zip\\":\\"60609\\",\\"country\\":\\"United States\\"}],\\"list_ids\\":[\\"56d9b5f0-5a95-11eb-a9a2-fa163e5bf31a\\"]}",
"account_operation_headers": []
}',
CURLOPT_HTTPHEADER => array(
'x-api-key: 5d1dc312-342b-436d-97c3-0f7f502218f1',
'content-type: application/json',
'Authorization: Bearer eyJraWQiOiJoTk1yTGplN3BLWlQ0aVpWQzZGTG9DS0RGTkYzT2w0XC9KaDU2TUFtc3RnQT0iLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiI2cjZ0bzVmb2UxZ2luNWt0N3Y2Y2JoanNjcyIsInRva2VuX3VzZSI6ImFjY2VzcyIsInNjb3BlIjoidjNhcGlcL2dlbmVyYWwucGFydG5lciIsImF1dGhfdGltZSI6MTY0ODIzNzEwOSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfTUd4alFNTTRQIiwiZXhwIjoxNjQ4MjQwNzA5LCJpYXQiOjE2NDgyMzcxMDksInZlcnNpb24iOjIsImp0aSI6IjUwZTRkODczLWI0ZDctNDA1My05MDUyLTBmYjllZjY2MDczOSIsImNsaWVudF9pZCI6IjZyNnRvNWZvZTFnaW41a3Q3djZjYmhqc2NzIn0.TCimfdavPnGJJXO3KdhqiKlX8mbjTBQCNaiI90F5ZgpSz2xlEA49sW9VrCcL0MTHcHbp58839a7EHaCRIo6wZbd6TcAq8Mm1wv_fmJTYs38fGL-dDR3GD9HucxUrnnAAkwvIAfkIHH6YJTpRnVTBwPv-5Hizv7X0kqxYVB3FBw6B13j9T5rX1lyqm2K-z--xU9VDn5kF9D78oV1Zi47_uVZv1eJDLE0fceBcpedZbf5sKMc_OmGK93OTszDD9MPWdQzVGVfkw_OiQX30M8SFB667erVnjal_gr2KrILynoBS0yVvR4m6A5ztqhW52yZV-Ds8JT8gS0-abc123TNw'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"account_operation_url\": \"/activities/contacts_json_import\",\n \"account_operation_method\": \"POST\",\n \"account_operation_payload\": \"{\\\"import_data\\\":[{\\\"email\\\":\\\"joe.jones@example.com\\\",\\\"first_name\\\":\\\"Joe\\\",\\\"last_name\\\":\\\"Jones\\\",\\\"job_title\\\":\\\"Chief Innovation Officer\\\",\\\"company_name\\\":\\\"RelativeGravity, Inc.\\\",\\\"birthday_month\\\":11,\\\"birthday_day\\\":24,\\\"anniversary\\\":\\\"2006-11-15\\\",\\\"phone\\\":\\\"555-555-5555\\\",\\\"street\\\":\\\"123 Maple Lane\\\",\\\"street2\\\":\\\"Apt. 337\\\",\\\"city\\\":\\\"Chicago\\\",\\\"state\\\":\\\"Illinois\\\",\\\"zip\\\":\\\"60609\\\",\\\"country\\\":\\\"United States\\\"}],\\\"list_ids\\\":[\\\"56d9b5f0-5a95-11eb-a9a2-fa163e5bf31a\\\"]}\",\n \"account_operation_headers\": []\n}");
Request request = new Request.Builder()
.url("https://api.cc.email/v3/partner/accounts/a05e1lxtn9i0/account_operations/sync")
.method("POST", body)
.addHeader("x-api-key", "5d1dc312-542b-436d-97c3-0f7f502218f1")
.addHeader("content-type", "application/json")
.addHeader("Authorization", "Bearer eyJraWQiOiJoTk1yTGplN3BLWlQ0aVpWQzZGTG9DS0RGTkYzT2w0XC9KaDU2TUFtc3RnQT0iLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiI2cjZ0bzVmb2UxZ2luNWt0N3Y2Y2JoanNjcyIsInRva2VuX3VzZSI6ImFjY2VzcyIsInNjb3BlIjoidjNhcGlcL2dlbmVyYWwucGFydG5lciIsImF1dGhfdGltZSI6MTY0ODIzNzEwOSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfTUd4alFNTTRQIiwiZXhwIjoxNjQ4MjQwNzA5LCJpYXQiOjE2NDgyMzcxMDksInZlcnNpb24iOjIsImp0aSI6IjUwZTRkODczLWI0ZDctNDA1My05MDUyLTBmYjllZjY2MDczOSIsImNsaWVudF9pZCI6IjZyNnRvNWZvZTFnaW41a3Q3djZjYmhqc2NzIn0.TCimfdavPnGJJXO3KdhqiKlX8mbjTBQCNaiI90F5ZgpSz2xlEA49sW9VrCcL0MTHcHbp58839a7EHaCRIo6wZbd6TcAq8Mm1wv_fmJTYs38fGL-dDR3GD9HucxUrnnAAkwvIAfkIHH6YJTpRnVTBwPv-5Hizv7X0kqxYVB3FBw6B13j9T5rX1lyqm2K-z--xU9VDn5kF9D78oV1Zi47_uVZv1eJDLE0fceBcpedZbf5sKMc_OmGK93OTszDD9MPWdQzVGVfkw_OiQX30M8SFB667erVnjal_gr2KrILynoBS0yVvR4m6A5ztqhW52yZV-Ds8JT8gS0-abc123TNw")
.build();
Response response = client.newCall(request).execute();
curl --location --request POST 'https://api.cc.email/v3/partner/accounts/a07e1lxtn321/account_operations/sync' \
--header 'x-api-key: 5d1dc312-542b-436d-97c3-0f7f502218f1' \
--header 'content-type: application/json' \
--header 'Authorization: Bearer eyJraWQiOiJoTk1yTGplN3BLWlQ0aVpWQzZGTG9DS0RGTkYzT2w0XC9KaDU2TUFtc3RnQT0iLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiI2cjZ0bzVmb2UxZ2luNWt0N3Y2Y2JoanNjcyIsInRva2VuX3VzZSI6ImFjY2VzcyIsInNjb3BlIjoidjNhcGlcL2dlbmVyYWwucGFydG5lciIsImF1dGhfdGltZSI6MTY0ODIzNzEwOSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfTUd4alFNTTRQIiwiZXhwIjoxNjQ4MjQwNzA5LCJpYXQiOjE2NDgyMzcxMDksInZlcnNpb24iOjIsImp0aSI6IjUwZTRkODczLWI0ZDctNDA1My05MDUyLTBmYjllZjY2MDczOSIsImNsaWVudF9pZCI6IjZyNnRvNWZvZTFnaW41a3Q3djZjYmhqc2NzIn0.TCimfdavPnGJJXO3KdhqiKlX8mbjTBQCNaiI90F5ZgpSz2xlEA49sW9VrCcL0MTHcHbp58839a7EHaCRIo6wZbd6TcAq8Mm1wv_fmJTYs38fGL-dDR3GD9HucxUrnnAAkwvIAfkIHH6YJTpRnVTBwPv-5Hizv7X0kqxYVB3FBw6B13j9T5rX1lyqm2K-z--xU9VDn5kF9D78oV1Zi47_uVZv1eJDLE0fceBcpedZbf5sKMc_OmGK93OTszDD9MPWdQzVGVfkw_OiQX30M8SFB667erVnjal_gr2KrILynoBS0yVvR4m6A5ztqhW52yZV-Ds8JT8gS0-abc123Nw' \
--data-raw '{
"account_operation_url": "/activities/contacts_json_import",
"account_operation_method": "POST",
"account_operation_payload": "{\"import_data\":[{\"email\":\"joe.jones@example.com\",\"first_name\":\"Joe\",\"last_name\":\"Jones\",\"job_title\":\"Chief Innovation Officer\",\"company_name\":\"RelativeGravity, Inc.\",\"birthday_month\":11,\"birthday_day\":24,\"anniversary\":\"2006-11-15\",\"phone\":\"555-555-5555\",\"street\":\"123 Maple Lane\",\"street2\":\"Apt. 337\",\"city\":\"Chicago\",\"state\":\"Illinois\",\"zip\":\"60609\",\"country\":\"United States\"}],\"list_ids\":[\"56d9b5f0-5a95-11eb-a9a2-fa163e5bf31a\"]}",
"account_operation_headers": []
}'
Response Body
The resulting response body includes contact details that relate to the contacts
resource and also includes list membership details that relate to the list_memberships
sub-resource.
"contacts": [
{
"contact_id": "5ef41618-f130-11e9-91a7-fa163e56c9b0",
"email_address": {
"address": "client865@0000065mbstore.com",
"permission_to_send": "implicit",
"created_at": "2019-10-17T22:48:36Z",
"updated_at": "2020-10-28T15:49:55Z",
"opt_in_source": "Account",
"opt_in_date": "2019-10-17T22:48:35Z",
"confirm_status": "off"
},
"first_name": "SingleAppt0000065_F",
"last_name": "SingleAppt0000065_L",
"birthday_month": 11,
"birthday_day": 14,
"anniversary": "2018-09-03",
"update_source": "Account",
"create_source": "Account",
"created_at": "2019-10-17T22:48:38Z",
"updated_at": "2021-10-22T13:12:13Z",
"list_memberships": [
"57ee2b14-f101-11e9-898f-fa163e56c9b0"
]
},
{
"contact_id": "5efcd0e6-f130-11e9-91a7-fa163e56c9b0",
"email_address": {
"address": "singleappt0000378@568mbstore.com",
"permission_to_send": "implicit",
"created_at": "2019-10-17T22:48:36Z",
"updated_at": "2019-10-17T22:48:36Z",
"opt_in_source": "Account",
"opt_in_date": "2019-10-17T22:48:35Z",
"confirm_status": "off"
},
"first_name": "SingleAppt0000378_F",
"last_name": "SingleAppt0000378_L",
"birthday_month": 10,
"birthday_day": 21,
"anniversary": "2018-11-05",
"update_source": "Account",
"create_source": "Account",
"created_at": "2019-10-17T22:48:38Z",
"updated_at": "2021-05-23T13:11:47Z",
"list_memberships": [
"57ee2b14-f101-11e9-898f-fa163e56c000"
]
}
],
"_links": {
"next": {
"href": "/v3/contacts?cursor=abcjbHVkZT1saXN0X21lbWJlcnNoaXBzJmxpbWl0PTImbmV4dD0y"
}
}
}
Import Contacts for a Managed Client Account
To import contacts and contact details into a managed client account, use the POST /partner/accounts/{encoded_account_id}/account_operations/sync
endpoint to make a POST call to the /activities/contacts_json_import
endpoint. This endpoint requires that you use single-string escaped JSON in the request body.
Request Body
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.cc.email/v3/partner/accounts/a05e1lxtn9i0/account_operations/sync',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"account_operation_url": "/activities/contacts_json_import",
"account_operation_method": "POST",
"account_operation_payload": "{\\"import_data\\":[{\\"email\\":\\"joe.jones@example.com\\",\\"first_name\\":\\"Joe\\",\\"last_name\\":\\"Jones\\",\\"job_title\\":\\"Chief Innovation Officer\\",\\"company_name\\":\\"RelativeGravity, Inc.\\",\\"birthday_month\\":11,\\"birthday_day\\":24,\\"anniversary\\":\\"2006-11-15\\",\\"phone\\":\\"555-555-5555\\",\\"street\\":\\"123 Maple Lane\\",\\"street2\\":\\"Apt. 337\\",\\"city\\":\\"Chicago\\",\\"state\\":\\"Illinois\\",\\"zip\\":\\"60609\\",\\"country\\":\\"United States\\"}],\\"list_ids\\":[\\"56d9b5f0-5a95-11eb-a9a2-fa163e5bf31a\\"]}",
"account_operation_headers": []
}',
CURLOPT_HTTPHEADER => array(
'x-api-key: 5d1dc312-542b-436d-97c3-0f7f502218f1',
'content-type: application/json',
'Authorization: Bearer eyJraWQiOiJoTk1yTGplN3BLWlQ0aVpWQzZGTG9DS0RGTkYzT2w0XC9KaDU2TUFtc3RnQT0iLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiI2cjZ0bzVmb2UxZ2luNWt0N3Y2Y2JoanNjcyIsInRva2VuX3VzZSI6ImFjY2VzcyIsInNjb3BlIjoidjNhcGlcL2dlbmVyYWwucGFydG5lciIsImF1dGhfdGltZSI6MTY0ODIzNzEwOSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfTUd4alFNTTRQIiwiZXhwIjoxNjQ4MjQwNzA5LCJpYXQiOjE2NDgyMzcxMDksInZlcnNpb24iOjIsImp0aSI6IjUwZTRkODczLWI0ZDctNDA1My05MDUyLTBmYjllZjY2MDczOSIsImNsaWVudF9pZCI6IjZyNnRvNWZvZTFnaW41a3Q3djZjYmhqc2NzIn0.TCimfdavPnGJJXO3KdhqiKlX8mbjTBQCNaiI90F5ZgpSz2xlEA49sW9VrCcL0MTHcHbp58839a7EHaCRIo6wZbd6TcAq8Mm1wv_fmJTYs38fGL-dDR3GD9HucxUrnnAAkwvIAfkIHH6YJTpRnVTBwPv-5Hizv7X0kqxYVB3FBw6B13j9T5rX1lyqm2K-z--xU9VDn5kF9D78oV1Zi47_uVZv1eJDLE0fceBcpedZbf5sKMc_OmGK93OTszDD9MPWdQzVGVfkw_OiQX30M8SFB667erVnjal_gr2KrILynoBS0yVvR4m6A5ztqhW52yZV-Ds8JT8gS0-abc123AzTNw'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"account_operation_url\": \"/activities/contacts_json_import\",\n \"account_operation_method\": \"POST\",\n \"account_operation_payload\": \"{\\\"import_data\\\":[{\\\"email\\\":\\\"joe.jones@example.com\\\",\\\"first_name\\\":\\\"Joe\\\",\\\"last_name\\\":\\\"Jones\\\",\\\"job_title\\\":\\\"Chief Innovation Officer\\\",\\\"company_name\\\":\\\"RelativeGravity, Inc.\\\",\\\"birthday_month\\\":11,\\\"birthday_day\\\":24,\\\"anniversary\\\":\\\"2006-11-15\\\",\\\"phone\\\":\\\"555-555-5555\\\",\\\"street\\\":\\\"123 Maple Lane\\\",\\\"street2\\\":\\\"Apt. 337\\\",\\\"city\\\":\\\"Chicago\\\",\\\"state\\\":\\\"Illinois\\\",\\\"zip\\\":\\\"60609\\\",\\\"country\\\":\\\"United States\\\"}],\\\"list_ids\\\":[\\\"66d9b5f0-5a95-11eb-a9a2-fa163e5bf31a\\\"]}\",\n \"account_operation_headers\": []\n}");
Request request = new Request.Builder()
.url("https://api.cc.email/v3/partner/accounts/a05e1lxtn9i0/account_operations/sync")
.method("POST", body)
.addHeader("x-api-key", "5d1dc312-542b-436d-97c3-0f7f502218f1")
.addHeader("content-type", "application/json")
.addHeader("Authorization", "Bearer eyJraWQiOiJoTk1yTGplN3BLWlQ0aVpWQzZGTG9DS0RGTkYzT2w0XC9KaDU2TUFtc3RnQT0iLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiI2cjZ0bzVmb2UxZ2luNWt0N3Y2Y2JoanNjcyIsInRva2VuX3VzZSI6ImFjY2VzcyIsInNjb3BlIjoidjNhcGlcL2dlbmVyYWwucGFydG5lciIsImF1dGhfdGltZSI6MTY0ODIzNzEwOSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfTUd4alFNTTRQIiwiZXhwIjoxNjQ4MjQwNzA5LCJpYXQiOjE2NDgyMzcxMDksInZlcnNpb24iOjIsImp0aSI6IjUwZTRkODczLWI0ZDctNDA1My05MDUyLTBmYjllZjY2MDczOSIsImNsaWVudF9pZCI6IjZyNnRvNWZvZTFnaW41a3Q3djZjYmhqc2NzIn0.TCimfdavPnGJJXO3KdhqiKlX8mbjTBQCNaiI90F5ZgpSz2xlEA49sW9VrCcL0MTHcHbp58839a7EHaCRIo6wZbd6TcAq8Mm1wv_fmJTYs38fGL-dDR3GD9HucxUrnnAAkwvIAfkIHH6YJTpRnVTBwPv-5Hizv7X0kqxYVB3FBw6B13j9T5rX1lyqm2K-z--xU9VDn5kF9D78oV1Zi47_uVZv1eJDLE0fceBcpedZbf5sKMc_OmGK93OTszDD9MPWdQzVGVfkw_OiQX30M8SFB667erVnjal_gr2KrILynoBS0yVvR4m6A5ztqhW52yZV-Ds8JT8gS0-abc123AzTNw")
.build();
Response response = client.newCall(request).execute();
curl --location --request POST 'https://api.cc.email/v3/partner/accounts/a05e1lxtn9i0/account_operations/sync' \
--header 'x-api-key: 5d1dc312-542b-436d-97c3-0f7f502218f1' \
--header 'content-type: application/json' \
--header 'Authorization: Bearer eyJraWQiOiJoTk1yTGplN3BLWlQ0aVpWQzZGTG9DS0RGTkYzT2w0XC9KaDU2TUFtc3RnQT0iLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiI2cjZ0bzVmb2UxZ2luNWt0N3Y2Y2JoanNjcyIsInRva2VuX3VzZSI6ImFjY2VzcyIsInNjb3BlIjoidjNhcGlcL2dlbmVyYWwucGFydG5lciIsImF1dGhfdGltZSI6MTY0ODIzNzEwOSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfTUd4alFNTTRQIiwiZXhwIjoxNjQ4MjQwNzA5LCJpYXQiOjE2NDgyMzcxMDksInZlcnNpb24iOjIsImp0aSI6IjUwZTRkODczLWI0ZDctNDA1My05MDUyLTBmYjllZjY2MDczOSIsImNsaWVudF9pZCI6IjZyNnRvNWZvZTFnaW41a3Q3djZjYmhqc2NzIn0.TCimfdavPnGJJXO3KdhqiKlX8mbjTBQCNaiI90F5ZgpSz2xlEA49sW9VrCcL0MTHcHbp58839a7EHaCRIo6wZbd6TcAq8Mm1wv_fmJTYs38fGL-dDR3GD9HucxUrnnAAkwvIAfkIHH6YJTpRnVTBwPv-5Hizv7X0kqxYVB3FBw6B13j9T5rX1lyqm2K-z--xU9VDn5kF9D78oV1Zi47_uVZv1eJDLE0fceBcpedZbf5sKMc_OmGK93OTszDD9MPWdQzVGVfkw_OiQX30M8SFB667erVnjal_gr2KrILynoBS0yVvR4m6A5ztqhW52yZV-Ds8JT8gS0-abc123AzTNw' \
--data-raw '{
"account_operation_url": "/activities/contacts_json_import",
"account_operation_method": "POST",
"account_operation_payload": "{\"import_data\":[{\"email\":\"joe.jones@example.com\",\"first_name\":\"Joe\",\"last_name\":\"Jones\",\"job_title\":\"Chief Innovation Officer\",\"company_name\":\"RelativeGravity, Inc.\",\"birthday_month\":11,\"birthday_day\":24,\"anniversary\":\"2006-11-15\",\"phone\":\"555-555-5555\",\"street\":\"123 Maple Lane\",\"street2\":\"Apt. 337\",\"city\":\"Chicago\",\"state\":\"Illinois\",\"zip\":\"60609\",\"country\":\"United States\"}],\"list_ids\":[\"56d9b5f0-5a95-11eb-a9a2-fa163e5bf31a\"]}",
"account_operation_headers": []
}'
Response Body
The response body includes details about the resulting activity that the request creates, including the activity_id
and the link to use to view the current status of the activity.
{
"activity_id": "56b90820-cc52-11ea-9dad-fa163e3d9012",
"state": "initialized",
"started_at": "2022-01-23T13:48:40.108Z",
"completed_at": "2022-01-23T13:48:44.108Z",
"created_at": "2022-01-23T13:48:44.108Z",
"updated_at": "2022-01-23T13:48:44.108Z",
"source_file_name": "222-21-04-contact_import.xls",
"percent_done": 75,
"activity_errors": [
"Message describing the error condition."
],
"status": {
"items_total_count": 87,
"person_count": 20,
"error_count": 1,
"correctable_count": 1,
"cannot_add_to_list_count": 1
},
"_links": {
"self": {
"href": "/v3/activities/055fe9a97-a579-43c5-bb1a-58ed29bf0a6a"
}
}
}
To view the results after the activity successfully completes, make a GET call to the /activities/{activity_id}
endpoint and specify the activity_id
to use.
Create New Segments for a Managed Client Account
To create a new segment for a managed client account, use the POST /partner/accounts/{encoded_account_id}/account_operations/sync
endpoint to make a POST call to the /segments
endpoint.
Request Body
You must specify both a unique segment name
and the segment_criteria
to use in the request body. This endpoint requires that you use valid string escaped JSON in the request body.
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.cc.email/v3/partner/accounts/a05e1lxtn9i0/account_operations/sync',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"account_operation_url": "/segments",
"account_operation_method": "POST",
"account_operation_payload": "{\\"name\\":\\"Re-engage contacts who did not open the last 5 email campaign activities.\\",\\"segment_criteria\\":\\"{\\\\\\"version\\\\\\":\\\\\\"1.0.0\\\\\\",\\\\\\"criteria\\\\\\":{\\\\\\"type\\\\\\":\\\\\\"and\\\\\\",\\\\\\"group\\\\\\":[{\\\\\\"source\\\\\\":\\\\\\"tracking\\\\\\",\\\\\\"field\\\\\\":\\\\\\"not_opened\\\\\\",\\\\\\"op\\\\\\":\\\\\\"contains-any\\\\\\",\\\\\\"const_value\\\\\\":\\\\\\"last-n-campaigns\\\\\\",\\\\\\"param\\\\\\":\\\\\\"5\\\\\\"}]}}\\"}",
"account_operation_headers": []
}',
CURLOPT_HTTPHEADER => array(
'x-api-key: 5d1dc312-542b-436d-97c3-0f7f502218f1',
'content-type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"account_operation_url\": \"/segments\",\n \"account_operation_method\": \"POST\",\n \"account_operation_payload\": \"{\\\"name\\\":\\\"Re-engage contacts who did not open the last 5 email campaign activities.\\\",\\\"segment_criteria\\\":\\\"{\\\\\\\"version\\\\\\\":\\\\\\\"1.0.0\\\\\\\",\\\\\\\"criteria\\\\\\\":{\\\\\\\"type\\\\\\\":\\\\\\\"and\\\\\\\",\\\\\\\"group\\\\\\\":[{\\\\\\\"source\\\\\\\":\\\\\\\"tracking\\\\\\\",\\\\\\\"field\\\\\\\":\\\\\\\"not_opened\\\\\\\",\\\\\\\"op\\\\\\\":\\\\\\\"contains-any\\\\\\\",\\\\\\\"const_value\\\\\\\":\\\\\\\"last-n-campaigns\\\\\\\",\\\\\\\"param\\\\\\\":\\\\\\\"5\\\\\\\"}]}}\\\"}\",\n \"account_operation_headers\": []\n}");
Request request = new Request.Builder()
.url("https://api.cc.email/v3/partner/accounts/a05e1lxtn9i0/account_operations/sync")
.method("POST", body)
.addHeader("x-api-key", "5d1dc312-542b-436d-97c3-0f7f502218f1")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
curl --location --request POST 'https://api.cc.email/v3/partner/accounts/a05e1lxtn9i0/account_operations/sync' \
--header 'x-api-key: 5d1dc312-542b-436d-97c3-0f7f502218f1' \
--header 'content-type: application/json' \
--data-raw '{
"account_operation_url": "/segments",
"account_operation_method": "POST",
"account_operation_payload": "{\"name\":\"Re-engage contacts who did not open the last 5 email campaign activities.\",\"segment_criteria\":\"{\\\"version\\\":\\\"1.0.0\\\",\\\"criteria\\\":{\\\"type\\\":\\\"and\\\",\\\"group\\\":[{\\\"source\\\":\\\"tracking\\\",\\\"field\\\":\\\"not_opened\\\",\\\"op\\\":\\\"contains-any\\\",\\\"const_value\\\":\\\"last-n-campaigns\\\",\\\"param\\\":\\\"5\\\"}]}}\"}",
"account_operation_headers": []
}'
Response Body
{
"name": "Re-engage contacts who did not open the last 5 email campaign activities.",
"segment_criteria": "{\"version\":\"1.0.0\",\"criteria\":{\"type\":\"and\",\"group\":[{\"source\":\"tracking\",\"field\":\"not_opened\",\"op\":\"contains-any\",\"const_value\":\"last-n-campaigns\",\"param\":\"5\"}]}}",
"segment_id": 14,
"created_at": "2021-04-25T11:08:00.000Z",
"edited_at": "2021-04-25T11:08:00.000Z"
}
View it! Although technology partner endpoints cannot be tested using our API Reference Tester, response samples and schema are available to view for this endpoint.