Introduction
The base URL for all of the requests detailed in this documentation is:
https://api.ontraport.com/1/
All requests must be made over HTTPS. Any insecure requests are redirected to the HTTPS equivalent URL. The
/1/
prefix in the URL is the version number. When substantial changes to the API are released, this number will change.
Welcome to the new documentation for the Ontraport API! If you are looking for the old documentation, you can find it here.
Our API offers a simple, RESTful interface with JSON-formatted responses. With it, you can manage contacts, process transactions, add and remove tags and sequences, and much more.
This documentation contains detailed information about our most widely used API endpoints and general information about best practices.
We currently offer an official PHP client library for our API to simplify building your integration. Code examples using this library and cURL are offered on the right side of the page. You can toggle between languages using the tabs at the top.
Getting Started
Obtain an API Key
In order to get started making requests on our API, you must obtain a unique API key and App ID. These credentials can be requested in your Administration settings. Your API key provides access to powerful functionality and should not be shared with anyone.
Once you have an API key, you can also try out some requests on your account using our live documentation. These requests will be performed on your actual data, so use caution in deciding which requests to make.
Obtain a sandbox
Any requests made using your API key will be performed using real data in your Ontraport account. You can email support@ontraport.com with any questions you may have.
To obtain a sandbox account, submit an application here.
Authentication
# Using curl, you can just pass the correct header with each request
curl -X "API endpoint here" \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
// Authentication occurs when the API Key and App ID are sent as request headers
// These headers are set when you create a new instance of the Ontraport client
$client = new Ontraport("2_AppID_12345678","Key5678");
Example values are used for API key and App ID, your unique credentials must be used in your request.
To interact with our API, authentication credentials must be sent with each HTTP request as headers. These credentials include a unique API key and App ID. Any requests sent without valid credentials in the headers will fail.
Header | Value |
---|---|
Api-Key |
Set to your unique API key. This must be used in conjunction with your unique site ID or your request will not authenticate. Required. |
Api-Appid |
Set to your unique site ID. Required. |
Rate limiting
Each Ontraport account is allowed up to 180 requests per minute. This is a rolling limit that resets each minute.
If you find that your application needs more than the allotted number of calls, you may wish to check that you are utilizing our pagination tools and/or consider implementing cache functionality.
Our support staff will consider reasonable requests to increase rate limits on a per-account basis.
You can track your rate limit status via response headers:
Header | Description |
---|---|
X-Rate-Limit-Limit |
The upper limit of API requests allowed per minute. |
X-Rate-Limit-Remaining |
The number of requests remaining in this one-minute period. |
X-Rate-Limit-Reset |
The number of seconds until the rolling limit resets. |
Object identifiers
Each Ontraport object has both an object type ID and an object ID. In this documentation, object type ID refers to the identifier that differentiates one object type from another. All objects of the same type have the same object type ID.
ID refers to the identifier for that specific object. For example, a contact will always have an object type ID of 0, but each contact will also have a unique ID by which it can be accessed. All objects of the same type will have a different ID.
Plural and singular endpoints
Example retrieving a contact with the unique ID of 15:
curl -X GET 'https://api.ontraport.com/1/Contact?id=15' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$queryParams = array(
"id" => 15
);
$client = new Ontraport("2_AppID_12345678","Key5678");
$response = $client->contact()->retrieveSingle($queryParams);
Example retrieving first name, last name and email for contacts with the last name "Smith":
curl -X GET 'https://api.ontraport.com/1/Contacts?condition=%5B%7B%20%22field%22%3A%7B%22field%22%3A%22lastname%22%7D%2C%20%22op%22%3A%22%3D%22%2C%20%22value%22%3A%7B%22value%22%3A%22Smith%22%7D%20%7D%5D&listFields=firstname%2Clastname%2Cemail' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$queryParams = array(
"condition" => "[{
\"field\":{\"field\":\"lastname\"},
\"op\":\"=\",
\"value\":{\"value\":\"Smith\"}
}]",
"listFields" => "firstname,lastname,email"
);
$client = new Ontraport("2_AppID_12345678","Key5678");
$response = $client->contact()->retrieveMultiple($queryParams);
Many of our objects have plural and singular endpoints. Through utilizing plural endpoints with pagination and criteria, you can minimize the number of API calls needed for your integration. Singular endpoints should be used only in the case that you want to retrieve or delete a specific object by its ID. If you wish to perform operations on a collection of objects, the plural endpoints should be used.
Retrieving an object using its singular endpoint will bring back all the data for that object, whereas using plural endpoints allows you to specify exactly which fields you would like to retrieve.
Pagination
Example retrieving the count for a contacts collection:
# The response data contains a "count" field which holds the object count
curl -X GET 'https://api.ontraport.com/1/Contacts/getInfo' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$response = $client->contact()->retrieveCollectionInfo(array());
$response = json_decode($response, true);
$count = $response["data"]["count"];
Example retrieving a collection of contacts:
curl -X GET 'https://api.ontraport.com/1/Contacts?start=0' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
curl -X GET 'https://api.ontraport.com/1/Contacts?start=50' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
curl -X GET 'https://api.ontraport.com/1/Contacts?start=100' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
curl -X GET 'https://api.ontraport.com/1/Contacts?start=150' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$start = 0;
$range = 50;
$requestParams = array(
"start" => $start,
"range" => $range
);
$contacts = $client->contact()->retrieveMultiplePaginated();
When making requests on collections of objects, the number of results returned defaults to the maximum, which is 50.
This means that without using pagination to iterate through your collections, you will only ever access the first 50 objects.
The start
and range
parameters allow you to navigate through larger data sets.
To determine the count of objects in your collection, you can make a call to getInfo for your desired resource and retrieve the count.
Parameter | Type | Description |
---|---|---|
start |
integer | The offset from which your requested data should begin. |
range |
integer | The number of records returned per request. |
Criteria
Example: "email = test@test.com"
[{
"field":{"field":"email"},
"op":"=",
"value":{"value":"test@test.com"}
}]
Example: "id IN (1, 2)"
[{
"field":{"field":"id"},
"op":"IN",
"value":{"list":[{"value":1},{"value":2}]}
}]
Example: "email IS NULL OR email = ''"
[{
"field":{"field":"email"},
"op":"=",
"value":{"value":""}
},
"OR",
{
"field":{"field":"email"},
"op":"IS",
"value":"NULL"
}]
We offer additional parameters to ensure that you are retrieving only those objects you specifically want. For example, if you would like to perform an action on contacts with the last name "Smith", it is better to target those records in your query as opposed to retrieving all your contacts and then filtering the results.
Parameter | Type | Description |
---|---|---|
search |
string | The string to search your object collection for. |
searchNotes |
boolean | Indicates whether or not notes should be searched for the search string. This parameter can't be used independently of the search parameter. |
condition |
string | This JSON-encoded field allows you to very specifically evaluate objects for a condition. You can check whether or not fields in your object meet a particular condition. field is where you designate what field you want to check for a condition. op indicates the comparison operator you would like to use. value is where you can set a value or list of values to compare field to. Possible operators include:> : Greater than < : Less than >= : Greater than or equal to <= : Less than or equal to = : Equal to IN : Field is one of a list of values You can also string conditions together with AND , to check that both conditions are true, or OR , to check that at least one of the conditions is true. Examples can be seen to the right. |
Sometimes you may just be interested in a few object fields and not the entire object. If you have a relationship between two objects, you may wish to gather information from the related object as well. In these cases, you can describe a list of the fields you would like returned.
Parameter | Type | Description |
---|---|---|
listFields |
string | An array as a comma-delimited list of object fields to retrieve. |
externs |
string | An array as a comma-delimited list of related external fields to retrieve. |
Instead of retrieving objects by specific IDs, you can also perform actions on a collection of objects by group ID.
Group ID should be accompanied by the performAll
parameter. However, if you set performAll = 1
, remember that a value of 0 for group_id
effectively selects all objects in a collection.
Parameter | Type | Description |
---|---|---|
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. |
Standard requests
Unique URLs
Each resource in our API is identified by a unique URL. For example, contacts can be created, retrieved, updated and deleted at:
https://api.ontraport.com/1/Contacts
HTTP Methods
When making an HTTP request, you must specify the method to be used. Our API accepts GET, PUT, POST and DELETE methods. Each of these methods corresponds to a persistent storage CRUD operation:
Method | Operation | Usage |
---|---|---|
POST |
Create | Adds new data to your database. |
GET |
Retrieve | Brings back data from your database. |
PUT |
Update | Replaces old data with new. |
DELETE |
Delete | Permanently removes data from your database. |
Request Headers
API requests must be accompanied by headers to specify what data formats will be sent and received. All responses will be JSON-encoded regardless of request method. The following is a list of all the headers you may be expected to send with your requests.
Header | Description |
---|---|
Api-Key |
Set to your unique API key. This must be used in conjunction with your unique site ID or your request will not authenticate. Required. |
Api-Appid |
Set to your unique site ID. Required. |
Content-Type |
Specifies the format of data being sent with your request. Set to application/x-www-form-urlencoded or application/json . Required for POST and PUT requests. See the documentation for specific endpoints in these cases. |
Request Parameters
Parameters for GET and DELETE requests should be encoded to a query string and appended to the URL:
https://api.ontraport.com/1/Object?param1=value1¶m2=value2¶m3=value3
Parameters for PUT and POST requests are sent in the request body.
The data type expected in the request body is indicated in the Content-Type
header.
When JSON is expected, parameters should be JSON-encoded:
{"param1":"value1","param2":"value2","param3":"value3"}
When form data is expected, parameters should be URL-encoded:
param1=value1¶m2=value2¶m3=value3
Extended Functionality
Simple object endpoints typically handle basic CRUD functionality for that object. For many objects, we have extended endpoints to allow for additional functionality. For example, you can obtain detailed information about the contact object by appending "getMeta" to the URL:
https://api.ontraport.com/1/Contacts/getMeta
Requests must be made over HTTPS. Any insecure requests are redirected to the HTTPS equivalent URL.
Standard responses
Example response:
{
"code": 0,
"data": {
"id": "1",
"owner": "1",
"firstname": "Frodo",
"lastname": "Baggins",
"email": "fb@gmail.com",
"address": null,
"city": null,
"state": null,
"zip": null,
"birthday": null,
"date": "1487705750",
"notes": null,
"status": null,
"category": null,
"lead_source": null,
"cell_phone": null,
"home_phone": null,
"sms_number": null,
"dla": "1487705750",
"contact_cat": "",
"bulk_mail": "1",
"bulk_sms": "0",
"lastvisit": null,
"referer": "0",
"lastaction": null,
"office_phone": null,
"fax": null,
"dlm": "1487705765",
"company": null,
"address2": null,
"title": null,
"website": null,
"country": null,
"system_source": "0",
"source_location": null,
"import_id": "0",
"ip_addy": null,
"visits": "0",
"freferrer": "0",
"lreferrer": "0",
"n_lead_source": "0",
"n_content": "0",
"n_term": "0",
"n_media": "0",
"n_medium": "0",
"n_campaign": "0",
"referral_page": null,
"aff_sales": "0",
"aff_amount": "0",
"program_id": "0",
"aff_paypal": null,
"fb_birthday": "0",
"fb_gender": null,
"fb_likes": null,
"fb_groups": null,
"fb_website": null,
"fb_hometown": null,
"fb_location": null,
"mrcAmount": "0",
"mrcUnpaid": "0.00",
"mriInvoiceNum": "0",
"mriInvoiceTotal": "0",
"ccType": "0",
"ccExpirationMonth": "0",
"ccExpirationYear": "0",
"ccExpirationDate": "0",
"ccNumber": null,
"mrcResult": "0",
"bindex": "0",
"last_inbound_sms": null,
"spent": null,
"num_purchased": null,
"updateSequence": "",
"grade": "0.00"
},
"account_id": "12345"
}
Every successful API call returns a JSON-formatted response containing:
Element | Type | Description |
---|---|---|
code |
integer | Indicates the success or failure of the call. If code is 0 , this indicates an HTTP 200 successful call. |
data |
object | Contains object-specific attributes and data |
account_id |
integer | ID of the account making the API call |
Error and response codes
Both successful and unsuccessful calls will return HTTP response codes. The most common codes you will encounter using our API are as follows:
Code | Description |
---|---|
200 |
OK - Your request was completed successfully. |
400 |
Bad Request - Your request data is not properly formed. |
401 |
Unauthorized - You are not authenticated. |
403 |
Forbidden - You do not have permissions to access this resource. |
404 |
Not Found - You are requesting a resource that does not exist. |
422 |
Unprocessable Entity - One or more of the fields you included were not able to be processed. Currently used for invalid email addresses. |
429 |
Too Many Requests - You have exceeded your maximum rate limit of 180 requests per minute. |
500 |
Internal Server Error - Something has gone wrong on the website's server. |
Click here to see a full listing of possible codes.
Accessible Objects
The following is a list of objects exposed by the API, along with their object type ID and corresponding permissions.
Object | Object Type ID | GET | PUT | POST | DELETE |
---|---|---|---|---|---|
Automation Log Item | 100 | x | |||
Blast | 13 | x | x | x | |
Calendar | 175 | x | |||
Calendar Event | 160 | x | x | x | x |
Calendar Event Guest | 161 | x | |||
Calendar Event Type | 177 | x | x | x | |
Calendar Potential Guest | 174 | x | |||
Calendar Template | 164 | x | x | x | x |
Campaign | 75 | x | |||
Campaign Builder | 140 | x | |||
Commission | 38 | x | |||
Contact | 0 | x | x | x | x |
Content | 78 | x | x | x | |
Coupon | 123 | x | x | x | x |
Coupon Code | 124 | x | |||
Coupon Product | 125 | x | |||
Credit Card | 45 | x | x | ||
Custom Domain | 58 | x | |||
Custom Object | 99 | x | |||
Custom Object Relationship | 102 | x | |||
Customer Value | 96 | x | |||
Deleted Open Order | 146 | x | |||
Facebook App | 53 | x | |||
Form | 22 | x | |||
Form (ONTRAForms) | 122 | x | |||
Fulfillment List | 19 | x | x | x | x |
Gateway | 70 | x | |||
Group | 3 | x | x | ||
IMAP Setting | 101 | x | |||
Landing Page | 20 | x | x | x | x |
Lead Router | 69 | x | x | x | x |
Lead Source | 76 | x | x | x | |
Log Item | 4 | x | |||
Medium | 77 | x | x | x | |
Message | 7 | x | x | x | x |
Message Template | 68 | x | |||
Note | 12 | x | x | x | x |
Offer | 65 | x | x | x | |
Open Order | 44 | x | |||
Order | 52 | x | x | ||
Partner | 36 | x | |||
Partner Product | 87 | x | |||
Partner Program | 35 | x | x | x | x |
Partner Promotional Item | 40 | x | x | x | x |
Postcard Order | 27 | x | |||
Product | 16 | x | x | x | x |
Product Sales Log | 95 | x | |||
Purchase | 17 | x | |||
Purchase History Log | 30 | x | |||
Referral | 37 | x | |||
Role | 61 | x | |||
Rule | 6 | x | x | x | x |
Sales Report | 94 | x | |||
Scheduled Broadcast | 23 | x | |||
Sequence | 5 | x | x | x | x |
Sequence Subscriber | 8 | x | |||
Shipped Package | 47 | x | |||
Shipping Collected | 97 | x | |||
Shipping Fulfillment Run | 49 | x | |||
Shipping Method | 64 | x | x | x | x |
Subscriber Retention | 92 | x | |||
Subscription Sale | 93 | x | |||
Tag | 14 | x | x | x | x |
Tag Subscriber | 138 | x | |||
Task | 1 | x | x | ||
Task History | 90 | x | |||
Task Note | 89 | x | x | ||
Task Outcome | 66 | x | |||
Tax | 63 | x | x | x | x |
Taxes Collected | 98 | x | |||
Term | 79 | x | x | x | |
Tracked Link | 80 | x | x | x | x |
Transaction | 46 | x | |||
Upsell Form | 42 | x | |||
URL History | 88 | x | |||
User | 2 | x | x | ||
Webhook | 145 | x | x | x | x |
Wordpress Membership | 43 | x | x | x | x |
Wordpress Site | 67 | x |
Field Types
address
A string representing an address.
Valid values:
Any string will be considered valid.
check
Check represents a boolean checkbox.
Valid values:
0, 1
color
A color field is a dropdown field with colored labels. It is formatted similarly to dropdown fields, but the label name and color are specified separately.
Valid values:
Colors can be supplied in hexadecimal code format (ex. #1f1e33), with or without the leading '#', or in comma-separated RGB format (ex. 31,30,51).
Example of a 'type' field:
"type": {
"alias": "Sales Stage",
"type": "drop",
"options": {
"add": [
{"label": "Closed - Lost", "color": "#ff00ff"},
{"label": "Closed - Won", "color": "#00ffff"},
{"label": "Committed", "color": "#ffff00"},
{"label": "Consideration", "color": "#aa05bb"},
{"label": "Demo Scheduled", "color": "#03ccaa"},
{"label": "Qualified Lead", "color": "#aaaaaa"},
{"label": "New Prospect", "color": "#1f1e33"}
]
}
}
country
Represents a selectable country.
Valid values:
Real countries
- "US"=>"United States"
- "CA"=>"Canada"
- "GB"=>"United Kingdom"
- "AF"=>"Afghanistan"
- "AX"=>"Åland"
- "AL"=>"Albania"
- "DZ"=>"Algeria"
- "AS"=>"American Samoa"
- "AD"=>"Andorra"
- "AO"=>"Angola"
- "AI"=>"Anguilla"
- "AQ"=>"Antarctica"
- "AG"=>"Antigua and Barbuda"
- "AR"=>"Argentina"
- "AM"=>"Armenia"
- "AW"=>"Aruba"
- "AU"=>"Australia"
- "AT"=>"Austria"
- "AZ"=>"Azerbaijan"
- "BS"=>"Bahamas"
- "BH"=>"Bahrain"
- "BD"=>"Bangladesh"
- "BB"=>"Barbados"
- "BY"=>"Belarus"
- "BE"=>"Belgium"
- "BZ"=>"Belize"
- "BJ"=>"Benin"
- "BM"=>"Bermuda"
- "BT"=>"Bhutan"
- "BO"=>"Bolivia"
- "BQ"=>"Bonaire"
- "BA"=>"Bosnia and Herzegovina"
- "BW"=>"Botswana"
- "BV"=>"Bouvet Island"
- "BR"=>"Brazil"
- "IO"=>"British Indian Ocean Territory"
- "VG"=>"British Virgin Islands"
- "BN"=>"Brunei"
- "BG"=>"Bulgaria"
- "BF"=>"Burkina Faso"
- "BI"=>"Burundi"
- "KH"=>"Cambodia"
- "CM"=>"Cameroon"
- "CA"=>"Canada"
- "CV"=>"Cape Verde"
- "KY"=>"Cayman Islands"
- "CF"=>"Central African Republic"
- "TD"=>"Chad"
- "CL"=>"Chile"
- "CN"=>"China"
- "CX"=>"Christmas Island"
- "CC"=>"Cocos (Keeling) Islands"
- "CO"=>"Colombia"
- "KM"=>"Comoros"
- "CK"=>"Cook Islands"
- "CR"=>"Costa Rica"
- "HR"=>"Croatia (Local Name: Hrvatska)"
- "CU"=>"Cuba"
- "CW"=>"Curacao"
- "CY"=>"Cyprus"
- "CZ"=>"Czech Republic"
- "CD"=>"Democratic Republic of the Congo"
- "DK"=>"Denmark"
- "DJ"=>"Djibouti"
- "DM"=>"Dominica"
- "DO"=>"Dominican Republic"
- "TL"=>"East Timor"
- "EC"=>"Ecuador"
- "EG"=>"Egypt"
- "SV"=>"El Salvador"
- "GQ"=>"Equatorial Guinea"
- "ER"=>"Eritrea"
- "EE"=>"Estonia"
- "ET"=>"Ethiopia"
- "FK"=>"Falkland Islands (Malvinas)"
- "FO"=>"Faroe Islands"
- "FJ"=>"Fiji"
- "FI"=>"Finland"
- "FR"=>"France"
- "GF"=>"French Guiana"
- "PF"=>"French Polynesia"
- "TF"=>"French Southern Territories"
- "GA"=>"Gabon"
- "GM"=>"Gambia"
- "GE"=>"Georgia"
- "DE"=>"Germany"
- "GH"=>"Ghana"
- "GI"=>"Gibraltar"
- "GR"=>"Greece"
- "GL"=>"Greenland"
- "GD"=>"Grenada"
- "GP"=>"Guadeloupe"
- "GU"=>"Guam"
- "GT"=>"Guatemala"
- "GG"=>"Guernsey"
- "GN"=>"Guinea"
- "GW"=>"Guinea-Bissau"
- "GY"=>"Guyana"
- "HT"=>"Haiti"
- "HM"=>"Heard Island and McDonald Islands"
- "HN"=>"Honduras"
- "HK"=>"Hong Kong"
- "HU"=>"Hungary"
- "IS"=>"Iceland"
- "IN"=>"India"
- "ID"=>"Indonesia"
- "IR"=>"Iran"
- "IQ"=>"Iraq"
- "IE"=>"Ireland"
- "IM"=>"Isle of Man"
- "IL"=>"Israel"
- "IT"=>"Italy"
- "CI"=>"Ivory Coast"
- "JM"=>"Jamaica"
- "JP"=>"Japan"
- "JE"=>"Jersey"
- "JO"=>"Jordan"
- "KZ"=>"Kazakhstan"
- "KE"=>"Kenya"
- "KI"=>"Kiribati"
- "XK"=>"Kosovo"
- "KW"=>"Kuwait"
- "KG"=>"Kyrgyzstan"
- "LA"=>"Laos"
- "LV"=>"Latvia"
- "LB"=>"Lebanon"
- "LS"=>"Lesotho"
- "LR"=>"Liberia"
- "LY"=>"Libya"
- "LI"=>"Liechtenstein"
- "LT"=>"Lithuania"
- "LU"=>"Luxembourg"
- "MO"=>"Macao"
- "MG"=>"Madagascar"
- "MW"=>"Malawi"
- "MY"=>"Malaysia"
- "MV"=>"Maldives"
- "ML"=>"Mali"
- "MT"=>"Malta"
- "MH"=>"Marshall Islands"
- "MQ"=>"Martinique"
- "MR"=>"Mauritania"
- "MU"=>"Mauritius"
- "YT"=>"Mayotte"
- "MX"=>"Mexico"
- "FM"=>"Micronesia"
- "MD"=>"Moldova"
- "MC"=>"Monaco"
- "MN"=>"Mongolia"
- "ME"=>"Montenegro"
- "MS"=>"Montserrat"
- "MA"=>"Morocco"
- "MZ"=>"Mozambique"
- "MM"=>"Myanmar (Burma)"
- "NA"=>"Namibia"
- "NR"=>"Nauru"
- "NP"=>"Nepal"
- "NL"=>"Netherlands"
- "NC"=>"New Caledonia"
- "NZ"=>"New Zealand"
- "NI"=>"Nicaragua"
- "NE"=>"Niger"
- "NG"=>"Nigeria"
- "NU"=>"Niue"
- "NF"=>"Norfolk Island"
- "KP"=>"North Korea"
- "MK"=>"North Macedonia"
- "MP"=>"Northern Mariana Islands"
- "NO"=>"Norway"
- "OM"=>"Oman"
- "PK"=>"Pakistan"
- "PW"=>"Palau"
- "PS"=>"Palestine"
- "PA"=>"Panama"
- "PG"=>"Papua New Guinea"
- "PY"=>"Paraguay"
- "PE"=>"Peru"
- "PH"=>"Philippines"
- "PN"=>"Pitcairn Islands"
- "PL"=>"Poland"
- "PT"=>"Portugal"
- "PR"=>"Puerto Rico"
- "QA"=>"Qatar"
- "CG"=>"Republic of the Congo"
- "RE"=>"Réunion"
- "RO"=>"Romania"
- "RU"=>"Russia"
- "RW"=>"Rwanda"
- "BL"=>"Saint Barthélemy"
- "SH"=>"Saint Helena"
- "KN"=>"Saint Kitts and Nevis"
- "LC"=>"Saint Lucia"
- "MF"=>"Saint Martin"
- "PM"=>"Saint Pierre and Miquelon"
- "VC"=>"Saint Vincent and the Grenadines"
- "WS"=>"Samoa"
- "SM"=>"San Marino"
- "SA"=>"Saudi Arabia"
- "SN"=>"Senegal"
- "RS"=>"Serbia"
- "SC"=>"Seychelles"
- "SL"=>"Sierra Leone"
- "SG"=>"Singapore"
- "SX"=>"Sint Maarten"
- "SK"=>"Slovakia (Slovak Republic)"
- "SI"=>"Slovenia"
- "SB"=>"Solomon Islands"
- "SO"=>"Somalia"
- "ZA"=>"South Africa"
- "GS"=>"South Georgia and the South Sandwich Islands"
- "KR"=>"South Korea"
- "SS"=>"South Sudan"
- "ES"=>"Spain"
- "LK"=>"Sri Lanka"
- "SD"=>"Sudan"
- "SR"=>"Suriname"
- "SJ"=>"Svalbard and Jan Mayen"
- "SZ"=>"Swaziland"
- "SE"=>"Sweden"
- "CH"=>"Switzerland"
- "SY"=>"Syria"
- "ST"=>"São Tomé and Príncipe"
- "TW"=>"Taiwan"
- "TJ"=>"Tajikistan"
- "TZ"=>"Tanzania"
- "TH"=>"Thailand"
- "TG"=>"Togo"
- "TK"=>"Tokelau"
- "TO"=>"Tonga"
- "TT"=>"Trinidad and Tobago"
- "TN"=>"Tunisia"
- "TR"=>"Turkey"
- "TM"=>"Turkmenistan"
- "TC"=>"Turks and Caicos Islands"
- "TV"=>"Tuvalu"
- "UM"=>"U.S. Minor Outlying Islands"
- "VI"=>"U.S. Virgin Islands"
- "UG"=>"Uganda"
- "UA"=>"Ukraine"
- "AE"=>"United Arab Emirates"
- "GB"=>"United Kingdom"
- "US"=>"United States"
- "UY"=>"Uruguay"
- "UZ"=>"Uzbekistan"
- "VU"=>"Vanuatu"
- "VA"=>"Vatican City"
- "VE"=>"Venezuela"
- "VN"=>"Vietnam"
- "WF"=>"Wallis and Futuna"
- "EH"=>"Western Sahara"
- "YE"=>"Yemen"
- "ZM"=>"Zambia"
- "ZW"=>"Zimbabwe"
drop
A dropdown field.
Valid values:
For a dropdown field, you must provide options for users to select.
Example of a 'type' field:
"type": {
"alias": "Sales Stage",
"type": "drop",
"options": {
"add": [
"Closed - Lost",
"Closed - Won",
"Committed",
"Consideration",
"Demo Scheduled",
"Qualified Lead",
"New Prospect"
]
}
}
A string that represents an email address.
Valid values:
Strings will be checked to be of the format X@Y.Z
file
A URL which refers to a file for an object.
Updating and adding files via the API is not supported. Only the file's URL can be retrieved via a GET request.
Valid values:
A URL, similar to https://example.ontraport.com/s/dl?token=NjAvMC8xL2YxOTA4LzAvMTc4ZGEzZDFhYzhlMTdiMDA3ZGRjN2FiYjAzMjM4ZTA=
fulldate
(may be listed as 'date' in older accounts)
A fulldate type represents a date. The info for time is stored, but not typically displayed. (use a 'Date & Time' field if you want to display a date AND time)
Valid values:
A unix timestamp
Example: 1580854597 (which is 02/04/2020)
funnel
Deprecated and no longer used.
image
A unique image name referring to an image hosted by Ontraport. The API accepts image field updates via image URLs. API requests containing Ontraport image fields (except profile_image field) are rehosted to Ontraport which generates a new image URL for the same image.
Note: As the image URL changes in the response, do not rely on utilizing the same image URL you sent in your request
Example request
A request to POST /objects:
{
"objectID" : 0,
"firstname" : "Bob",
"yourimagefield" : "https://yourserver.jpeg"
}
A plausible response for this is:
{
"objectID" : 0,
"firstname" : "Bob",
"yourimagefield" : "https://i.ontraport.com/200030.a02f959a506cbae565c7e.JPEG"
}
Valid values:
Image URLs starting with i.ontraport.com/youraccountID.
are valid values
Example profile_image field:
{
"id": 1679,
"alias": "Profile Image",
"field": "profile_image",
"type": "image",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1,
"options": "https://i.ontraport.com/"
}
JSONtext
Text meant to be interpreted as JSON.
Valid values:
Any string is valid input, but may not be valid JSON.
list
A list selection field.
Valid values:
For a list selection field, you must provide options for users to select. When updating a list type field, the option ID values must be separated by this delimiter: */*. For example, */*55*/*97*/*.
Example of a 'list' field:
"f1792": {
"alias": "Example List",
"type": "list",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1,
"options": {
"123": "One",
"124": "Two",
"125": "Three"
}
}
longtext
A long section of text, usually multiple lines.
Valid values:
Any string.
mergefield
A combination of other fields' values. These fields cannot be created or directly modified.
Valid values:
Code example provided on the right.
Example of a full name (combining first name and last name):
<op:merge field='firstname'>X</op:merge> <op:merge field='lastname'>X</op:merge>
The field overall shows up in field editor like:
{
"id": 198,
"alias": "Name",
"field": "fn",
"type": "mergefield",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 0,
"options": "<op:merge field='firstname'>X</op:merge> <op:merge field='lastname'>X</op:merge>"
},
numeric
A numeric value.
Valid values:
A number.
parent
Related to a parent or child object.
Valid values:
The value is an ID referring to the specific 'parent' object.
The parent's object type will be specified as 'parent_object' in the meta call.
Example of /meta call:
"f1723": {
"alias": "Offspring(Parent)",
"type": "parent",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0,
"parent_object": "10002"
}
Example of /fieldeditor call:
{
"id": 1723,
"alias": "Offspring(Parent)",
"field": "f1723",
"type": "parent",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0,
"options": "{\"model\":\"10002\"}"
}
percentage
A numeric value representing a percentage. Also displays the count of the numerator to the left of the percentage.
Valid values:
No value directly stored. 'mergefield' is the numerator field.
The 'extra_data' field will carry some more info, such as the denominator field and precision.
Example: {"ref_field":"mcsent","precision":2,"link_sprintf":{"url":"/#!/%s/listAll&bmasks=[[\"%i\",\"11\",true,\"AND\"]]", "fields":["url","id"]}}
phone
A phone number.
Valid values:
Something in the form of +X XXX-XXX-XXXX
price
A value representing a currency amount.
Valid values:
Some integer or decimal number with 2 decimal spaces. A dollar sign at the front is allowed, but not necessary.
Valid examples: 3, $7, or $2.10
Invalid examples: 1.54356 or 12.01$
raw_percentage
Same as percentage, just displayed as only the percentage.
related_data
Related data is a way to grab the field info of some related data object.
Valid values:
The value will directly store and update to match the targeted data.
The way this is handled is through 'options', visible in the /fieldeditor call. It will be a chain of fields separated by '//'. This chain shows the path of relations, going to the final object and then its field. A maximum of two relations is currently supported.
Example of a simple relation (Child->Parent->Name):
{
"id": 1738,
"alias": "ParentName",
"field": "f1738",
"type": "related_data",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 1,
"options": "f1736//f1708"
}
Example of a three-layered relation (Child->Parent->Grandparent->Name):
{
"id": 1738,
"alias": "GrandData",
"field": "f1738",
"type": "related_data",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 1,
"options": "f1736//f1722//f1709"
}
sms
A string value representing a SMS number
Valid values:
Integers will be validated as long as they are numeric and less than 16 characters. The backend will reformat them as well as it can.
state
A state within a country. Available countries are US, AU, ZA, and IN.
Valid values:
Available states
- "AL"=>"Alabama"
- "AK"=>"Alaska"
- "AZ"=>"Arizona"
- "AR"=>"Arkansas"
- "CA"=>"California"
- "CO"=>"Colorado"
- "CT"=>"Connecticut"
- "DE"=>"Delaware"
- "DC"=>"D.C."
- "FL"=>"Florida"
- "GA"=>"Georgia"
- "HI"=>"Hawaii"
- "ID"=>"Idaho"
- "IL"=>"Illinois"
- "IN"=>"Indiana"
- "IA"=>"Iowa"
- "KS"=>"Kansas"
- "KY"=>"Kentucky"
- "LA"=>"Louisiana"
- "ME"=>"Maine"
- "MD"=>"Maryland"
- "MA"=>"Massachusetts"
- "MI"=>"Michigan"
- "MN"=>"Minnesota"
- "MS"=>"Mississippi"
- "MO"=>"Missouri"
- "MT"=>"Montana"
- "NE"=>"Nebraska"
- "NV"=>"Nevada"
- "NH"=>"New Hampshire"
- "NM"=>"New Mexico"
- "NJ"=>"New Jersey"
- "NY"=>"New York"
- "NC"=>"North Carolina"
- "ND"=>"North Dakota"
- "OH"=>"Ohio"
- "OK"=>"Oklahoma"
- "OR"=>"Oregon"
- "PA"=>"Pennsylvania"
- "PR"=>"Puerto Rico"
- "RI"=>"Rhode Island"
- "SC"=>"South Carolina"
- "SD"=>"South Dakota"
- "TN"=>"Tennessee"
- "TX"=>"Texas"
- "UT"=>"Utah"
- "VT"=>"Vermont"
- "VA"=>"Virginia"
- "WA"=>"Washington"
- "WV"=>"West Virginia"
- "WI"=>"Wisconsin"
- "WY"=>"Wyoming"
- "AB"=>"Alberta"
- "BC"=>"British Columbia"
- "MB"=>"Manitoba"
- "NB"=>"New Brunswick"
- "NL"=>"Newfoundland and Labrador"
- "NS"=>"Nova Scotia"
- "NT"=>"Northwest Territories"
- "NU"=>"Nunavut"
- "ON"=>"Ontario"
- "PE"=>"Prince Edward Island"
- "QC"=>"Quebec"
- "SK"=>"Saskatchewan"
- "YT"=>"Yukon"
- "ACT"=>"(AU) Australian Capital Territory"
- "NSW"=>"(AU) New South Wales"
- "VIC"=>"(AU) Victoria"
- "QLD"=>"(AU) Queensland"
- "AU_NT"=>"(AU) Northern Territory"
- "AU_WA"=>"(AU) Western Australia"
- "SA"=>"(AU) South Australia"
- "TAS"=>"(AU) Tasmania"
- "GP"=>"(ZA) Gauteng"
- "WP"=>"(ZA) Western Cape"
- "EC"=>"(ZA) Eastern Cape"
- "KZN"=>"(ZA) Kwa-Zulu Natal"
- "NW"=>"(ZA) North West"
- "AF_NC"=>"(ZA) Northern Cape"
- "MP"=>"(ZA) Mpumalanga"
- "FS"=>"(ZA) Free State"
- "INASM" => "(IN) Assam"
- "INANP" => "(IN) Andaman and Nicobar Islands"
- "INARP" => "(IN) Andhra Pradesh"
- "INAUP" => "(IN) Arunachal Pradesh"
- "INBIH" => "(IN) Bihar"
- "INCHA" => "(IN) Chandigarh"
- "INCHH" => "(IN) Chhattisgarh"
- "INDEL" => "(IN) Delhi"
- "INDAM" => "(IN) Daman and Diu"
- "INDAD" => "(IN) Dadra and Nagar Haveli"
- "INGOA" => "(IN) Goa"
- "INGUJ" => "(IN) Gujarat"
- "INHAR" => "(IN) Haryana"
- "INHIM" => "(IN) Himachal Pradesh"
- "INJAM" => "(IN) Jammu and Kashmir"
- "INJHA" => "(IN) Jharkhand"
- "INKAR" => "(IN) Karnataka"
- "INKER" => "(IN) Kerala"
- "INLAK" => "(IN) Lakshadweep"
- "INMIZ" => "(IN) Mizoram"
- "INMAD" => "(IN) Madhya Pradesh"
- "INMEG" => "(IN) Meghalaya"
- "INMAN" => "(IN) Manipur"
- "INMAH" => "(IN) Maharashtra"
- "INNAG" => "(IN) Nagaland"
- "INODI" => "(IN) Odisha"
- "INPUD" => "(IN) Puducherry"
- "INPUN" => "(IN) Punjab"
- "INRAJ" => "(IN) Rajasthan"
- "INSIK" => "(IN) Sikkim"
- "INTRI" => "(IN) Tripura"
- "INTAM" => "(IN) Tamil Nadu"
- "INUTK" => "(IN) Uttarakhand"
- "INUTP" => "(IN) Uttar Pradesh"
- "INWBG" => "(IN) West Bengal"
- "_NOTLISTED_" => "My State is not listed"
subscription
Refers to some type of subscription value (tags, campaigns, or sequences).
Valid values:
If you want to update these values, refer to /objects/subscribe (for campaigns and sequences) and /objects/tag (for tags)
Refer to Tag Subscribers or Sequence Subscribers objects for more details.
text
A text field.
Valid values:
Any string.
timestamp
A unix timestamp that is treated as a time and date adjusted to timezone.
Valid values:
Any unix timestamp.
Example: 1580854597 (which is 02/04/2020 @ 10:16pm (UTC))
timezone
A timezone, represented as a string and interpreted where necessary.
Valid values:
Examples:
- America/Los_Angeles
- Europe/London
- Australia/Sydney
- Asia/Tokyo
- Asia/Kolkata
unique
A unique ID.
Valid values:
A system-generated string that doesn't match any other unique ID of any object across the account.
url
A string representing a URL.
Valid values:
Input type is string, but validated to be a proper URL.
Objects
The objects API provides powerful and versatile functionality for a wide variety of our objects. Although we provide many endpoints for specific object types, using generic object endpoints with an object type ID provides an interface for most objects.
You can create new objects, get or delete single objects or collections of objects, and update object data. You can also retrieve meta for all objects or a single object to obtain more detailed information about object attributes, and retrieve information about a collection of objects.
This API also contains functionality allowing you to tag and untag, add and remove objects from sequences, and pause and unpause rules and sequences.
To perform a request on any object endpoint, you must provide a valid object type ID. All other parameters are specific to the object you are accessing.
The generic object
Attributes
Generic object endpoints are unique because of their flexibility. Functions can be performed on any object using these endpoints given that a valid object type ID and correctly structured data is provided. However, if the data for your API request is not supplied as expected for that object type, your request will fail.
If you are not sure what the correct parameters are to send with your request, you can use the objects/meta endpoint to retrieve information about object fields before proceeding.
Custom Objects
Custom objects created in Ontraport accounts will automatically have accessible endpoints for GET
, PUT
, POST
, and DELETE
requests.
Fields in custom objects can be modified through the /fieldeditor
endpoint.
However, all custom objects are created with the following default fields that cannot be deleted or edited.
Attributes | Type | Description |
---|---|---|
id |
integer | The custom object's ID. |
unique_id |
integer | System field. Can't be updated through the API. Identifies an object in the database. Not case-sensitive. |
owner |
integer | The ID of the user who controls the custom object. This field must contain a value for a custom object to be saved properly. |
date |
timestamp | The date the custom object was added, measured in seconds from the Unix Epoch. |
dla |
integer | Date of the custom object's last activity. In this documentation, activity means that the custom object interacted with a form, website, or email link. |
dlm |
timestamp | The date the custom object was last modified, measured in seconds from the Unix Epoch. |
system_source |
integer | System field. Can't be updated through the API. Identifies the source from which the custom object was added to the database. |
source_location |
string | System field. Can't be updated through the API. Identifies the specific location from which the custom object was added to the database. |
import_id |
integer | System field. Can't be updated through the API. The ID of the import batch the custom object was imported with, if any. |
ip_addy |
string | Deprecated. The custom object's IP address. This is an old version of ip_addy_display and is not used anymore. |
ip_addy_display |
string | The custom object's IP address. |
contact_cat |
string | Deprecated. The tags a custom object is subscribed to. Each tag has an ID, and in this field the tags are appended together with the delimiter */* . A contact_cat entry containing multiple tags looks like this: */*1*/*2*/*3*/* . Tags are now related to custom objects in a separate tag subscriber object. |
bulk_mail |
integer | A flag that indicates a custom object's bulk email status. Values are mapped as follows:0 => Transactional Only 1 => Opted-in 2 => Double opt-in -2 => Hard bounce -5 => Under review You can only set the value to 0 through the API. You cannot manually opt-in a custom object who has opted to receive only transactional mail. |
bulk_sms |
integer | A flag that indicates whether or not a custom object is opted in to receive bulk texts. Values are mapped as follows:0 => Unconfirmed 1 => Pending confirmation 2 => Opted-in -1 => Hard bounced -3 => Unsubscribed -5 => Pending review You can only set the value to -3 through the API. You cannot manually opt-in a custom object who has opted out. |
bindex
updateSequence
| string | Deprecated. The sequences a custom object is subscribed to. Each sequence has an ID, and in this field the sequences are appended together with the delimiter */*
. An updateSequence entry containing multiple tags looks like this: */*1*/*2*/*3*/*
. Sequences are now related to custom objects in a separate sequence subscribers object. If you want to subscribe a custom object to a sequence please see the /objects/subscribe endpoint.
updateCampaign
| string | Deprecated. The campaigns a custom object is subscribed to. Each campaign has an ID, and in this field the campaigns are appended together with the delimiter */*
. This field will appear in responses, but should not be updated. If you want to subscribe a custom object to a campaign please see the /objects/subscribe endpoint. Note : "campaign" throughout this doc is called "automation" throughout the Ontraport app.
Create an object
curl -X POST -d '{
"objectID": 0,
"firstname": "Mary",
"lastname": "Smith",
"email": "msmith@ontraport.com"
}' 'https://api.ontraport.com/1/objects' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
use OntraportAPI\ObjectType;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => ObjectType::CONTACT, // Object type ID: 0
"firstname" => "Mary",
"lastname" => "Smith",
"email" => "msmith@ontraport.com"
);
$response = $client->object()->create($requestParams);
Example Response:
{
"code": 0,
"data": {
"firstname": "Mary",
"lastname": "Smith",
"email": "msmith@ontraport.com",
"id": "7",
"owner": "1",
"address": null,
"city": null,
"state": null,
"zip": null,
"birthday": null,
"date": "1492557339",
"cell_phone": null,
"home_phone": null,
"sms_number": null,
"dla": "1492557339",
"contact_cat": "",
"bulk_mail": "1",
"bulk_sms": "0",
"office_phone": null,
"fax": null,
"dlm": "1492557339",
"company": null,
"address2": null,
"title": null,
"website": null,
"country": null,
"system_source": "3",
"source_location": null,
"import_id": "0",
"ip_addy": null,
"ip_addy_display": null,
"visits": "0",
"freferrer": "0",
"lreferrer": "0",
"n_lead_source": "0",
"n_content": "0",
"n_term": "0",
"n_media": "0",
"n_medium": "0",
"n_campaign": "0",
"referral_page": null,
"aff_sales": "0",
"aff_amount": "0",
"program_id": "0",
"aff_paypal": null,
"fb_birthday": "0",
"fb_gender": null,
"fb_likes": null,
"fb_groups": null,
"fb_website": null,
"fb_hometown": null,
"fb_location": null,
"mrcAmount": "0",
"mrcUnpaid": "0.00",
"mriInvoiceNum": "0",
"mriInvoiceTotal": "0",
"ccType": "0",
"ccExpirationMonth": "0",
"ccExpirationYear": "0",
"ccExpirationDate": "0",
"ccNumber": null,
"mrcResult": "0",
"last_inbound_sms": null,
"spent": null,
"num_purchased": null,
"updateSequence": "",
"updateCampaign": "",
"grade": "0.00"
},
"account_id": "12345"
}
This endpoint will add a new object to your database. It can be used for any object type as long as the correct parameters are supplied. This endpoint allows duplication; if you want to avoid duplicates you should merge instead.
Request Endpoint
POST https://api.ontraport.com/1/objects
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/json
Request Parameters
Parameters should be sent in the request body as a JSON-encoded string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID. Required. |
*All other parameters depend upon the object.
Note when using custom fields of the list selection type as a parameter, it must have the option's id wrapped with the delimiter */*
.
If a list selection field has "field" => "f1500"
with options mapped as follows: "1" => "one", "2" => "two"
.
An entry containing multiple options looks like this: "f1500": "*/*1*/*2*/*"
. You can obtain information regarding
your custom fields with the GET /objects/meta endpoint.
Create or merge an object
curl -X POST -d 'objectID=0&firstname=Marie&email=msmith@ontraport.com' 'https://api.ontraport.com/1/objects/saveorupdate' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
use OntraportAPI\ObjectType;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => ObjectType::CONTACT, // Object type ID: 0
"firstname" => "Marie",
"email" => "msmith@ontraport.com" // The unique field for the contact object
);
$response = $client->object()->saveOrUpdate($requestParams);
Example Response:
{
"code": 0,
"data": {
"attrs": {
"firstname": "Marie",
"dlm": "1500506335",
"id": "7"
}
},
"account_id": "12345"
}
Looks for an existing object with a matching unique field and merges supplied data with existing data.
If no unique field is supplied or if no existing object has a matching unique field, a new object will be created.
While merging on the unique_id
field is supported for ORM objects, merging on the id
field is not, and may cause unintended consequences.
If you would like to update an object based on its ID, you should use the update endpoint.
Request Endpoint
POST https://api.ontraport.com/1/objects/saveorupdate
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID. Required. |
ignore_blanks |
boolean | Whether or not blank strings should be ignored upon update. Defaults to false: blank strings passed to this endpoint will overwrite existing value. This option will not ignore 0's or boolean false. |
unique_id |
string | A unique identifier for the object (only ORM objects have a unique_id field). This field is system generated and can't be updated. If a unique_id is sent that matches an object in the account, that object's data will be updated. This field will take precedence over other unique fields. |
*All other parameters depend upon the object.
Create fields and sections in an object record
curl -X POST -d '{
"objectID": 0,
"name": "Contact Information",
"fields": [
[
{
"alias": "My New Field",
"type": "text",
"required": 0,
"unique": 0
}
],
[],
[
{
"alias": "My New Dropdown",
"type": "drop",
"options": {
"add": [
"first", "second", "third"
]
}
}
]
]
}' 'https://api.ontraport.com/1/objects/fieldeditor' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
use OntraportAPI\ObjectType;
use OntraportAPI\Models\FieldEditor\ObjectField;
use OntraportAPI\Models\FieldEditor\ObjectSection;
$client = new Ontraport("2_AppID_12345678","Key5678");
$myField = new ObjectField("My New Field", ObjectField::TYPE_TEXT);
$myDropDown = new ObjectField("My New Dropdown", ObjectField::TYPE_DROP);
$myDropDown->addDropOptions(array("first", "second", "third"));
$mySection = new ObjectSection("Contact Information", array($myField, $myDropDown));
$requestParams = $mySection->toRequestParams();
$requestParams["objectID"] = ObjectType::CONTACT;
$response = $client->object()->createFields($requestParams);
Example Response:
{
"code": 0,
"data": {
"success": [
{
"f1558": "My New Field"
},
{
"f1559": "My New Dropdown"
}
],
"error": []
},
"account_id": "12345"
}
Create new fields and sections in an object record. If the section name doesn't exist, a new one will be created with that name.
Request Endpoint
POST https://api.ontraport.com/1/objects/fieldeditor
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/json
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID. Required. |
name |
string | The name of the Section. Required. |
fields |
array | An array of columns containing fields containing arrays of field objects. Required. Example of how these are nested: [[{field1}],[{field2}],[{field3}]] |
Field
This field object
Parameter | Type | Description |
---|---|---|
alias |
string | The name of the field. Required. |
type |
string | The field type. Required. Can be one of the following:check country fulldate list longtext numeric price phone state drop text email sms address timestamp file image related_data rich_text rollup url |
required |
integer | If this field should be required. Default 0 . |
unique |
integer | If this field should be unique. Default 0 . |
options |
object | Extra options for certain field types. If the field is a drop or list type, specify if you want to add the values and provide an array of names:"add":["first", "second", "third"] |
Retrieve a single object
curl -X GET 'https://api.ontraport.com/1/object?objectID=14&id=1' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
use OntraportAPI\ObjectType;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => ObjectType::TAG, // Object type ID: 14
"id" => 1
);
$response = $client->object()->retrieveSingle($requestParams);
Example Response:
{
"code": 0,
"data": {
"tag_id": "1",
"tag_name": "Contact Tags",
"group_id": "0",
"object_type_id": "0"
},
"account_id": "12345"
}
Retrieves all the information for an existing object of the specified object type.
Request Endpoint
GET https://api.ontraport.com/1/object
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID. Required. |
id |
integer | The ID of the specific object. Required. |
Retrieve multiple objects
curl -X GET 'https://api.ontraport.com/1/objects?objectID=0&sort=lastname&sortDir=desc' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
use OntraportAPI\ObjectType;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => ObjectType::CONTACT, // Object type ID: 0
"sort" => "lastname",
"sortDir" => "desc",
"listFields" => "id,firstname,lastname,email"
);
$response = $client->object()->retrieveMultiple($requestParams);
Example Response:
{
"code": 0,
"data": [
{
"id": "1",
"firstname": "Mary",
"lastname": "Smith",
"email": "msmith@ontraport.com",
"owner": "1"
},
{
"id": "2",
"firstname": "Fred",
"lastname": "Brown",
"email": "fbrown@ontraport.com",
"owner": "1"
}
],
"account_id": "12345",
"misc": []
}
Retrieves a collection of objects based on a set of parameters.
You can limit unnecessary API requests by utilizing criteria and our pagination tools to select only the data set you require.
Request Endpoint
GET https://api.ontraport.com/1/objects
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID. Required. |
ids |
string | An integer array as a comma-delimited list of the IDs of the objects to retrieve. Entering a value of 0 will result in all objects of specified type being selected. |
start |
integer | The offset to start your search from. |
range |
integer | The number of objects you want to retrieve. The maximum and default range is 50. |
sort |
string | The field results should be sorted on. |
sortDir |
string | The direction your results should be sorted. Your options are asc and desc . This field must be used in conjunction with the sort parameter. |
condition |
string | A JSON encoded string to more specifically set criteria for which objects to bring back. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not object notes should be searched for the specified string in addition to other object fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
externs |
string | If you have a relationship between your object and another object, you may want to include the data from a related field in your results. Each external field is listed in the format {object}//{field} . Multiple fields are separated by commas. |
listFields |
string | A string array as a comma-delimited list of the fields which should be returned in your results. |
user_readable |
String | A string that allows you to select between user readable info with 'CSV' and raw data with 'RAW'. |
Retrieve objects having a tag
curl -X GET 'https://api.ontraport.com/1/objects/tag?objectID=0&tag_id=1&listFields=id%2Cowner%2Cfirstname%2Clastname%2Cemail' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
use OntraportAPI\ObjectType;
$client = new Ontraport("2_AppID_12345678","Key5678");
$queryParams = array(
"objectID" => ObjectType::CONTACT, // Object type ID: 0
"tag_id" => 2,
"listFields" => "id,firstname,lastname,email"
);
$response = $client->object()->retrieveAllWithTag($queryParams);
Example Response:
{
"code": 0,
"data": [
{
"id": "3",
"owner": "1",
"firstname": "John",
"lastname": "Doe",
"email": "john@ontraport.com"
},
{
"id": "4",
"owner": "1",
"firstname": "Jane",
"lastname": "Doe",
"email": "jane@ontraport.com"
}
],
"account_id": "12345",
"misc": []
}
Retrieves a collection of objects having a specified tag.
Request Endpoint
GET https://api.ontraport.com/1/objects/tag
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID. Required. |
tag_id |
integer | The ID of the tag you would like to filter your objects by. Either tag_id or tag_name is required. If both are provided, tag_id will be prioritized. |
tag_name |
string | The name of the tag you would like to filter your objects by. Either tag_id or tag_name is required. If both are provided, tag_name will be ignored. |
count |
boolean | Indicates whether to retrieve a count of the collection instead of the collection itself. |
start |
integer | The offset to start your search from. |
range |
integer | The number of objects you want to retrieve. The maximum and default range is 50. |
sort |
string | The field results should be sorted on. |
sortDir |
string | The direction your results should be sorted. Your options are asc and desc . This field must be used in conjunction with the sort parameter. |
condition |
string | A JSON encoded string to more specifically set criteria for which objects to bring back. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not object notes should be searched for the specified string in addition to other object fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
externs |
string | If you have a relationship between your object and another object, you may want to include the data from a related field in your results. Each external field is listed in the format {object}//{field} . Multiple fields are separated by commas. |
listFields |
string | A string array as a comma-delimited list of the fields which should be returned in your results. |
Retrieve an object ID by email
curl -X GET 'https://api.ontraport.com/1/object/getByEmail?objectID=0&email=tester%40ontraport.com&all=0' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
use OntraportAPI\ObjectType;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => ObjectType::CONTACT, // Object type ID: 0
"email" => "tester@ontraport.com",
"all" => 0
);
$response = $client->object()->retrieveIdByEmail($requestParams);
Example Response: (retrieving single ID)
{
"code": 0,
"data": {
"id": "6"
},
"account_id": "12345"
}
Example Response: (retrieving array of IDs)
{
"code": 0,
"data": {
"ids": [
"6",
"12"
]
},
"account_id": "12345"
}
Retrieves the IDs of contact objects or custom objects by their email fields. You can retrieve an array of all the IDs of objects with matching emails, or you can retrieve the first matching ID.
Request Endpoint
GET https://api.ontraport.com/1/object/getByEmail
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID. Required. |
email |
string | The email of the object you would like to retrieve. Required. |
all |
integer | A binary integer flag indicating whether you would like to retrieve an array of all IDs for objects with a matching email. The default value of 0 indicates that you just want the first matching ID. A value of 1 indicates that you would like an array of all matching IDs. |
Retrieve object meta
curl -X GET 'https://api.ontraport.com/1/objects/meta?format=byId&objectID=7' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
use OntraportAPI\ObjectType;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => ObjectType::MESSAGE, // Object type ID: 7
"format" => "byId"
);
$response = $client->object()->retrieveMeta($requestParams);
Example Response:
{
"code": 0,
"data": {
"7": {
"name": "Message",
"fields": {
"alias": {
"alias": "Name",
"type": "text",
"required": "0",
"unique": "0",
"editable": "1",
"deletable": "0"
},
"name": {
"alias": "Name",
"type": "mergefield",
"required": "0",
"unique": "0",
"editable": 0,
"deletable": "1"
},
"subject": {
"alias": "Subject",
"type": "text",
"required": "0",
"unique": "0",
"editable": 1,
"deletable": "1"
},
"spam_score": {
"alias": "Spam Score",
"type": "",
"required": "0",
"unique": "0",
"editable": null,
"deletable": "1"
},
"type": {
"alias": "Type",
"type": "drop",
"required": "0",
"unique": "0",
"editable": 1,
"deletable": "1",
"options": {
"e-mail": "Email",
"e-mail transactional": "Email (Transactional)",
"Task": "Task",
"sms": "SMS",
"Postcard": "Postcard",
"[\"e-mail\",\"Template\"]": "Email/ONTRAmail",
"Template": "ONTRAmail",
"template transactional": "ONTRAmail (Transactional)"
}
},
"mcsent": {
"alias": "Sent",
"type": "numeric",
"required": "0",
"unique": "0",
"editable": "0",
"deletable": "1"
},
"mcopened": {
"alias": "Opened",
"type": "percentage",
"required": "0",
"unique": "0",
"editable": "0",
"deletable": "1"
},
"mcclicked": {
"alias": "Clicked",
"type": "percentage",
"required": "0",
"unique": "0",
"editable": "0",
"deletable": "1"
},
"mcabuse": {
"alias": "Complaints",
"type": "percentage",
"required": "0",
"unique": "0",
"editable": "0",
"deletable": "1"
},
"mcunsub": {
"alias": "Opt Outs",
"type": "percentage",
"required": "0",
"unique": "0",
"editable": "0",
"deletable": "1"
},
"date": {
"alias": "Date Created",
"type": "timestamp",
"required": "0",
"unique": "0",
"editable": "0",
"deletable": "1"
},
"mcnotopened": {
"alias": "Not Opened",
"type": "percentage",
"required": "0",
"unique": "0",
"editable": "0",
"deletable": "1"
},
"mcnotclicked": {
"alias": "Not Clicked",
"type": "percentage",
"required": "0",
"unique": "0",
"editable": "0",
"deletable": "1"
},
"dlm": {
"alias": "Date Modified",
"type": "timestamp",
"required": "0",
"unique": "0",
"editable": "0",
"deletable": "0"
}
}
}
},
"account_id": "12345"
}
Retrieves the field meta data for the specified object.
Request Endpoint
GET https://api.ontraport.com/1/objects/meta
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID. If none is supplied, meta for all objects will be retrieved. |
format |
string | Indicates whether the list should be indexed by object name or object type ID. Possible values are byId and byName (default). |
Retrieve object collection info
curl -X GET 'https://api.ontraport.com/1/objects/getInfo?objectID=0&search=Mary' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
use OntraportAPI\ObjectType;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => ObjectType::CONTACT, // Object type ID: 0
"search" => "Mary"
);
$response = $client->object()->retrieveCollectionInfo($requestParams);
Example Response:
{
"code": 0,
"data": {
"listFields": [
"fn",
"email",
"office_phone",
"date",
"grade",
"dla",
"contact_id"
],
"listFieldSettings": [],
"count": "2"
},
"account_id": "12345"
}
Retrieves information about a collection of objects, such as the number of objects that match the given criteria.
Request Endpoint
GET https://api.ontraport.com/1/objects/getInfo
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID. Required. |
condition |
string | A JSON encoded string to more specifically set criteria for which objects you wish to select. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other object fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Retrieve fields and sections in an object record
curl -X GET \
'https://api.ontraport.com/1/objects/fieldeditor?objectID=0§ion=Contact%20Information' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
// Get all sections and fields
$response = $client->object()->retrieveFields(array(
"objectID" => 0
));
// Get the fields in a particular section
$response = $client->object()->retrieveFields(array(
"objectID" => 0,
"section" => "Contact Information"
));
// Get information for a single field
$response = $client->object()->retrieveFields(array(
"objectID" => 0,
"field" => "firstname"
));
Example Response:
{
"code": 0,
"data": {
"id": 1,
"name": "Contact Information",
"description": "",
"fields": [
[
{},
{
"id": 1,
"alias": "First Name",
"field": "firstname",
"type": "text",
"required": 0,
"unique": 0,
"editable": 1,
"options": null
},
{
"id": 2,
"alias": "Last Name",
"field": "lastname",
"type": "text",
"required": 0,
"unique": 0,
"editable": 1,
"options": null
},
{
"id": 3,
"alias": "Email",
"field": "email",
"type": "email",
"required": 0,
"unique": 0,
"editable": 1,
"options": null
},
{},{}
],
[{},{}],
[{},{}]
]
},
"account_id": "12345"
}
Retrieve information about the fields and sections an object has. If a section name is passed, only the fields in that section will be returned. If a field name is passed, only that field information will be returned. By default, this endpoint returns all sections and fields for a specified object.
Request Endpoint
GET https://api.ontraport.com/1/objects/fieldeditor
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID. Required. |
section |
string | The name of the Section. |
field |
array | The name of the field e.g. f1234 |
Update an object's data
curl -X PUT -d '{
"objectID": 0,
"id": 7,
"lastname": "Smyth"
}' 'https://api.ontraport.com/1/objects' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
use OntraportAPI\ObjectType;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => ObjectType::CONTACT, // Object type ID: 0
"id" => 7,
"lastname" => "Smyth"
);
$response = $client->object()->update($requestParams);
Example Response:
{
"code": 0,
"data": {
"attrs": {
"lastname": "Smyth",
"dlm": "1500506494",
"id": "7"
}
},
"account_id": "12345"
}
Updates an existing object with given data. The object type ID and ID of the object to update are required. The other fields should only be used if you want to change the existing value.
Request Endpoint
PUT https://api.ontraport.com/1/objects
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/json
Request Parameters
Parameters should be sent in the request body as a JSON-encoded string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID. Required. |
id |
integer | The ID of the object. For ORM objects, either id or unique_id is required. For non-ORM objects, id is required. |
unique_id |
string | In ORM objects only. A unique identifier for the object. This field is system generated and can't be updated. If the unique_id sent matches an object in the account, that object's data will be updated. Either id or unique_id are required. If both are sent, unique_id will be ignored. |
*All other parameters depend upon the object.
Update fields and sections in an object record
curl -X PUT -d '{
"objectID": 0,
"name": "Contact Information",
"description": "Fields for contacts",
"fields": [
[
{
"field": "f1558",
"alias": "Changed New Field",
"type": "longtext"
}
]
]
}' 'https://api.ontraport.com/1/objects/fieldeditor' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
use OntraportAPI\ObjectType;
use OntraportAPI\Models\FieldEditor\ObjectField;
use OntraportAPI\Models\FieldEditor\ObjectSection;
$client = new Ontraport("2_AppID_12345678","Key5678");
$myField = new ObjectField("Changed New Field", ObjectField::TYPE_LONGTEXT);
$mySection = new ObjectSection("Contact Information", array($myField));
$requestParams = $mySection->toRequestParams();
$requestParams["objectID"] = ObjectType::CONTACT;
$response = $client->object()->updateFields($requestParams);
Example Response:
{
"code": 0,
"data": {
"success": [
{
"f1558": "Changed New Field"
}
]
},
"account_id": "12345"
}
Update fields and sections in an object record. The section MUST exist in order to update it. Any fields that do not already exist will be created. Fields can be matched either by their alias (displayed name), or by the actual name of the field e.g. f1234
Request Endpoint
PUT https://api.ontraport.com/1/objects/fieldeditor
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/json
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID. Required. |
name |
string | The name of the Section. |
description |
string | A description for the new Section. |
fields |
array | An array of columns containing fields containing arrays of field objects. Required. Example of how these are nested: [[{field1}],[{field2}],[{field3}]] |
Field
This field object
Parameter | Type | Description |
---|---|---|
field |
string | The name of the field. Required unless alias is sent. |
alias |
string | The display name of the field. If sent along with field , the alias will be renamed to what is provided. |
type |
string | The field type. This is only used for converting text to longtext . |
options |
object | Extra options for certain for certain field types. If the field is a drop or list type, specify if you want to remove or replace the values and providing an array of names:"remove":["first", "second", "third"] |
Delete a single object
curl -X DELETE 'https://api.ontraport.com/1/object?objectID=0&id=4' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
use OntraportAPI\ObjectType;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => ObjectType::CONTACT, // Object type ID: 0
"id" => 4
);
$response = $client->object()->deleteSingle($requestParams);
Example Response:
{
"code": 0,
"account_id": "12345"
}
Deletes an existing object of the specified object type.
Request Endpoint
DELETE https://api.ontraport.com/1/object
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID to delete. Required. |
id |
integer | The ID of the specific object to delete. Required. |
Delete multiple objects
curl -X DELETE 'https://api.ontraport.com/1/objects?objectID=14&ids=1%2C2' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
use OntraportAPI\ObjectType;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => ObjectType::TAG, // Object type ID: 14
"ids" => "1,2"
);
$response = $client->object()->deleteMultiple($requestParams);
Example Response:
{
"code": 0,
"data": "Deleted",
"account_id": "12345"
}
This endpoint deletes a collection of objects. Use caution with this endpoint.
Request Endpoint
DELETE https://api.ontraport.com/1/objects
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID. Required. |
ids |
string | An integer array as a comma-delimited list of the IDs of objects to delete. Entering a value of 0 will result in all objects of specified type being selected. |
start |
integer | The offset to start your search from. |
range |
integer | The number of objects you want to delete. The maximum and default range is 50. |
condition |
string | A JSON encoded string to more specifically set criteria for which objects to bring back. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not object notes should be searched for the specified string in addition to other object fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Delete fields and sections in an object
curl -X DELETE -d 'objectID=0&field=f1234'\
'https://api.ontraport.com/1/objects/fieldeditor' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678' \
--header 'Content-Type: application/x-www-form-urlencoded'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$response = $client->object()->deleteFields(array(
"objectID" => 0,
"field" => "f1234"
));
Example Response:
{
"code": 0,
"data": "Deleted",
"account_id": "50"
}
Deletes a field, or section in an object record. If attempting to delete a section, the section MUST be empty.
Request Endpoint
DELETE https://api.ontraport.com/1/objects/fieldeditor
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID. Required. |
section |
string | The name of the Section. |
field |
array | The name of the field e.g f1234 |
Add an object to a sequence
curl -X PUT -d 'objectID=0&add_list=1&ids=6' 'https://api.ontraport.com/1/objects/sequence' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
use OntraportAPI\ObjectType;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => ObjectType::CONTACT, // Object type ID: 0
"ids" => 6,
"add_list" => 1
);
$response = $client->object()->addToSequence($requestParams);
Example Response:
{
"code": 0,
"data": "The subscription is now being processed.",
"account_id": "12345"
}
Adds one or more objects to one or more sequences.
Request Endpoint
PUT https://api.ontraport.com/1/objects/sequence
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID. Required. |
add_list |
string | An array as a comma-delimited list of the IDs of the sequence(s) to which objects should be added. Required. |
ids |
string | An array as a comma-delimited list of the IDs of the objects to be added to sequences. Required. |
start |
integer | The offset to start your search from. |
range |
integer | The number of objects to include in your query. The maximum and default range is 50. |
condition |
string | A JSON encoded string to more specifically set criteria for which objects should be affected. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your objects for. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Tag an object
curl -X PUT -d 'objectID=0&add_list=2&ids=6' 'https://api.ontraport.com/1/objects/tag' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
use OntraportAPI\ObjectType;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => ObjectType::CONTACT, // Object type ID: 0
"ids" => 6,
"add_list" => 2
);
$response = $client->object()->addTag($requestParams);
Example Response:
{
"code": 0,
"data": "The tag is now being processed.",
"account_id": "12345"
}
Adds one or more tags to one or more objects.
Request Endpoint
PUT https://api.ontraport.com/1/objects/tag
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID. Required. |
add_list |
string | An array as a comma-delimited list of the IDs of the tag(s) which should be added to objects. Required. |
ids |
string | An array as a comma-delimited list of the IDs of the objects to be tagged. Required. |
start |
integer | The offset to start your search from. |
range |
integer | The number of objects to include in your query. The maximum and default range is 50. |
condition |
string | A JSON encoded string to more specifically set criteria for which objects should be affected. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your objects for. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Tag an object by name
curl -X PUT -d '{
"objectID": 0,
"ids": [
2
],
"add_names": [
"Blue","Yellow"
]
}' 'https://api.ontraport.com/1/objects/tagByName' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
use OntraportAPI\ObjectType;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => ObjectType::CONTACT, // Object type ID: 0
"ids" => array(7),
"add_names" => array(
"Blue",
"Yellow"
)
);
$response = $client->object()->addTagByName($requestParams);
Example Response:
{
"code": 0,
"data": "The tag is now being processed.",
"account_id": "12345"
}
Adds one or more tags to one or more objects by the tag name. This endpoint will create the tag if it doesn't exist.
Request Endpoint
PUT https://api.ontraport.com/1/objects/tagByName
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/json
Request Parameters
Parameters should be sent in the request body as a JSON-encoded string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID. Required. |
add_names |
string | An array of the names of the tag(s) which should be added to objects. Required. |
ids |
string | An array of the IDs of the objects to be tagged. Required. |
start |
integer | The offset to start your search from. |
range |
integer | The number of objects to include in your query. The maximum and default range is 50. |
condition |
string | A JSON encoded string to more specifically set criteria for which objects should be affected. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your objects for. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Subscribe an object to a campaign or sequence
Note:
"campaign" throughout this doc is called "automation" throughout the Ontraport app.
curl -X PUT -d 'objectID=0&add_list=3&ids=2&sub_type=Campaign' 'https://api.ontraport.com/1/objects/subscribe' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
use OntraportAPI\ObjectType;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => ObjectType::CONTACT, // Object type ID: 0
"ids" => 2,
"add_list" => 3,
"sub_type" => "Campaign"
);
$response = $client->object()->subscribe($requestParams);
Example Response:
{
"code": 0,
"data": "The subscription is now being processed.",
"account_id": "12345"
}
Subscribes one or more objects to one or more campaigns or sequences.
Request Endpoint
PUT https://api.ontraport.com/1/objects/subscribe
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID. Required. |
add_list |
string | An array as a comma-delimited list of the IDs of the campaign(s) or sequence(s) the objects should be subscribed to. Required. |
ids |
string | An array as a comma-delimited list of the IDs of the objects to be subscribed. Required. |
sub_type |
string | Either Campaign or Sequence . If no value is supplied, Campaign will be used. |
condition |
string | A JSON encoded string to more specifically set criteria for which objects should be affected. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your objects for. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Remove an object from a sequence
curl -X DELETE -d 'objectID=0&remove_list=1&ids=6' 'https://api.ontraport.com/1/objects/sequence' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
use OntraportAPI\ObjectType;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => ObjectType::CONTACT, // Object type ID: 0
"ids" => 6,
"remove_list" => 1
);
$response = $client->object()->removeFromSequence($requestParams);
Example Response:
{
"code": 0,
"data": "The subscription is now being processed.",
"account_id": "12345"
}
This endpoint removes one or more objects from one or more sequences.
Request Endpoint
DELETE https://api.ontraport.com/1/objects/sequence
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID. Required. |
remove_list |
string | An array as a comma-delimited list of the IDs of the sequences(s) from which to remove objects. Required. |
ids |
string | An array as a comma-delimited list of the IDs of the objects to be removed from sequence(s). Required. |
start |
integer | The offset to start your search from. |
range |
integer | The number of objects to include in your query. The maximum and default range is 50. |
condition |
string | A JSON encoded string to more specifically set criteria for which objects should be affected. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your objects for. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Remove a tag from an object
curl -X DELETE -d 'objectID=0&remove_list=2&ids=6' 'https://api.ontraport.com/1/objects/tag' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
use OntraportAPI\ObjectType;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => ObjectType::CONTACT, // Object type ID: 0
"ids" => 6,
"remove_list" => 2
);
$response = $client->object()->removeTag($requestParams);
Example Response:
{
"code": 0,
"data": "The tag is now being processed.",
"account_id": "12345"
}
This endpoint removes one or more tags from one or more objects.
Request Endpoint
DELETE https://api.ontraport.com/1/objects/tag
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID. Required. |
remove_list |
string | An array as a comma-delimited list of the IDs of the tag(s) to be removed from objects. Required. |
ids |
string | An array as a comma-delimited list of the IDs of the objects to remove from tag(s). Required. |
start |
integer | The offset to start your search from. |
range |
integer | The number of objects to include in your query. The maximum and default range is 50. |
condition |
string | A JSON encoded string to more specifically set criteria for which objects should be affected. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your objects for. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Remove a tag from an object by name
curl -X DELETE -d '{
"objectID": 0,
"ids": [
2
],
"remove_names": [
"Blue","Yellow"
]
}' 'https://api.ontraport.com/1/objects/tagByName' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
use OntraportAPI\ObjectType;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => ObjectType::CONTACT, // Object type ID: 0
"ids" => array(7),
"remove_names" => array(
"Blue",
"Yellow"
)
);
$response = $client->object()->removeTagByName($requestParams);
Example Response:
{
"data": "The tag is now being processed.",
"account_id": "12345"
}
This endpoint removes one or more tags from one or more objects by the tag name.
Request Endpoint
DELETE https://api.ontraport.com/1/objects/tagByName
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/json
Request Parameters
Parameters should be sent in the request body as a JSON-encoded string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID. Required. |
remove_names |
string | An array of the names of the tag(s) to be removed from objects. Nonexistent tag names will be ignored and will not cause a failure. Required. |
ids |
string | An array of the IDs of the objects to remove from tag(s). Required. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Unsubscribe an object from a campaign or sequence
Note:
"campaign" throughout this doc is called "automation" throughout the Ontraport app.
curl -X DELETE -d 'objectID=0&remove_list=3&ids=2&sub_type=Campaign' 'https://api.ontraport.com/1/objects/subscribe' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
use OntraportAPI\ObjectType;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => ObjectType::CONTACT, // Object type ID: 0
"ids" => 2,
"remove_list" => 3,
"sub_type" => "Campaign"
);
$response = $client->object()->unsubscribe($requestParams);
Example Response:
{
"code": 0,
"data": "The subscription is now being processed.",
"account_id": "12345"
}
This endpoint unsubscribes one or more objects from one or more campaigns or sequences.
Request Endpoint
DELETE https://api.ontraport.com/1/objects/subscribe
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID. Required. |
remove_list |
string | An array as a comma-delimited list of the IDs of the campaign(s) or sequence(s) to unsubscribe objects from. Required. |
ids |
string | An array as a comma-delimited list of the IDs of the objects to unsubscribe. Required. |
sub_type |
string | Either Campaign or Sequence . If no value is provided, Campaign will be used. |
condition |
string | A JSON encoded string to more specifically set criteria for which objects should be affected. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your objects for. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Pause rules and sequences for an object
curl -X POST -d 'objectID=5&ids=1' 'https://api.ontraport.com/1/objects/pause' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
use OntraportAPI\ObjectType;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => ObjectType::SEQUENCE, // Object type ID: 5
"ids" => 1
);
$response = $client->object()->pause($requestParams);
Example Response:
{
"code": 0,
"account_id": "12345"
}
This endpoint pauses rules, sequences, and sequence subscribers.
Request Endpoint
POST https://api.ontraport.com/1/objects/pause
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID. Possible object types are rules, sequences, and sequence subscribers. Required. |
ids |
string | An array as a comma-delimited list of the IDs of the objects to be paused. Required. |
start |
integer | The offset to start your search from. |
range |
integer | The number of objects to include in your query. The maximum and default range is 50. |
condition |
string | A JSON encoded string to more specifically set criteria for which objects should be affected. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your objects for. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Unpause rule and sequences for an object
curl -X POST -d 'objectID=5&ids=1' 'https://api.ontraport.com/1/objects/unpause' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
use OntraportAPI\ObjectType;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => ObjectType::SEQUENCE, // Object type ID: 5
"ids" => 1
);
$response = $client->object()->unpause($requestParams);
Example Response:
{
"code": 0,
"account_id": "12345"
}
Unpauses rules, sequences, and sequence subscribers.
Request Endpoint
POST https://api.ontraport.com/1/objects/unpause
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID to be unpaused. Possible object types are rules, sequences, and sequence subscribers. Required. |
ids |
string | An array as a comma-delimited list of the IDs of the objects to unpause. Required. |
start |
integer | The offset to start your search from. |
range |
integer | The number of objects to include in your query. The maximum and default range is 50. |
condition |
string | A JSON encoded string to more specifically set criteria for which objects should be affected. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your objects for. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Custom objects
# Retrieving a custom object using the generic objects endpoints
curl -X GET 'https://api.ontraport.com/1/object?objectID=10003&id=1' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
# Retrieving a custom object using the specific endpoint for an example object
curl -X GET 'https://api.ontraport.com/1/Company?&id=1' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
// Retrieving a sample custom object with object type ID 10003
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 1
);
$response = $client->custom(10003)->retrieveSingle($requestParams);
If you have custom objects you have created in the app, these can also be accessed through the API. All custom object attributes depend upon the object you have created.
Like other object types, you can use the objects API with the object type ID to access CRUD functionality for custom objects. You also can use the plural and singular endpoints which are dynamically created for your account for each custom object type in your database. For example, if you created a "Company" object you would have the following two endpoints:
https://api.ontraport.com/1/Company
and
https://api.ontraport.com/1/Companies
A listing of the endpoints available to you can be viewed in our live documentation.
Object type IDs for custom objects are always greater than 10000. You can spot these objects if you make a call to retrieve meta for all objects and look for IDs meeting that criteria.
Responses for these calls will follow the same model as responses for other resources, but the content of the data
array will vary.
Calendar Events - COMING SOON!
Object Type ID: 160
A calendar event object can be created manually or added to your account via a google calendar sync. Each recurring calendar event has a single entry which represents all possible entries, unless edits have been made to a single occurrence or a group of occurences that differ from the parent event.
Through the calendar events API, you can retrieve a single calendar event entry or a collection of calendar events. You can add and remove guests from events and change their RSVP status. You can create events, update events, and delete events.
Throughout this documentation, you will see the term "composite ID" used frequently, both with respect to calendar event instances, and with respect to calendar event guests. Calendar events can be recurring, and they can reoccur infinitely. Each instance of the series has the same base ID, and a different recurrence timestamp. Therefore, an event composite ID is composed of the base ID, an underscore, and the recurrence timestamp. An event instance with a base ID of 4 and a recurrence timestamp of 1625713200 would have a composite ID of 4_1625713200. When events are not recurring, we can assume their recurrence timestamp is 0.
Calendar events can have guests, and these guests can be one of two Ontraport object types: contacts and users. Guests will have a unique identifier, but most of the time we will refer to them by a composite ID as well. The guest composite ID is composed of the object type ID of the guest, an underscore, and the unique identifier of the contact or user tied to that guest. For example, contact ID 4 would have a guest composite ID of 0_4.
The calendar event object
{
"id": "2_1625601600",
"recurrence_timestamp": "0",
"location": "2040 Alameda Padre Serra, Santa Barbara, CA, USA",
"title": "Team meeting",
"start_time": 1625601600,
"end_time": 1625605200,
"description": "Ontraport team meeting.",
"duration": "3600",
"status": "0",
"repeat_every_count": "1",
"repeat_every_frequency": "2",
"repeat_monthly_modifier": "",
"repeat_on_days": "Tuesday",
"repeat_end_type": "0",
"repeat_end_date": "0",
"repeat_end_modifier": "",
"computed_end_date": "0",
"is_recurring": "1",
"is_repeat_custom": "0",
"is_all_day": "0",
"staff_id": "1",
"type_id": "1",
"event_template": "0",
"calendar_id": "0",
"repeat_rule_string_rfc5545": "FREQ=WEEKLY;BYDAY=TU",
"visibility": "1",
"notifications": "{\"event_notification\":[{\"notification_trigger_type\":\"action\",\"notification_send_to\":\"all\",\"notification_action_type\":\"email\",\"notification_trigger_action_type\":\"event_update\",\"notification_trigger_action_field_type\":\"start_time\",\"notification_action_email\":\"2\"}]}",
"remote_id": "",
"remote_parent_id": "",
"dla": "1624572693",
"dlm": "1624572693",
"remote_start_timezone": "",
"remote_end_timezone": "",
"repeat": "weekly",
"calendar_read_only": 0,
"is_remote": 0,
"calendar_access_role": "owner"
}
Calendar event attributes
Attribute | Type | Description |
---|---|---|
id |
string | The calendar event's composite ID. |
actual_id |
integer | The base ID for the entire event or recurrence series. All events belonging to the same series have the same base ID. |
recurrence_timestamp |
timestamp | For exceptions made to recurring event series, the timestamp of the date of the original start time of that recurrence. This remains the same even if the actual start time is modified. |
location |
string | The event location. |
title |
string | The event title. |
start_time |
timestamp | The UNIX timestamp of the event's start time. If the event is recurring, this represents the start time of the first event in the series. |
end_time |
timestamp | The UNIX timestamp of the event's end time. If the event is recurring, this represents the end time of the first event in the series. |
description |
string | A description of the event. |
duration |
integer | The length of the event, in seconds. |
repeat_every_count |
integer | For recurring events, given a frequency like weekly, the interval the event should repeat. For example, 1 for every week, 3 for every third week. |
repeat_every_frequency |
integer | How often a recurring event should repeat. Integer codes are mapped as follows:0 => Yearly 1 => Monthly 2 => Weekly 3 => Daily . Ontraport does not support finer granularity than daily. |
repeat_monthly_modifier |
integer | For monthly recurring events, an indicator of what type of monthly repeat. Repeats can be based on the ordinal day of the month (e.g. the 5th of every month) or a specific day of the week (e.g. the 3rd Tuesday). Integer codes are mapped as follows:0 => Repeat on a specific ordinal day of the month 1 => Repeat on a specific day of the week |
repeat_on_days |
string/integer | For a recurring event, either a comma-separated list of the the day(s) of the week (for weekly recurring events or monthly recurring events on a particular day of the week) or the day number of the month (for monthly recurring events on a particular day of the month). |
repeat_end_type |
integer | The indicator for when a recurring event should end. Integer codes are mapped as follows:0 => Never 1 => After a number of recurrences 2 => On a specific date . |
repeat_end_date |
timestamp | If the repeat_end_type is on a specific date, the UNIX timestamp for the date the recurring event should end. |
repeat_end_modifier |
integer | If the repeat_end_type is a number of recurrences, the number of recurrences it should continue. |
computed_end_date |
timestamp | Available for some recurrence cases, the computed end date for a recurring series. |
is_recurring |
integer | A binary integer flag indicating whether or not the event is recurring. |
is_repeat_custom |
integer | A binary integer flag indicating whether or not this event contains custom recurrence settings. |
is_all_day |
integer | A binary integer flag indicating whether or not this event lasts all day. |
staff_id |
integer | The user ID for the owner of this event. |
type_id |
integer | The event type ID for this event. |
event_template |
integer | The template ID for this event. |
calendar_id |
integer | The calendar ID (synced or local) for this event. |
repeat_rule_string_rfc5545 |
string | The RFC standard recurrence rule for this event. Find documentation on RFC standards here. |
visibility |
integer | The event visibility. Integer codes are mapped as follows:0 => Root event (When a recurring event has instances which have been modified, the original recurrence settings are retained for future calculations in this record.) 1 => Visible 2 => Deleted |
notifications |
string | [Notifications]. A JSON-encoded string of the notification rules for this event. |
remote_id |
string | For events imported from Google calendar, Google's ID for the event. |
remote_parent_id |
string | For events imported from Google calendar, Google's ID for this recurring event series. |
dla |
timestamp | The date this event was created. |
dlm |
timestamp | The date this event was last modified. |
remote_start_timezone |
string | For events imported from Google calendar, the timezone of the start time. |
remote_end_timezone |
integer | For events imported from Google calendar, the timezone of the end time. |
calendar_read_only |
integer | A binary integer flag indicating whether or not this event is read only. An event is read-only if the linked calendar staff_id differs from the event staff_id , or if the calendar_access_role is not writer or owner . This setting is not editable. |
is_remote |
integer | A binary integer flag indicating whether or not this event originated from a remote (synced) calendar. |
owner |
string | An ineditable string representation of the event owner's name. Note that this is generated from the staff_id and is a separate field. |
is_multi_day |
integer | A binary integer flag indicating whether or not this event was created to span multiple days. This flag is set internally and not editable. |
calendar_access_role |
string | For events imported from Google calendar, whether we have write or owner permissions on the event. |
guest_status |
integer | The guest RSVP status. Options are mapped as follows:0 => Unconfirmed 1 => No 2 => Maybe 3 => Yes . This field can only be included when retrieving guests in sucollection mode so that events are limited to one guest. |
Create a calendar event object
curl -X POST -d '{
"title": "Repeat Every Day for 5 Days",
"start_time": 1625248800,
"duration": 1800,
"location": "My House",
"description": "Recurring Daily for 5 Days",
"repeat_every_frequency": 3,
"repeat_end_type": 1,
"repeat_end_modifier": 5,
"is_recurring": 1,
"staff_id": 1,
"guestInfo": {
"guestList": [
{
"id": "0_1",
"fieldUpdates": {
"status": 2
}
}
]
}
}' 'http://api.ontraport.com/1/CalendarEvents'
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
Coming soon!
Example Response:
{
"code": 0,
"data": {
"objectID": 160,
"title": "Repeat Every Day for 5 Days",
"start_time": 1625248800,
"duration": 1800,
"location": "My House",
"description": "Recurring Daily for 5 Days",
"repeat_every_frequency": 3,
"repeat_end_type": 1,
"repeat_end_modifier": 5,
"is_recurring": 1,
"staff_id": 1,
"guestInfo": {
"guestList": [
{
"id": "0_1",
"fieldUpdates": {
"status": 2
}
}
]
},
"timezone": "America/Los_Angeles",
"repeat_on_days": "",
"repeat_end_date": "",
"end_time": 1625250600,
"status": 0,
"repeat_every_count": 1,
"is_multi_day": 0,
"repeat_rule_string_rfc5545": "FREQ=DAILY;COUNT=5",
"computed_end_date": 1625594400,
"id": "5_0",
"calendar_read_only": 0,
"is_remote": 0,
"calendar_access_role": "owner"
},
"account_id": 12345
}
Creates a new calendar event.
Request Endpoint
POST https://api.ontraport.com/1/CalendarEvents
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
location |
string | The event location. |
title |
string | The event title. |
start_time |
timestamp | The UNIX timestamp of the event's start time. If the event is recurring, this represents the start time of the first event in the series. |
end_time |
timestamp | The UNIX timestamp of the event's end time. If the event is recurring, this represents the end time of the first event in the series. |
description |
string | A description of the event. |
duration |
integer | The length of the event, in seconds. |
repeat_every_count |
integer | For recurring events, given a frequency like weekly, the interval the event should repeat. For example, 1 for every week, 3 for every third week. |
repeat_every_frequency |
integer | How often a recurring event should repeat. Integer codes are mapped as follows:0 => Yearly 1 => Monthly 2 => Weekly 3 => Daily . Ontraport does not support finer granularity than daily. |
repeat_monthly_modifier |
integer | For monthly recurring events, an indicator of what type of monthly repeat. Repeats can be based on the ordinal day of the month (e.g. the 5th of every month) or a specific day of the week (e.g. the 3rd Tuesday). Integer codes are mapped as follows:0 => Repeat on a specific ordinal day of the month 1 => Repeat on a specific day of the week |
repeat_on_days |
string/integer | For a recurring event, either a comma-separated list of the the day(s) of the week (for weekly recurring events or monthly recurring events on a particular day of the week) or the day number of the month (for monthly recurring events on a particular day of the month). |
repeat_end_type |
integer | The indicator for when a recurring event should end. Integer codes are mapped as follows:0 => Never 1 => After a number of recurrences 2 => On a specific date . |
repeat_end_date |
timestamp | If the repeat_end_type is on a specific date, the UNIX timestamp for the date the recurring event should end. |
repeat_end_modifier |
integer | If the repeat_end_type is after a certain number of recurrences, the number of occurrences. |
is_recurring |
integer | A binary integer flag indicating whether or not the event is recurring. |
is_repeat_custom |
integer | A binary integer flag indicating whether or not this event contains custom recurrence settings. |
is_all_day |
integer | A binary integer flag indicating whether or not this event lasts all day. |
staff_id |
integer | The user ID for the owner of this event. |
type_id |
integer | The event type ID for this event. |
event_template |
integer | The template ID for this event. |
calendar_id |
integer | The calendar ID (synced or local) for this event. |
notifications |
string | [Notifications]. A JSON-encoded string of the notification rules for this event. |
guestInfo |
array | [Guest Info]. An array of information managing guest adds, guest removes, and guest status changes. |
Guest Info
An array of information managing guest adds, guest removes, and guest status changes. Optionally can be included with calendar event creates and updates.
Parameter | Type | Description |
---|---|---|
guestList |
array | [Guest List]. An array of guest additions and / or status changes for the calendar event. |
removedList |
array | An array of composite guest IDs to be removed from current guest list. |
Guest List
An array of information managing guest adds and guest status changes.
Parameter | Type | Description |
---|---|---|
id |
integer | The composite ID of the guest to add or update. |
fieldUpdates |
array | If updating the guest status, an array containing a status key. Options for status are mapped as follows:0 => Unconfirmed 1 => No 2 => Maybe 3 => Yes |
Notifications
Notifications are an array of data controlling rules that fire based on some calendar event action or relative time. They are sent to the API as a json-encoded string.
curl -X PUT -d '{
"id": "6_1625248800",
"title": "Edited Recurring",
"guestInfo": {
"removedList": ["0_1"]
},
"notifications": "{\"event_notification\":[{\"notification_trigger_type\":\"action\",\"notification_send_to\":\"contact\",\"notification_action_type\":\"email\",\"notification_trigger_action_type\":\"event_update\",\"notification_trigger_action_field_type\":\"any\",\"notification_action_email\":\"2\"}]}",
"edit_scope": 2
}' 'http://api.ontraport.com/1/CalendarEvents'
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
Coming soon!
Example Response:
{
"code": 0,
"data": {
"id": "6_1625248800",
"recurrence_timestamp": "0",
"location": "My House",
"title": "Edited Recurring",
"start_time": 1625248800,
"end_time": 1625250600,
"description": "Recurring Daily for 5 Days",
"duration": "1800",
"status": "0",
"repeat_every_count": "1",
"repeat_every_frequency": "3",
"repeat_monthly_modifier": "",
"repeat_on_days": "",
"repeat_end_type": "1",
"repeat_end_date": "0",
"repeat_end_modifier": "5",
"computed_end_date": "1625594400",
"is_recurring": "1",
"is_repeat_custom": "0",
"is_all_day": "0",
"staff_id": "1",
"type_id": "0",
"event_template": "0",
"calendar_id": "0",
"repeat_rule_string_rfc5545": "FREQ=DAILY;COUNT=5",
"visibility": "1",
"notifications": "{\"event_notification\":[{\"notification_trigger_type\":\"action\",\"notification_send_to\":\"contact\",\"notification_action_type\":\"email\",\"notification_trigger_action_type\":\"event_update\",\"notification_trigger_action_field_type\":\"any\",\"notification_action_email\":\"2\"}]}",
"remote_id": "",
"remote_parent_id": "",
"dla": "1625681964",
"dlm": "1625690463",
"remote_start_timezone": "",
"remote_end_timezone": "",
"repeat": "daily",
"calendar_read_only": 0,
"is_remote": 0,
"calendar_access_role": "owner",
"objectID": 160,
"edit_scope": 2,
"guest_ids": {
"remove": {
"0_1": "1"
},
"all": []
},
"timezone": "America/Los_Angeles",
"is_multi_day": 0
},
"account_id": 1234560
}
Parameters used to control the type of notification:
Parameter | Type | Description |
---|---|---|
notification_trigger_type |
string | Whether the notifications will be triggered by an action taken in the account, or by a time relative to the event start or end. time for time-based and action for action-based notifications. Required |
Parameters needed for the trigger on time-based notifications:
Parameter | Type | Description |
---|---|---|
notification_time_count |
integer | The quantity of the time unit you are using for your notifications. For example, if you want to trigger notifications 1 day before an event, this number will be 1. The total time cannot add up to more than one year. Required |
notification_time_interval |
string | The indicator for the time unit the notifications should trigger based on relative to the target. Options are as follows: minutes hours days Required. |
notification_time_relative_direction |
string | The indicator for when the notifications should trigger with respect to the target. before or after . Required |
notification_time_relative_target |
string | The event bound you wish to trigger notifications based on. start_time or end_time . Required |
Parameters needed for the trigger on action-based notifications:
Parameter | Type | Description |
---|---|---|
notification_trigger_action_type |
string | The event triggering the notification for this event. Options are as follows:event_update => Trigger a notification when a particular field or any field is updated in the event.event_cancel => Trigger a notification when the event is deleted.guest_added => Trigger a notification when a guest is added to an event.guest_removed => Trigger a notification when a guest is removed from an event.Required |
notification_trigger_action_field_type |
string | For event_update triggers only, the field to trigger notifications on for event updates. Defaults to any . Specific fields include: title , start_time , end_time , location , staff_id , description , location . |
Parameters needed for the action on all notifications:
Parameter | Type | Description |
---|---|---|
notification_send_to |
string | Who this notification will be sent to. Options are as follows:all => Send to all guestscontacts => Send to all guests who are contactsowner => Send to the guest who is the owner of the event. This option cannot be used for campaign rules.users => Send to all guests who are users. This option cannot be used with campaign rules.attending => Send to all guests who have RSVP'd that they are attending this eventunconfirmed => Send to all guests who have not responded to this eventthis => Send to only the collection of guests an action occurred on. This option can be used only for guest_added and guest_removed rules.email => Send to a specific email address.sms => Send to a specific SMS number.Required |
notification_action_type |
string | What type of notification this is. Options are as follows:email => Send an email when this notification is triggered.sms => Send an SMS when this notification is triggered.campaign => Add the guests who are contacts only to a campaign when this notification is triggered.Required |
notification_action_email |
integer | If the notification should send an email, the email ID. |
notification_action_sms |
integer | If the notification should send an sms, the SMS ID. |
notification_action_campaign |
integer | If the notification should add contacts to a campaign, the campaign ID. |
notification_specific_email |
string | If the notification should sent to a specific email, the email it should send to. |
notification_specific_sms |
string | If the notification should sent to a specific SMS number, the SMS number it should send to. |
notification_action_sms_number |
string | If the notification should send an SMS, the SMS number in the account it should send from. |
Retrieve a single calendar event
curl -X GET 'https://api.ontraport.com/1/CalendarEvent?id=2_1625601600' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
coming soon
Example Response:
{
"code": 0,
"data": {
"id": "2_1625601600",
"recurrence_timestamp": "0",
"location": "2040 Alameda Padre Serra, Santa Barbara, CA, USA",
"title": "Team meeting",
"start_time": 1625601600,
"end_time": 1625605200,
"description": "Ontraport team meeting.",
"duration": "3600",
"status": "0",
"repeat_every_count": "1",
"repeat_every_frequency": "2",
"repeat_monthly_modifier": "",
"repeat_on_days": "Tuesday",
"repeat_end_type": "0",
"repeat_end_date": "0",
"repeat_end_modifier": "",
"computed_end_date": "0",
"is_recurring": "1",
"is_repeat_custom": "0",
"is_all_day": "0",
"staff_id": "1",
"type_id": "1",
"event_template": "0",
"calendar_id": "0",
"repeat_rule_string_rfc5545": "FREQ=WEEKLY;BYDAY=TU",
"visibility": "1",
"notifications": "{\"event_notification\":[{\"notification_trigger_type\":\"action\",\"notification_send_to\":\"all\",\"notification_action_type\":\"email\",\"notification_trigger_action_type\":\"event_update\",\"notification_trigger_action_field_type\":\"start_time\",\"notification_action_email\":\"2\"}]}",
"remote_id": "",
"remote_parent_id": "",
"dla": "1624572693",
"dlm": "1624572693",
"remote_start_timezone": "",
"remote_end_timezone": "",
"repeat": "weekly",
"calendar_read_only": 0,
"is_remote": 0,
"calendar_access_role": "owner"
},
"account_id": 12345
}
Retrieves all the information for an existing calendar event.
Request Endpoint
GET https://api.ontraport.com/1/CalendarEvent
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
string | The calendar event's composite ID. Required. |
Retrieve multiple calendar events
curl -X GET 'http://api.ontraport.com/1/CalendarEvents?start_time=1624474800' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
Coming soon!
Example Response:
{
"code": 0,
"data": [
{
"id": "1_0",
"actual_id": "1",
"staff_id": "1",
"type_id": "4",
"title": "Haircut",
"description": "",
"location": "",
"start_time": 1624581000,
"end_time": 1624582800,
"duration": "1800",
"dla": "1624579571",
"dlm": "1624579571",
"is_recurring": "0",
"repeat_every_count": "1",
"repeat_every_frequency": "",
"repeat_on_days": "",
"repeat_end_type": "0",
"repeat_end_modifier": "",
"is_repeat_custom": "0",
"is_all_day": "0",
"status": "0",
"repeat_end_date": "0",
"owner": "joe tester",
"guest_status": null,
"guests": null,
"calendar_id": "0",
"remote_start_timezone": "",
"remote_end_timezone": ""
},
{
"id": "2_0",
"actual_id": "2",
"staff_id": "1",
"type_id": "5",
"title": "Dinner with client",
"description": "",
"location": "Dario's Pizza, Bridgeway, Sausalito, CA, USA",
"start_time": 1624761000,
"end_time": 1624766400,
"duration": "5400",
"dla": "1624579612",
"dlm": "1624579612",
"is_recurring": "0",
"repeat_every_count": "1",
"repeat_every_frequency": "",
"repeat_on_days": "",
"repeat_end_type": "0",
"repeat_end_modifier": "",
"is_repeat_custom": "0",
"is_all_day": "0",
"status": "0",
"repeat_end_date": "0",
"owner": "joe tester",
"guest_status": null,
"guests": null,
"calendar_id": "0",
"remote_start_timezone": "",
"remote_end_timezone": ""
},
{
"id": "3_0",
"actual_id": "3",
"staff_id": "1",
"type_id": "5",
"title": "Disneyland",
"description": "",
"location": "Disneyland Park, Disneyland Drive, Anaheim, CA, USA",
"start_time": 1625099400,
"end_time": 1625101200,
"duration": "1800",
"dla": "1624579645",
"dlm": "1624579645",
"is_recurring": "0",
"repeat_every_count": "1",
"repeat_every_frequency": "",
"repeat_on_days": "",
"repeat_end_type": "0",
"repeat_end_modifier": "",
"is_repeat_custom": "0",
"is_all_day": "0",
"status": "0",
"repeat_end_date": "0",
"owner": "joe tester",
"guest_status": null,
"guests": null,
"calendar_id": "0",
"remote_start_timezone": "",
"remote_end_timezone": ""
}
],
"account_id": 12345
}
Retrieves a collection of calendar events based on a set of parameters. Each of the different possible modes mimics the way the data is retrieved in the Ontraport app.
Pagination works differently for calendar events. Rather than passing in a range value for items desired per page, the range is fixed based on the mode. For the primary mode, events
, each page will return 50 events, in addition to all the events on the first and last day of that range. For the subcollection
mode, that range is lowered to 25.
Request Endpoint
GET https://api.ontraport.com/1/CalendarEvents
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
start_time |
timestamp | The timestamp you would like to begin retrieving events from. Calendar event pagination is different from regular event pagination, and is controlled by changing the start time. Required |
search |
string | A string to search your calendar event objects for. Search fields include: title, location, description, start_time, and end_time. Additionally, in subcollection mode, guest_status can be searched. |
group_id |
integer | The group ID of calendar events to retrieve. |
calendarEventOwner |
string | Which staff member or staff members to retrieve events for. Options are as follows:all : Retrieve all events regardless of owner.me : Retrieve only the events belonging to the owner of your API keys.team : Return the events for the owner of your API keys and their subordinatesYou can also pass in the ID of any user on the account to retrieve only the events belonging to them. |
mode |
string | Calendar events can be retrieved in slightly different ways to mimic the behavior of the Ontraport app. Options are as follows:events : This is the default option. This mode's pagination is controlled by the start_time parameter, and will return 50 events per page, plus all of the other events on the first and last day of the page. Events spanning multiple days will be represented by an event on each day of the date range.subcollection : This option mimics the subcollection in the Ontraport app. This mode's pagination is controlled by start_time and the relative_paginate parameter, and will return 25 events per page, plus all of the other events on the first and last day of the page. Events spanning multiple days will be represented by a single event record. For this mode, the guestsearch parameter must be set. bullets : This mode's pagination is controlled by the start_time parameter, and will return for the entire relevant month the day numbers that have existing events. No other event data is returned for this option.submenu : This option does not allow for pagination and will return a list of event IDs from the context of today, with all events up to one month in the past and six months in the future. No other filter applies to the submenu.recents : Returns the ten most recently edited events. |
relative_paginate |
string | This option can only be used with mode set to subcollection , and is a set of controls that allows skipping to the previous or next page, all the way to the beginning, or all the way to the end of the event collection. Skipping to the end is not supported where infinitely recurring events are present. These options must be used in conjunction with the start_time parameter. Options map as follows:-2 => Skip to the beginning -1 => Skip to previous page 1 => Skip to next page 2 => Skip to the end . |
guestsearch |
string | The composite ID of a guest to search for. This option is necessary when mode is set to subcollection . |
Update a calendar event
curl -X PUT -d '{
"id": "6_1625248800",
"title": "Edited Recurring",
"guestInfo": {
"removedList": ["0_1"]
},
"notifications": "{\"event_notification\":[{\"notification_trigger_type\":\"action\",\"notification_send_to\":\"contact\",\"notification_action_type\":\"email\",\"notification_trigger_action_type\":\"event_update\",\"notification_trigger_action_field_type\":\"any\",\"notification_action_email\":\"2\"}]}",
"edit_scope": 2
}' 'http://api.ontraport.com/1/CalendarEvents'
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
Coming soon!
Example Response:
{
"code": 0,
"data": {
"id": "6_1625248800",
"recurrence_timestamp": "0",
"location": "My House",
"title": "Edited Recurring",
"start_time": 1625248800,
"end_time": 1625250600,
"description": "Recurring Daily for 5 Days",
"duration": "1800",
"status": "0",
"repeat_every_count": "1",
"repeat_every_frequency": "3",
"repeat_monthly_modifier": "",
"repeat_on_days": "",
"repeat_end_type": "1",
"repeat_end_date": "0",
"repeat_end_modifier": "5",
"computed_end_date": "1625594400",
"is_recurring": "1",
"is_repeat_custom": "0",
"is_all_day": "0",
"staff_id": "1",
"type_id": "0",
"event_template": "0",
"calendar_id": "0",
"repeat_rule_string_rfc5545": "FREQ=DAILY;COUNT=5",
"visibility": "1",
"notifications": "{\"event_notification\":[{\"notification_trigger_type\":\"action\",\"notification_send_to\":\"contact\",\"notification_action_type\":\"email\",\"notification_trigger_action_type\":\"event_update\",\"notification_trigger_action_field_type\":\"any\",\"notification_action_email\":\"2\"}]}",
"remote_id": "",
"remote_parent_id": "",
"dla": "1625681964",
"dlm": "1625690463",
"remote_start_timezone": "",
"remote_end_timezone": "",
"repeat": "daily",
"calendar_read_only": 0,
"is_remote": 0,
"calendar_access_role": "owner",
"objectID": 160,
"edit_scope": 2,
"guest_ids": {
"remove": {
"0_1": "1"
},
"all": []
},
"timezone": "America/Los_Angeles",
"is_multi_day": 0
},
"account_id": 1234560
}
Updates an existing calendar event with given data. The composite ID of the calendar event to update is required.
Request Endpoint
PUT https://api.ontraport.com/1/CalendarEvents
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
id |
string | The composite ID of the event. |
location |
string | The event location. |
title |
string | The event title. |
start_time |
timestamp | The UNIX timestamp of the event's start time. If the event is recurring, this represents the start time of the first event in the series. |
end_time |
timestamp | The UNIX timestamp of the event's end time. If the event is recurring, this represents the end time of the first event in the series. |
description |
string | A description of the event. |
duration |
integer | The length of the event, in seconds. |
repeat_every_count |
integer | For recurring events, given a frequency like weekly, the interval the event should repeat. For example, 1 for every week, 3 for every third week. |
repeat_every_frequency |
integer | How often a recurring event should repeat. Integer codes are mapped as follows:0 => Yearly 1 => Monthly 2 => Weekly 3 => Daily . Ontraport does not support finer granularity than daily. |
repeat_monthly_modifier |
integer | For monthly recurring events, an indicator of what type of monthly repeat. Repeats can be based on the ordinal day of the month (e.g. the 5th of every month) or a specific day of the week (e.g. the 3rd Tuesday). Integer codes are mapped as follows:0 => Repeat on a specific ordinal day of the month 1 => Repeat on a specific day of the week |
repeat_on_days |
string/integer | For a recurring event, either a comma-separated list of the the day(s) of the week (for weekly recurring events or monthly recurring events on a particular day of the week) or the day number of the month (for monthly recurring events on a particular day of the month). |
repeat_end_type |
integer | The indicator for when a recurring event should end. Integer codes are mapped as follows:0 => Never 1 => After a number of recurrences 2 => On a specific date . |
repeat_end_date |
timestamp | If the repeat_end_type is on a specific date, the UNIX timestamp for the date the recurring event should end. |
repeat_end_modifier |
integer | If the repeat_end_type is after a certain number of recurrences, the number of occurrences. |
is_recurring |
integer | A binary integer flag indicating whether or not the event is recurring. |
is_repeat_custom |
integer | A binary integer flag indicating whether or not this event contains custom recurrence settings. |
is_all_day |
integer | A binary integer flag indicating whether or not this event lasts all day. |
staff_id |
integer | The user ID for the owner of this event. |
type_id |
integer | The event type ID for this event. |
event_template |
integer | The template ID for this event. |
calendar_id |
integer | The calendar ID (synced or local) for this event. |
notifications |
string | [Notifications]. A JSON-encoded string of the notification rules for this event. |
guestInfo |
array | [Guest Info]. An array of information managing guest adds, guest removes, and guest status changes. |
edit_scope |
integer | For recurring events, the scope of the recurrences to be edited. Integer codes are mapped as follows:0 => This event 1 => This and following events 2 => All events Default is all events. |
Update guest status for calendar event(s)
curl -X PUT -d 'guest_id=0_1&ids=3_1625358600&status=1' 'http://api.ontraport.com/1/CalendarEvent/updateGuestStatus' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
Coming soon!
Example Response:
{
"code": 0,
"data": {
"guest_id": "0_1",
"event_ids": [
"3_1625358600"
],
"status": "1"
},
"account_id": 12345
}
Updates the guest status for one or more calendar events. Each event instance must be specified individually for this endpoint. The guest composite ID, a status, and at least one event composite ID are required. If a guest composite ID is passed and that guest is not currently on the event, they will be added with the status indicated.
Request Endpoint
PUT https://api.ontraport.com/1/CalendarEvents/updateGuestStatus
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
guest_id |
string | The guest composite ID. Required |
ids |
array | An array as a comma-separated list of the event instance composite ids to change the status of the guest for. Required |
status |
integer | The guest attendance status. Integer codes are mapped as follows:0 => Unconfirmed 1 => No 2 => Maybe 3 => Yes Required |
Remove a guest from calendar event(s)
curl -X PUT -d 'guest_id=0_1&ids=3_1625445000' 'http://api.ontraport.com/1/CalendarEvent/removeGuest' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
Coming soon!
Example Response:
{
"code": 0,
"data": {
"guest_id": "0_1",
"event_ids": [
"3_1625445000"
]
},
"account_id": 12345
}
Removes a guest from one or more calendar event instances. Each event instance must be specified individually for this endpoint. The guest composite ID and at least one event composite ID are required.
Request Endpoint
PUT https://api.ontraport.com/1/CalendarEvents/removeGuest
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
guest_id |
string | The guest composite ID. Required |
ids |
array | An array as a comma-separated list of the event instance composite ids to change the status of the guest for. Required |
Delete a specific calendar event
curl -X DELETE 'http://api.ontraport.com/1/CalendarEvent?id=2_1625335200&edit_scope=2' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
Coming soon!
Example Response:
{
"code": 0,
"data": {
"id": "2_1625335200",
"notify_event_guests": false,
"isMultipleEvents": true
},
"account_id": 12345
}
Deletes a specific calendar event by its ID.
Request Endpoint
DELETE https://api.ontraport.com/1/CalendarEvent
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
string | The composite ID of the calendar event to delete. Required. |
edit_scope |
integer | For recurring events, the scope of the recurrences to be deleted. Integer codes are mapped as follows:0 => This event 1 => This and following events 2 => All events Default is all events. |
notify_event_guests |
integer | A binary integer flag indicating whether or not a system email should be sent to all event guests to notify them of event deletion. |
Calendar Event Guests - COMING SOON!
Object Type ID: 161
A calendar event guest is a contact or user who is invited to a calendar event. There is a limit of 300 guests per calendar event. The Ontraport API offers retrieval only on CalendarEventGuest endpoints. Guests can be added to events using the CalendarEvents POST/PUT endpoints, and their RSVP status can be changed using those endpoints or the dedicated endpoint for changing status.
Sometimes in this documentation we will refer to a guest's composite ID. Guests will have a unique identifier, but most of the time we will refer to them by a composite ID as well. The guest composite ID is composed of the object type ID of the guest, an underscore, and the unique identifier of the contact or user tied to that guest. For example, contact ID 4 would have a guest composite ID of 0_4.
The calendar event guest object
{
"id": "2_1",
"guest_id": "17",
"owner": "1",
"name": "joe tester",
"firstname": "joe",
"lastname": "tester",
"email": "tester@ontraport.com",
"sms_number": null,
"bulk_mail": "1",
"bulk_sms": "2",
"object_type_id": "2",
"object_id": "1",
"contact_id": "0",
"staff_id": "1",
"event_id": "7",
"event_recurrence_ts": "1625266800",
"recurrence_flag": "0",
"external_id": "",
"gcal_email": "",
"date": "1625697168",
"dlm": "1625697168",
"deleted": "0",
"status": "3"
}
Calendar event attributes
Attribute | Type | Description |
---|---|---|
id |
integer | The guest's composite ID. |
guest_id |
integer | This is the unique identifier for a guest who belongs to a particular event instance or series. It is unique across the entire account and cannot be reused on multiple events. |
owner |
integer | The ID of the user who owns this guest. The guest owner is the owner of the event the guest belongs to and cannot be changed. |
name |
string | The first and last name of the contact or user who is a guest. This field will update as the corresponding fields in the contact or user records update. |
firstname |
string | The first name of the contact or user who is a guest. This field will update as the corresponding field in the contact or user records update. |
lastname |
string | The last name of the contact or user who is a guest. This field will update as the corresponding field in the contact or user records update. |
email |
string | The email of the contact or user who is a guest. This field will update as the corresponding field in the contact or user records update. |
bulk_mail |
integer | The bulk mail field of the contact or user who is a guest. If the guest is a user, the status will always be opted in. If the guest is a contact, this field will update as the corresponding field in the contact record updates. Values are mapped as follows:0 => Transactional Only 1 => Opted-in 2 => Double opt-in -2 => Hard bounce -5 => Under review |
bulk_sms |
integer | The bulk sms field of the contact or user who is a guest. If the guest is a user, the status will always be opted in. If the guest is a contact, this field will update as the corresponding field in the contact record updates. Values are mapped as follows:0 => Opted-out 1 => Opted-in 2 => Double opt-in -2 => Hard bounce |
object_type_id |
integer | The object type ID for the guest. All guests will be either contacts (0) or users (2). |
object_id |
integer | The ID of the contact or user. |
contact_id |
integer | The ID of the contact, if any. |
staff_id |
integer | The ID of the staff, if any. |
event_id |
integer | The ID of event the guest belongs to. |
event_recurrence_ts |
timestamp | For exceptions made to recurring event series, the timestamp of the date of the original start time of that recurrence. This remains the same even if the actual start time is modified. |
recurrence_flag |
integer | A binary flag indicating whether or not this guest is tied to a recurring event. This flag will be 0 for single events, and for single exceptions made to recurring events. |
external_id |
string | A Google unique identifier imported from synced calendar. |
gcal_email |
string | A Google email field imported from synced calendar. |
date |
integer | A UNIX timestamp for the date the guest was added to the event. |
dlm |
integer | A UNIX timestamp for the date the guest was last updated. |
deleted |
integer | A binary integer flag indicating whether or not this guest has been deleted. |
status |
integer | The guest RSVP status. Options are mapped as follows:0 => Unconfirmed 1 => No 2 => Maybe 3 => Yes |
Retrieve a list of calendar event guests
curl -X GET 'https://api.ontraport.com/1/CalendarEventGuests?range=50&event_id=6_1629950400' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
Coming soon!
Example response:
{
"code": 0,
"data": [
{
"id": "0_5005",
"guest_id": "320",
"owner": "1",
"name": "Clark Kent",
"firstname": "Clark",
"lastname": "Kent",
"email": "ClarkKent5005@test.ontramail.com",
"sms_number": null,
"bulk_mail": "1",
"bulk_sms": "0",
"object_type_id": "0",
"object_id": "5005",
"contact_id": "5005",
"staff_id": "0",
"event_id": "6",
"event_recurrence_ts": "1629777600",
"recurrence_flag": "1",
"external_id": "",
"gcal_email": "",
"date": "1629843199",
"dlm": "1629843221",
"deleted": "0",
"status": "0"
},
{
"id": "2_1",
"guest_id": "1",
"owner": "1",
"name": "joe tester",
"firstname": "joe",
"lastname": "tester",
"email": "tester@ONTRAPORT.com",
"sms_number": null,
"bulk_mail": "1",
"bulk_sms": "2",
"object_type_id": "2",
"object_id": "1",
"contact_id": "0",
"staff_id": "1",
"event_id": "6",
"event_recurrence_ts": "1629777600",
"recurrence_flag": "1",
"external_id": "",
"gcal_email": "",
"date": "1629764006",
"dlm": "1629843221",
"deleted": "0",
"status": "3"
}
],
"account_id": 12345
}
Retrieves a collection of calendar event guests based on a set of parameters. You can limit unnecessary API requests by utilizing criteria and our pagination tools to select only the data set you require.
Request Endpoint
GET https://api.ontraport.com/1/CalendarEventGuests
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
ids |
array | An array as a comma-delimited list of the composite IDs of the guests to retrieve. If this parameter is used, it must be used in conjunction with event_id for correct results. |
start |
integer | The offset to return results from. |
range |
integer | The number of guests you want to retrieve. The maximum and default range is 50. |
condition |
string | A JSON encoded string to more specifically set criteria for which guests to bring back. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your guest objects for. |
event_id |
string | The calendar event composite ID. This parameter will limit guests retrieved by event instance. It must be included to retrieve a list of guests on a particular event. If the parameter is not included, a new event is assumed and the default guest (the current user) will be returned. |
Calendar Potential Guests - COMING SOON!
Object Type ID: 174
Potential guests are a list of contacts and users who can be added to an event as a guest. They can't be created, updated or deleted and are only returned as a list. The potential guests endpoint provides the ability to retrieve composite guest IDs corresponding to contacts and users. These can then be used in requests to add guests to events.
The calendar potential guest object
{
"type":"0",
"value":"0_2",
"label":"Two (2@o.com)"
}
Calendar potential guest attributes
Attribute | Type | Description |
---|---|---|
type |
integer | The potential guest's object type ID, or "suggested" if the contact belongs to the five most recently edited contacts or added users. |
value |
string | The guest's composite ID. |
label |
string | The potential guest's first name, last name, and email. |
Retrieve a list of calendar potential guests
curl -X GET 'https://api.ontraport.com/1/CalendarPotentialGuests' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
Coming soon!
Example response:
{
"code": 0,
"data": [
{
"type": "suggested",
"value": "0_2",
"label": "Two (2@o.com)"
},
{
"type": "suggested",
"value": "0_1",
"label": "One (1@o.com)"
},
{
"type": "2",
"value": "2_1",
"label": "joe tester (tester@ONTRAPORT.com)"
},
{
"type": "0",
"value": "0_2",
"label": "Two (2@o.com)"
},
{
"type": "0",
"value": "0_1",
"label": "One (1@o.com)"
}
],
"account_id": 60
}
Retrieves a list of potential guests based on a set of parameters. You can limit unnecessary API requests by utilizing our pagination tools to select only the data set you require.
Request Endpoint
GET https://api.ontraport.com/1/CalendarPotentialGuests
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
start |
integer | The offset to return results from. |
range |
integer | The number of guests you want to retrieve. The maximum and default range is 200. The first request will return all suggested potential guests and user potential guests, as well as the first page of contacts. Subsequent pages will contain contact potential guests only. |
search |
string | A string to search potential guests for. |
guestmode |
integer | A binary integer flag indicating a change in the data returned. If this value is 1, email and object type will be returned in the data. |
Calendar Templates - COMING SOON!
Object Type ID: 164
Calendar templates are templates that can be applied to an event to fill in blank fields and add notifications. When a template is applied to an event, existing field values will take precedence, and the template data will be selectively applied to any empty fields.
The calendar template object
{
"id": "1",
"name": "Test Template",
"title": "Template Event",
"staff_id": "1",
"location": "123 XYZ St",
"description": "My description",
"notifications": "{\"event_notification\":[{\"notification_trigger_type\":\"action\",\"notification_send_to\":\"contact\",\"notification_action_type\":\"email\",\"notification_trigger_action_type\":\"event_update\",\"notification_trigger_action_field_type\":\"any\",\"notification_action_email\":\"2\"}]}",
"date": "1626121179",
"dlm": "1626121202",
"deleted": "0",
"type_id": "4"
}
Calendar template attributes
Attribute | Type | Description |
---|---|---|
id |
integer | The calendar template's ID. |
name |
string | The template name. |
location |
string | The event location. |
title |
string | The event title. |
description |
string | A description of the event. |
staff_id |
integer | The user ID for the owner of this event. |
type_id |
integer | The event type ID for this event. |
notifications |
string | [Notifications]. A JSON-encoded string of the notification rules for this event. |
date |
integer | The UNIX timestamp for when the template was created. |
dlm |
integer | The UNIX timestamp for the last time the template was modified. |
Create a calendar template
curl -X POST -d 'name=New%20Template&title=Template%20for%20Events&location=My%20House&staff_id=1&type_id=1¬ifications=%7B%22event_notification%22%3A%5B%7B%22notification_trigger_type%22%3A%22action%22%2C%22notification_send_to%22%3A%22contact%22%2C%22notification_action_type%22%3A%22email%22%2C%22notification_trigger_action_type%22%3A%22event_update%22%2C%22notification_trigger_action_field_type%22%3A%22any%22%2C%22notification_action_email%22%3A%222%22%7D%5D%7D&description=Meeting' 'http://api.ontraport.com/1/CalendarTemplates' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
Coming soon!
Example Response:
{
"code": 0,
"data": {
"name": "New Template",
"title": "Template for Events",
"location": "My House",
"staff_id": "1",
"type_id": "1",
"notifications": "{\"event_notification\":[{\"notification_trigger_type\":\"action\",\"notification_send_to\":\"contact\",\"notification_action_type\":\"email\",\"notification_trigger_action_type\":\"event_update\",\"notification_trigger_action_field_type\":\"any\",\"notification_action_email\":\"2\"}]}",
"description": "Meeting",
"id": "2",
"date": "1626123617",
"dlm": "1626123617",
"deleted": "0"
},
"account_id": 12345
}
Creates a new calendar template object.
Request Endpoint
POST https://api.ontraport.com/1/CalendarTemplates
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
location |
string | The event location. |
name |
string | The template name. |
title |
string | The event title. |
description |
string | A description of the event. |
staff_id |
integer | The user ID for the owner of this event. |
type_id |
integer | The event type ID for this event. |
notifications |
string | [Notifications]. A JSON-encoded string of the notification rules for this event. |
Retrieve a specific calendar template
curl -X GET 'https://api.ontraport.com/1/CalendarTemplate?id=1' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
Coming soon!
Example Response:
{
"code": 0,
"data": {
"name": "Test Template",
"title": "Template Event",
"date": 1626121202,
"dlm": 1626121202,
"location": "123 XYZ St",
"staff_id": "1",
"type_id": "4",
"notifications": "{\"event_notification\":[{\"notification_trigger_type\":\"action\",\"notification_send_to\":\"contact\",\"notification_action_type\":\"email\",\"notification_trigger_action_type\":\"event_update\",\"notification_trigger_action_field_type\":\"any\",\"notification_action_email\":\"2\"}]}",
"description": "My description",
"id": "1",
"owner": "1"
},
"account_id": 12345
}
Retrieves all the information for an existing calendar template. The only parameter needed is the ID for the calendar template which is returned in the response upon template creation.
Request Endpoint
GET https://.ontraport.com/1/CalendarTemplate
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The calendar template ID. Required. |
Retrieve multiple calendar templates
curl -X GET 'https://api.ontraport.com/1/CalendarTemplates?range=50' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
Coming soon!
Example response:
{
"code": 0,
"data": [
{
"id": "1",
"name": "Test Template",
"title": "Template Event",
"staff_id": "1",
"location": "123 XYZ St",
"description": "My description",
"notifications": "{\"event_notification\":[{\"notification_trigger_type\":\"action\",\"notification_send_to\":\"contact\",\"notification_action_type\":\"email\",\"notification_trigger_action_type\":\"event_update\",\"notification_trigger_action_field_type\":\"any\",\"notification_action_email\":\"2\"}]}",
"date": "1626121179",
"dlm": "1626121202",
"deleted": "0",
"type_id": "4"
}
],
"account_id": 12345,
"misc": []
}
Retrieves a list of calendar templates based on a set of parameters. You can limit unnecessary API requests by utilizing our pagination tools to select only the data set you require.
Request Endpoint
GET https://api.ontraport.com/1/CalendarTemplates
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
ids |
string | An array as a comma-delimited list of the IDs of the templates to retrieve. Entering a value of 0 will result in all templates being selected. |
start |
integer | The offset to return results from. |
range |
integer | The number of templates you want to retrieve. The maximum and default range is 50. |
sort |
string | The field results should be sorted on. |
sortDir |
string | The direction your results should be sorted. Your options are asc and desc . This field must be used in conjunction with the sort parameter. |
condition |
string | A JSON encoded string to more specifically set criteria for which templates to bring back. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your template objects for. |
group_id |
integer | The group id of templates to retrieve. |
listFields |
string | An array as a comma-delimited list of the fields which should be returned in your results. |
Update a calendar template
curl -X PUT -d 'id=2&title=New%20Title%20-%20Template' 'http://api.ontraport.com/1/CalendarTemplates' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
Coming soon!
Example Response:
{
"code": 0,
"data": {
"attrs": {
"title": "New Title",
"staff_id": null,
"location": null,
"description": null,
"notifications": null,
"dlm": "1626968421",
"deleted": "0",
"type_id": "0",
"id": "2"
}
},
"account_id": 12345
}
Updates an existing calendar template with given data. An ID is required. The other fields should only be used if you want to change the existing value.
Request Endpoint
PUT https://api.ontraport.com/1/CalendarTemplates
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
id |
integer | The calendar template's ID. |
location |
string | The event location. |
name |
string | The template name. |
title |
string | The event title. |
description |
string | A description of the event. |
staff_id |
integer | The user ID for the owner of this event. |
type_id |
integer | The event type ID for this event. |
notifications |
string | [Notifications]. A JSON-encoded string of the notification rules for this event. |
Delete a specific calendar template
curl -X DELETE 'https://api.ontraport.com/1/CalendarTemplate?id=1' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
Coming soon!
Example Response:
{
"code": 0,
"account_id": "12345"
}
Deletes a specific calendar template by its ID.
Request Endpoint
DELETE https://api.ontraport.com/1/CalendarTemplate
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The ID of the calendar template to delete. Required. |
Calendar Event Types - COMING SOON!
Object Type ID: 177
Calendar event types are essentially tags that can be applied to events to label them as a particular type. There are some default types in every account, and you can also create new types and delete existing.
The calendar event type object
{
"id": "1",
"name": "Meeting",
"deleted": "0"
}
Calendar event type attributes
Attribute | Type | Description |
---|---|---|
id |
integer | The calendar event type's ID. |
name |
string | The type name. |
deleted |
integer | A binary integer flag indicating whether or not the type is deleted. |
Create a calendar event type
curl -X POST -d 'name=Check-in' 'https://api.ontraport.com/1/CalendarEventTypes' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
Coming soon!
Example Response:
{
"code": 0,
"data": {
"name": "Check-in",
"id": "6",
"deleted": "0"
},
"account_id": 12345
}
Creates a new calendar event type object.
Request Endpoint
POST https://api.ontraport.com/1/CalendarEventTypes
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
name |
string | The type name. |
Retrieve a specific calendar event type
curl -X GET 'https://api.ontraport.com/1/CalendarEventType?id=1' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
Coming soon!
Example Response:
{
"code": 0,
"data": {
"id": "1",
"name": "Meeting",
"deleted": "0"
},
"account_id": 12345
}
Retrieves all the information for an existing calendar event type. The only parameter needed is the ID for the calendar event which is returned in the response upon type creation.
Request Endpoint
GET https://.ontraport.com/1/CalendarEventType
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The calendar event type's ID. Required. |
Retrieve multiple calendar event types
curl -X GET 'http://api.ontraport.com/1/CalendarEventTypes?range=50' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
Coming soon!
Example response:
{
"code": 0,
"data": [
{
"id": "1",
"name": "Meeting",
"deleted": "0"
},
{
"id": "2",
"name": "Call",
"deleted": "0"
},
{
"id": "3",
"name": "Conference Call",
"deleted": "0"
},
{
"id": "4",
"name": "Appointment",
"deleted": "0"
},
{
"id": "5",
"name": "Event",
"deleted": "0"
},
{
"id": "6",
"name": "Check-in",
"deleted": "0"
}
],
"account_id": 12345,
"misc": []
}
Retrieves a list of calendar event types based on a set of parameters. You can limit unnecessary API requests by utilizing our pagination tools to select only the data set you require.
Request Endpoint
GET https://api.ontraport.com/1/CalendarEventTypes
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
ids |
string | An array as a comma-delimited list of the IDs of the types to retrieve. Entering a value of 0 will result in all types being selected. |
start |
integer | The offset to return results from. |
range |
integer | The number of types you want to retrieve. The maximum and default range is 50. |
sort |
string | The field results should be sorted on. |
sortDir |
string | The direction your results should be sorted. Your options are asc and desc . This field must be used in conjunction with the sort parameter. |
condition |
string | A JSON encoded string to more specifically set criteria for which types to bring back. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your calendar event type objects for. |
listFields |
string | An array as a comma-delimited list of the fields which should be returned in your results. |
Delete a specific calendar event type
curl -X DELETE 'https://api.ontraport.com/1/CalendarEventType?id=6' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
Coming soon!
Example Response:
{
"code": 0,
"account_id": 12345
}
Deletes a specific calendar event type by its ID.
Request Endpoint
DELETE https://api.ontraport.com/1/CalendarEventType
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The ID of the calendar event type to delete. Required. |
Campaign Builder Items
Object Type ID: 140
These objects contain data on your CampaignBuilder campaigns, such as names, IDs, and current status. In this section, "campaign" refers to automated marketing campaigns. You can retrieve a single campaign or a list of campaigns. If you want to add a contact or custom object to a campaign, see this endpoint.
Note:
"campaign" throughout this doc is called "automation" throughout the Ontraport app.
The Campaign Builder object
{
"id": "1",
"name": "Test Campaign",
"date": "1503016553",
"dlm": "1503016553",
"object_type_id": "0",
"pause": "0",
"deleted": "false"
}
Campaign attributes
Attribute | Type | Description |
---|---|---|
id |
integer | The campaign ID. |
name |
string | The campaign name. |
date |
timestamp | The date the campaign was created, measured in seconds from the Unix Epoch. |
dlm |
timestamp | The date the campaign was last modified, measured in seconds from the Unix Epoch. |
object_type_id |
integer | The ID of the object type the campaign relates to. |
pause |
integer | A binary integer flag indicating whether or not the campaign is paused. |
deleted |
boolean | Whether or not the campaign has been deleted. |
Retrieve a specific campaign
curl -X GET 'https://api.ontraport.com/1/CampaignBuilderItem?id=1' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 1
);
$response = $client->campaignbuilder()->retrieveSingle($requestParams);
Example Response:
{
"code": 0,
"data": {
"id": "1",
"name": "Test Campaign",
"date": "1503016553",
"dlm": "1503016553",
"object_type_id": "0",
"pause": "0",
"deleted": "false"
},
"account_id": "12345"
}
Retrieves data on an existing campaign.
Request URL
GET https://api.ontraport.com/1/CampaignBuilderItem
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The campaign ID. Required. |
Retrieve multiple campaigns
curl -X GET 'https://api.ontraport.com/1/CampaignBuilderItems?listFields=ids%2Cname' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"listFields" => "id,name"
);
$response = $client->campaignbuilder()->retrieveMultiple($requestParams);
Example response:
{
"code": 0,
"data": [
{
"id": "1",
"name": "Test Campaign"
},
{
"id": "2",
"name": "Test Campaign 2"
}
],
"account_id": "12345",
"misc": []
}
Retrieves a list of Campaigns. You can limit unnecessary API requests by utilizing criteria and our pagination tools to select only the data set you require.
Request URL
GET https://api.ontraport.com/1/CampaignBuilderItems
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
ids |
string | An integer array as a comma-delimited list of the IDs of the campaigns to retrieve. Entering a value of 0 will result in all campaigns being selected. |
start |
integer | The offset to return results from. |
range |
integer | The number of campaigns you want to retrieve. The maximum and default range is 50. |
sort |
string | The field results should be sorted on. |
sortDir |
string | The direction your results should be sorted. Your options are asc and desc . This field must be used in conjunction with the sort parameter. |
condition |
string | A JSON encoded string to more specifically set criteria for which campaigns to bring back. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your campaign objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other task fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
externs |
string | If you have a relationship between your campaign object and another object, you may want to include the data from a related field in your results. Each external field is listed in the format {object}//{field} . Multiple fields are separated by commas. |
listFields |
string | A string array as a comma-delimited list of the fields which should be returned in your results. |
Retrieve campaign meta
curl -X GET 'https://api.ontraport.com/1/Tasks/meta' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$response = $client->task()->retrieveMeta();
Example Response:
{
"code": 0,
"data": {
"140": {
"name": "CampaignBuilder",
"fields": {
"name": {
"alias": "Name",
"type": "text"
},
"date": {
"alias": "Date Created",
"type": "fulldate"
},
"state": {
"alias": "State",
"type": "drop",
"options": {
"0": "Live",
"1": "Paused",
"2": "Unpublished"
}
},
"element_num": {
"alias": "# Elements",
"type": "numeric"
},
"todos": {
"alias": "# ToDos",
"type": "numeric"
},
"subs_ever": {
"alias": "# On Campaign Ever",
"type": "numeric"
},
"subs": {
"alias": "# On Campaign Now",
"type": "numeric"
},
"dlm": {
"alias": "Date Modified",
"type": "fulldate"
}
}
}
},
"account_id": "12345"
}
Retrieves the field meta data for the campaign object.
Request URL
GET https://api.ontraport.com/1/CampaignBuilderItems/meta
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
None
Retrieve campaign collection info
curl -X GET 'https://api.ontraport.com/1/CampaignBuilderItems/getInfo?search=Test' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"search" => "Test"
);
$response = $client->campaignbuilder()->retrieveCollectionInfo($requestParams);
Example Response:
{
"code": 0,
"data": {
"listFields": [
"name",
"state",
"date",
"dlm",
"subs",
"subs_ever",
"element_num",
"todos"
],
"listFieldSettings": [],
"count": "2"
},
"account_id": "12345"
}
Retrieves information about a collection of campaigns, such as the number of campaigns that match the given criteria.
Request URL
GET https://api.ontraport.com/1/CampaignBuilderItems/getInfo
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
condition |
string | A JSON encoded string to more specifically set criteria for which campaigns to select. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your campaign objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other campaign fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Contacts
Object Type ID: 0
Contact objects allow you to keep up-to-date records for all the contacts you are managing.
Through the contacts API, you can create, retrieve, update, merge and delete contacts. You can also retrieve meta for a contact object to obtain more detailed information about its attributes and retrieve information about a collection of contacts.
Contacts can be associated with many other objects such as tasks, tags, rules, and sequences. You can access additional functionality for tagging contacts and adding and removing contacts from sequences using the objects API with an objectID of 0.
The contact object
{
"id": "27",
"owner": "1",
"firstname": "First",
"lastname": "Last",
"email": "user@ontraport.com",
"address": "2040 Alameda Padre Serra",
"city": "Santa Barbara",
"state": "CA",
"zip": "93103",
"birthday": "469569600",
"date": "1531352701",
"priority": "0",
"status": null,
"home_phone": null,
"sms_number": "+18055555555",
"dla": "1531352701",
"contact_cat": "",
"bulk_mail": "1",
"bulk_sms": "0",
"office_phone": "805-555-5555",
"fax": null,
"dlm": "1531352717",
"company": "Ontraport",
"address2": "Suite 220",
"title": "Employee",
"website": "www.ontraport.com",
"country": "US",
"system_source": "0",
"source_location": null,
"import_id": "0",
"ip_addy": null,
"freferrer": "0",
"lreferrer": "0",
"n_lead_source": "0",
"n_content": "0",
"n_term": "0",
"n_media": "0",
"n_medium": "0",
"n_campaign": "0",
"l_lead_source": "0",
"l_content": "0",
"l_term": "0",
"l_medium": "0",
"l_campaign": "0",
"referral_page": null,
"aff_sales": "0",
"aff_amount": "0",
"program_id": "0",
"aff_paypal": null,
"fb_gender": null,
"mrcAmount": "0",
"mrcUnpaid": "0.00",
"mriInvoiceNum": "0",
"mriInvoiceTotal": "0",
"ccType": "0",
"ccExpirationMonth": "0",
"ccExpirationYear": "0",
"ccExpirationDate": "0",
"ccNumber": null,
"mrcResult": "0",
"last_inbound_sms": null,
"timezone": null,
"time_since_dla": "0",
"spent": null,
"num_purchased": null,
"updateSequence": "",
"grade": "0.00",
"unique_id": "D4GD000"
}
Attributes | Type | Description |
---|---|---|
id |
integer | The contact's ID. |
unique_id |
string | A unique identifier for the contact. This field does not reveal the actual account contact ID. It is unique across all ORM objects in your account, making it useful for merging duplicate contacts in form fillouts. This field is system generated and can't be updated. |
owner |
integer | The ID of the user who controls the contact. This field must contain a value for a contact object to be saved properly. |
firstname |
string | The contact's first name. |
lastname |
string | The contact's last name. |
email |
string | The contact's email address. |
address |
string | The contact's postal address. |
city |
string | The contact's city. |
state |
string | The contact's state. |
zip |
string | The contact's postal code. |
birthday |
timestamp | The contact's birthday, measured in seconds from the Unix Epoch. |
date |
timestamp | The date the contact was added, measured in seconds from the Unix Epoch. |
priority |
integer | The contact's priority. High => 8 Medium => 9 Low => 10 None => 0 |
status |
integer | The contact's Sales Stage. Integer codes map as follows: 1 => Closed - Lost 2 => Closed - Won 3 => Committed 4 => Consideration 5 => Demo Scheduled 6 => Qualified Lead 7 => New Prospect |
cell_phone |
string | The contact's mobile phone number. |
home_phone |
string | The contact's home phone number. |
sms_number |
string | The mobile number where the contact prefers receive text messages. |
dla |
integer | Date of the contact's last activity. In this documentation, activity means that the contact interacted with a form, website, or email link. |
contact_cat |
string | Deprecated. The tags a contact is subscribed to. Each tag has an ID, and in this field the tags are appended together with the delimiter */* . A contact_cat entry containing multiple tags looks like this: */*1*/*2*/*3*/* . Tags are now related to contacts in a separate tag subscriber object. |
bulk_mail |
integer | A flag that indicates a contact's bulk email status. Values are mapped as follows:0 => Transactional Only 1 => Opted-in 2 => Double opt-in -2 => Hard bounce -5 => Under review You can only set the value to 0 through the API. You cannot manually opt-in a contact who has opted to receive only transactional mail. |
bulk_sms |
integer | A flag that indicates whether or not a contact is opted in to receive bulk texts. Values are mapped as follows:0 => Unconfirmed 1 => Pending confirmation 2 => Opted-in -1 => Hard bounced -3 => Unsubscribed -5 => Pending review You can only set the value to -3 through the API. You cannot manually opt-in a contact who has opted out. |
office_phone |
string | The contact's office phone number. |
fax |
string | The contact's fax number. |
dlm |
timestamp | The date the contact was last modified, measured in seconds from the Unix Epoch. |
company |
string | The company the contact is affiliated with. |
address2 |
string | A second address field which is generally used for storing suite or unit numbers. |
title |
string | The contact's job title. |
website |
string | The contact's website. |
country |
string | The contact's country. |
system_source |
integer | System field. Can't be updated through the API. Identifies the source from which the contact was added to the database. |
source_location |
string | System field. Can't be updated through the API. Identifies the specific location from which the contact was added to the database. |
import_id |
integer | System field. Can't be updated through the API. The ID of the import batch the contact was imported with, if any. |
ip_addy |
string | Deprecated. The contact's IP address. This is an old version of ip_addy_display and is not used anymore. |
ip_addy_display |
string | The contact's IP address. |
freferrer |
integer | The affiliate ID of the first affiliate to refer the contact. |
lreferrer |
integer | The affiliate ID of the last affiliate to refer the contact. |
n_lead_source |
integer | The lead source ID for the tracking URL the contact arrived from. |
n_content |
integer | The content ID for the tracking URL the contact arrived from. |
n_medium |
integer | The medium ID for the tracking URL the contact arrived from. |
n_campaign |
integer | The tracking campaign ID for the tracking URL the contact arrived from. |
n_term |
integer | The term ID for the tracking URL the contact arrived from. |
l_lead_source |
integer | The last lead source ID for the tracking URL the contact arrived from. |
l_content |
integer | The last content ID for the tracking URL the contact arrived from. |
l_medium |
integer | The last medium ID for the tracking URL the contact arrived from. |
l_campaign |
integer | The last tracking campaign ID for the tracking URL the contact arrived from. |
l_term |
integer | The last term ID for the tracking URL the contact arrived from. |
referral_page |
string | The page the contact was referred from. |
aff_sales |
integer | If the contact is an affiliate, the total number of affiliate sale transactions. |
aff_amount |
double | If the contact is an affiliate, the total amount of affiliate sales. |
program_id |
integer | For affiliates, the partner program ID. |
aff_paypal |
string | Affiliate email address for Paypal payments. |
fb_gender |
string | The contact's gender as listed on Facebook. |
mrcAmount |
double | The amount of the contact's most recent credit card charge. |
mrcUnpaid |
double | Total contact transactions remaining unpaid. |
mriInvoiceNum |
integer | The contact's most recent invoice number. |
mriInvoiceTotal |
double | The contact's most recent invoice total. |
ccType |
integer | The contact's credit card type. Integer codes map to card providers as follows:0 => none ,1 => Visa 2 => Mastercard 3 => American Express 4 => Discover 5 => Paypal . |
ccExpirationMonth |
integer | The expiration month of the contact's credit card. Integer values are mapped as follows:1 => January 2 => February 3 => March 4 => April 5 => May 6 => June 7 => July 8 => August 9 => September 10 => October 11 => November 12 => December |
ccExpirationYear |
integer | The year the contact's credit card expires. |
ccExpirationDate |
integer | The day of the month that the contact's credit card expires. |
ccNumber |
string | The last 4 digits of the contact's credit card number. |
mrcResult |
integer | The result of the contact's most recent credit card charge. Integer values map as follows:0 => Success 1 => Declined |
last_inbound_sms |
string | The last text message that you received from the contact. |
timezone |
string | The contact's timezone. |
time_since_dla |
integer | The time since the contact's last activity. Only accounts after 2018 will have this field. |
spent |
double | The total amount the contact has spent with your company. |
num_purchased |
integer | The contact's total orders. |
updateSequence |
string | Deprecated. The sequences a contact is subscribed to. Each sequence has an ID, and in this field the sequences are appended together with the delimiter */* . An updateSequence entry containing multiple tags looks like this: */*1*/*2*/*3*/* . Sequences are now related to contacts in a separate sequence subscribers object. If you want to subscribe a contact to a sequence please see the /objects/subscribe endpoint. |
updateCampaign |
string | Deprecated. The campaigns a contact is subscribed to. Note: "campaign" throughout this doc is called "automation" throughout the Ontraport app. Each campaign has an ID, and in this field the campaigns are appended together with the delimiter */* . This field will appear in responses, but should not be updated. If you want to subscribe a contact to a campaign please see the /objects/subscribe endpoint. |
grade |
integer | The contact's score based upon lead scoring rules. |
{custom fields} |
varies | If you have created custom fields for your contact objects, they can be accessed through the API. These fields are unique to your account and will appear in the response when you retrieve a contact object. If you are not sure what a response field is used for, you can retrieve contact meta to check for the field name. |
Create a contact
curl -X POST -d 'firstname=Angie&lastname=Lopez&email=alopez%40ontraport.com' 'https://api.ontraport.com/1/Contacts' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"firstname" => "Angie",
"lastname" => "Lopez",
"email" => "alopez@gmail.com"
);
$response = $client->contact()->create($requestParams);
Example Response:
{
"code": 0,
"data": {
"firstname": "Angie",
"lastname": "Lopez",
"email": "alopez@ontraport.com",
"id": "1",
"owner": "1",
"address": null,
"city": null,
"state": null,
"zip": null,
"birthday": null,
"date": "1493143903",
"status": null,
"priority": "0",
"home_phone": null,
"sms_number": null,
"dla": "1493143903",
"contact_cat": "",
"bulk_mail": "-5",
"bulk_sms": "0",
"office_phone": null,
"fax": null,
"dlm": "1493143903",
"company": null,
"address2": null,
"title": null,
"website": null,
"country": null,
"system_source": "3",
"source_location": null,
"import_id": "0",
"ip_addy": null,
"ip_addy_display": null,
"freferrer": "0",
"lreferrer": "0",
"n_lead_source": "0",
"n_content": "0",
"n_term": "0",
"n_media": "0",
"n_medium": "0",
"n_campaign": "0",
"l_lead_source": "0",
"l_content": "0",
"l_term": "0",
"l_medium": "0",
"l_campaign": "0",
"referral_page": null,
"aff_sales": "0",
"aff_amount": "0",
"program_id": "0",
"aff_paypal": null,
"fb_gender": null,
"mrcAmount": "0",
"mrcUnpaid": "0.00",
"mriInvoiceNum": "0",
"mriInvoiceTotal": "0",
"ccType": "0",
"ccExpirationMonth": "0",
"ccExpirationYear": "0",
"ccExpirationDate": "0",
"ccNumber": null,
"mrcResult": "0",
"last_inbound_sms": null,
"timezone": null,
"time_since_dla": "0",
"spent": null,
"num_purchased": null,
"updateSequence": "",
"grade": "0.00",
"unique_id": "D4GD000"
},
"account_id": "12345"
}
Creates a new contact object. This endpoint allows duplication; if you want to avoid duplicate emails you should merge instead.
Request Endpoint
POST https://api.ontraport.com/1/Contacts
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
firstname |
string | The contact's first name. |
lastname |
string | The contact's last name. |
email |
string | The contact's email address. |
freferrer |
integer | The affiliate ID of the first affiliate to refer the contact. |
lreferrer |
integer | The affiliate ID of the last affiliate to refer the contact. |
address |
string | The contact's postal address. |
address2 |
string | A second address field which is generally used for storing suite or unit numbers. |
city |
string | The contact's city. |
state |
string | The contact's state. |
zip |
string | The contact's postal code. |
country |
string | The contact's country. |
birthday |
timestamp | The contact's birthday, measured in seconds from the Unix Epoch. |
priority |
integer | The contact's priority. High => 8 Medium => 9 Low => 10 None => 0 |
status |
integer | The contact's Sales Stage. Integer codes map as follows: 1 => Closed - Lost 2 => Closed - Won 3 => Committed 4 => Consideration 5 => Demo Scheduled 6 => Qualified Lead 7 => New Prospect |
cell_phone |
string | The contact's mobile phone number. |
home_phone |
string | The contact's home phone number. |
sms_number |
string | The mobile number where the contact prefers receive text messages. |
office_phone |
string | The contact's office phone number. |
fax |
string | The contact's fax number. |
company |
string | The company the contact is affiliated with. |
title |
string | The contact's job title. |
website |
string | The contact's website. |
contact_cat |
string | Deprecated. The tags a contact is subscribed to. Each tag has an ID, and in this field the tags are appended together with the delimiter */* . A contact_cat entry containing multiple tags looks like this: */*1*/*2*/*3*/* . Tags are now related to contacts in a separate tag subscriber object. |
bulk_mail |
integer | A flag that indicates a contact's bulk email status. Values are mapped as follows:0 => Transactional Only 1 => Opted-in 2 => Double opt-in -2 => Hard bounce -5 => Under review You can only set the value to 0 through the API. You cannot manually opt-in a contact who has opted to receive only transactional mail. |
bulk_sms |
integer | A flag that indicates whether or not a contact is opted in to receive bulk texts. Values are mapped as follows:0 => Unconfirmed 1 => Pending confirmation 2 => Opted-in -1 => Hard bounced -3 => Unsubscribed -5 => Pending review You can only set the value to -3 through the API. You cannot manually opt-in a contact who has opted out. |
n_lead_source |
integer/string | The lead source for the first tracking URL the contact arrived from. This field accepts the lead source name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
n_content |
integer/string | The content for the first tracking URL the contact arrived from. This field accepts the content name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
n_medium |
integer/string | The medium for the first tracking URL the contact arrived from. This field accepts the medium name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
n_campaign |
integer/string | The tracking campaign for the first tracking URL the contact arrived from. This field accepts the tracking campaign name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
n_term |
integer/string | The term for the first tracking URL the contact arrived from. This field accepts the tracking campaign name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
l_lead_source |
integer/string | The lead source for the last tracking URL the contact arrived from. This field accepts the lead source name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
l_content |
integer/string | The content for the last tracking URL the contact arrived from. This field accepts the content name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
l_medium |
integer/string | The medium for the last tracking URL the contact arrived from. This field accepts the medium name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
l_campaign |
integer/string | The tracking campaign for the last tracking URL the contact arrived from. This field accepts the tracking campaign name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
l_term |
integer/string | The term for the last tracking URL the contact arrived from. This field accepts the tracking campaign name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
use_utm_names |
boolean | Used to indicate that utm variables will be passed by name rather than ID. Defaults to false. |
referral_page |
string | The page the contact was referred from. |
aff_sales |
integer | If the contact is an affiliate, the total number of affiliate sale transactions. |
aff_amount |
double | If the contact is an affiliate, the total amount of affiliate sales. |
program_id |
integer | For affiliates, the partner program ID. |
aff_paypal |
string | Affiliate email address for Paypal payments. |
timezone |
string | The contact's timezone. |
time_since_dla |
integer | The time since the contact's last activity. Only accounts after 2018 will have this field. |
num_purchased |
integer | The contact's total orders. |
updateSequence |
string | Deprecated. The sequences a contact is subscribed to. Each sequence has an ID, and in this field the sequences are appended together with the delimiter */* . An updateSequence entry containing multiple tags looks like this: */*1*/*2*/*3*/* . Sequences are now related to contacts in a separate sequence subscribers object. If you want to subscribe a contact to a sequence please see the /objects/subscribe endpoint. |
updateCampaign |
string | Deprecated. The campaigns a contact is subscribed to. Each campaign has an ID, and in this field the campaigns are appended together with the delimiter */* . This field will appear in responses, but should not be updated. If you want to subscribe a contact to a campaign please see the /objects/subscribe endpoint. |
Note when using custom fields of the list selection type as a parameter, it must have the option's id wrapped with the delimiter */*
.
If a list selection field has "field" => "f1500"
with options mapped as follows: "1" => "one", "2" => "two"
.
An entry containing multiple options looks like this: "f1500": "*/*1*/*2*/*"
. You can obtain information regarding
your custom fields with the GET /Contacts/meta endpoint.
Retrieve a specific contact
curl -X GET 'https://api.ontraport.com/1/Contact?id=27' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 27
);
$response = $client->contact()->retrieveSingle($requestParams);
Example Response:
{
"code": 0,
"data": {
"id": "27",
"owner": "1",
"firstname": "First",
"lastname": "Last",
"email": "user@ontraport.com",
"address": "2040 Alameda Padre Serra",
"city": "Santa Barbara",
"state": "CA",
"zip": "93103",
"birthday": "469569600",
"date": "1491866009",
"priority": "0",
"status": null,
"cell_phone": null,
"home_phone": null,
"sms_number": "+18055555555",
"dla": "1491866009",
"contact_cat": "",
"bulk_mail": "1",
"bulk_sms": "0",
"office_phone": "805-555-5555",
"fax": null,
"dlm": "1491866203",
"company": "Ontraport",
"address2": "Suite 220",
"title": "Employee",
"website": "www.ontraport.com",
"country": "US",
"system_source": "0",
"source_location": null,
"import_id": "0",
"ip_addy": null,
"ip_addy_display": null,
"freferrer": "0",
"lreferrer": "0",
"n_lead_source": "0",
"n_content": "0",
"n_term": "0",
"n_media": "0",
"n_medium": "0",
"n_campaign": "0",
"referral_page": null,
"aff_sales": "0",
"aff_amount": "0",
"program_id": "0",
"aff_paypal": null,
"fb_gender": null,
"mrcAmount": "0",
"mrcUnpaid": "0.00",
"mriInvoiceNum": "0",
"mriInvoiceTotal": "0",
"ccType": "0",
"ccExpirationMonth": "0",
"ccExpirationYear": "0",
"ccExpirationDate": "0",
"ccNumber": null,
"mrcResult": "0",
"last_inbound_sms": null,
"time_since_dla": "0",
"spent": null,
"num_purchased": null,
"updateSequence": "",
"grade": "0.00",
"unique_id": "D4GD000"
},
"account_id": "12345"
}
Retrieves all the information for an existing contact. The only parameter needed is the ID for the contact which is returned in the response upon contact creation.
Request Endpoint
GET https://api.ontraport.com/1/Contact
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The contact ID. Required. |
Retrieve multiple contacts
curl -X GET 'https://api.ontraport.com/1/Contacts?ids=29%2C30%2C31&sort=lastname&sortDir=desc&listFields=firstname%2Clastname%2Cemail' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"ids" => "29,30,31",
"sort" => "lastname",
"sortDir" => "desc",
"listFields" => "firstname,lastname,email"
);
$response = $client->contact()->retrieveMultiple($requestParams);
Example response:
{
"code": 0,
"data": [
{
"firstname": "John",
"lastname": "Smith",
"email": "john@ontraport.com",
"id": "29",
"owner": "1"
},
{
"firstname": "Jane",
"lastname": "Doe",
"email": "jane@ontraport.com",
"id": "30",
"owner": "1"
},
{
"firstname": "Mary",
"lastname": "Brown",
"email": "mary@ontraport.com",
"id": "31",
"owner": "1"
}
],
"account_id": "12345",
"misc": []
}
Retrieves a collection of contacts based on a set of parameters. You can limit unnecessary API requests by utilizing criteria and our pagination tools to select only the data set you require.
Request Endpoint
GET https://api.ontraport.com/1/Contacts
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
ids |
string | An array as a comma-delimited list of the IDs of the contacts to retrieve. Entering a value of 0 will result in all contacts being selected. |
start |
integer | The offset to return results from. |
range |
integer | The number of contacts you want to retrieve. The maximum and default range is 50. |
sort |
string | The field results should be sorted on. |
sortDir |
string | The direction your results should be sorted. Your options are asc and desc . This field must be used in conjunction with the sort parameter. |
condition |
string | A JSON encoded string to more specifically set criteria for which contacts to bring back. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your contact objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not contact notes should be searched for the specified string in addition to other contact fields. |
group_id |
integer | The group id of contacts to retrieve. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
externs |
string | If you have a relationship between your contact object and another object, you may want to include the data from a related field in your results. Each external field is listed in the format {object}//{field} . Multiple fields are separated by commas. |
listFields |
string | An array as a comma-delimited list of the fields which should be returned in your results. |
Update a contact
curl -X PUT -d 'id=29&firstname=Bob&email=bob%40ontraport.com' 'https://api.ontraport.com/1/Contacts' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 29,
"firstname" => "Bob",
"email" => "bob@ontraport.com"
);
$response = $client->contact()->update($requestParams);
Example Response:
{
"code": 0,
"data": {
"attrs": {
"firstname": "Bob",
"dlm": "1500507946",
"id": "29"
}
},
"account_id": "12345"
}
Updates an existing contact with given data. Either the ID or the Unique ID of the contact to update is required. ID will take precedence over Unique ID. The other fields should only be used if you want to change the existing value.
Request Endpoint
PUT https://api.ontraport.com/1/Contacts
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
id |
integer | The contact's ID. Either id or unique_id are required to update a contact. |
unique_id |
string | A unique identifier for the contact. This field is system generated and can't be updated. If the unique_id sent matches a contact in the account, that contact's data will be updated. Either id or unique_id are required. If both are sent, unique_id will be ignored. |
firstname |
string | The contact's first name. |
lastname |
string | The contact's last name. |
email |
string | The contact's email address. |
freferrer |
integer | The affiliate ID of the first affiliate to refer the contact. |
lreferrer |
integer | The affiliate ID of the last affiliate to refer the contact. |
address |
string | The contact's postal address. |
address2 |
string | A second address field which is generally used for storing suite or unit numbers. |
city |
string | The contact's city. |
state |
string | The contact's state. |
zip |
string | The contact's postal code. |
country |
string | The contact's country. |
timezone |
string | The contact's timezone. |
birthday |
timestamp | The contact's birthday, measured in seconds from the Unix Epoch. |
priority |
integer | The contact's priority. High => 8 Medium => 9 Low => 10 None => 0 |
status |
integer | The contact's Sales Stage. Integer codes map as follows: 1 => Closed - Lost 2 => Closed - Won 3 => Committed 4 => Consideration 5 => Demo Scheduled 6 => Qualified Lead 7 => New Prospect |
cell_phone |
string | The contact's mobile phone number. |
home_phone |
string | The contact's home phone number. |
sms_number |
string | The mobile number where the contact prefers receive text messages. |
office_phone |
string | The contact's office phone number. |
fax |
string | The contact's fax number. |
company |
string | The company the contact is affiliated with. |
title |
string | The contact's job title. |
website |
string | The contact's website. |
bulk_mail |
integer | A flag that indicates a contact's bulk email status. Values are mapped as follows:0 => Transactional Only 1 => Opted-in 2 => Double opt-in -2 => Hard bounce -5 => Under review You can only set the value to 0 through the API. You cannot manually opt-in a contact who has opted to receive only transactional mail. |
bulk_sms |
integer | A flag that indicates whether or not a contact is opted in to receive bulk texts. Values are mapped as follows:0 => Unconfirmed 1 => Pending confirmation 2 => Opted-in -1 => Hard bounced -3 => Unsubscribed -5 => Pending review You can only set the value to -3 through the API. You cannot manually opt-in a contact who has opted out. |
n_lead_source |
integer/ string | The lead source for the first tracking URL the contact arrived from. This field accepts the lead source name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
n_content |
integer/string | The content for the first tracking URL the contact arrived from. This field accepts the content name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
n_medium |
integer/string | The medium for the first tracking URL the contact arrived from. This field accepts the medium name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
n_campaign |
integer/string | The tracking campaign for the first tracking URL the contact arrived from. This field accepts the tracking campaign name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
n_term |
integer/string | The term for the first tracking URL the contact arrived from. This field accepts the tracking campaign name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
l_lead_source |
integer/string | The lead source for the last tracking URL the contact arrived from. This field accepts the lead source name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
l_content |
integer/string | The content for the last tracking URL the contact arrived from. This field accepts the content name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
l_medium |
integer/string | The medium for the last tracking URL the contact arrived from. This field accepts the medium name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
l_campaign |
integer/string | The tracking campaign for the last tracking URL the contact arrived from. This field accepts the tracking campaign name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
l_term |
integer/string | The term for the last tracking URL the contact arrived from. This field accepts the tracking campaign name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
use_utm_names |
boolean | Used to indicate that utm variables will be passed by name rather than ID. Defaults to false. |
referral_page |
string | The page the contact was referred from. |
program_id |
integer | For affiliates, the partner program ID. |
aff_paypal |
string | Affiliate email address for Paypal payments. |
num_purchased |
integer | The contact's total orders. |
Delete a specific contact
curl -X DELETE 'https://api.ontraport.com/1/Contact?id=2' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 2
);
$response = $client->contact()->deleteSingle($requestParams);
Example Response:
{
"code": 0,
"account_id": "12345"
}
Deletes a specific contact by its ID.
Request Endpoint
DELETE https://api.ontraport.com/1/Contact
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The ID of the contact to delete. Required. |
Delete multiple contacts
curl -X DELETE 'https://api.ontraport.com/1/Contacts?ids=567%2C568%2C569&range=3&sort=firstname&sortDir=desc' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"ids" => "1,2,3",
"sort" => "lastname",
"sortDir" => "desc",
"listFields" => "firstname,lastname,email"
);
$response = $client->contact()->deleteMultiple($requestParams);
Example Response:
{
"code": 0,
"data": "Deleted",
"account_id": "12345"
}
Deletes a collection of contacts based on a set of parameters. You can choose the ids for the contacts to delete or use our pagination tools for a mass delete. Be very careful using this endpoint with your API key. Specified contacts will be permanently deleted from your database.
Request Endpoint
DELETE https://api.ontraport.com/1/Contacts
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
ids |
string | An array as a comma-delimited list of the IDs of the contacts to delete. Entering a value of 0 will result in all contacts being selected. Caution should be used with this endpoint. |
start |
integer | The offset to delete results from. |
range |
integer | The number of contacts you want to delete. The maximum and default range is 50. |
condition |
string | A JSON encoded string to more specifically set criteria for which contacts to delete. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your contact objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not contact notes should be searched for the specified string in addition to other contact fields. |
group_id |
integer | The group id of contacts to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Merge or create a contact
curl -X POST -d 'firstname=John&lastname=Doe&email=user%40ontraport.com' 'https://api.ontraport.com/1/Contacts/saveorupdate' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
curl -X POST -d 'birthday=804798000&email=user%40ontraport.com' 'https://api.ontraport.com/1/Contacts/saveorupdate' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
// Creating a contact with an email that does not exist in the account
$requestParams = array(
"firstname" => "John",
"lastname" => "Doe",
"email" => "user@ontraport.com"
);
// Updating birthday for contact with existing email in the account
$requestParams = array(
"birthday" => "804798000",
"email" => "user@ontraport.com"
);
$response = $client->contact()->saveOrUpdate($requestParams);
Example Response for Creating a Contact:
{
"code": 0,
"data": {
"firstname": "John",
"id": "1",
"owner": "1",
"lastname": "Doe",
"email": "user@ontraport.com",
"address": null,
"city": null,
"state": null,
"zip": null,
"birthday": null,
"date": "1531352827",
"priority": "0",
"status": null,
"home_phone": null,
"sms_number": null,
"dla": "1531352827",
"contact_cat": "",
"bulk_mail": "-5",
"bulk_sms": "0",
"office_phone": null,
"fax": null,
"dlm": "1531352827",
"company": null,
"address2": null,
"title": null,
"website": null,
"country": null,
"system_source": "3",
"source_location": null,
"import_id": "0",
"ip_addy": null,
"ip_addy_display": null,
"freferrer": "0",
"lreferrer": "0",
"n_lead_source": "0",
"n_content": "0",
"n_term": "0",
"n_media": "0",
"n_medium": "0",
"n_campaign": "0",
"l_lead_source": "0",
"l_content": "0",
"l_term": "0",
"l_medium": "0",
"l_campaign": "0",
"referral_page": null,
"aff_sales": "0",
"aff_amount": "0",
"program_id": "0",
"aff_paypal": null,
"fb_gender": null,
"mrcAmount": "0",
"mrcUnpaid": "0.00",
"mriInvoiceNum": "0",
"mriInvoiceTotal": "0",
"ccType": "0",
"ccExpirationMonth": "0",
"ccExpirationYear": "0",
"ccExpirationDate": "0",
"ccNumber": null,
"mrcResult": "0",
"last_inbound_sms": null,
"timezone": null,
"time_since_dla": "0",
"spent": null,
"num_purchased": null,
"updateSequence": "",
"grade": "0.00",
"unique_id": "D4GD000"
},
"account_id": "12345"
}
Example Response for Updating a Contact:
{
"code": 0,
"data": {
"attrs": {
"birthday": "804798000",
"dlm": "1531348174",
"id": "1"
}
},
"account_id": "12345"
}
Looks for an existing contact with a matching unique field and merges supplied data with existing data.
If no unique field is supplied or if no existing contact has a matching unique field field, a new contact will be created.
Recommended to avoid unwanted duplicate mailings.
While merging on the unique_id
field is supported, merging on the id
field is not, and may cause unintended consequences.
If you would like to update a contact based on its ID, you should use the update endpoint.
Request Endpoint
POST https://api.ontraport.com/1/Contacts/saveorupdate
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
firstname |
string | The contact's first name. |
lastname |
string | The contact's last name. |
email |
string | The contact's email address. |
unique_id |
string | A unique identifier for the contact. This field is system generated and can't be updated. If a unique_id is sent that matches a contact in the account, that contact's data will be updated. This field will take precedence over other unique fields. |
freferrer |
integer | The affiliate ID of the first affiliate to refer the contact. |
lreferrer |
integer | The affiliate ID of the last affiliate to refer the contact. |
address |
string | The contact's postal address. |
address2 |
string | A second address field which is generally used for storing suite or unit numbers. |
city |
string | The contact's city. |
state |
string | The contact's state. |
zip |
string | The contact's postal code. |
country |
string | The contact's country. |
timezone |
string | The contact's timezone. |
birthday |
timestamp | The contact's birthday, measured in seconds from the Unix Epoch. |
priority |
integer | The contact's priority. High => 8 Medium => 9 Low => 10 None => 0 |
status |
integer | The contact's Sales Stage. Integer codes map as follows: 1 => Closed - Lost 2 => Closed - Won 3 => Committed 4 => Consideration 5 => Demo Scheduled 6 => Qualified Lead 7 => New Prospect |
cell_phone |
string | The contact's mobile phone number. |
home_phone |
string | The contact's home phone number. |
sms_number |
string | The mobile number where the contact prefers receive text messages. |
office_phone |
string | The contact's office phone number. |
fax |
string | The contact's fax number. |
company |
string | The company the contact is affiliated with. |
title |
string | The contact's job title. |
website |
string | The contact's website. |
contact_cat |
string | Deprecated. The tags a contact is subscribed to. Each tag has an ID, and in this field the tags are appended together with the delimiter */* . A contact_cat entry containing multiple tags looks like this: */*1*/*2*/*3*/* . Tags are now related to contacts in a separate tag subscriber object. |
bulk_mail |
integer | A flag that indicates a contact's bulk email status. Values are mapped as follows:0 => Transactional Only 1 => Opted-in 2 => Double opt-in -2 => Hard bounce -5 => Under review You can only set the value to 0 through the API. You cannot manually opt-in a contact who has opted to receive only transactional mail. |
bulk_sms |
integer | A flag that indicates whether or not a contact is opted in to receive bulk texts. alues are mapped as follows:0 => Unconfirmed 1 => Pending confirmation 2 => Opted-in -1 => Hard bounced -3 => Unsubscribed -5 => Pending review You can only set the value to -3 through the API. You cannot manually opt-in a contact who has opted out. |
n_lead_source |
integer | The lead source ID for the tracking URL the contact arrived from. |
n_content |
integer/string | The content for the first tracking URL the contact arrived from. This field accepts the content name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
n_medium |
integer/string | The medium for the first tracking URL the contact arrived from. This field accepts the medium name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
n_campaign |
integer/string | The tracking campaign for the first tracking URL the contact arrived from. This field accepts the tracking campaign name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
n_term |
integer/string | The term for the first tracking URL the contact arrived from. This field accepts the tracking campaign name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
l_lead_source |
integer/string | The lead source for the last tracking URL the contact arrived from. This field accepts the lead source name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
l_content |
integer/string | The content for the last tracking URL the contact arrived from. This field accepts the content name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
l_medium |
integer/string | The medium for the last tracking URL the contact arrived from. This field accepts the medium name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
l_campaign |
integer/string | The tracking campaign for the last tracking URL the contact arrived from. This field accepts the tracking campaign name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
l_term |
integer/string | The term for the last tracking URL the contact arrived from. This field accepts the tracking campaign name if use_utm_names has a value of true, and ID if it is not passed or has a value of false. Utm variables passed by name will be created if they do not exist. |
use_utm_names |
boolean | Used to indicate that utm variables will be passed by name rather than ID. Defaults to false. |
referral_page |
string | The page the contact was referred from. |
aff_sales |
integer | If the contact is an affiliate, the total number of affiliate sale transactions. |
aff_amount |
double | If the contact is an affiliate, the total amount of affiliate sales. |
program_id |
integer | For affiliates, the partner program ID. |
aff_paypal |
string | Affiliate email address for Paypal payments. |
num_purchased |
integer | The contact's total orders. |
updateSequence |
string | Deprecated. The sequences a contact is subscribed to. Each sequence has an ID, and in this field the sequences are appended together with the delimiter /. An updateSequence entry containing multiple tags looks like this: /*1/2/3/*. Sequences are now related to contacts in a separate sequence subscribers object. If you want to subscribe a contact to a sequence please see the /objects/subscribe endpoint. |
updateCampaign |
string | Deprecated. The campaigns a contact is subscribed to. Each campaign has an ID, and in this field the campaigns are appended together with the delimiter */* . This field will appear in responses, but should not be updated. If you want to subscribe a contact to a campaign please see the /objects/subscribe endpoint. |
Retrieve contact object meta
curl -X GET 'https://api.ontraport.com/1/Contacts/meta' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$response = $client->contact()->retrieveMeta();
Example Response:
{
"code": 0,
"data": {
"0": {
"name": "Contact",
"fields": {
"firstname": {
"alias": "First Name",
"type": "text"
},
"lastname": {
"alias": "Last Name",
"type": "text"
},
"email": {
"alias": "Email",
"type": "email"
},
"freferrer": {
"alias": "First Referrer",
"type": "parent",
"parent_object": 36
},
"lreferrer": {
"alias": "Last Referrer",
"type": "parent",
"parent_object": 36
},
"address": {
"alias": "Address",
"type": "text"
},
"city": {
"alias": "City",
"type": "text"
},
"state": {
"alias": "State",
"type": "state"
},
"zip": {
"alias": "Zip Code",
"type": "text"
},
"birthday": {
"alias": "Birthday",
"type": "fulldate"
},
"aff_paypal": {
"alias": "Paypal Address",
"type": "text"
},
"program_id": {
"alias": "Partner Program",
"type": "parent",
"parent_object": 35
},
"contact_cat": {
"alias": "Contact Tags",
"type": "subscription"
},
"bulk_mail": {
"alias": "Bulk Email Status",
"type": "check"
},
"office_phone": {
"alias": "Office Phone",
"type": "phone"
},
"fax": {
"alias": "Fax",
"type": "phone"
},
"company": {
"alias": "Company",
"type": "text"
},
"address2": {
"alias": "Address 2",
"type": "text"
},
"website": {
"alias": "Website",
"type": "text"
},
"title": {
"alias": "Title",
"type": "text"
},
"country": {
"alias": "Country",
"type": "country"
},
"date": {
"alias": "Date Added",
"type": "timestamp"
},
"dlm": {
"alias": "Date Modified",
"type": "timestamp"
},
"dla": {
"alias": "Last Activity",
"type": "timestamp"
},
"spent": {
"alias": "Spent",
"type": "price"
},
"n_lead_source": {
"alias": "First Lead Source",
"type": "parent",
"parent_object": 76
},
"n_campaign": {
"alias": "First Campaign",
"type": "parent",
"parent_object": 75
},
"n_content": {
"alias": "First Content",
"type": "parent",
"parent_object": 78
},
"n_medium": {
"alias": "First Medium",
"type": "parent",
"parent_object": 77
},
"referral_page": {
"alias": "Referring Page",
"type": "text"
},
"aff_sales": {
"alias": "Number of Sales",
"type": "numeric"
},
"aff_amount": {
"alias": "Total Sales",
"type": "price"
},
"mriInvoiceNum": {
"alias": "Last Invoice #",
"type": "numeric"
},
"mriInvoiceTotal": {
"alias": "Last Total Invoice Amount",
"type": "price"
},
"mrcAmount": {
"alias": "Last Charge Amount",
"type": "price"
},
"mrcUnpaid": {
"alias": "Total Amount of Unpaid Transactions",
"type": "price"
},
"ccType": {
"alias": "Card Type",
"type": "drop",
"options": {
"0": "",
"1": "Visa",
"2": "Mastercard",
"3": "American Express",
"4": "Discover",
"5": "Paypal",
"6": "Other"
}
},
"ccExpirationMonth": {
"alias": "Card Expiration Month",
"type": "drop",
"options": {
"1": "January",
"2": "February",
"3": "March",
"4": "April",
"5": "May",
"6": "June",
"7": "July",
"8": "August",
"9": "September",
"10": "October",
"11": "November",
"12": "December"
}
},
"ccExpirationYear": {
"alias": "Card Expiration Year",
"type": "numeric"
},
"ccNumber": {
"alias": "Card Number (Last 4)",
"type": "numeric"
},
"mrcResult": {
"alias": "Last CC Status",
"type": "drop",
"options": {
"0": "Success",
"1": "Declined"
}
},
"ccExpirationDate": {
"alias": "Card Expiration Date",
"type": "fulldate"
},
"lnf": {
"alias": "Name",
"type": "mergefield"
},
"fn": {
"alias": "Name",
"type": "mergefield"
},
"grade": {
"alias": "Score",
"type": "numeric"
},
"num_purchased": {
"alias": "Orders",
"type": "numeric"
},
"id": {
"alias": "Contact ID",
"type": "numeric"
},
"owner": {
"alias": "Owner",
"type": "parent",
"parent_object": 2
},
"bulk_sms": {
"alias": "Bulk SMS Status",
"type": "check"
},
"sms_number": {
"alias": "SMS Number",
"type": "sms"
},
"timezone": {
"alias": "Timezone",
"type": "timezone"
},
"priority": {
"alias": "Priority",
"type": "drop",
"options": {
"8": "High",
"9": "Medium",
"10": "Low"
}
},
"time_since_dla": {
"alias": "Time Since Last Activity",
"type": "drop",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0,
"options": {
"60": "More than a month ago (Cold)",
"61": "This month",
"62": "This Week",
"63": "Today (Hot!)"
}
},
"status": {
"alias": "Sales Stage",
"type": "drop",
"options": {
"1": "Closed - Lost",
"2": "Closed - Won",
"3": "Committed",
"4": "Consideration",
"5": "Demo Scheduled",
"6": "Qualified Lead",
"7": "New Prospect"
}
},
"updateSequence": {
"alias": "Sequences",
"type": "subscription"
},
"n_term": {
"alias": "Term",
"type": "parent",
"parent_object": 79
},
"last_note": {
"alias": "Last Note",
"type": "text"
},
"ip_addy_display": {
"alias": "IP Address",
"type": "text"
},
"last_inbound_sms": {
"alias": "Last Inbound SMS",
"type": "text"
},
"timezone": {
"alias": "Timezone",
"type": "timezone"
},
"l_lead_source": {
"alias": "Last Lead Source",
"type": "parent",
"parent_object": 76
},
"l_campaign": {
"alias": "Last Campaign",
"type": "parent",
"parent_object": 75
},
"l_content": {
"alias": "Last Content",
"type": "parent",
"parent_object": 78
},
"l_medium": {
"alias": "Last Medium",
"type": "parent",
"parent_object": 77
},
"l_term": {
"alias": "Last Term",
"type": "parent",
"parent_object": 79
}
}
}
},
"account_id": "12345"
}
Retrieves the field meta data for the contact object.
Request Endpoint
GET https://api.ontraport.com/1/Contacts/meta
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
None
Retrieve contact collection info
curl -X GET 'https://api.ontraport.com/1/Contacts/getInfo?search=John' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"search" => "John"
);
$response = $client->contact()->retrieveCollectionInfo($requestParams);
Example Response:
{
"code": 0,
"data": {
"listFields": [
"fn",
"email",
"office_phone",
"date",
"grade",
"dla",
"contact_id"
],
"listFieldSettings": [],
"count": "2"
},
"account_id": "12345"
}
Retrieves information about a collection of contacts, such as the number of contacts that match the given criteria.
Request Endpoint
GET https://api.ontraport.com/1/Contacts/getInfo
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
condition |
string | A JSON encoded string to more specifically set criteria for which contacts to select. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your contact objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not contact notes should be searched for the specified string in addition to other contact fields. |
group_id |
integer | The group id of contacts to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Commissions
Object Type ID: 38
The Commission object allows you to keep up-to-date records for all commissions earned
The Commission object
{
"id": "1",
"purchase_id": "1",
"affiliate_id": "2",
"contact_id": "3",
"product_id": "4",
"program_id": "5",
"subid": "0",
"date": "1645198001",
"date_processed": "1645198005",
"date_paid": "0",
"dlm": "1645198005",
"commission": "2",
"total": "10",
"status": "3",
"type": "0"
}
Attributes | Type | Description |
---|---|---|
id |
integer | The commission's ID. |
purchase_id |
integer | The related purchase's ID. |
affiliate_id |
integer | The related affiliate's (partner) ID. |
contact_id |
integer | The related contact's ID. |
product_id |
integer | The related product's ID. |
program_id |
integer | The related partner program's ID. |
subid |
string | A string identifier related to a sub_id string the partner used used while going through an affiliate link. |
date |
timestamp | The date and time the commission was made measured in seconds from the Unix Epoch. |
date_processed |
timestamp | The date and time the commission was processed measured in seconds from the Unix Epoch. |
date_paid |
timestamp | The date and time the commission was paid measured in seconds from the Unix Epoch. |
dlm |
timestamp | The date and time the commission was last modified measured in seconds from the Unix Epoch. |
commission |
double | The commission earned. |
total |
double | The total of the related transaction that commission was earned on. |
status |
integer | The status of the commission. Integer codes are mapped as follows:0 => Pending 1 => Approve 2 => Paid 3 => Decline 4 => Refund 5 => Refund Approved 6 => Refund Paid |
type |
Integer | The type of commission earned: :0 => Percent 1 => Flat Rate |
Retrieve a single Commision
curl -X GET 'https://api.ontraport.com/1/Commission?id=1' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
COMING SOON
Example Response:
{
"id": "1",
"purchase_id": "1",
"affiliate_id": "2",
"contact_id": "3",
"product_id": "4",
"program_id": "5",
"subid": "0",
"date": "1645198001",
"date_processed": "1645198005",
"date_paid": "0",
"dlm": "1645198005",
"commission": "2",
"total": "10",
"status": "3",
"type": "0"
}
Retrieves all the information for an existing Commission
Request Endpoint
GET https://api.ontraport.com/1/Commission
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The ID of the specific Commission. Required. |
Retrieve multiple Commissions
curl -X GET 'https://api.ontraport.com/1/Commissions?range=5&sortDir=asc' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
COMING SOON
Example Response:
{
"code": 0,
"data": [
{
"id": "1",
"purchase_id": "1",
"affiliate_id": "9",
"contact_id": "12",
"product_id": "1",
"program_id": "4",
"subid": "0",
"date": "1645198001",
"date_processed": "1645198005",
"date_paid": "0",
"dlm": "1645198005",
"commission": "10",
"total": "50",
"status": "3",
"type": "0"
},
{
"id": "1439",
"purchase_id": "2",
"affiliate_id": "9",
"contact_id": "6",
"product_id": "7",
"program_id": "10",
"subid": "0",
"date": "1645198001",
"date_processed": "1645198005",
"date_paid": "0",
"dlm": "1645198005",
"commission": "4",
"total": "20",
"status": "3",
"type": "0"
},
{
"id": "178",
"purchase_id": "3",
"affiliate_id": "9",
"contact_id": "7",
"product_id": "4",
"program_id": "4",
"subid": "26",
"date": "1645198001",
"date_processed": "1645198005",
"date_paid": "0",
"dlm": "1645198005",
"commission": "1",
"total": "5",
"status": "3",
"type": "0"
},
{
"id": "1779",
"purchase_id": "4",
"affiliate_id": "9",
"contact_id": "10",
"product_id": "6",
"program_id": "4",
"subid": "0",
"date": "1645198001",
"date_processed": "1645198005",
"date_paid": "0",
"dlm": "1645198005",
"commission": "20",
"total": "100",
"status": "3",
"type": "0"
},
{
"id": "130",
"purchase_id": "5",
"affiliate_id": "9",
"contact_id": "2",
"product_id": "11",
"program_id": "4",
"subid": "49",
"date": "1645198001",
"date_processed": "1645198005",
"date_paid": "0",
"dlm": "1645198005",
"commission": "20",
"total": "100",
"status": "3",
"type": "0"
}
],
"account_id": 60,
"misc": []
}
Retrieves a collection of Commissions based on a set of parameters.
You can limit unnecessary API requests by utilizing criteria and our pagination tools to select only the data set you require.
Request Endpoint
GET https://api.ontraport.com/1/Commissions
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
ids |
string | An integer array as a comma-delimited list of the IDs of the commissions to retrieve. Entering a value of 0 will result in all commissions being selected. |
start |
integer | The offset to start your search from. |
range |
integer | The number of commissions you want to retrieve. The maximum and default range is 50. |
sort |
string | The field results should be sorted on. |
sortDir |
string | The direction your results should be sorted. Your options are asc and desc . This field must be used in conjunction with the sort parameter. |
condition |
string | A JSON encoded string to more specifically set criteria for which commissions to bring back. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your commissions for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not object notes should be searched for the specified string in addition to other commission fields. |
group_id |
integer | The group id of commissions to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all Commissions in a collection. |
externs |
string | If you have a relationship between commissions and another object, you may want to include the data from a related field in your results. Each external field is listed in the format {object}//{field} . Multiple fields are separated by commas. |
listFields |
string | A string array as a comma-delimited list of the fields which should be returned in your results. |
Retrieve Commission collection info
curl -X GET 'https://api.ontraport.com/1/Commissions/getInfo' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
COMING SOON
Example Response:
{
"code": 0,
"data": {
"listFields": [
"contact_id",
"total",
"commission"
],
"listFieldSettings": [],
"cardViewSettings": {
"fields": [
"contact_id",
"total",
"commission"
]
},
"viewMode": [],
"widgetSettings": {
"map": [
[
"overview"
],
[
"fields"
],
[
"notes",
"tasks",
"settings"
]
],
"widgets": {
"overview": {
"type": "object_widget_overview",
"options": {
"visible": "true",
"excludeFromWidgetSettings": true
}
},
"tasks": {
"type": "object_widget_object_list_text_object_task_widget",
"options": {
"visible": "true",
"objectID": 1,
"header": "Tasks"
}
},
"notes": {
"type": "object_widget_object_list_text_object_notes_widget",
"options": {
"visible": "true",
"objectID": 12,
"header": "Notes"
}
},
"settings": {
"type": "object_widget_settings",
"options": {
"placeAtEndOfColumn": true,
"excludeFromWidgetSettings": true
}
},
"fields": {
"type": "object_widget_fields",
"options": {
"visible": "true",
"excludeFromWidgetSettings": true,
"fields": [
"contact_id",
"total",
"commission"
]
}
}
},
"listFields": [
"profile_image",
"contact_id",
"total",
"commission"
]
},
"count": "0",
"sums": {
"total": 0,
"commission": 0
}
},
"account_id": 60
}
Retrieves information about Commissions, such as the number of Commissions and other totals.
Request Endpoint
GET https://api.ontraport.com/1/Commissions/getInfo
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
condition |
string | A JSON encoded string to more specifically set criteria for which Commissions you wish to select. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your Commissions for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other Commission fields. |
group_id |
integer | The group id of Commissions to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all Commissions in a collection. |
Retrieve Commissions meta
curl -X GET 'https://api.ontraport.com/1/Commissions/meta?format=byId' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
COMING SOON
Example Response:
{
{
"code": 0,
"data": {
"38": {
"name": "Affiliate_Commission",
"fields": {
"date_processed": {
"alias": "Date Processed",
"type": "timestamp",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0
},
"date": {
"alias": "Transaction Date",
"type": "timestamp",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 0
},
"total": {
"alias": "Sale Amount",
"type": "price",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0
},
"commission": {
"alias": "Commission",
"type": "price",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0
},
"date_paid": {
"alias": "Date Paid",
"type": "timestamp",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0
},
"affiliate_id": {
"alias": "Partner",
"type": "parent",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1,
"parent_object": 36
},
"contact_id": {
"alias": "Contact",
"type": "parent",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1,
"parent_object": 0
},
"product_id": {
"alias": "Product",
"type": "parent",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1,
"parent_object": 16
}
}
}
},
"account_id": 12345
}
}
Retrieves the field meta data for Commissions.
Request Endpoint
GET https://api.ontraport.com/1/Commissions/meta
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
format |
string | Indicates whether the list should be indexed by name or ID. Possible values are byId and byName (default). |
Credit Cards
Object Type ID: 45
Credit cards objects store data for a contact's saved credit cards, including card information, type, status, and billing details.
The credit card object
{
"id": "1",
"firstname": "Maria",
"lastname": "Romero",
"contact_id": "1",
"last4": "1111",
"type": "1",
"exp_month": "11",
"exp_year": "2027",
"address": "2040 Alameda Padre Serra",
"address2": "Suite 220",
"city": "Santa Barbara",
"state": "CA",
"zip": "93103",
"country": "US",
"status": "3",
"recent_sale": "0",
"invoice_id": "1"
}
Credit card attributes
Attribute | Type | Description |
---|---|---|
id |
integer | The credit card ID. |
firstname |
string | The first name of the credit card owner. |
lastname |
string | The last name of the credit card owner. |
contact_id |
integer | The ID of the contact associated with the credit card. |
last4 |
integer | The last four digits of the credit card number. |
type |
integer | The credit card issuer. Integer codes are mapped as follows:1 => Visa 2 => Mastercard 3 => American Express 4 => Discover 6 => Other |
exp_month |
integer | The two-digit integer representation of the credit card's expiration month. |
exp_year |
integer | The four-digit credit card expiration year. |
address |
string | The credit card's billing address. |
address2 |
string | Additional information about the credit card's billing address, such as unit number. |
city |
string | The credit card's billing address city. |
state |
string | The credit card's billing address state. |
zip |
string | The credit card's billing address zip code. |
country |
string | The credit card's billing address country. |
status |
integer | The current status of the credit card. Integer codes are mapped as follows:1 => Active 2 => Expired 3 => Active Default 4 => Expired Default |
recent_sale |
timestamp | The date and time of the most recent charge measured in seconds from the Unix Epoch. |
invoice_id |
integer | The ID of the invoice generated in relation to the most recent charge to the credit card. |
Retrieve a specific credit card
curl -X GET 'https://api.ontraport.com/1/CreditCard?id=2' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$queryParams = array(
"id" => 2
);
$response = $client->creditcard()->retrieveSingle($queryParams);
Example Response:
{
"code": 0,
"data": {
"id": "1",
"firstname": "Maria",
"lastname": "Romero",
"contact_id": "1",
"last4": "1111",
"type": "1",
"exp_month": "11",
"exp_year": "2027",
"address": "2040 Alameda Padre Serra",
"address2": "Suite 220",
"city": "Santa Barbara",
"state": "CA",
"zip": "93103",
"country": "US",
"status": "3",
"recent_sale": "0",
"invoice_id": "1"
},
"account_id": "12345"
}
Retrieves all the information for an existing credit card.
Request Endpoint
GET https://api.ontraport.com/1/CreditCard
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The credit card ID. Required. |
Retrieve multiple credit cards
curl -X GET 'https://api.ontraport.com/1/CreditCards?listFields=contact_id%2C%20last4%2C%20exp_month%2C%20exp_year%2C%20status' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$queryParams = array(
"listFields" => "contact_id, last4, exp_month, exp_year, status"
);
$response = $client->creditcard()->retrieveMultiple($queryParams);
Example Response:
{
"code": 0,
"data": [
{
"contact_id": "1",
"last4": "1111",
"exp_month": "11",
"exp_year": "2027",
"status": "3",
"id": "1"
},
{
"contact_id": "1",
"last4": "1111",
"exp_month": "9",
"exp_year": "2037",
"status": "1",
"id": "2"
}
],
"account_id": "12345",
"misc": []
}
Retrieves a collection of credit cards based on a set of parameters. You can limit unnecessary API requests by utilizing criteria and our pagination tools to select only the data set you require.
Request Endpoint
GET https://api.ontraport.com/1/CreditCards
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
ids |
string | An integer array as a comma-delimited list of the IDs of the credit cards to retrieve. Entering a value of 0 will result in all forms being selected. |
start |
integer | The id to start your search after. |
range |
integer | The number of credit cards you want to retrieve. The maximum and default range is 50. |
sort |
string | The field results should be sorted on. |
sortDir |
string | The direction your results should be sorted. Your options are asc and desc . This field must be used in conjunction with the sort parameter. |
condition |
string | A JSON encoded string to more specifically set criteria for which credit cards to select. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your form objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not object notes should be searched for the specified string in addition to native form fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
externs |
string | If you have a relationship between your credit card object and another object, you may want to include the data from a related field in your results. Each external field is listed in the format {object}//{field} . Multiple fields are separated by commas. |
listFields |
string | A string array as a comma-delimited list of the fields which should be returned in your results. |
Retrieve credit card collection info
curl -X GET 'https://api.ontraport.com/1/CreditCards/getInfo?condition=%5B%7B%20%22field%22%3A%7B%22field%22%3A%22contact_id%22%7D%2C%20%22op%22%3A%22%3D%22%2C%20%22value%22%3A%7B%22value%22%3A1%7D%20%7D%5D' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$condition = new OntraportAPI\Criteria("contact_id", "=", 1);
$queryParams = array(
"condition" => $condition->fromArray()
);
$response = $client->creditcard()->retrieveCollectionInfo($queryParams);
Example Response:
{
"code": 0,
"data": {
"listFields": [
"contact_id",
"last4",
"exp_month",
"exp_year"
],
"listFieldSettings": [],
"count": "2"
},
"account_id": "12345"
}
Retrieves information about a collection of credit cards, such as the number of credit cards that match the given criteria.
Request Endpoint
GET https://api.ontraport.com/1/CreditCards/getInfo
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
condition |
string | A JSON encoded string to more specifically set criteria for which credit cards to select. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your credit card objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not object notes should be searched for the specified string in addition to native credit card fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Retrieve credit card meta
curl -X GET 'https://api.ontraport.com/1/CreditCards/meta' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$response = $client->creditcard()->retrieveMeta();
Example Response:
{
"code": 0,
"data": {
"45": {
"name": "CreditCard",
"fields": {
"contact_id": {
"alias": "Contact",
"type": "parent"
},
"last4": {
"alias": "Card Number (last 4)",
"type": "text"
},
"type": {
"alias": "Card Type",
"type": "drop",
"options": {
"1": "Visa",
"2": "Mastercard",
"3": "AMEX",
"4": "Discover",
"6": "Other"
}
},
"status": {
"alias": "Card Status",
"type": "drop",
"options": {
"0": "Hidden",
"1": "Active",
"2": "Expired",
"3": "Active (Default)",
"4": "Expired (Default)"
}
},
"exp_month": {
"alias": "Card Expiration Month",
"type": "numeric"
},
"exp_year": {
"alias": "Card Expiration Year",
"type": "numeric"
},
"address": {
"alias": "Billing Address",
"type": "text"
},
"address2": {
"alias": "Billing Address 2",
"type": "text"
},
"city": {
"alias": "Billing City",
"type": "text"
},
"state": {
"alias": "Billing State",
"type": "state"
},
"zip": {
"alias": "Billing Zip",
"type": "text"
},
"country": {
"alias": "Billing \nCountry",
"type": "country"
},
"invoice_id": {
"alias": "Invoice",
"type": "parent",
"parent_object": 46
},
"firstname": {
"alias": "Billing First Name",
"type": "text"
},
"lastname": {
"alias": "Billing Last Name",
"type": "text"
}
}
}
},
"account_id": "12345"
}
Retrieves the field meta data for a credit card.
Request Endpoint
GET https://api.ontraport.com/1/CreditCards/meta
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
None
Set a default credit card
curl -X PUT --header 'Content-Type: application/x-www-form-urlencoded' -d 'id=11' 'https://api.ontraport.com/1/CreditCard/default' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$queryParams = array(
"id" => 2
);
$response = $client->creditcard()->setDefault($queryParams);
Example Response:
{
"code": 0,
"data": {
"id": "11",
"status": 3
},
"account_id": "12345"
}
Sets the status of an existing card to default and adjusts the status of the current default card.
Request Endpoint
PUT https://api.ontraport.com/1/CreditCard/default
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
id |
integer | The credit card ID. Required. |
Forms
Object Type ID: 122
Forms are used to simply and easily gather information from your contacts. Our ONTRAforms are the recommended form type, as we offer many pre-designed and customizable templates which will greatly simplify your process. We also offer legacy SmartForms, which allow you to create your own designs.
Through the form API, you can retrieve a single form or a collection of forms. You can also retrieve meta for a form object and retrieve information about a collection of forms.
The form object
{
"form_id": "2",
"formname": "Test Form",
"type": "11",
"tags": null,
"sequences": null,
"campaigns": null,
"redirect": null,
"owner": "",
"captcha": "1",
"notif": null,
"fillouts": "0",
"json_raw_object": "0",
"deleted": "",
"object_type_id": "0",
"responsive": "1",
"visits": "0",
"unique_visits": "0",
"revenue": "0.00",
"date": "1510703743",
"dlm": "1510703743"
}
Form attributes
Attribute | Type | Description |
---|---|---|
form_id |
integer | The form's ID. |
formname |
string | An arbitrary name for the form. |
type |
integer | The type of form. Integer codes are mapped as follows:10 => SmartForm 11 => ONTRAform Any other codes correspond to deprecated form types. |
tags |
string | The tags a contact should be added to upon form fillout. |
sequences |
string | The sequences a contact should be added to upon form fillout. |
campaigns |
string | The campaigns a contact should be added to upon form fillout.Note: These are referred to as automations throughout the Ontraport app. |
redirect |
string | The URL for the thank you page the user is redirected to upon form fillout. |
owner |
integer | The ID of the user controlling the form. |
captcha |
integer | A binary integer flag indicating whether or not the form includes a Captcha. Values are mapped as follows:0 => false 1 => true |
notif |
string | The email address to be notified when the form is filled out. |
fillouts |
integer | The number of times the form has been filled out. |
unique_fillouts |
integer | The percentage of unique users that has filled out the form divided by the number of unique_visits . |
json_raw_object |
blob | JSON-encoded form data. |
deleted |
integer/boolean | A flag indicating whether or not the form has been deleted. Different forms may use either a binary integer or boolean value. If an integer, values are mapped as follows:0 => false 1 => true |
object_type_id |
integer | The ID of the object type associated with the form. |
responsive |
integer | A flag indicating whether or not the form has a responsive layout. Values are mapped as follows:0 => false 1 => true |
visits |
integer | The number of times the form has been visited. |
unique_visits |
integer | The number of times unique visitors have visited the form. |
revenue |
double | The total amount of income accrued from the form (only applies to order and upsell forms). |
date |
timestamp | The date and time the form was created measured in seconds from the Unix Epoch. Note that this field will not contain data for any forms created prior to November 7, 2017. |
dlm |
timestamp | The date and time the form was last modified measured in seconds from the Unix Epoch. |
Retrieve a specific form
curl -X GET 'https://api.ontraport.com/1/Form?id=2' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$queryParams = array(
"id" => 2
);
$response = $client->form()->retrieveSingle($queryParams);
Example Response:
{
"code": 0,
"data": {
"form_id": "2",
"formname": "Test Form",
"type": "11",
"tags": null,
"sequences": null,
"campaigns": null,
"redirect": null,
"owner": "",
"captcha": "1",
"notif": null,
"fillouts": "0",
"json_raw_object": "0",
"deleted": "",
"object_type_id": "0",
"responsive": "1",
"visits": "0",
"unique_visits": "0",
"revenue": "0.00",
"date": "1510703743",
"dlm": "1510703743"
},
"account_id": "12345"
}
Retrieves all the information for an existing form.
Request Endpoint
GET https://api.ontraport.com/1/Form
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The form ID. Required. |
Retrieve multiple forms
curl -X GET 'https://api.ontraport.com/1/Forms?sort=type&sortDir=asc&listFields=form_id%2Cformname%2Ctype' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$queryParams = array(
"sort" => "type",
"sortDir" => "asc",
"listFields" => "form_id,formname,type"
);
$response = $client->form()->retrieveMultiple($queryParams);
Example Response:
{
"code": 0,
"data": [
{
"form_id": "4",
"formname": "Smart Form",
"type": "10",
"owner": ""
},
{
"form_id": "2",
"formname": "Test ONTRAform",
"type": "11",
"owner": ""
},
{
"form_id": "3",
"formname": "Test ONTRAform 2",
"type": "11",
"owner": ""
}
],
"account_id": "12345",
"misc": []
}
Retrieves a collection of forms based on a set of parameters. You can limit unnecessary API requests by utilizing criteria and our pagination tools to select only the data set you require.
Request Endpoint
GET https://api.ontraport.com/1/Forms
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
ids |
string | An integer array as a comma-delimited list of the IDs of the forms to retrieve. Entering a value of 0 will result in all forms being selected. |
start |
integer | The id to start your search after. |
range |
integer | The number of forms you want to retrieve. The maximum and default range is 50. |
sort |
string | The field results should be sorted on. |
sortDir |
string | The direction your results should be sorted. Your options are asc and desc . This field must be used in conjunction with the sort parameter. |
condition |
string | A JSON encoded string to more specifically set criteria for which forms to select. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your form objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not object notes should be searched for the specified string in addition to native form fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
externs |
string | If you have a relationship between your form object and another object, you may want to include the data from a related field in your results. Each external field is listed in the format {object}//{field} . Multiple fields are separated by commas. |
listFields |
string | A string array as a comma-delimited list of the fields which should be returned in your results. |
Retrieve form collection info
curl -X GET 'https://api.ontraport.com/1/Forms/getInfo?search=Test' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$queryParams = array(
"search" => "Test"
);
$response = $client->form()->retrieveCollectionInfo($queryParams);
Example Response:
{
"code": 0,
"data": {
"listFields": [
"formname",
"redirect"
],
"listFieldSettings": [],
"count": "1"
},
"account_id": "12345"
}
Retrieves information about a collection of forms, such as the number of forms that match the given criteria.
Request Endpoint
GET https://api.ontraport.com/1/Forms/getInfo
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
condition |
string | A JSON encoded string to more specifically set criteria for which forms to select. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your form objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not object notes should be searched for the specified string in addition to native form fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Retrieve Smart Form meta
curl -X GET 'https://api.ontraport.com/1/Forms/meta' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$response = $client->form()->retrieveMeta();
Example Response:
{
"code": 0,
"data": {
"122": {
"name": "SmartFormFE",
"fields": {
"formname": {
"alias": "Form Name",
"type": "text",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1
},
"redirect": {
"alias": "Thank You Page",
"type": "url",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1
},
"fillouts": {
"alias": "Conversions",
"type": "numeric",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1
},
"unique_visits": {
"alias": "Unique Visits",
"type": "numeric",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1
},
"visits": {
"alias": "Visits",
"type": "numeric",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1
},
"type": {
"alias": "Form Type",
"type": "drop",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1,
"options": {
"1": "Legacy Smart Form",
"10": "Smart Form",
"11": "ONTRAform"
}
},
"date": {
"alias": "Date Created",
"type": "timestamp",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 0
},
"dlm": {
"alias": "Date Modified",
"type": "timestamp",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 0
},
"unique_fillouts": {
"alias": "Conversion Rate",
"type": "raw_percentage",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1
}
}
}
},
"account_id": "12345"
}
Retrieves the field meta data for a SmartForm. If you want to retrieve meta for another form type, you should use the objects/meta endpoint with the appropriate object ID.
Request Endpoint
GET https://api.ontraport.com/1/Forms/meta
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
None
Retrieve Form HTML
curl -X GET 'https://api.ontraport.com/1/form?id=4' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$queryParams = array(
"id" => 4
);
$response = $client->form()->retrieveFormHTML($queryParams);
Example Response:
{
"code": 0,
"data": "<html>Insert HTML here</html>",
"account_id": "12345"
}
Retrieves the HTML for a Form by its ID.
Request Endpoint
GET https://api.ontraport.com/1/form
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The ID of the form to retrieve HTML for. |
Retrieve all form blocks
curl -X GET 'api.ontraport.com/1/Form/getAllFormBlocks' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$response = $client->form()->retrieveFormBlocks();
Example Response:
{
"code": 0,
"data": {
"lp1.0.96bbda26-83fa-10ae-dd9a-5381b1fbf3dd": "Form on landingpage",
"f1": "Standalone form"
},
"account_id": "12345"
}
Retrieves name and ID pairs for all existing form blocks.
Request Endpoint
GET https://api.ontraport.com/1/Form/getAllFormBlocks
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
page |
integer | The zero-indexed page number. 50 entries are returned per page. Optional. |
Retrieve all blocks for form
curl -X GET 'api.ontraport.com/1/Form/getBlocksByFormName?name=myLandingPage' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$queryParams = array(
"name" => "myLandingPage"
);
$response = $client->form()->retrieveBlocksByForm($queryParams);
Example Response:
{
"code": 0,
"data": {
"block_ids": [
"lp1.0.6d1f42fd-4e7f-706b-a20a-bd160bdd0439",
"lp1.0.d41c1051-a2d8-7c68-d915-4f804185996e"
]
},
"account_id": "12345"
}
Retrieves IDs for all form blocks in a specified form or landing page.
Request Endpoint
GET https://api.ontraport.com/1/getBlocksByFormName
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
name |
string | The name of the form or landing page. Required. |
Groups
Object Type ID: 3
Groups are a way of categorizing types of objects into specific segments based on some criteria.
The group object
Group attributes
Attribute | Type | Description |
---|---|---|
name |
string | The group's name. |
is_public |
integer | 0 => Everyone can view and delete 1 => Only owner can view and delete 2 => Everyone can view, only owner can delete |
object_type_id |
integer | The object's type id. |
writable |
boolean | Whether the group can be edited or not. |
owner |
integer | The user id of the owner of the group. |
conditions |
object | The conditions that define the group |
id |
integer | The group's id. |
Retrieve a specific group
curl -X GET 'https://api.ontraport.com/1/Group?id=2' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$queryParams = array(
"id" => 2
);
$response = $client->group()->retrieveSingle($queryParams);
Example Response:
{
"name": "Clicked or Visited - Last 30 days",
"is_public": "1",
"object_type_id": "0",
"writable": true,
"owner": "1",
"conditions": {
"statement": [
{
"rule": {
"field": "dla",
"condition": "h",
"value": [
"S30DAYS"
]
}
}
]
},
"id": "2"
}
Retrieves all the information for an existing Group.
Request Endpoint
GET https://api.ontraport.com/1/Group
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The group's ID. Required. |
Retrieve multiple groups
curl -X GET 'https://api.ontraport.com/1/Groups?range=50&condition=%5B%7B%22field%22%3A%7B%22field%22%3A%22type%22%7D%2C%22op%22%3A%22%3D%22%2C%22value%22%3A%7B%22value%22%3A%220%22%7D%7D%5D \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$queryParams = array(
"sort" => "type",
"sortDir" => "asc",
"listFields" => "is_public"
);
$response = $client->group()->retrieveMultiple($queryParams);
Example Response:
{
"code": 0,
"data": [
{
"id": "29",
"name": "NewGrrrroup",
"type": "0",
"owner": "1",
"listfields": "",
"public_view": "2",
"is_public": "1"
},
{
"id": "30",
"name": "AAAAAAAAAAAAAAAAAAAAAAAAA",
"type": "0",
"owner": "1",
"listfields": "",
"public_view": "0",
"is_public": "1"
}
],
"account_id": 50,
"misc": []
}
Retrieves a collection of groups based on a set of parameters. You can limit unnecessary API requests by utilizing criteria and our pagination tools to select only the data set you require.
Request Endpoint
GET https://api.ontraport.com/1/Groups
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
ids |
string | An integer array as a comma-delimited list of the IDs of the groups to retrieve. Entering a value of 0 will result in all groups being selected. |
start |
integer | The id to start your search after. |
range |
integer | The number of groups you want to retrieve. The maximum and default range is 50. |
sort |
string | The field results should be sorted on. |
sortDir |
string | The direction your results should be sorted. Your options are asc and desc . This field must be used in conjunction with the sort parameter. |
condition |
string | A JSON encoded string to more specifically set criteria for which groups to select. For example, to return only groups that match a specific Object Type ID. See criteria examples for more details. |
search |
string | A string to search your group objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not object notes should be searched for the specified string in addition to native group fields. |
group_id |
integer | The group id of objects to act upon. |
externs |
string | If you have a relationship between your group object and another object, you may want to include the data from a related field in your results. Each external field is listed in the format {object}//{field} . Multiple fields are separated by commas. |
listFields |
string | A string array as a comma-delimited list of the fields which should be returned in your results. |
Retrieve group collection info
curl -X GET 'https://api.ontraport.com/1/Groups/getInfo?search=Test' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$queryParams = array(
"search" => "Test"
);
$response = $client->group()->retrieveCollectionInfo($queryParams);
Example Response:
{
"code": 0,
"data": {
"listFields": [
""
],
"listFieldSettings": [],
"cardViewSettings": {
"fields": [
""
]
},
"viewMode": [],
"count": "14"
},
"account_id": 50
}
Retrieves information about a collection of groups, such as the number of groups that match the given criteria.
Request Endpoint
GET https://api.ontraport.com/1/Groups/getInfo
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
condition |
string | A JSON encoded string to more specifically set criteria for which groups to select. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your group objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not object notes should be searched for the specified string in addition to native group fields. |
group_id |
integer | The group id of objects to act upon. |
Retrieve Group meta
curl -X GET 'https://api.ontraport.com/1/Groups/meta' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$response = $client->group()->retrieveMeta();
Example Response:
{
"code": 0,
"data": {
"3": {
"name": "Group",
"fields": {}
}
},
"account_id": 50
}
Retrieves the field meta data for a Group.
Request Endpoint
GET https://api.ontraport.com/1/Groups/meta
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
None
Delete a specific group
curl -X DELETE 'https://api.ontraport.com/1/Group?id=2' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$queryParams = array(
"id" => 2
);
$response = $client->group()->deleteSingle($queryParams);
Example Response:
{
"code": 0,
"account_id": 50
}
Deletes an existing Group.
Request Endpoint
DELETE https://api.ontraport.com/1/Group
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The group's ID. Required. |
Landing Pages
Object Type ID: 20
Landing page objects contain the data for one-off web pages a prospect can land on after clicking on an online marketing call-to-action.
We support professionally designed ONTRApage templates as well as redirects to other landing pages, "code mode" and legacy HTML pages.
Through the API, you can retrieve one or more landing pages and retrieve the hosted URL for a specific landing page. You can also retrieve meta for a landing page object to obtain more detailed information about its attributes and retrieve information about a collection of landing pages.
The landing page object
{
"id": "1",
"uri_id": null,
"resource": "[{\"templateId\":84,\"status\":true,\"blocks\":[{\"alias\":\"Banner\",\"blockId\":\"20\",\"blockTypeId\":3,\"id\":\"527f664f-a6a4-8e9d-634e-26c041d2bee5\",\"path\":\"\\/js\\/ontraport\\/opt_assets\\/blocks\\/landing_page\\/20_event_banner\\/\",\"scripts\":\" \\/*block scripts*\\/\",\"theme\":{\"color_variation\":\"option-4\"},\"userDefinedData\":[{\"id\":\"header-1\",\"type\":\"html\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"html\":\"<span class=\\\"h1\\\">COMING SOON<\\/span>\",\"visibility\":\"visible\",\"options\":false,\"help\":false,\"alias\":\"Header\"}},{\"id\":\"subHeader-1\",\"type\":\"html\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"html\":\"<span class=\\\" opt-palette-editor__text-area h2 h2 h2\\\">Yes you're on the right page, but its not quite ready.<\\/span>\",\"visibility\":\"visible\",\"options\":false,\"help\":false,\"alias\":\"Sub-Header\"}},{\"id\":\"header-group\",\"type\":\"group\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"alias\":\"header group\",\"visibility\":\"visible\"}},{\"id\":\"logo-1\",\"type\":\"image\",\"for\":null,\"tag\":\"IMG\",\"attrs\":{\"src\":\"\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/stockPhoto\\/84\\/29694.1.47135abcc7e84179f73c77f9e8f8af1b.PNG\",\"options\":false,\"visibility\":\"visible\",\"alias\":\"Logo\"}},{\"id\":\"block-background\",\"type\":\"background\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"bg\":\"transparent\",\"options\":false,\"alias\":\"block background\",\"src\":\"\\/js\\/ontraport\\/components\\/opt_palette_editor\\/image\\/views\\/noimage.png\"}},{\"id\":\"tagline-1\",\"type\":\"html\",\"for\":null,\"tag\":\"H3\",\"attrs\":{\"html\":\" JOIN OUR LIVE WEBINAR \",\"visibility\":\"hidden\",\"options\":false,\"help\":false,\"alias\":\"Tagline\"}},{\"id\":\"date-1\",\"type\":\"html\",\"for\":null,\"tag\":\"H1\",\"attrs\":{\"html\":\" DECEMBER 25, 2015 \\/\\/ 1:00PM PST \",\"visibility\":\"hidden\",\"options\":false,\"help\":false,\"alias\":\"Date\"}},{\"id\":\"button-1\",\"type\":\"button\",\"for\":null,\"tag\":\"A\",\"attrs\":{\"visibility\":\"hidden\",\"alias\":\"Button\",\"html\":\"\\n SIGN ME UP\\n \",\"href\":\"javascript:\\/\\/\",\"target\":\"_self\",\"file_name\":null,\"page_select\":null,\"url_type\":null,\"src\":null,\"link_background\":\"\",\"hover_bg\":\"\",\"hover_text\":\"\"}}],\"visibility\":true,\"permissionLevel\":\"free\"},{\"alias\":\"Countdown timer\",\"blockId\":\"119\",\"blockTypeId\":22,\"id\":\"b681e5f2-2c31-a251-f0f6-fa5bb76469d8\",\"path\":\"\\/js\\/ontraport\\/opt_assets\\/blocks\\/landing_page\\/119_count_down_timer\\/\",\"scripts\":\"\\/*block scripts*\\/\\n\\n\",\"theme\":{\"color_variation\":\"option-4\"},\"userDefinedData\":[{\"id\":\"header-1\",\"type\":\"html\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"html\":\"<span class=\\\" opt-palette-editor__text-area h3 h3 h3\\\">PAGE WILL BE READY IN :<\\/span>\\n \",\"visibility\":\"visible\",\"options\":false,\"help\":false,\"alias\":\"Header\"}},{\"id\":\"block-background\",\"type\":\"background\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"bg\":\"transparent\",\"options\":false,\"alias\":\"block background\",\"src\":\"\\/js\\/ontraport\\/components\\/opt_palette_editor\\/image\\/views\\/noimage.png\"}}],\"visibility\":true,\"permissionLevel\":\"premium\"},{\"alias\":\"Smart form\",\"blockId\":\"130\",\"blockTypeId\":10,\"id\":\"bd440856-4d06-bedf-1302-eb5f220c29e9\",\"path\":\"\\/js\\/ontraport\\/opt_assets\\/blocks\\/landing_page\\/130_horizontal_text_and_form\\/\",\"scripts\":\" \\/*block scripts*\\/\",\"theme\":{\"spacing\":{\"children\":{\"~spacing\":{\"attributes\":{\"padding-bottom\":\"100px\"}}}},\"color_variation\":\"option-4\"},\"userDefinedData\":[{\"id\":\"block-background\",\"type\":\"background\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"bg\":\"transparent\",\"options\":false,\"alias\":\"block background\",\"src\":\"\\/js\\/ontraport\\/components\\/opt_palette_editor\\/image\\/views\\/noimage.png\",\"fixed-width-default\":false}},{\"id\":\"bodyText-1\",\"type\":\"html\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"html\":\"<span class=\\\" opt-palette-editor__text-area body-text body-text\\\">Enter you name & Email and we will let you know when its ready.<\\/span>\",\"visibility\":\"visible\",\"options\":false,\"help\":false,\"alias\":\"Body Text\"}}],\"visibility\":true,\"direction\":1,\"settings\":{\"opt_in_settings\":\"single\",\"conditionsCustomUrl\":\"\",\"conditionsRedirectRadioButtons\":\"default\",\"form_contacts_thank_you_page_redir\":\"0\",\"singleCustomUrl\":\"\",\"thankYouRedirectRadioButtons\":\"default\",\"singleLandPageSelect\":\"\",\"conditionsLandPageSelect\":\"\",\"conditionsPopOntraformSelect\":\"\",\"confirmation_email\":\"\",\"tags\":[],\"sequences\":[],\"rules_default\":[],\"rules_transaction_fail\":[],\"notif\":\"\",\"cookie_overide\":\"0\",\"cgi\":\"0\",\"owner\":false,\"tyPopOntraformSelect\":\"\"},\"permissionLevel\":\"free\"}],\"settings\":{\"domain\":null,\"visits\":null,\"conversions\":null,\"design_type\":null,\"object_type_id\":null,\"listFields\":null,\"listFieldSettings\":null,\"count\":null,\"lpsent\":null,\"lpconvert\":null,\"id\":null,\"uri_id\":null,\"rotation\":null,\"last_save\":null,\"last_auto\":null,\"autosave\":null,\"visits_0\":null,\"visits_1\":null,\"visits_2\":null,\"visits_3\":null,\"platform\":null,\"ssl_enabled\":null,\"blocks\":null,\"block_type_id\":null,\"a_sent\":null,\"a_convert\":null,\"b_sent\":null,\"b_convert\":null,\"c_sent\":null,\"c_convert\":null,\"d_sent\":null,\"d_convert\":null,\"conditionsCustomUrl\":\"\",\"singleCustomUrl\":\"\",\"notif\":\"\",\"owner\":\"\",\"ontraformInstanceTimedOrUserScroll\":{\"opfActiveCheckbox\":\"0\",\"opfSettings\":{\"popPositionValue\":\"mc\",\"onScrollTo\":\"0\",\"onScrollToValue\":\"45\",\"onVisitDuration\":\"0\",\"onVisitDurationValue\":\"2\",\"filloutRestrictions\":\"0\",\"frequencyRestrictions\":\"1\",\"frequencyRestrictionsMaxTriggers\":2,\"frequencyRestrictionsTimeframe\":1}},\"ontraformInstanceExitIntent\":{\"opfActiveCheckbox\":\"0\",\"opfSettings\":{\"popPositionValue\":\"mc\",\"filloutRestrictions\":\"0\",\"frequencyRestrictions\":\"1\",\"frequencyRestrictionsMaxTriggers\":2,\"frequencyRestrictionsTimeframe\":1}},\"page_title\":\"\",\"meta_description\":\"\",\"header_custom_script\":\"\",\"footer_custom_script\":\"\",\"favicon_uploader\":\"\\/\\/app.ontraport.com\\/favicon.ico\",\"sort_items\":\"newest\",\"search_items\":{\"search\":\"\"}},\"theme\":{\"theme_font\":{\"children\":{\"h1, ~h1~h1\":{\"attributes\":{\"font-family\":\"'Dosis', sans-serif\",\"font-size\":\"96px\",\"line-height\":\"98px\",\"font-weight\":\"100\",\"font-style\":\"normal\"}},\"h2, ~h2~h2\":{\"attributes\":{\"font-family\":\"'Roboto', sans-serif\",\"font-size\":\"34px\",\"line-height\":\"36px\",\"font-weight\":\"100\",\"font-style\":\"italic\"}},\"h3, ~h3~h3\":{\"attributes\":{\"font-family\":\"'Roboto', sans-serif\",\"font-size\":\"22px\",\"line-height\":\"24px\",\"font-weight\":\"400\",\"font-style\":\"normal\"}},\"~label~label\":{\"attributes\":{\"font-family\":\"'Dosis', sans-serif\",\"font-size\":\"16px\",\"line-height\":\"18px\",\"font-weight\":\"600\",\"font-style\":\"normal\"}},\"~button~button\":{\"attributes\":{\"font-family\":\"'Dosis', sans-serif\",\"font-size\":\"22px\",\"line-height\":\"24px\",\"font-weight\":\"600\",\"font-style\":\"normal\"}},\"~large-body-text~large-body-text\":{\"attributes\":{\"font-family\":\"'Roboto', sans-serif\",\"font-size\":\"20px\",\"line-height\":\"22px\",\"font-weight\":\"400\",\"font-style\":\"normal\"}},\"~body-text~body-text\":{\"attributes\":{\"font-family\":\"'Roboto', sans-serif\",\"font-size\":\"16px\",\"line-height\":\"18px\",\"font-weight\":\"100\",\"font-style\":\"normal\"}},\"blockquote, ~blockquote\":{\"attributes\":{\"font-family\":\"'Dosis', sans-serif\",\"font-size\":\"16px\",\"line-height\":\"18px\",\"font-weight\":\"400\",\"font-style\":\"italic\"}}}},\"theme_colors\":{\"primary-color\":\"#17a4d1\",\"complimentary-color\":\"#328ed3\",\"dark-color\":\"#91cd47\",\"light-color\":\"#e9f4da\",\"white-color\":\"#ffffff\"},\"theme_background\":{\"id\":\"template-background\",\"type\":\"background\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"bg\":\"\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/stockPhoto\\/84\\/29694.1.1f36335d542d468765dd98e598ffbf9f.PNG\",\"options\":[\"backgrounds\"],\"alias\":\"background\",\"src\":\"\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/stockPhoto\\/84\\/29694.1.1f36335d542d468765dd98e598ffbf9f.PNG\"}},\"theme_spacing\":{\"children\":{\"~spacing\":{\"attributes\":{\"padding-top\":\"20px\",\"padding-bottom\":\"20px\"}}}}},\"templateData\":{\"account_id\":\"0\",\"remote_item_id\":\"0\",\"status\":\"approved\",\"share_type\":\"marketplace\",\"share_subtype\":\"free\",\"purchase_conditions\":\"\",\"featured\":\"1\",\"name\":\"Launchpad\",\"price\":\"0.00\",\"type\":\"Landing Page\",\"date\":\"1441818555\",\"date_approved\":\"0\",\"approved_by\":\"0\",\"dlm\":\"1445879184\",\"description\":\"Start the countdown with Launchpad. This template is a single, above the fold page that highlights a countdown timer, an icon image, a few lines of copy and a contact form.\",\"thumbnail\":\"https:\\/\\/app.ontraport.com\\/js\\/ontraport\\/opt_assets\\/templates\\/template_thumbs\\/84_thumbnail.png\",\"resource\":{\"templateId\":84,\"status\":true,\"blocks\":[{\"alias\":\"Banner\",\"blockId\":\"20\",\"blockTypeId\":3,\"id\":\"527f664f-a6a4-8e9d-634e-26c041d2bee5\",\"path\":\"\\/js\\/ontraport\\/opt_assets\\/blocks\\/landing_page\\/20_event_banner\\/\",\"scripts\":\" \\/*block scripts*\\/\",\"theme\":{\"color_variation\":\"option-4\"},\"userDefinedData\":[{\"id\":\"header-1\",\"type\":\"html\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"html\":\"<span class=\\\"h1\\\">COMING SOON<\\/span>\",\"visibility\":\"visible\",\"options\":false,\"help\":false,\"alias\":\"Header\"}},{\"id\":\"subHeader-1\",\"type\":\"html\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"html\":\"<span class=\\\" opt-palette-editor__text-area h2 h2 h2\\\">Yes you're on the right page, but its not quite ready.<\\/span>\",\"visibility\":\"visible\",\"options\":false,\"help\":false,\"alias\":\"Sub-Header\"}},{\"id\":\"header-group\",\"type\":\"group\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"alias\":\"header group\",\"visibility\":\"visible\"}},{\"id\":\"logo-1\",\"type\":\"image\",\"for\":null,\"tag\":\"IMG\",\"attrs\":{\"src\":\"\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/stockPhoto\\/84\\/29694.1.47135abcc7e84179f73c77f9e8f8af1b.PNG\",\"options\":false,\"visibility\":\"visible\",\"alias\":\"Logo\"}},{\"id\":\"block-background\",\"type\":\"background\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"bg\":\"transparent\",\"options\":false,\"alias\":\"block background\",\"src\":\"\\/js\\/ontraport\\/components\\/opt_palette_editor\\/image\\/views\\/noimage.png\"}},{\"id\":\"tagline-1\",\"type\":\"html\",\"for\":null,\"tag\":\"H3\",\"attrs\":{\"html\":\" JOIN OUR LIVE WEBINAR \",\"visibility\":\"hidden\",\"options\":false,\"help\":false,\"alias\":\"Tagline\"}},{\"id\":\"date-1\",\"type\":\"html\",\"for\":null,\"tag\":\"H1\",\"attrs\":{\"html\":\" DECEMBER 25, 2015 \\/\\/ 1:00PM PST \",\"visibility\":\"hidden\",\"options\":false,\"help\":false,\"alias\":\"Date\"}},{\"id\":\"button-1\",\"type\":\"button\",\"for\":null,\"tag\":\"A\",\"attrs\":{\"visibility\":\"hidden\",\"alias\":\"Button\",\"html\":\"\\n SIGN ME UP\\n \",\"href\":\"javascript:\\/\\/\",\"target\":\"_self\",\"file_name\":null,\"page_select\":null,\"url_type\":null,\"src\":null,\"link_background\":\"\",\"hover_bg\":\"\",\"hover_text\":\"\"}}],\"visibility\":true},{\"alias\":\"Countdown timer\",\"blockId\":\"119\",\"blockTypeId\":22,\"id\":\"b681e5f2-2c31-a251-f0f6-fa5bb76469d8\",\"path\":\"\\/js\\/ontraport\\/opt_assets\\/blocks\\/landing_page\\/119_count_down_timer\\/\",\"scripts\":\"\\/*block scripts*\\/\\n\\n$(function(){\\n var $blockStyle119 = $( \\\".block-style-119\\\" );\\n\\n \\/* Script applies a font size and line height that are 20px larger than the specified sizes. *\\/\\n $blockStyle119.each(function( index, element ) {\\n var $style = $( \\\"<style\\/>\\\" ).addClass( \\\"block-style-119-font-style\\\"),\\n $element = $( element ),\\n $countdownItem = $element.find( \\\".block-style-119__count-down-item\\\" ).first(),\\n _itemFontSize = $countdownItem.css(\\\"fontSize\\\").replace(\\\"px\\\", \\\"\\\"),\\n _itemLineHeight = $countdownItem.css(\\\"lineHeight\\\").replace(\\\"px\\\", \\\"\\\");\\n\\n _itemFontSize = +_itemFontSize + 20;\\n\\n _itemLineHeight = +_itemLineHeight + 20;\\n\\n $element.find( \\\"style.block-style-119-font-style\\\").remove();\\n\\n $element.prepend( $style.html( \\\".h1.block-style-119__count-down-item { font-size: \\\" + _itemFontSize + \\\"px; line-height: \\\" + _itemLineHeight + \\\"px; }\\\" ) );\\n\\n });\\n});\\n\\n\",\"theme\":{\"color_variation\":\"option-4\"},\"userDefinedData\":[{\"id\":\"header-1\",\"type\":\"html\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"html\":\"<span class=\\\" opt-palette-editor__text-area h3 h3 h3\\\">PAGE WILL BE READY IN :<\\/span>\\n \",\"visibility\":\"visible\",\"options\":false,\"help\":false,\"alias\":\"Header\"}},{\"id\":\"block-background\",\"type\":\"background\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"bg\":\"transparent\",\"options\":false,\"alias\":\"block background\",\"src\":\"\\/js\\/ontraport\\/components\\/opt_palette_editor\\/image\\/views\\/noimage.png\"}}],\"visibility\":true},{\"alias\":\"Smart form\",\"blockId\":\"130\",\"blockTypeId\":10,\"id\":\"bd440856-4d06-bedf-1302-eb5f220c29e9\",\"path\":\"\\/js\\/ontraport\\/opt_assets\\/blocks\\/landing_page\\/130_horizontal_text_and_form\\/\",\"scripts\":\" \\/*block scripts*\\/\",\"theme\":{\"spacing\":{\"children\":{\"~spacing\":{\"attributes\":{\"padding-bottom\":\"100px\"}}}},\"color_variation\":\"option-4\"},\"userDefinedData\":[{\"id\":\"block-background\",\"type\":\"background\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"bg\":\"transparent\",\"options\":false,\"alias\":\"block background\",\"src\":\"\\/js\\/ontraport\\/components\\/opt_palette_editor\\/image\\/views\\/noimage.png\",\"fixed-width-default\":false}},{\"id\":\"bodyText-1\",\"type\":\"html\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"html\":\"<span class=\\\" opt-palette-editor__text-area body-text body-text\\\">Enter you name & Email and we will let you know when its ready.<\\/span>\",\"visibility\":\"visible\",\"options\":false,\"help\":false,\"alias\":\"Body Text\"}}],\"visibility\":true,\"direction\":1,\"settings\":{\"opt_in_settings\":\"single\",\"conditionsCustomUrl\":\"\",\"conditionsRedirectRadioButtons\":\"default\",\"form_contacts_thank_you_page_redir\":\"0\",\"singleCustomUrl\":\"\",\"thankYouRedirectRadioButtons\":\"default\",\"singleLandPageSelect\":\"\",\"conditionsLandPageSelect\":\"\",\"conditionsPopOntraformSelect\":\"\",\"confirmation_email\":\"\",\"tags\":[],\"sequences\":[],\"rules_default\":[],\"rules_transaction_fail\":[],\"notif\":\"\",\"cookie_overide\":\"0\",\"cgi\":\"0\",\"owner\":false,\"tyPopOntraformSelect\":\"\"}}],\"settings\":{\"domain\":null,\"visits\":null,\"conversions\":null,\"design_type\":null,\"listFields\":null,\"listFieldSettings\":null,\"count\":null,\"lpsent\":null,\"lpconvert\":null,\"id\":null,\"uri_id\":null,\"rotation\":null,\"last_save\":null,\"last_auto\":null,\"autosave\":null,\"visits_0\":null,\"visits_1\":null,\"visits_2\":null,\"visits_3\":null,\"platform\":null,\"ssl_enabled\":null,\"type\":\"landing_page\",\"blocks\":null,\"block_type_id\":null,\"a_sent\":null,\"a_convert\":null,\"b_sent\":null,\"b_convert\":null,\"c_sent\":null,\"c_convert\":null,\"d_sent\":null,\"d_convert\":null,\"object_type_id\":null,\"conditionsCustomUrl\":\"\",\"singleCustomUrl\":\"\",\"page_title\":\"\",\"meta_description\":\"\",\"header_custom_script\":\"\",\"footer_custom_script\":\"\",\"favicon_uploader\":\"\\/\\/app.ontraport.com\\/favicon.ico\",\"notif\":\"\",\"owner\":\"\",\"opt_canvas\":[],\"opt_palette\":[]},\"theme\":{\"theme_font\":{\"children\":{\"h1, ~h1~h1\":{\"attributes\":{\"font-family\":\"'Dosis', sans-serif\",\"font-size\":\"96px\",\"line-height\":\"98px\",\"font-weight\":\"100\",\"font-style\":\"normal\"}},\"h2, ~h2~h2\":{\"attributes\":{\"font-family\":\"'Roboto', sans-serif\",\"font-size\":\"34px\",\"line-height\":\"36px\",\"font-weight\":\"100\",\"font-style\":\"italic\"}},\"h3, ~h3~h3\":{\"attributes\":{\"font-family\":\"'Roboto', sans-serif\",\"font-size\":\"22px\",\"line-height\":\"24px\",\"font-weight\":\"400\",\"font-style\":\"normal\"}},\"~label~label\":{\"attributes\":{\"font-family\":\"'Dosis', sans-serif\",\"font-size\":\"16px\",\"line-height\":\"18px\",\"font-weight\":\"600\",\"font-style\":\"normal\"}},\"~button~button\":{\"attributes\":{\"font-family\":\"'Dosis', sans-serif\",\"font-size\":\"22px\",\"line-height\":\"24px\",\"font-weight\":\"600\",\"font-style\":\"normal\"}},\"~large-body-text~large-body-text\":{\"attributes\":{\"font-family\":\"'Roboto', sans-serif\",\"font-size\":\"20px\",\"line-height\":\"22px\",\"font-weight\":\"400\",\"font-style\":\"normal\"}},\"~body-text~body-text\":{\"attributes\":{\"font-family\":\"'Roboto', sans-serif\",\"font-size\":\"16px\",\"line-height\":\"18px\",\"font-weight\":\"100\",\"font-style\":\"normal\"}},\"blockquote, ~blockquote\":{\"attributes\":{\"font-family\":\"'Dosis', sans-serif\",\"font-size\":\"16px\",\"line-height\":\"18px\",\"font-weight\":\"400\",\"font-style\":\"italic\"}}}},\"theme_colors\":{\"primary-color\":\"#17a4d1\",\"complimentary-color\":\"#328ed3\",\"dark-color\":\"#91cd47\",\"light-color\":\"#e9f4da\",\"white-color\":\"#ffffff\"},\"theme_background\":{\"id\":\"template-background\",\"type\":\"background\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"bg\":\"\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/stockPhoto\\/84\\/29694.1.1f36335d542d468765dd98e598ffbf9f.PNG\",\"options\":[\"backgrounds\"],\"alias\":\"background\",\"src\":\"\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/stockPhoto\\/84\\/29694.1.1f36335d542d468765dd98e598ffbf9f.PNG\"}},\"theme_spacing\":{\"children\":{\"~spacing\":{\"attributes\":{\"padding-top\":\"20px\",\"padding-bottom\":\"20px\"}}}}}},\"industries\":null,\"types\":null,\"tags\":null,\"opt_template_categories\":\" featured free\",\"id\":\"84\",\"displayObjectNotFoundErrors\":true},\"version\":\"v2\",\"mergedData\":\"<!DOCTYPE html><html><head> <!-- This page was built using ONTRApages. Create and host your pages free at ONTRApages.com or learn more about the most powerful business and marketing automation platform designed for entrepreneurs at Ontraport.com --> <meta charset=\\\"utf-8\\\"> <meta name=\\\"viewport\\\" content=\\\"width=device-width, initial-scale=1.0\\\"> <link rel=\\\"stylesheet\\\" href=\\\"\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/skeleton\\/css\\/normalize.css\\\"> <link rel=\\\"stylesheet\\\" href=\\\"\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/skeleton\\/css\\/skeleton.css\\\"> <link rel=\\\"stylesheet\\\" href=\\\"\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/skeleton\\/css\\/skeleton.ontraport.css\\\"> <link rel=\\\"stylesheet\\\" href=\\\"\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/skeleton\\/css\\/fonts.css\\\"> <link rel=\\\"stylesheet\\\" href=\\\"\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/css\\/wysihtml5-textalign.css\\\"> <!--OPT-CUSTOM-HEADER-SCRIPT--><style class=\\\"theme-style\\\">h1, .h1.h1 { font-family: 'Dosis', sans-serif; font-size: 96px; line-height: 98px; font-weight: 100; text-decoration: inherit;}h2, .h2.h2 { font-family: 'Roboto', sans-serif; font-size: 34px; line-height: 36px; font-weight: 100; font-style: italic; text-decoration: inherit;}h3, .h3.h3 { font-family: 'Roboto', sans-serif; font-size: 22px; line-height: 24px; font-weight: 400; text-decoration: inherit;}.label.label { font-family: 'Dosis', sans-serif; font-size: 16px; line-height: 18px; font-weight: 600; text-decoration: inherit;}.button.button { font-family: 'Dosis', sans-serif; font-size: 22px; line-height: 24px; font-weight: 600; text-decoration: inherit;}.large-body-text.large-body-text { font-family: 'Roboto', sans-serif; font-size: 20px; line-height: 22px; font-weight: 400; text-decoration: inherit;}.body-text.body-text { font-family: 'Roboto', sans-serif; font-size: 16px; line-height: 18px; font-weight: 100; text-decoration: inherit;}blockquote, .blockquote { font-family: 'Dosis', sans-serif; font-size: 16px; line-height: 18px; font-weight: 400; font-style: italic; text-decoration: inherit;}.bb.bb.bb { color: #91cd47;}.v.v.v { color: #ffffff;}.ak.ak.ak { background-color: #ffffff;}.i.i.i { background-color: #91cd47;}.at.at.at, .at.at.at a { color: #ffffff; background-color: #17a4d1;}.q.q.q, .q.q.q a { color: #17a4d1; background-color: #ffffff;}.aw.aw.aw { background-color: #e9f4da;}.as.as.as { border-color: #91cd47;}.al.al { color: #91cd47;}.al.al.al:hover { color: #17a4d1;}.ba.ba.ba { color: #17a4d1;}.ba.ba.ba:hover { color: #91cd47;}hr.bc.bc.bc, span.bc.bc.bc, h1.bc.bc.bc, h2.bc.bc.bc, h3.bc.bc.bc, p.bc.bc.bc, .an.an.an { color: #17a4d1;}hr.bc.bc.bc, table.bc.bc.bc, div.bc.bc.bc, a.bc.bc.bc, .x.x.x { background-color: #17a4d1;}hr.bc.bc.bc, img.bc.bc.bc, a.bc.bc.bc, div.bc.bc.bc, .aj.aj.aj { border-color: #17a4d1;}hr.am.am.am, span.am.am.am, h1.am.am.am, h2.am.am.am, h3.am.am.am, p.am.am.am, .u.u.u { color: #328ed3;}hr.am.am.am, table.am.am.am, div.am.am.am, a.am.am.am, .h.h.h { background-color: #328ed3;}hr.am.am.am, img.am.am.am, a.am.am.am, div.am.am.am, .o.o.o { border-color: #328ed3;}hr.bf.bf.bf, span.bf.bf.bf, h1.bf.bf.bf, h2.bf.bf.bf, h3.bf.bf.bf, p.bf.bf.bf, .ax.ax.ax { color: #91cd47;}hr.bf.bf.bf, table.bf.bf.bf, div.bf.bf.bf, a.bf.bf.bf, .ah.ah.ah { background-color: #91cd47;}hr.bf.bf.bf, img.bf.bf.bf, a.bf.bf.bf, div.bf.bf.bf, .aq.aq.aq { border-color: #91cd47;}hr.be.be.be, span.be.be.be, h1.be.be.be, h2.be.be.be, h3.be.be.be, p.be.be.be, .ar.ar.ar { color: #e9f4da;}hr.be.be.be, table.be.be.be, div.be.be.be, a.be.be.be, .ad.ad.ad { background-color: #e9f4da;}hr.be.be.be, img.be.be.be, a.be.be.be, div.be.be.be, .ao.ao.ao { border-color: #e9f4da;}hr.bd.bd.bd, span.bd.bd.bd, h1.bd.bd.bd, h2.bd.bd.bd, h3.bd.bd.bd, p.bd.bd.bd, .au.au.au { color: #ffffff;}hr.bd.bd.bd, table.bd.bd.bd, div.bd.bd.bd, a.bd.bd.bd, .ab.ab.ab { background-color: #ffffff;}hr.bd.bd.bd, img.bd.bd.bd, a.bd.bd.bd, div.bd.bd.bd, .ap.ap.ap { border-color: #ffffff;}a { color: #17a4d1; text-decoration: none;}a:hover { text-decoration: underline;}.spacing { padding-top: 20px; padding-bottom: 20px;}<\\/style><style class=\\\"block-theme-css\\\">.b .bb.bb.bb { color: #ffffff;}.b .v.v.v { color: #17a4d1;}.b .ak.ak.ak { background-color: #17a4d1;}.b .i.i.i { background-color: #ffffff;}.b .at.at.at,.b .at.at.at a { color: #17a4d1; background-color: #ffffff;}.b .q.q.q,.b .q.q.q a { color: #ffffff; background-color: #17a4d1;}.b .aw.aw.aw { background-color: #ffffff;}.b .as.as.as { border-color: #ffffff;}.b .al.al.al { color: #ffffff;}.b .al.al.al:hover { color: #91cd47;}.b .ba.ba.ba { color: #ffffff;}.b .ba.ba.ba:hover { color: #91cd47;}.b hr.bc.bc.bc,.b span.bc.bc.bc,.b h1.bc.bc.bc,.b h2.bc.bc.bc,.b h3.bc.bc.bc,.b p.bc.bc.bc,.b .an.an.an { color: #e9f4da;}.b hr.bc.bc.bc,.b table.bc.bc.bc,.b div.bc.bc.bc,.b a.bc.bc.bc,.b .x.x.x { background-color: #e9f4da;}.b hr.bc.bc.bc,.b img.bc.bc.bc,.b a.bc.bc.bc,.b div.bc.bc.bc,.b .aj.aj.aj { border-color: #e9f4da;}.b hr.am.am.am,.b span.am.am.am,.b h1.am.am.am,.b h2.am.am.am,.b h3.am.am.am,.b p.am.am.am,.b .u.u.u { color: #328ed3;}.b hr.am.am.am,.b table.am.am.am,.b div.am.am.am,.b a.am.am.am,.b .h.h.h { background-color: #328ed3;}.b hr.am.am.am,.b img.am.am.am,.b a.am.am.am,.b div.am.am.am,.b .o.o.o { border-color: #328ed3;}.b hr.bf.bf.bf,.b span.bf.bf.bf,.b h1.bf.bf.bf,.b h2.bf.bf.bf,.b h3.bf.bf.bf,.b p.bf.bf.bf,.b .ax.ax.ax { color: #ffffff;}.b hr.bf.bf.bf,.b table.bf.bf.bf,.b div.bf.bf.bf,.b a.bf.bf.bf,.b .ah.ah.ah { background-color: #ffffff;}.b hr.bf.bf.bf,.b img.bf.bf.bf,.b a.bf.bf.bf,.b div.bf.bf.bf,.b .aq.aq.aq { border-color: #ffffff;}.b hr.be.be.be,.b span.be.be.be,.b h1.be.be.be,.b h2.be.be.be,.b h3.be.be.be,.b p.be.be.be,.b .ar.ar.ar { color: #e9f4da;}.b hr.be.be.be,.b table.be.be.be,.b div.be.be.be,.b a.be.be.be,.b .ad.ad.ad { background-color: #e9f4da;}.b hr.be.be.be,.b img.be.be.be,.b a.be.be.be,.b div.be.be.be,.b .ao.ao.ao { border-color: #e9f4da;}.b hr.bd.bd.bd,.b span.bd.bd.bd,.b h1.bd.bd.bd,.b h2.bd.bd.bd,.b h3.bd.bd.bd,.b p.bd.bd.bd,.b .au.au.au { color: #17a4d1;}.b hr.bd.bd.bd,.b table.bd.bd.bd,.b div.bd.bd.bd,.b a.bd.bd.bd,.b .ab.ab.ab { background-color: #17a4d1;}.b hr.bd.bd.bd,.b img.bd.bd.bd,.b a.bd.bd.bd,.b div.bd.bd.bd,.b .ap.ap.ap { border-color: #17a4d1;}.b a { color: #17a4d1; text-decoration: none;}.b a:hover { text-decoration: underline;}.c .bb.bb.bb { color: #ffffff;}.c .v.v.v { color: #17a4d1;}.c .ak.ak.ak { background-color: #17a4d1;}.c .i.i.i { background-color: #ffffff;}.c .at.at.at,.c .at.at.at a { color: #17a4d1; background-color: #ffffff;}.c .q.q.q,.c .q.q.q a { color: #ffffff; background-color: #17a4d1;}.c .aw.aw.aw { background-color: #ffffff;}.c .as.as.as { border-color: #ffffff;}.c .al.al.al { color: #ffffff;}.c .al.al.al:hover { color: #91cd47;}.c .ba.ba.ba { color: #ffffff;}.c .ba.ba.ba:hover { color: #91cd47;}.c hr.bc.bc.bc,.c span.bc.bc.bc,.c h1.bc.bc.bc,.c h2.bc.bc.bc,.c h3.bc.bc.bc,.c p.bc.bc.bc,.c .an.an.an { color: #e9f4da;}.c hr.bc.bc.bc,.c table.bc.bc.bc,.c div.bc.bc.bc,.c a.bc.bc.bc,.c .x.x.x { background-color: #e9f4da;}.c hr.bc.bc.bc,.c img.bc.bc.bc,.c a.bc.bc.bc,.c div.bc.bc.bc,.c .aj.aj.aj { border-color: #e9f4da;}.c hr.am.am.am,.c span.am.am.am,.c h1.am.am.am,.c h2.am.am.am,.c h3.am.am.am,.c p.am.am.am,.c .u.u.u { color: #328ed3;}.c hr.am.am.am,.c table.am.am.am,.c div.am.am.am,.c a.am.am.am,.c .h.h.h { background-color: #328ed3;}.c hr.am.am.am,.c img.am.am.am,.c a.am.am.am,.c div.am.am.am,.c .o.o.o { border-color: #328ed3;}.c hr.bf.bf.bf,.c span.bf.bf.bf,.c h1.bf.bf.bf,.c h2.bf.bf.bf,.c h3.bf.bf.bf,.c p.bf.bf.bf,.c .ax.ax.ax { color: #ffffff;}.c hr.bf.bf.bf,.c table.bf.bf.bf,.c div.bf.bf.bf,.c a.bf.bf.bf,.c .ah.ah.ah { background-color: #ffffff;}.c hr.bf.bf.bf,.c img.bf.bf.bf,.c a.bf.bf.bf,.c div.bf.bf.bf,.c .aq.aq.aq { border-color: #ffffff;}.c hr.be.be.be,.c span.be.be.be,.c h1.be.be.be,.c h2.be.be.be,.c h3.be.be.be,.c p.be.be.be,.c .ar.ar.ar { color: #e9f4da;}.c hr.be.be.be,.c table.be.be.be,.c div.be.be.be,.c a.be.be.be,.c .ad.ad.ad { background-color: #e9f4da;}.c hr.be.be.be,.c img.be.be.be,.c a.be.be.be,.c div.be.be.be,.c .ao.ao.ao { border-color: #e9f4da;}.c hr.bd.bd.bd,.c span.bd.bd.bd,.c h1.bd.bd.bd,.c h2.bd.bd.bd,.c h3.bd.bd.bd,.c p.bd.bd.bd,.c .au.au.au { color: #17a4d1;}.c hr.bd.bd.bd,.c table.bd.bd.bd,.c div.bd.bd.bd,.c a.bd.bd.bd,.c .ab.ab.ab { background-color: #17a4d1;}.c hr.bd.bd.bd,.c img.bd.bd.bd,.c a.bd.bd.bd,.c div.bd.bd.bd,.c .ap.ap.ap { border-color: #17a4d1;}.c a { color: #17a4d1; text-decoration: none;}.c a:hover { text-decoration: underline;}.a .spacing { padding-bottom: 100px;}.a .bb.bb.bb { color: #ffffff;}.a .v.v.v { color: #17a4d1;}.a .ak.ak.ak { background-color: #17a4d1;}.a .i.i.i { background-color: #ffffff;}.a .at.at.at,.a .at.at.at a { color: #17a4d1; background-color: #ffffff;}.a .q.q.q,.a .q.q.q a { color: #ffffff; background-color: #17a4d1;}.a .aw.aw.aw { background-color: #ffffff;}.a .as.as.as { border-color: #ffffff;}.a .al.al.al { color: #ffffff;}.a .al.al.al:hover { color: #91cd47;}.a .ba.ba.ba { color: #ffffff;}.a .ba.ba.ba:hover { color: #91cd47;}.a hr.bc.bc.bc,.a span.bc.bc.bc,.a h1.bc.bc.bc,.a h2.bc.bc.bc,.a h3.bc.bc.bc,.a p.bc.bc.bc,.a .an.an.an { color: #e9f4da;}.a hr.bc.bc.bc,.a table.bc.bc.bc,.a div.bc.bc.bc,.a a.bc.bc.bc,.a .x.x.x { background-color: #e9f4da;}.a hr.bc.bc.bc,.a img.bc.bc.bc,.a a.bc.bc.bc,.a div.bc.bc.bc,.a .aj.aj.aj { border-color: #e9f4da;}.a hr.am.am.am,.a span.am.am.am,.a h1.am.am.am,.a h2.am.am.am,.a h3.am.am.am,.a p.am.am.am,.a .u.u.u { color: #328ed3;}.a hr.am.am.am,.a table.am.am.am,.a div.am.am.am,.a a.am.am.am,.a .h.h.h { background-color: #328ed3;}.a hr.am.am.am,.a img.am.am.am,.a a.am.am.am,.a div.am.am.am,.a .o.o.o { border-color: #328ed3;}.a hr.bf.bf.bf,.a span.bf.bf.bf,.a h1.bf.bf.bf,.a h2.bf.bf.bf,.a h3.bf.bf.bf,.a p.bf.bf.bf,.a .ax.ax.ax { color: #ffffff;}.a hr.bf.bf.bf,.a table.bf.bf.bf,.a div.bf.bf.bf,.a a.bf.bf.bf,.a .ah.ah.ah { background-color: #ffffff;}.a hr.bf.bf.bf,.a img.bf.bf.bf,.a a.bf.bf.bf,.a div.bf.bf.bf,.a .aq.aq.aq { border-color: #ffffff;}.a hr.be.be.be,.a span.be.be.be,.a h1.be.be.be,.a h2.be.be.be,.a h3.be.be.be,.a p.be.be.be,.a .ar.ar.ar { color: #e9f4da;}.a hr.be.be.be,.a table.be.be.be,.a div.be.be.be,.a a.be.be.be,.a .ad.ad.ad { background-color: #e9f4da;}.a hr.be.be.be,.a img.be.be.be,.a a.be.be.be,.a div.be.be.be,.a .ao.ao.ao { border-color: #e9f4da;}.a hr.bd.bd.bd,.a span.bd.bd.bd,.a h1.bd.bd.bd,.a h2.bd.bd.bd,.a h3.bd.bd.bd,.a p.bd.bd.bd,.a .au.au.au { color: #17a4d1;}.a hr.bd.bd.bd,.a table.bd.bd.bd,.a div.bd.bd.bd,.a a.bd.bd.bd,.a .ab.ab.ab { background-color: #17a4d1;}.a hr.bd.bd.bd,.a img.bd.bd.bd,.a a.bd.bd.bd,.a div.bd.bd.bd,.a .ap.ap.ap { border-color: #17a4d1;}.a a { color: #17a4d1; text-decoration: none;}.a a:hover { text-decoration: underline;}<\\/style><link rel=\\\"shortcut icon\\\" type=\\\"image\\/x-icon\\\" href=\\\"\\/\\/app.ontraport.com\\/favicon.ico\\\"><link rel=\\\"dns-prefetch\\\" href=\\\"https:\\/\\/optassets.ontraport.com\\\"><link rel=\\\"dns-prefetch\\\" href=\\\"\\/\\/ajax.googleapis.com\\\"><link rel=\\\"dns-prefetch\\\" href=\\\"\\/\\/app.ontraport.com\\\"><link rel=\\\"dns-prefetch\\\" href=\\\"\\/\\/optassets.ontraport.com\\\"><\\/head><body> <div class=\\\"opt-container\\\" opt-id=\\\"template-background\\\" opt-type=\\\"background\\\" style=\\\"background-size: cover; background-image: url("https:\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/stockPhoto\\/84\\/29694.1.1f36335d542d468765dd98e598ffbf9f.PNG");\\\" opt-options=\\\"["backgrounds"]\\\" opt-alias=\\\"background\\\"><div><div class=\\\"row b\\\" opt-id=\\\"527f664f-a6a4-8e9d-634e-26c041d2bee5\\\" opt-type=\\\"block\\\" opt-block-type-id=\\\"3\\\" opt-block-style-id=\\\"20\\\"><div class=\\\"block-style\\\"><style class=\\\"block-css\\\">\\/*block styles*\\/ .az { text-align: center; width: 100%; background-position: center center;} .af { max-width: 100%;} .ac,.s,.z,.p { margin-bottom: 20px;} .l { padding: 40px 0;} .r { margin-bottom: 40px; margin-top:0;}.j { margin-bottom: 0;} .r,.j { border: 0; height: 1px;} .w { display: block;} .ae { margin-top: 30px; padding-top: 15px; padding-bottom: 15px; min-width: 150px;}<\\/style> <div class=\\\"block-wrapper az ak spacing\\\" style=\\\"background-color: transparent; background-image: none;\\\"> <div class=\\\"container body-text\\\"> <div aria-description=\\\"Event Banner\\\"> <img src=\\\"https:\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/stockPhoto\\/84\\/29694.1.47135abcc7e84179f73c77f9e8f8af1b.PNG\\\" class=\\\"af\\\"> <div class=\\\"l\\\"> <hr class=\\\"ah r\\\"> <div class=\\\"ac bb\\\"><span class=\\\"h1\\\">COMING SOON<\\/span><\\/div> <div class=\\\"s bb\\\"><span class=\\\" opt-palette-editor__text-area h2 h2 h2\\\">Yes you're on the right page, but its not quite ready.<\\/span><\\/div> <hr class=\\\"ah j\\\"> <\\/div> <\\/div> <\\/div><\\/div> <\\/div><\\/div><div class=\\\"row c\\\" opt-id=\\\"b681e5f2-2c31-a251-f0f6-fa5bb76469d8\\\" opt-type=\\\"block\\\" opt-block-type-id=\\\"22\\\" opt-block-style-id=\\\"119\\\"><div class=\\\"block-style\\\"><style class=\\\"block-css\\\">\\/*block styles*\\/ .aa { max-width: 100%; margin-bottom: 10px;} .d { display: block;} .f { list-style: none; max-width: 85%; margin-left: auto; margin-right: auto; word-wrap: break-word;} .f li { display: inline-block; margin-right: 30px; min-width: 125px;} .g { margin-bottom: 0;}<\\/style> <div class=\\\"block-wrapper ak block-style-119 spacing\\\" style=\\\"background-color: transparent; background-image: none;\\\"> <div class=\\\"container opt-center\\\"> <div class=\\\"aa bb\\\"><span class=\\\" opt-palette-editor__text-area h3 h3 h3\\\">PAGE WILL BE READY IN :<\\/span> <\\/div> <ontraport-countdown month=\\\"5\\\" redirect_href=\\\"#\\\" class=\\\"d countdown\\\" day=\\\"12\\\" then=\\\"1494572400000\\\"> <ul class=\\\"f\\\"> <li><p class=\\\"ce-days bb h1 g\\\">29<\\/p> <span class=\\\"bb h3\\\">DAYS<\\/span><\\/li> <li><p class=\\\"ce-hours bb h1 g\\\">14<\\/p> <span class=\\\"bb h3\\\">HOURS<\\/span><\\/li> <li><p class=\\\"ce-minutes bb h1 g\\\">16<\\/p> <span class=\\\"bb h3\\\">MINUTES<\\/span><\\/li> <li><p class=\\\"ce-seconds bb h1 g\\\">34<\\/p> <span class=\\\"bb h3\\\">SECONDS<\\/span><\\/li> <\\/ul> <\\/ontraport-countdown> <\\/div><\\/div> <\\/div><\\/div><div class=\\\"row a\\\" opt-id=\\\"bd440856-4d06-bedf-1302-eb5f220c29e9\\\" opt-type=\\\"block\\\" opt-block-type-id=\\\"10\\\" opt-block-style-id=\\\"130\\\"><div class=\\\"block-style\\\"><style class=\\\"block-css\\\">.k { display: none;} .ay { display: inline;} .t { margin-right: 5px; position: relative; top: -1px;} .ai { margin-bottom: 25px;} .ag { margin-bottom: 0;} .m { display: inline-block; margin-right: 1%; width: 35%; vertical-align: top;} .n { display: inline;} .e { display: inline-block;} .y input[type=\\\"email\\\"], .y input[type=\\\"number\\\"], .y input[type=\\\"search\\\"], .y input[type=\\\"text\\\"], .y input[type=\\\"tel\\\"], .y input[type=\\\"url\\\"], .y input[type=\\\"password\\\"], .y input[type=\\\"date\\\"], .y textarea,.y select { width: 100%; display: inline-block;} .av label { word-wrap: break-word;} .y input[type=\\\"submit\\\"].button-style { padding: 0 20px; border-radius: 3px; text-decoration: none; letter-spacing: inherit; text-transform: none; border: 0; height: 38px; line-height: 1; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; vertical-align: middle; -webkit-transition: opacity .4s ease-in-out; transition: opacity .4s ease-in-out;}.y input[type=\\\"submit\\\"].button-style:hover { opacity: .9;} @media (max-width: 1200px) { .block-style-130__columns.block-style-130__columns { text-align: center; width: 100%; } .m { width: 24%; }} @media (max-width: 549px) { .m { width: 100%; } }.opt-page-size-mobile .m { width: 100%;} <\\/style> <div class=\\\"block-wrapper block-style-130 ak spacing\\\" style=\\\"background-color: transparent; background-image: none;\\\"> <div class=\\\"container\\\"> <div class=\\\"y\\\"> <div class=\\\"row\\\"> <div class=\\\"six columns block-style-130__columns\\\"> <div class=\\\"ai bb\\\"><span class=\\\" opt-palette-editor__text-area body-text body-text\\\">Enter you name & Email and we will let you know when its ready.<\\/span><\\/div> <\\/div> <div class=\\\"six columns block-style-130__columns\\\"> <form role=\\\"form\\\" accept-charset=\\\"UTF-8\\\" method=\\\"post\\\" action=\\\"[system_form_processor_bd440856-4d06-bedf-1302-eb5f220c29e9]\\\" class=\\\"ag opt-center\\\"> <div class=\\\"n\\\"> <div class=\\\"m\\\"> <label class=\\\"bb label k\\\" for=\\\"firstname\\\" opt-for=\\\"firstname-input\\\">First Name<\\/label> <input class=\\\"aw\\\" type=\\\"text\\\" name=\\\"firstname\\\" id=\\\"firstname\\\" placeholder=\\\"First Name\\\"> <\\/div> <div class=\\\"m\\\"> <label class=\\\"bb label k\\\" for=\\\"email\\\" opt-for=\\\"email-input\\\">Email<\\/label> <input class=\\\"aw\\\" type=\\\"email\\\" name=\\\"email\\\" id=\\\"email\\\" placeholder=\\\"Email\\\" required=\\\"required\\\"> <\\/div> <\\/div> <div class=\\\"e\\\"> <input type=\\\"submit\\\" value=\\\"Submit\\\" class=\\\"button button-style at\\\"> <\\/div> <span style=\\\"display: none;\\\">[system_form_fields_bd440856-4d06-bedf-1302-eb5f220c29e9]<\\/span> <\\/form> <\\/div> <\\/div> <\\/div> <\\/div> <\\/div> <\\/div><\\/div><\\/div> <!--OPT-AD-BLOCK-HERE--> <\\/div> <script src=\\\"\\/\\/ajax.googleapis.com\\/ajax\\/libs\\/jquery\\/1.7.1\\/jquery.min.js\\\"><\\/script> <script class=\\\"opt-page-script\\\" type=\\\"text\\/javascript\\\" src=\\\"https:\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/jQueryPageBackgroundPro\\/js\\/libs\\/underscore.js\\\"><\\/script> <span style=\\\"display: none;\\\" class=\\\"opt-system-scripts\\\">[system_scripts]<\\/span> <span style=\\\"display: none;\\\" class=\\\"opt-form-scripts\\\">[system_form_scripts]<\\/span> <script type=\\\"text\\/javascript\\\" class=\\\"opt-page-script opt-form-scripts\\\" src=\\\"https:\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/jQueryCloneVal\\/jquery-cloneVal.js\\\"><\\/script> <script src=\\\"\\/\\/app.ontraport.com\\/js\\/globalize\\/globalize.js\\\"><\\/script> <script type=\\\"text\\/javascript\\\" class=\\\"opt-page-script opt-document-register-element-driver\\\" src=\\\"https:\\/\\/optassets.ontraport.com\\/opt_assets\\/templates\\/custom-elements\\/document-register-element\\/build\\/document-register-element.js\\\"><\\/script> <script type=\\\"text\\/javascript\\\" class=\\\"opt-page-script opt-countdown-script\\\" src=\\\"https:\\/\\/optassets.ontraport.com\\/opt_assets\\/templates\\/custom-elements\\/countdown\\/countdown.js\\\"><\\/script> <span style=\\\"display: none;\\\">[bot_catcher]<\\/span> <!--OPT-CUSTOM-FOOTER-SCRIPT--><script> <\\/script><\\/body><\\/html>\",\"formBlockIds\":[\"bd440856-4d06-bedf-1302-eb5f220c29e9\"]},{\"templateId\":false,\"status\":false,\"blocks\":[],\"settings\":{\"favicon_uploader\":\"\\/\\/app.ontraport.com\\/favicon.png\"},\"theme\":{\"theme_font\":{\"children\":{\"h1, ~h1~h1\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"50px\",\"line-height\":\"50px\",\"font-weight\":\"100\",\"font-style\":\"normal\"}},\"h2, ~h2~h2\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"30px\",\"line-height\":\"32px\",\"font-weight\":\"400\",\"font-style\":\"normal\"}},\"h3, ~h3~h3\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"20px\",\"line-height\":\"20px\",\"font-weight\":\"900\",\"font-style\":\"normal\"}},\"~label~label\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"16px\",\"line-height\":\"16px\",\"font-weight\":\"300\",\"font-style\":\"normal\"}},\"~button~button\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"14px\",\"line-height\":\"14px\",\"font-weight\":\"600\",\"font-style\":\"normal\"}},\"~large-body-text~large-body-text\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"18px\",\"line-height\":\"24px\",\"font-weight\":\"100\",\"font-style\":\"normal\"}},\"~body-text~body-text\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"14px\",\"line-height\":\"22px\",\"font-weight\":\"300\",\"font-style\":\"normal\"}},\"blockquote, ~blockquote\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"14px\",\"line-height\":\"22px\",\"font-weight\":\"100\",\"font-style\":\"italic\"}}}},\"theme_colors\":{\"primary-color\":\"#1e88e5\",\"complimentary-color\":\"#41baff\",\"dark-color\":\"#333333\",\"light-color\":\"#f3efea\",\"white-color\":\"#ffffff\"},\"theme_background\":{\"id\":\"template-background\",\"type\":\"background\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"bg\":\"#ffffff\",\"options\":[\"backgrounds\"],\"alias\":\"background\"}},\"theme_spacing\":{\"children\":{\"~spacing\":{\"attributes\":{\"padding-top\":\"20px\",\"padding-bottom\":\"20px\"}}}},\"theme_dimensions\":{\"widthType\":\"option\",\"width\":\"100%\",\"height\":null},\"border\":{\"color\":\"#000000\",\"size\":\"0px\"}},\"mergedData\":\"\",\"formBlockIds\":[]},{\"templateId\":false,\"status\":false,\"blocks\":[],\"settings\":{\"favicon_uploader\":\"\\/\\/app.ontraport.com\\/favicon.png\"},\"theme\":{\"theme_font\":{\"children\":{\"h1, ~h1~h1\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"50px\",\"line-height\":\"50px\",\"font-weight\":\"100\",\"font-style\":\"normal\"}},\"h2, ~h2~h2\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"30px\",\"line-height\":\"32px\",\"font-weight\":\"400\",\"font-style\":\"normal\"}},\"h3, ~h3~h3\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"20px\",\"line-height\":\"20px\",\"font-weight\":\"900\",\"font-style\":\"normal\"}},\"~label~label\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"16px\",\"line-height\":\"16px\",\"font-weight\":\"300\",\"font-style\":\"normal\"}},\"~button~button\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"14px\",\"line-height\":\"14px\",\"font-weight\":\"600\",\"font-style\":\"normal\"}},\"~large-body-text~large-body-text\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"18px\",\"line-height\":\"24px\",\"font-weight\":\"100\",\"font-style\":\"normal\"}},\"~body-text~body-text\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"14px\",\"line-height\":\"22px\",\"font-weight\":\"300\",\"font-style\":\"normal\"}},\"blockquote, ~blockquote\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"14px\",\"line-height\":\"22px\",\"font-weight\":\"100\",\"font-style\":\"italic\"}}}},\"theme_colors\":{\"primary-color\":\"#1e88e5\",\"complimentary-color\":\"#41baff\",\"dark-color\":\"#333333\",\"light-color\":\"#f3efea\",\"white-color\":\"#ffffff\"},\"theme_background\":{\"id\":\"template-background\",\"type\":\"background\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"bg\":\"#ffffff\",\"options\":[\"backgrounds\"],\"alias\":\"background\"}},\"theme_spacing\":{\"children\":{\"~spacing\":{\"attributes\":{\"padding-top\":\"20px\",\"padding-bottom\":\"20px\"}}}},\"theme_dimensions\":{\"widthType\":\"option\",\"width\":\"100%\",\"height\":null},\"border\":{\"color\":\"#000000\",\"size\":\"0px\"}},\"mergedData\":\"\",\"formBlockIds\":[]},{\"templateId\":false,\"status\":false,\"blocks\":[],\"settings\":{\"favicon_uploader\":\"\\/\\/app.ontraport.com\\/favicon.png\"},\"theme\":{\"theme_font\":{\"children\":{\"h1, ~h1~h1\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"50px\",\"line-height\":\"50px\",\"font-weight\":\"100\",\"font-style\":\"normal\"}},\"h2, ~h2~h2\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"30px\",\"line-height\":\"32px\",\"font-weight\":\"400\",\"font-style\":\"normal\"}},\"h3, ~h3~h3\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"20px\",\"line-height\":\"20px\",\"font-weight\":\"900\",\"font-style\":\"normal\"}},\"~label~label\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"16px\",\"line-height\":\"16px\",\"font-weight\":\"300\",\"font-style\":\"normal\"}},\"~button~button\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"14px\",\"line-height\":\"14px\",\"font-weight\":\"600\",\"font-style\":\"normal\"}},\"~large-body-text~large-body-text\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"18px\",\"line-height\":\"24px\",\"font-weight\":\"100\",\"font-style\":\"normal\"}},\"~body-text~body-text\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"14px\",\"line-height\":\"22px\",\"font-weight\":\"300\",\"font-style\":\"normal\"}},\"blockquote, ~blockquote\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"14px\",\"line-height\":\"22px\",\"font-weight\":\"100\",\"font-style\":\"italic\"}}}},\"theme_colors\":{\"primary-color\":\"#1e88e5\",\"complimentary-color\":\"#41baff\",\"dark-color\":\"#333333\",\"light-color\":\"#f3efea\",\"white-color\":\"#ffffff\"},\"theme_background\":{\"id\":\"template-background\",\"type\":\"background\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"bg\":\"#ffffff\",\"options\":[\"backgrounds\"],\"alias\":\"background\"}},\"theme_spacing\":{\"children\":{\"~spacing\":{\"attributes\":{\"padding-top\":\"20px\",\"padding-bottom\":\"20px\"}}}},\"theme_dimensions\":{\"widthType\":\"option\",\"width\":\"100%\",\"height\":null},\"border\":{\"color\":\"#000000\",\"size\":\"0px\"}},\"mergedData\":\"\",\"formBlockIds\":[]}]",
"design_type": "3",
"name": "Welcome",
"seo_settings": "[{},{},{},{}]",
"rotation": "0",
"last_save": "0",
"last_auto": "0",
"autosave": "",
"visits_0": "0",
"visits_1": "0",
"visits_2": "0",
"visits_3": "0",
"platform": "0",
"unique_visits_0": "0",
"unique_visits_1": "0",
"unique_visits_2": "0",
"unique_visits_3": "0",
"convert_0": "0",
"convert_1": "0",
"convert_2": "0",
"convert_3": "0",
"unique_convert_0": "0",
"unique_convert_1": "0",
"unique_convert_2": "0",
"unique_convert_3": "0",
"domain": null,
"ssl_enabled": "0",
"date": "1510704945",
"dlm": "1510704945"
}
Landing page attributes
Attribute | Type | Description |
---|---|---|
id |
integer | The landing page's ID. |
uri_id |
integer | The hosted URL's ID. |
resource |
blob | JSON encoded data containing the entire structure of the landing page. |
design_type |
integer | The landing page's design type. Integer codes are mapped as follows:0 => HTML 1 => Code Mode 2 => Redirect 3 => ONTRApages |
name |
string | The landing page's name. |
seo_settings |
string | The landing page's settings for search engine optimization. A JSON array with four indices that correspond to split test A, B, C, and D to store the page's title, meta description, and whether or not to disable search engines from indexing the landing page. |
rotation |
integer | If using split testing, the ID of the next split test in line for rotation. |
last_save |
timestamp | The time and date the landing page was last manually saved. |
last_auto |
timestamp | The time and date the landing page was last automatically saved. |
autosave |
longtext | The content of the last autosaved data. |
visits_0 |
integer | The count of visits for split test A. |
visits_1 |
integer | The count of visits for split test B. |
visits_2 |
integer | The count of visits for split test C. |
visits_3 |
integer | The count of visits for split test D. |
unique_visits_0 |
integer | The count of unique user visits per session for split test A. |
unique_visits_1 |
integer | The count of unique user visits per session for split test B. |
unique_visits_2 |
integer | The count of unique user visits per session for split test C. |
unique_visits_3 |
integer | The count of unique user visits per session for split test D. |
convert_0 |
integer | The number of contacts that opted in from a selected landing page or submitted a form in split test A |
convert_1 |
integer | The number of contacts that opted in from a selected landing page or submitted a form in split test B |
convert_2 |
integer | The number of contacts that opted in from a selected landing page or submitted a form in split test C |
convert_3 |
integer | The number of contacts that opted in from a selected landing page or submitted a form in split test D |
unique_convert_0 |
integer | The percentage of contacts that opted in during a unique session divided by the number of unique visits for split test A. |
unique_convert_1 |
integer | The percentage of contacts that opted in during a unique session divided by the number of unique visits for split test B. |
unique_convert_2 |
integer | The percentage of contacts that opted in during a unique session divided by the number of unique visits for split test C. |
unique_convert_3 |
integer | The percentage of contacts that opted in during a unique session divided by the number of unique visits for split test D. |
domain |
string | The URL where the landing page is hosted. |
ssl_enabled |
integer | A flag designating whether or not ssl certification is enabled. Values can be 0 or 1 . |
date |
timestamp | The date and time the landing page was created measured in seconds from the Unix Epoch. Note that this field will not contain data for any forms created prior to November 7, 2017. |
dlm |
timestamp | The data and time the landing page was last modified measured in seconds from the Unix Epoch. |
Retrieve a specific landing page
curl -X GET 'https://api.ontraport.com/1/LandingPage?id=1' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 1
);
$response = $client->landingpage()->retrieveSingle($requestParams);
Example Response:
{
"code": 0,
"data": {
"id": "1",
"uri_id": null,
"resource": "[{\"templateId\":84,\"status\":true,\"blocks\":[{\"alias\":\"Banner\",\"blockId\":\"20\",\"blockTypeId\":3,\"id\":\"527f664f-a6a4-8e9d-634e-26c041d2bee5\",\"path\":\"\\/js\\/ontraport\\/opt_assets\\/blocks\\/landing_page\\/20_event_banner\\/\",\"scripts\":\" \\/*block scripts*\\/\",\"theme\":{\"color_variation\":\"option-4\"},\"userDefinedData\":[{\"id\":\"header-1\",\"type\":\"html\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"html\":\"<span class=\\\"h1\\\">COMING SOON<\\/span>\",\"visibility\":\"visible\",\"options\":false,\"help\":false,\"alias\":\"Header\"}},{\"id\":\"subHeader-1\",\"type\":\"html\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"html\":\"<span class=\\\" opt-palette-editor__text-area h2 h2 h2\\\">Yes you're on the right page, but its not quite ready.<\\/span>\",\"visibility\":\"visible\",\"options\":false,\"help\":false,\"alias\":\"Sub-Header\"}},{\"id\":\"header-group\",\"type\":\"group\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"alias\":\"header group\",\"visibility\":\"visible\"}},{\"id\":\"logo-1\",\"type\":\"image\",\"for\":null,\"tag\":\"IMG\",\"attrs\":{\"src\":\"\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/stockPhoto\\/84\\/29694.1.47135abcc7e84179f73c77f9e8f8af1b.PNG\",\"options\":false,\"visibility\":\"visible\",\"alias\":\"Logo\"}},{\"id\":\"block-background\",\"type\":\"background\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"bg\":\"transparent\",\"options\":false,\"alias\":\"block background\",\"src\":\"\\/js\\/ontraport\\/components\\/opt_palette_editor\\/image\\/views\\/noimage.png\"}},{\"id\":\"tagline-1\",\"type\":\"html\",\"for\":null,\"tag\":\"H3\",\"attrs\":{\"html\":\" JOIN OUR LIVE WEBINAR \",\"visibility\":\"hidden\",\"options\":false,\"help\":false,\"alias\":\"Tagline\"}},{\"id\":\"date-1\",\"type\":\"html\",\"for\":null,\"tag\":\"H1\",\"attrs\":{\"html\":\" DECEMBER 25, 2015 \\/\\/ 1:00PM PST \",\"visibility\":\"hidden\",\"options\":false,\"help\":false,\"alias\":\"Date\"}},{\"id\":\"button-1\",\"type\":\"button\",\"for\":null,\"tag\":\"A\",\"attrs\":{\"visibility\":\"hidden\",\"alias\":\"Button\",\"html\":\"\\n SIGN ME UP\\n \",\"href\":\"javascript:\\/\\/\",\"target\":\"_self\",\"file_name\":null,\"page_select\":null,\"url_type\":null,\"src\":null,\"link_background\":\"\",\"hover_bg\":\"\",\"hover_text\":\"\"}}],\"visibility\":true,\"permissionLevel\":\"free\"},{\"alias\":\"Countdown timer\",\"blockId\":\"119\",\"blockTypeId\":22,\"id\":\"b681e5f2-2c31-a251-f0f6-fa5bb76469d8\",\"path\":\"\\/js\\/ontraport\\/opt_assets\\/blocks\\/landing_page\\/119_count_down_timer\\/\",\"scripts\":\"\\/*block scripts*\\/\\n\\n\",\"theme\":{\"color_variation\":\"option-4\"},\"userDefinedData\":[{\"id\":\"header-1\",\"type\":\"html\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"html\":\"<span class=\\\" opt-palette-editor__text-area h3 h3 h3\\\">PAGE WILL BE READY IN :<\\/span>\\n \",\"visibility\":\"visible\",\"options\":false,\"help\":false,\"alias\":\"Header\"}},{\"id\":\"block-background\",\"type\":\"background\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"bg\":\"transparent\",\"options\":false,\"alias\":\"block background\",\"src\":\"\\/js\\/ontraport\\/components\\/opt_palette_editor\\/image\\/views\\/noimage.png\"}}],\"visibility\":true,\"permissionLevel\":\"premium\"},{\"alias\":\"Smart form\",\"blockId\":\"130\",\"blockTypeId\":10,\"id\":\"bd440856-4d06-bedf-1302-eb5f220c29e9\",\"path\":\"\\/js\\/ontraport\\/opt_assets\\/blocks\\/landing_page\\/130_horizontal_text_and_form\\/\",\"scripts\":\" \\/*block scripts*\\/\",\"theme\":{\"spacing\":{\"children\":{\"~spacing\":{\"attributes\":{\"padding-bottom\":\"100px\"}}}},\"color_variation\":\"option-4\"},\"userDefinedData\":[{\"id\":\"block-background\",\"type\":\"background\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"bg\":\"transparent\",\"options\":false,\"alias\":\"block background\",\"src\":\"\\/js\\/ontraport\\/components\\/opt_palette_editor\\/image\\/views\\/noimage.png\",\"fixed-width-default\":false}},{\"id\":\"bodyText-1\",\"type\":\"html\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"html\":\"<span class=\\\" opt-palette-editor__text-area body-text body-text\\\">Enter you name & Email and we will let you know when its ready.<\\/span>\",\"visibility\":\"visible\",\"options\":false,\"help\":false,\"alias\":\"Body Text\"}}],\"visibility\":true,\"direction\":1,\"settings\":{\"opt_in_settings\":\"single\",\"conditionsCustomUrl\":\"\",\"conditionsRedirectRadioButtons\":\"default\",\"form_contacts_thank_you_page_redir\":\"0\",\"singleCustomUrl\":\"\",\"thankYouRedirectRadioButtons\":\"default\",\"singleLandPageSelect\":\"\",\"conditionsLandPageSelect\":\"\",\"conditionsPopOntraformSelect\":\"\",\"confirmation_email\":\"\",\"tags\":[],\"sequences\":[],\"rules_default\":[],\"rules_transaction_fail\":[],\"notif\":\"\",\"cookie_overide\":\"0\",\"cgi\":\"0\",\"owner\":false,\"tyPopOntraformSelect\":\"\"},\"permissionLevel\":\"free\"}],\"settings\":{\"domain\":null,\"visits\":null,\"conversions\":null,\"design_type\":null,\"object_type_id\":null,\"listFields\":null,\"listFieldSettings\":null,\"count\":null,\"lpsent\":null,\"lpconvert\":null,\"id\":null,\"uri_id\":null,\"rotation\":null,\"last_save\":null,\"last_auto\":null,\"autosave\":null,\"visits_0\":null,\"visits_1\":null,\"visits_2\":null,\"visits_3\":null,\"platform\":null,\"ssl_enabled\":null,\"blocks\":null,\"block_type_id\":null,\"a_sent\":null,\"a_convert\":null,\"b_sent\":null,\"b_convert\":null,\"c_sent\":null,\"c_convert\":null,\"d_sent\":null,\"d_convert\":null,\"conditionsCustomUrl\":\"\",\"singleCustomUrl\":\"\",\"notif\":\"\",\"owner\":\"\",\"ontraformInstanceTimedOrUserScroll\":{\"opfActiveCheckbox\":\"0\",\"opfSettings\":{\"popPositionValue\":\"mc\",\"onScrollTo\":\"0\",\"onScrollToValue\":\"45\",\"onVisitDuration\":\"0\",\"onVisitDurationValue\":\"2\",\"filloutRestrictions\":\"0\",\"frequencyRestrictions\":\"1\",\"frequencyRestrictionsMaxTriggers\":2,\"frequencyRestrictionsTimeframe\":1}},\"ontraformInstanceExitIntent\":{\"opfActiveCheckbox\":\"0\",\"opfSettings\":{\"popPositionValue\":\"mc\",\"filloutRestrictions\":\"0\",\"frequencyRestrictions\":\"1\",\"frequencyRestrictionsMaxTriggers\":2,\"frequencyRestrictionsTimeframe\":1}},\"page_title\":\"\",\"meta_description\":\"\",\"header_custom_script\":\"\",\"footer_custom_script\":\"\",\"favicon_uploader\":\"\\/\\/app.ontraport.com\\/favicon.ico\",\"sort_items\":\"newest\",\"search_items\":{\"search\":\"\"}},\"theme\":{\"theme_font\":{\"children\":{\"h1, ~h1~h1\":{\"attributes\":{\"font-family\":\"'Dosis', sans-serif\",\"font-size\":\"96px\",\"line-height\":\"98px\",\"font-weight\":\"100\",\"font-style\":\"normal\"}},\"h2, ~h2~h2\":{\"attributes\":{\"font-family\":\"'Roboto', sans-serif\",\"font-size\":\"34px\",\"line-height\":\"36px\",\"font-weight\":\"100\",\"font-style\":\"italic\"}},\"h3, ~h3~h3\":{\"attributes\":{\"font-family\":\"'Roboto', sans-serif\",\"font-size\":\"22px\",\"line-height\":\"24px\",\"font-weight\":\"400\",\"font-style\":\"normal\"}},\"~label~label\":{\"attributes\":{\"font-family\":\"'Dosis', sans-serif\",\"font-size\":\"16px\",\"line-height\":\"18px\",\"font-weight\":\"600\",\"font-style\":\"normal\"}},\"~button~button\":{\"attributes\":{\"font-family\":\"'Dosis', sans-serif\",\"font-size\":\"22px\",\"line-height\":\"24px\",\"font-weight\":\"600\",\"font-style\":\"normal\"}},\"~large-body-text~large-body-text\":{\"attributes\":{\"font-family\":\"'Roboto', sans-serif\",\"font-size\":\"20px\",\"line-height\":\"22px\",\"font-weight\":\"400\",\"font-style\":\"normal\"}},\"~body-text~body-text\":{\"attributes\":{\"font-family\":\"'Roboto', sans-serif\",\"font-size\":\"16px\",\"line-height\":\"18px\",\"font-weight\":\"100\",\"font-style\":\"normal\"}},\"blockquote, ~blockquote\":{\"attributes\":{\"font-family\":\"'Dosis', sans-serif\",\"font-size\":\"16px\",\"line-height\":\"18px\",\"font-weight\":\"400\",\"font-style\":\"italic\"}}}},\"theme_colors\":{\"primary-color\":\"#17a4d1\",\"complimentary-color\":\"#328ed3\",\"dark-color\":\"#91cd47\",\"light-color\":\"#e9f4da\",\"white-color\":\"#ffffff\"},\"theme_background\":{\"id\":\"template-background\",\"type\":\"background\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"bg\":\"\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/stockPhoto\\/84\\/29694.1.1f36335d542d468765dd98e598ffbf9f.PNG\",\"options\":[\"backgrounds\"],\"alias\":\"background\",\"src\":\"\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/stockPhoto\\/84\\/29694.1.1f36335d542d468765dd98e598ffbf9f.PNG\"}},\"theme_spacing\":{\"children\":{\"~spacing\":{\"attributes\":{\"padding-top\":\"20px\",\"padding-bottom\":\"20px\"}}}}},\"templateData\":{\"account_id\":\"0\",\"remote_item_id\":\"0\",\"status\":\"approved\",\"share_type\":\"marketplace\",\"share_subtype\":\"free\",\"purchase_conditions\":\"\",\"featured\":\"1\",\"name\":\"Launchpad\",\"price\":\"0.00\",\"type\":\"Landing Page\",\"date\":\"1441818555\",\"date_approved\":\"0\",\"approved_by\":\"0\",\"dlm\":\"1445879184\",\"description\":\"Start the countdown with Launchpad. This template is a single, above the fold page that highlights a countdown timer, an icon image, a few lines of copy and a contact form.\",\"thumbnail\":\"https:\\/\\/app.ontraport.com\\/js\\/ontraport\\/opt_assets\\/templates\\/template_thumbs\\/84_thumbnail.png\",\"resource\":{\"templateId\":84,\"status\":true,\"blocks\":[{\"alias\":\"Banner\",\"blockId\":\"20\",\"blockTypeId\":3,\"id\":\"527f664f-a6a4-8e9d-634e-26c041d2bee5\",\"path\":\"\\/js\\/ontraport\\/opt_assets\\/blocks\\/landing_page\\/20_event_banner\\/\",\"scripts\":\" \\/*block scripts*\\/\",\"theme\":{\"color_variation\":\"option-4\"},\"userDefinedData\":[{\"id\":\"header-1\",\"type\":\"html\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"html\":\"<span class=\\\"h1\\\">COMING SOON<\\/span>\",\"visibility\":\"visible\",\"options\":false,\"help\":false,\"alias\":\"Header\"}},{\"id\":\"subHeader-1\",\"type\":\"html\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"html\":\"<span class=\\\" opt-palette-editor__text-area h2 h2 h2\\\">Yes you're on the right page, but its not quite ready.<\\/span>\",\"visibility\":\"visible\",\"options\":false,\"help\":false,\"alias\":\"Sub-Header\"}},{\"id\":\"header-group\",\"type\":\"group\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"alias\":\"header group\",\"visibility\":\"visible\"}},{\"id\":\"logo-1\",\"type\":\"image\",\"for\":null,\"tag\":\"IMG\",\"attrs\":{\"src\":\"\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/stockPhoto\\/84\\/29694.1.47135abcc7e84179f73c77f9e8f8af1b.PNG\",\"options\":false,\"visibility\":\"visible\",\"alias\":\"Logo\"}},{\"id\":\"block-background\",\"type\":\"background\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"bg\":\"transparent\",\"options\":false,\"alias\":\"block background\",\"src\":\"\\/js\\/ontraport\\/components\\/opt_palette_editor\\/image\\/views\\/noimage.png\"}},{\"id\":\"tagline-1\",\"type\":\"html\",\"for\":null,\"tag\":\"H3\",\"attrs\":{\"html\":\" JOIN OUR LIVE WEBINAR \",\"visibility\":\"hidden\",\"options\":false,\"help\":false,\"alias\":\"Tagline\"}},{\"id\":\"date-1\",\"type\":\"html\",\"for\":null,\"tag\":\"H1\",\"attrs\":{\"html\":\" DECEMBER 25, 2015 \\/\\/ 1:00PM PST \",\"visibility\":\"hidden\",\"options\":false,\"help\":false,\"alias\":\"Date\"}},{\"id\":\"button-1\",\"type\":\"button\",\"for\":null,\"tag\":\"A\",\"attrs\":{\"visibility\":\"hidden\",\"alias\":\"Button\",\"html\":\"\\n SIGN ME UP\\n \",\"href\":\"javascript:\\/\\/\",\"target\":\"_self\",\"file_name\":null,\"page_select\":null,\"url_type\":null,\"src\":null,\"link_background\":\"\",\"hover_bg\":\"\",\"hover_text\":\"\"}}],\"visibility\":true},{\"alias\":\"Countdown timer\",\"blockId\":\"119\",\"blockTypeId\":22,\"id\":\"b681e5f2-2c31-a251-f0f6-fa5bb76469d8\",\"path\":\"\\/js\\/ontraport\\/opt_assets\\/blocks\\/landing_page\\/119_count_down_timer\\/\",\"scripts\":\"\\/*block scripts*\\/\\n\\n$(function(){\\n var $blockStyle119 = $( \\\".block-style-119\\\" );\\n\\n \\/* Script applies a font size and line height that are 20px larger than the specified sizes. *\\/\\n $blockStyle119.each(function( index, element ) {\\n var $style = $( \\\"<style\\/>\\\" ).addClass( \\\"block-style-119-font-style\\\"),\\n $element = $( element ),\\n $countdownItem = $element.find( \\\".block-style-119__count-down-item\\\" ).first(),\\n _itemFontSize = $countdownItem.css(\\\"fontSize\\\").replace(\\\"px\\\", \\\"\\\"),\\n _itemLineHeight = $countdownItem.css(\\\"lineHeight\\\").replace(\\\"px\\\", \\\"\\\");\\n\\n _itemFontSize = +_itemFontSize + 20;\\n\\n _itemLineHeight = +_itemLineHeight + 20;\\n\\n $element.find( \\\"style.block-style-119-font-style\\\").remove();\\n\\n $element.prepend( $style.html( \\\".h1.block-style-119__count-down-item { font-size: \\\" + _itemFontSize + \\\"px; line-height: \\\" + _itemLineHeight + \\\"px; }\\\" ) );\\n\\n });\\n});\\n\\n\",\"theme\":{\"color_variation\":\"option-4\"},\"userDefinedData\":[{\"id\":\"header-1\",\"type\":\"html\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"html\":\"<span class=\\\" opt-palette-editor__text-area h3 h3 h3\\\">PAGE WILL BE READY IN :<\\/span>\\n \",\"visibility\":\"visible\",\"options\":false,\"help\":false,\"alias\":\"Header\"}},{\"id\":\"block-background\",\"type\":\"background\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"bg\":\"transparent\",\"options\":false,\"alias\":\"block background\",\"src\":\"\\/js\\/ontraport\\/components\\/opt_palette_editor\\/image\\/views\\/noimage.png\"}}],\"visibility\":true},{\"alias\":\"Smart form\",\"blockId\":\"130\",\"blockTypeId\":10,\"id\":\"bd440856-4d06-bedf-1302-eb5f220c29e9\",\"path\":\"\\/js\\/ontraport\\/opt_assets\\/blocks\\/landing_page\\/130_horizontal_text_and_form\\/\",\"scripts\":\" \\/*block scripts*\\/\",\"theme\":{\"spacing\":{\"children\":{\"~spacing\":{\"attributes\":{\"padding-bottom\":\"100px\"}}}},\"color_variation\":\"option-4\"},\"userDefinedData\":[{\"id\":\"block-background\",\"type\":\"background\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"bg\":\"transparent\",\"options\":false,\"alias\":\"block background\",\"src\":\"\\/js\\/ontraport\\/components\\/opt_palette_editor\\/image\\/views\\/noimage.png\",\"fixed-width-default\":false}},{\"id\":\"bodyText-1\",\"type\":\"html\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"html\":\"<span class=\\\" opt-palette-editor__text-area body-text body-text\\\">Enter you name & Email and we will let you know when its ready.<\\/span>\",\"visibility\":\"visible\",\"options\":false,\"help\":false,\"alias\":\"Body Text\"}}],\"visibility\":true,\"direction\":1,\"settings\":{\"opt_in_settings\":\"single\",\"conditionsCustomUrl\":\"\",\"conditionsRedirectRadioButtons\":\"default\",\"form_contacts_thank_you_page_redir\":\"0\",\"singleCustomUrl\":\"\",\"thankYouRedirectRadioButtons\":\"default\",\"singleLandPageSelect\":\"\",\"conditionsLandPageSelect\":\"\",\"conditionsPopOntraformSelect\":\"\",\"confirmation_email\":\"\",\"tags\":[],\"sequences\":[],\"rules_default\":[],\"rules_transaction_fail\":[],\"notif\":\"\",\"cookie_overide\":\"0\",\"cgi\":\"0\",\"owner\":false,\"tyPopOntraformSelect\":\"\"}}],\"settings\":{\"domain\":null,\"visits\":null,\"conversions\":null,\"design_type\":null,\"listFields\":null,\"listFieldSettings\":null,\"count\":null,\"lpsent\":null,\"lpconvert\":null,\"id\":null,\"uri_id\":null,\"rotation\":null,\"last_save\":null,\"last_auto\":null,\"autosave\":null,\"visits_0\":null,\"visits_1\":null,\"visits_2\":null,\"visits_3\":null,\"platform\":null,\"ssl_enabled\":null,\"type\":\"landing_page\",\"blocks\":null,\"block_type_id\":null,\"a_sent\":null,\"a_convert\":null,\"b_sent\":null,\"b_convert\":null,\"c_sent\":null,\"c_convert\":null,\"d_sent\":null,\"d_convert\":null,\"object_type_id\":null,\"conditionsCustomUrl\":\"\",\"singleCustomUrl\":\"\",\"page_title\":\"\",\"meta_description\":\"\",\"header_custom_script\":\"\",\"footer_custom_script\":\"\",\"favicon_uploader\":\"\\/\\/app.ontraport.com\\/favicon.ico\",\"notif\":\"\",\"owner\":\"\",\"opt_canvas\":[],\"opt_palette\":[]},\"theme\":{\"theme_font\":{\"children\":{\"h1, ~h1~h1\":{\"attributes\":{\"font-family\":\"'Dosis', sans-serif\",\"font-size\":\"96px\",\"line-height\":\"98px\",\"font-weight\":\"100\",\"font-style\":\"normal\"}},\"h2, ~h2~h2\":{\"attributes\":{\"font-family\":\"'Roboto', sans-serif\",\"font-size\":\"34px\",\"line-height\":\"36px\",\"font-weight\":\"100\",\"font-style\":\"italic\"}},\"h3, ~h3~h3\":{\"attributes\":{\"font-family\":\"'Roboto', sans-serif\",\"font-size\":\"22px\",\"line-height\":\"24px\",\"font-weight\":\"400\",\"font-style\":\"normal\"}},\"~label~label\":{\"attributes\":{\"font-family\":\"'Dosis', sans-serif\",\"font-size\":\"16px\",\"line-height\":\"18px\",\"font-weight\":\"600\",\"font-style\":\"normal\"}},\"~button~button\":{\"attributes\":{\"font-family\":\"'Dosis', sans-serif\",\"font-size\":\"22px\",\"line-height\":\"24px\",\"font-weight\":\"600\",\"font-style\":\"normal\"}},\"~large-body-text~large-body-text\":{\"attributes\":{\"font-family\":\"'Roboto', sans-serif\",\"font-size\":\"20px\",\"line-height\":\"22px\",\"font-weight\":\"400\",\"font-style\":\"normal\"}},\"~body-text~body-text\":{\"attributes\":{\"font-family\":\"'Roboto', sans-serif\",\"font-size\":\"16px\",\"line-height\":\"18px\",\"font-weight\":\"100\",\"font-style\":\"normal\"}},\"blockquote, ~blockquote\":{\"attributes\":{\"font-family\":\"'Dosis', sans-serif\",\"font-size\":\"16px\",\"line-height\":\"18px\",\"font-weight\":\"400\",\"font-style\":\"italic\"}}}},\"theme_colors\":{\"primary-color\":\"#17a4d1\",\"complimentary-color\":\"#328ed3\",\"dark-color\":\"#91cd47\",\"light-color\":\"#e9f4da\",\"white-color\":\"#ffffff\"},\"theme_background\":{\"id\":\"template-background\",\"type\":\"background\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"bg\":\"\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/stockPhoto\\/84\\/29694.1.1f36335d542d468765dd98e598ffbf9f.PNG\",\"options\":[\"backgrounds\"],\"alias\":\"background\",\"src\":\"\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/stockPhoto\\/84\\/29694.1.1f36335d542d468765dd98e598ffbf9f.PNG\"}},\"theme_spacing\":{\"children\":{\"~spacing\":{\"attributes\":{\"padding-top\":\"20px\",\"padding-bottom\":\"20px\"}}}}}},\"industries\":null,\"types\":null,\"tags\":null,\"opt_template_categories\":\" featured free\",\"id\":\"84\",\"displayObjectNotFoundErrors\":true},\"version\":\"v2\",\"mergedData\":\"<!DOCTYPE html><html><head> <!-- This page was built using ONTRApages. Create and host your pages free at ONTRApages.com or learn more about the most powerful business and marketing automation platform designed for entrepreneurs at Ontraport.com --> <meta charset=\\\"utf-8\\\"> <meta name=\\\"viewport\\\" content=\\\"width=device-width, initial-scale=1.0\\\"> <link rel=\\\"stylesheet\\\" href=\\\"\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/skeleton\\/css\\/normalize.css\\\"> <link rel=\\\"stylesheet\\\" href=\\\"\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/skeleton\\/css\\/skeleton.css\\\"> <link rel=\\\"stylesheet\\\" href=\\\"\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/skeleton\\/css\\/skeleton.ontraport.css\\\"> <link rel=\\\"stylesheet\\\" href=\\\"\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/skeleton\\/css\\/fonts.css\\\"> <link rel=\\\"stylesheet\\\" href=\\\"\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/css\\/wysihtml5-textalign.css\\\"> <!--OPT-CUSTOM-HEADER-SCRIPT--><style class=\\\"theme-style\\\">h1, .h1.h1 { font-family: 'Dosis', sans-serif; font-size: 96px; line-height: 98px; font-weight: 100; text-decoration: inherit;}h2, .h2.h2 { font-family: 'Roboto', sans-serif; font-size: 34px; line-height: 36px; font-weight: 100; font-style: italic; text-decoration: inherit;}h3, .h3.h3 { font-family: 'Roboto', sans-serif; font-size: 22px; line-height: 24px; font-weight: 400; text-decoration: inherit;}.label.label { font-family: 'Dosis', sans-serif; font-size: 16px; line-height: 18px; font-weight: 600; text-decoration: inherit;}.button.button { font-family: 'Dosis', sans-serif; font-size: 22px; line-height: 24px; font-weight: 600; text-decoration: inherit;}.large-body-text.large-body-text { font-family: 'Roboto', sans-serif; font-size: 20px; line-height: 22px; font-weight: 400; text-decoration: inherit;}.body-text.body-text { font-family: 'Roboto', sans-serif; font-size: 16px; line-height: 18px; font-weight: 100; text-decoration: inherit;}blockquote, .blockquote { font-family: 'Dosis', sans-serif; font-size: 16px; line-height: 18px; font-weight: 400; font-style: italic; text-decoration: inherit;}.bb.bb.bb { color: #91cd47;}.v.v.v { color: #ffffff;}.ak.ak.ak { background-color: #ffffff;}.i.i.i { background-color: #91cd47;}.at.at.at, .at.at.at a { color: #ffffff; background-color: #17a4d1;}.q.q.q, .q.q.q a { color: #17a4d1; background-color: #ffffff;}.aw.aw.aw { background-color: #e9f4da;}.as.as.as { border-color: #91cd47;}.al.al { color: #91cd47;}.al.al.al:hover { color: #17a4d1;}.ba.ba.ba { color: #17a4d1;}.ba.ba.ba:hover { color: #91cd47;}hr.bc.bc.bc, span.bc.bc.bc, h1.bc.bc.bc, h2.bc.bc.bc, h3.bc.bc.bc, p.bc.bc.bc, .an.an.an { color: #17a4d1;}hr.bc.bc.bc, table.bc.bc.bc, div.bc.bc.bc, a.bc.bc.bc, .x.x.x { background-color: #17a4d1;}hr.bc.bc.bc, img.bc.bc.bc, a.bc.bc.bc, div.bc.bc.bc, .aj.aj.aj { border-color: #17a4d1;}hr.am.am.am, span.am.am.am, h1.am.am.am, h2.am.am.am, h3.am.am.am, p.am.am.am, .u.u.u { color: #328ed3;}hr.am.am.am, table.am.am.am, div.am.am.am, a.am.am.am, .h.h.h { background-color: #328ed3;}hr.am.am.am, img.am.am.am, a.am.am.am, div.am.am.am, .o.o.o { border-color: #328ed3;}hr.bf.bf.bf, span.bf.bf.bf, h1.bf.bf.bf, h2.bf.bf.bf, h3.bf.bf.bf, p.bf.bf.bf, .ax.ax.ax { color: #91cd47;}hr.bf.bf.bf, table.bf.bf.bf, div.bf.bf.bf, a.bf.bf.bf, .ah.ah.ah { background-color: #91cd47;}hr.bf.bf.bf, img.bf.bf.bf, a.bf.bf.bf, div.bf.bf.bf, .aq.aq.aq { border-color: #91cd47;}hr.be.be.be, span.be.be.be, h1.be.be.be, h2.be.be.be, h3.be.be.be, p.be.be.be, .ar.ar.ar { color: #e9f4da;}hr.be.be.be, table.be.be.be, div.be.be.be, a.be.be.be, .ad.ad.ad { background-color: #e9f4da;}hr.be.be.be, img.be.be.be, a.be.be.be, div.be.be.be, .ao.ao.ao { border-color: #e9f4da;}hr.bd.bd.bd, span.bd.bd.bd, h1.bd.bd.bd, h2.bd.bd.bd, h3.bd.bd.bd, p.bd.bd.bd, .au.au.au { color: #ffffff;}hr.bd.bd.bd, table.bd.bd.bd, div.bd.bd.bd, a.bd.bd.bd, .ab.ab.ab { background-color: #ffffff;}hr.bd.bd.bd, img.bd.bd.bd, a.bd.bd.bd, div.bd.bd.bd, .ap.ap.ap { border-color: #ffffff;}a { color: #17a4d1; text-decoration: none;}a:hover { text-decoration: underline;}.spacing { padding-top: 20px; padding-bottom: 20px;}<\\/style><style class=\\\"block-theme-css\\\">.b .bb.bb.bb { color: #ffffff;}.b .v.v.v { color: #17a4d1;}.b .ak.ak.ak { background-color: #17a4d1;}.b .i.i.i { background-color: #ffffff;}.b .at.at.at,.b .at.at.at a { color: #17a4d1; background-color: #ffffff;}.b .q.q.q,.b .q.q.q a { color: #ffffff; background-color: #17a4d1;}.b .aw.aw.aw { background-color: #ffffff;}.b .as.as.as { border-color: #ffffff;}.b .al.al.al { color: #ffffff;}.b .al.al.al:hover { color: #91cd47;}.b .ba.ba.ba { color: #ffffff;}.b .ba.ba.ba:hover { color: #91cd47;}.b hr.bc.bc.bc,.b span.bc.bc.bc,.b h1.bc.bc.bc,.b h2.bc.bc.bc,.b h3.bc.bc.bc,.b p.bc.bc.bc,.b .an.an.an { color: #e9f4da;}.b hr.bc.bc.bc,.b table.bc.bc.bc,.b div.bc.bc.bc,.b a.bc.bc.bc,.b .x.x.x { background-color: #e9f4da;}.b hr.bc.bc.bc,.b img.bc.bc.bc,.b a.bc.bc.bc,.b div.bc.bc.bc,.b .aj.aj.aj { border-color: #e9f4da;}.b hr.am.am.am,.b span.am.am.am,.b h1.am.am.am,.b h2.am.am.am,.b h3.am.am.am,.b p.am.am.am,.b .u.u.u { color: #328ed3;}.b hr.am.am.am,.b table.am.am.am,.b div.am.am.am,.b a.am.am.am,.b .h.h.h { background-color: #328ed3;}.b hr.am.am.am,.b img.am.am.am,.b a.am.am.am,.b div.am.am.am,.b .o.o.o { border-color: #328ed3;}.b hr.bf.bf.bf,.b span.bf.bf.bf,.b h1.bf.bf.bf,.b h2.bf.bf.bf,.b h3.bf.bf.bf,.b p.bf.bf.bf,.b .ax.ax.ax { color: #ffffff;}.b hr.bf.bf.bf,.b table.bf.bf.bf,.b div.bf.bf.bf,.b a.bf.bf.bf,.b .ah.ah.ah { background-color: #ffffff;}.b hr.bf.bf.bf,.b img.bf.bf.bf,.b a.bf.bf.bf,.b div.bf.bf.bf,.b .aq.aq.aq { border-color: #ffffff;}.b hr.be.be.be,.b span.be.be.be,.b h1.be.be.be,.b h2.be.be.be,.b h3.be.be.be,.b p.be.be.be,.b .ar.ar.ar { color: #e9f4da;}.b hr.be.be.be,.b table.be.be.be,.b div.be.be.be,.b a.be.be.be,.b .ad.ad.ad { background-color: #e9f4da;}.b hr.be.be.be,.b img.be.be.be,.b a.be.be.be,.b div.be.be.be,.b .ao.ao.ao { border-color: #e9f4da;}.b hr.bd.bd.bd,.b span.bd.bd.bd,.b h1.bd.bd.bd,.b h2.bd.bd.bd,.b h3.bd.bd.bd,.b p.bd.bd.bd,.b .au.au.au { color: #17a4d1;}.b hr.bd.bd.bd,.b table.bd.bd.bd,.b div.bd.bd.bd,.b a.bd.bd.bd,.b .ab.ab.ab { background-color: #17a4d1;}.b hr.bd.bd.bd,.b img.bd.bd.bd,.b a.bd.bd.bd,.b div.bd.bd.bd,.b .ap.ap.ap { border-color: #17a4d1;}.b a { color: #17a4d1; text-decoration: none;}.b a:hover { text-decoration: underline;}.c .bb.bb.bb { color: #ffffff;}.c .v.v.v { color: #17a4d1;}.c .ak.ak.ak { background-color: #17a4d1;}.c .i.i.i { background-color: #ffffff;}.c .at.at.at,.c .at.at.at a { color: #17a4d1; background-color: #ffffff;}.c .q.q.q,.c .q.q.q a { color: #ffffff; background-color: #17a4d1;}.c .aw.aw.aw { background-color: #ffffff;}.c .as.as.as { border-color: #ffffff;}.c .al.al.al { color: #ffffff;}.c .al.al.al:hover { color: #91cd47;}.c .ba.ba.ba { color: #ffffff;}.c .ba.ba.ba:hover { color: #91cd47;}.c hr.bc.bc.bc,.c span.bc.bc.bc,.c h1.bc.bc.bc,.c h2.bc.bc.bc,.c h3.bc.bc.bc,.c p.bc.bc.bc,.c .an.an.an { color: #e9f4da;}.c hr.bc.bc.bc,.c table.bc.bc.bc,.c div.bc.bc.bc,.c a.bc.bc.bc,.c .x.x.x { background-color: #e9f4da;}.c hr.bc.bc.bc,.c img.bc.bc.bc,.c a.bc.bc.bc,.c div.bc.bc.bc,.c .aj.aj.aj { border-color: #e9f4da;}.c hr.am.am.am,.c span.am.am.am,.c h1.am.am.am,.c h2.am.am.am,.c h3.am.am.am,.c p.am.am.am,.c .u.u.u { color: #328ed3;}.c hr.am.am.am,.c table.am.am.am,.c div.am.am.am,.c a.am.am.am,.c .h.h.h { background-color: #328ed3;}.c hr.am.am.am,.c img.am.am.am,.c a.am.am.am,.c div.am.am.am,.c .o.o.o { border-color: #328ed3;}.c hr.bf.bf.bf,.c span.bf.bf.bf,.c h1.bf.bf.bf,.c h2.bf.bf.bf,.c h3.bf.bf.bf,.c p.bf.bf.bf,.c .ax.ax.ax { color: #ffffff;}.c hr.bf.bf.bf,.c table.bf.bf.bf,.c div.bf.bf.bf,.c a.bf.bf.bf,.c .ah.ah.ah { background-color: #ffffff;}.c hr.bf.bf.bf,.c img.bf.bf.bf,.c a.bf.bf.bf,.c div.bf.bf.bf,.c .aq.aq.aq { border-color: #ffffff;}.c hr.be.be.be,.c span.be.be.be,.c h1.be.be.be,.c h2.be.be.be,.c h3.be.be.be,.c p.be.be.be,.c .ar.ar.ar { color: #e9f4da;}.c hr.be.be.be,.c table.be.be.be,.c div.be.be.be,.c a.be.be.be,.c .ad.ad.ad { background-color: #e9f4da;}.c hr.be.be.be,.c img.be.be.be,.c a.be.be.be,.c div.be.be.be,.c .ao.ao.ao { border-color: #e9f4da;}.c hr.bd.bd.bd,.c span.bd.bd.bd,.c h1.bd.bd.bd,.c h2.bd.bd.bd,.c h3.bd.bd.bd,.c p.bd.bd.bd,.c .au.au.au { color: #17a4d1;}.c hr.bd.bd.bd,.c table.bd.bd.bd,.c div.bd.bd.bd,.c a.bd.bd.bd,.c .ab.ab.ab { background-color: #17a4d1;}.c hr.bd.bd.bd,.c img.bd.bd.bd,.c a.bd.bd.bd,.c div.bd.bd.bd,.c .ap.ap.ap { border-color: #17a4d1;}.c a { color: #17a4d1; text-decoration: none;}.c a:hover { text-decoration: underline;}.a .spacing { padding-bottom: 100px;}.a .bb.bb.bb { color: #ffffff;}.a .v.v.v { color: #17a4d1;}.a .ak.ak.ak { background-color: #17a4d1;}.a .i.i.i { background-color: #ffffff;}.a .at.at.at,.a .at.at.at a { color: #17a4d1; background-color: #ffffff;}.a .q.q.q,.a .q.q.q a { color: #ffffff; background-color: #17a4d1;}.a .aw.aw.aw { background-color: #ffffff;}.a .as.as.as { border-color: #ffffff;}.a .al.al.al { color: #ffffff;}.a .al.al.al:hover { color: #91cd47;}.a .ba.ba.ba { color: #ffffff;}.a .ba.ba.ba:hover { color: #91cd47;}.a hr.bc.bc.bc,.a span.bc.bc.bc,.a h1.bc.bc.bc,.a h2.bc.bc.bc,.a h3.bc.bc.bc,.a p.bc.bc.bc,.a .an.an.an { color: #e9f4da;}.a hr.bc.bc.bc,.a table.bc.bc.bc,.a div.bc.bc.bc,.a a.bc.bc.bc,.a .x.x.x { background-color: #e9f4da;}.a hr.bc.bc.bc,.a img.bc.bc.bc,.a a.bc.bc.bc,.a div.bc.bc.bc,.a .aj.aj.aj { border-color: #e9f4da;}.a hr.am.am.am,.a span.am.am.am,.a h1.am.am.am,.a h2.am.am.am,.a h3.am.am.am,.a p.am.am.am,.a .u.u.u { color: #328ed3;}.a hr.am.am.am,.a table.am.am.am,.a div.am.am.am,.a a.am.am.am,.a .h.h.h { background-color: #328ed3;}.a hr.am.am.am,.a img.am.am.am,.a a.am.am.am,.a div.am.am.am,.a .o.o.o { border-color: #328ed3;}.a hr.bf.bf.bf,.a span.bf.bf.bf,.a h1.bf.bf.bf,.a h2.bf.bf.bf,.a h3.bf.bf.bf,.a p.bf.bf.bf,.a .ax.ax.ax { color: #ffffff;}.a hr.bf.bf.bf,.a table.bf.bf.bf,.a div.bf.bf.bf,.a a.bf.bf.bf,.a .ah.ah.ah { background-color: #ffffff;}.a hr.bf.bf.bf,.a img.bf.bf.bf,.a a.bf.bf.bf,.a div.bf.bf.bf,.a .aq.aq.aq { border-color: #ffffff;}.a hr.be.be.be,.a span.be.be.be,.a h1.be.be.be,.a h2.be.be.be,.a h3.be.be.be,.a p.be.be.be,.a .ar.ar.ar { color: #e9f4da;}.a hr.be.be.be,.a table.be.be.be,.a div.be.be.be,.a a.be.be.be,.a .ad.ad.ad { background-color: #e9f4da;}.a hr.be.be.be,.a img.be.be.be,.a a.be.be.be,.a div.be.be.be,.a .ao.ao.ao { border-color: #e9f4da;}.a hr.bd.bd.bd,.a span.bd.bd.bd,.a h1.bd.bd.bd,.a h2.bd.bd.bd,.a h3.bd.bd.bd,.a p.bd.bd.bd,.a .au.au.au { color: #17a4d1;}.a hr.bd.bd.bd,.a table.bd.bd.bd,.a div.bd.bd.bd,.a a.bd.bd.bd,.a .ab.ab.ab { background-color: #17a4d1;}.a hr.bd.bd.bd,.a img.bd.bd.bd,.a a.bd.bd.bd,.a div.bd.bd.bd,.a .ap.ap.ap { border-color: #17a4d1;}.a a { color: #17a4d1; text-decoration: none;}.a a:hover { text-decoration: underline;}<\\/style><link rel=\\\"shortcut icon\\\" type=\\\"image\\/x-icon\\\" href=\\\"\\/\\/app.ontraport.com\\/favicon.ico\\\"><link rel=\\\"dns-prefetch\\\" href=\\\"https:\\/\\/optassets.ontraport.com\\\"><link rel=\\\"dns-prefetch\\\" href=\\\"\\/\\/ajax.googleapis.com\\\"><link rel=\\\"dns-prefetch\\\" href=\\\"\\/\\/app.ontraport.com\\\"><link rel=\\\"dns-prefetch\\\" href=\\\"\\/\\/optassets.ontraport.com\\\"><\\/head><body> <div class=\\\"opt-container\\\" opt-id=\\\"template-background\\\" opt-type=\\\"background\\\" style=\\\"background-size: cover; background-image: url("https:\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/stockPhoto\\/84\\/29694.1.1f36335d542d468765dd98e598ffbf9f.PNG");\\\" opt-options=\\\"["backgrounds"]\\\" opt-alias=\\\"background\\\"><div><div class=\\\"row b\\\" opt-id=\\\"527f664f-a6a4-8e9d-634e-26c041d2bee5\\\" opt-type=\\\"block\\\" opt-block-type-id=\\\"3\\\" opt-block-style-id=\\\"20\\\"><div class=\\\"block-style\\\"><style class=\\\"block-css\\\">\\/*block styles*\\/ .az { text-align: center; width: 100%; background-position: center center;} .af { max-width: 100%;} .ac,.s,.z,.p { margin-bottom: 20px;} .l { padding: 40px 0;} .r { margin-bottom: 40px; margin-top:0;}.j { margin-bottom: 0;} .r,.j { border: 0; height: 1px;} .w { display: block;} .ae { margin-top: 30px; padding-top: 15px; padding-bottom: 15px; min-width: 150px;}<\\/style> <div class=\\\"block-wrapper az ak spacing\\\" style=\\\"background-color: transparent; background-image: none;\\\"> <div class=\\\"container body-text\\\"> <div aria-description=\\\"Event Banner\\\"> <img src=\\\"https:\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/stockPhoto\\/84\\/29694.1.47135abcc7e84179f73c77f9e8f8af1b.PNG\\\" class=\\\"af\\\"> <div class=\\\"l\\\"> <hr class=\\\"ah r\\\"> <div class=\\\"ac bb\\\"><span class=\\\"h1\\\">COMING SOON<\\/span><\\/div> <div class=\\\"s bb\\\"><span class=\\\" opt-palette-editor__text-area h2 h2 h2\\\">Yes you're on the right page, but its not quite ready.<\\/span><\\/div> <hr class=\\\"ah j\\\"> <\\/div> <\\/div> <\\/div><\\/div> <\\/div><\\/div><div class=\\\"row c\\\" opt-id=\\\"b681e5f2-2c31-a251-f0f6-fa5bb76469d8\\\" opt-type=\\\"block\\\" opt-block-type-id=\\\"22\\\" opt-block-style-id=\\\"119\\\"><div class=\\\"block-style\\\"><style class=\\\"block-css\\\">\\/*block styles*\\/ .aa { max-width: 100%; margin-bottom: 10px;} .d { display: block;} .f { list-style: none; max-width: 85%; margin-left: auto; margin-right: auto; word-wrap: break-word;} .f li { display: inline-block; margin-right: 30px; min-width: 125px;} .g { margin-bottom: 0;}<\\/style> <div class=\\\"block-wrapper ak block-style-119 spacing\\\" style=\\\"background-color: transparent; background-image: none;\\\"> <div class=\\\"container opt-center\\\"> <div class=\\\"aa bb\\\"><span class=\\\" opt-palette-editor__text-area h3 h3 h3\\\">PAGE WILL BE READY IN :<\\/span> <\\/div> <ontraport-countdown month=\\\"5\\\" redirect_href=\\\"#\\\" class=\\\"d countdown\\\" day=\\\"12\\\" then=\\\"1494572400000\\\"> <ul class=\\\"f\\\"> <li><p class=\\\"ce-days bb h1 g\\\">29<\\/p> <span class=\\\"bb h3\\\">DAYS<\\/span><\\/li> <li><p class=\\\"ce-hours bb h1 g\\\">14<\\/p> <span class=\\\"bb h3\\\">HOURS<\\/span><\\/li> <li><p class=\\\"ce-minutes bb h1 g\\\">16<\\/p> <span class=\\\"bb h3\\\">MINUTES<\\/span><\\/li> <li><p class=\\\"ce-seconds bb h1 g\\\">34<\\/p> <span class=\\\"bb h3\\\">SECONDS<\\/span><\\/li> <\\/ul> <\\/ontraport-countdown> <\\/div><\\/div> <\\/div><\\/div><div class=\\\"row a\\\" opt-id=\\\"bd440856-4d06-bedf-1302-eb5f220c29e9\\\" opt-type=\\\"block\\\" opt-block-type-id=\\\"10\\\" opt-block-style-id=\\\"130\\\"><div class=\\\"block-style\\\"><style class=\\\"block-css\\\">.k { display: none;} .ay { display: inline;} .t { margin-right: 5px; position: relative; top: -1px;} .ai { margin-bottom: 25px;} .ag { margin-bottom: 0;} .m { display: inline-block; margin-right: 1%; width: 35%; vertical-align: top;} .n { display: inline;} .e { display: inline-block;} .y input[type=\\\"email\\\"], .y input[type=\\\"number\\\"], .y input[type=\\\"search\\\"], .y input[type=\\\"text\\\"], .y input[type=\\\"tel\\\"], .y input[type=\\\"url\\\"], .y input[type=\\\"password\\\"], .y input[type=\\\"date\\\"], .y textarea,.y select { width: 100%; display: inline-block;} .av label { word-wrap: break-word;} .y input[type=\\\"submit\\\"].button-style { padding: 0 20px; border-radius: 3px; text-decoration: none; letter-spacing: inherit; text-transform: none; border: 0; height: 38px; line-height: 1; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; vertical-align: middle; -webkit-transition: opacity .4s ease-in-out; transition: opacity .4s ease-in-out;}.y input[type=\\\"submit\\\"].button-style:hover { opacity: .9;} @media (max-width: 1200px) { .block-style-130__columns.block-style-130__columns { text-align: center; width: 100%; } .m { width: 24%; }} @media (max-width: 549px) { .m { width: 100%; } }.opt-page-size-mobile .m { width: 100%;} <\\/style> <div class=\\\"block-wrapper block-style-130 ak spacing\\\" style=\\\"background-color: transparent; background-image: none;\\\"> <div class=\\\"container\\\"> <div class=\\\"y\\\"> <div class=\\\"row\\\"> <div class=\\\"six columns block-style-130__columns\\\"> <div class=\\\"ai bb\\\"><span class=\\\" opt-palette-editor__text-area body-text body-text\\\">Enter you name & Email and we will let you know when its ready.<\\/span><\\/div> <\\/div> <div class=\\\"six columns block-style-130__columns\\\"> <form role=\\\"form\\\" accept-charset=\\\"UTF-8\\\" method=\\\"post\\\" action=\\\"[system_form_processor_bd440856-4d06-bedf-1302-eb5f220c29e9]\\\" class=\\\"ag opt-center\\\"> <div class=\\\"n\\\"> <div class=\\\"m\\\"> <label class=\\\"bb label k\\\" for=\\\"firstname\\\" opt-for=\\\"firstname-input\\\">First Name<\\/label> <input class=\\\"aw\\\" type=\\\"text\\\" name=\\\"firstname\\\" id=\\\"firstname\\\" placeholder=\\\"First Name\\\"> <\\/div> <div class=\\\"m\\\"> <label class=\\\"bb label k\\\" for=\\\"email\\\" opt-for=\\\"email-input\\\">Email<\\/label> <input class=\\\"aw\\\" type=\\\"email\\\" name=\\\"email\\\" id=\\\"email\\\" placeholder=\\\"Email\\\" required=\\\"required\\\"> <\\/div> <\\/div> <div class=\\\"e\\\"> <input type=\\\"submit\\\" value=\\\"Submit\\\" class=\\\"button button-style at\\\"> <\\/div> <span style=\\\"display: none;\\\">[system_form_fields_bd440856-4d06-bedf-1302-eb5f220c29e9]<\\/span> <\\/form> <\\/div> <\\/div> <\\/div> <\\/div> <\\/div> <\\/div><\\/div><\\/div> <!--OPT-AD-BLOCK-HERE--> <\\/div> <script src=\\\"\\/\\/ajax.googleapis.com\\/ajax\\/libs\\/jquery\\/1.7.1\\/jquery.min.js\\\"><\\/script> <script class=\\\"opt-page-script\\\" type=\\\"text\\/javascript\\\" src=\\\"https:\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/jQueryPageBackgroundPro\\/js\\/libs\\/underscore.js\\\"><\\/script> <span style=\\\"display: none;\\\" class=\\\"opt-system-scripts\\\">[system_scripts]<\\/span> <span style=\\\"display: none;\\\" class=\\\"opt-form-scripts\\\">[system_form_scripts]<\\/span> <script type=\\\"text\\/javascript\\\" class=\\\"opt-page-script opt-form-scripts\\\" src=\\\"https:\\/\\/optassets.ontraport.com\\/opt_assets\\/blocks\\/common\\/jQueryCloneVal\\/jquery-cloneVal.js\\\"><\\/script> <script src=\\\"\\/\\/app.ontraport.com\\/js\\/globalize\\/globalize.js\\\"><\\/script> <script type=\\\"text\\/javascript\\\" class=\\\"opt-page-script opt-document-register-element-driver\\\" src=\\\"https:\\/\\/optassets.ontraport.com\\/opt_assets\\/templates\\/custom-elements\\/document-register-element\\/build\\/document-register-element.js\\\"><\\/script> <script type=\\\"text\\/javascript\\\" class=\\\"opt-page-script opt-countdown-script\\\" src=\\\"https:\\/\\/optassets.ontraport.com\\/opt_assets\\/templates\\/custom-elements\\/countdown\\/countdown.js\\\"><\\/script> <span style=\\\"display: none;\\\">[bot_catcher]<\\/span> <!--OPT-CUSTOM-FOOTER-SCRIPT--><script> <\\/script><\\/body><\\/html>\",\"formBlockIds\":[\"bd440856-4d06-bedf-1302-eb5f220c29e9\"]},{\"templateId\":false,\"status\":false,\"blocks\":[],\"settings\":{\"favicon_uploader\":\"\\/\\/app.ontraport.com\\/favicon.png\"},\"theme\":{\"theme_font\":{\"children\":{\"h1, ~h1~h1\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"50px\",\"line-height\":\"50px\",\"font-weight\":\"100\",\"font-style\":\"normal\"}},\"h2, ~h2~h2\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"30px\",\"line-height\":\"32px\",\"font-weight\":\"400\",\"font-style\":\"normal\"}},\"h3, ~h3~h3\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"20px\",\"line-height\":\"20px\",\"font-weight\":\"900\",\"font-style\":\"normal\"}},\"~label~label\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"16px\",\"line-height\":\"16px\",\"font-weight\":\"300\",\"font-style\":\"normal\"}},\"~button~button\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"14px\",\"line-height\":\"14px\",\"font-weight\":\"600\",\"font-style\":\"normal\"}},\"~large-body-text~large-body-text\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"18px\",\"line-height\":\"24px\",\"font-weight\":\"100\",\"font-style\":\"normal\"}},\"~body-text~body-text\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"14px\",\"line-height\":\"22px\",\"font-weight\":\"300\",\"font-style\":\"normal\"}},\"blockquote, ~blockquote\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"14px\",\"line-height\":\"22px\",\"font-weight\":\"100\",\"font-style\":\"italic\"}}}},\"theme_colors\":{\"primary-color\":\"#1e88e5\",\"complimentary-color\":\"#41baff\",\"dark-color\":\"#333333\",\"light-color\":\"#f3efea\",\"white-color\":\"#ffffff\"},\"theme_background\":{\"id\":\"template-background\",\"type\":\"background\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"bg\":\"#ffffff\",\"options\":[\"backgrounds\"],\"alias\":\"background\"}},\"theme_spacing\":{\"children\":{\"~spacing\":{\"attributes\":{\"padding-top\":\"20px\",\"padding-bottom\":\"20px\"}}}},\"theme_dimensions\":{\"widthType\":\"option\",\"width\":\"100%\",\"height\":null},\"border\":{\"color\":\"#000000\",\"size\":\"0px\"}},\"mergedData\":\"\",\"formBlockIds\":[]},{\"templateId\":false,\"status\":false,\"blocks\":[],\"settings\":{\"favicon_uploader\":\"\\/\\/app.ontraport.com\\/favicon.png\"},\"theme\":{\"theme_font\":{\"children\":{\"h1, ~h1~h1\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"50px\",\"line-height\":\"50px\",\"font-weight\":\"100\",\"font-style\":\"normal\"}},\"h2, ~h2~h2\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"30px\",\"line-height\":\"32px\",\"font-weight\":\"400\",\"font-style\":\"normal\"}},\"h3, ~h3~h3\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"20px\",\"line-height\":\"20px\",\"font-weight\":\"900\",\"font-style\":\"normal\"}},\"~label~label\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"16px\",\"line-height\":\"16px\",\"font-weight\":\"300\",\"font-style\":\"normal\"}},\"~button~button\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"14px\",\"line-height\":\"14px\",\"font-weight\":\"600\",\"font-style\":\"normal\"}},\"~large-body-text~large-body-text\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"18px\",\"line-height\":\"24px\",\"font-weight\":\"100\",\"font-style\":\"normal\"}},\"~body-text~body-text\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"14px\",\"line-height\":\"22px\",\"font-weight\":\"300\",\"font-style\":\"normal\"}},\"blockquote, ~blockquote\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"14px\",\"line-height\":\"22px\",\"font-weight\":\"100\",\"font-style\":\"italic\"}}}},\"theme_colors\":{\"primary-color\":\"#1e88e5\",\"complimentary-color\":\"#41baff\",\"dark-color\":\"#333333\",\"light-color\":\"#f3efea\",\"white-color\":\"#ffffff\"},\"theme_background\":{\"id\":\"template-background\",\"type\":\"background\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"bg\":\"#ffffff\",\"options\":[\"backgrounds\"],\"alias\":\"background\"}},\"theme_spacing\":{\"children\":{\"~spacing\":{\"attributes\":{\"padding-top\":\"20px\",\"padding-bottom\":\"20px\"}}}},\"theme_dimensions\":{\"widthType\":\"option\",\"width\":\"100%\",\"height\":null},\"border\":{\"color\":\"#000000\",\"size\":\"0px\"}},\"mergedData\":\"\",\"formBlockIds\":[]},{\"templateId\":false,\"status\":false,\"blocks\":[],\"settings\":{\"favicon_uploader\":\"\\/\\/app.ontraport.com\\/favicon.png\"},\"theme\":{\"theme_font\":{\"children\":{\"h1, ~h1~h1\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"50px\",\"line-height\":\"50px\",\"font-weight\":\"100\",\"font-style\":\"normal\"}},\"h2, ~h2~h2\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"30px\",\"line-height\":\"32px\",\"font-weight\":\"400\",\"font-style\":\"normal\"}},\"h3, ~h3~h3\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"20px\",\"line-height\":\"20px\",\"font-weight\":\"900\",\"font-style\":\"normal\"}},\"~label~label\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"16px\",\"line-height\":\"16px\",\"font-weight\":\"300\",\"font-style\":\"normal\"}},\"~button~button\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"14px\",\"line-height\":\"14px\",\"font-weight\":\"600\",\"font-style\":\"normal\"}},\"~large-body-text~large-body-text\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"18px\",\"line-height\":\"24px\",\"font-weight\":\"100\",\"font-style\":\"normal\"}},\"~body-text~body-text\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"14px\",\"line-height\":\"22px\",\"font-weight\":\"300\",\"font-style\":\"normal\"}},\"blockquote, ~blockquote\":{\"attributes\":{\"font-family\":\"Arial, sans-serif\",\"font-size\":\"14px\",\"line-height\":\"22px\",\"font-weight\":\"100\",\"font-style\":\"italic\"}}}},\"theme_colors\":{\"primary-color\":\"#1e88e5\",\"complimentary-color\":\"#41baff\",\"dark-color\":\"#333333\",\"light-color\":\"#f3efea\",\"white-color\":\"#ffffff\"},\"theme_background\":{\"id\":\"template-background\",\"type\":\"background\",\"for\":null,\"tag\":\"DIV\",\"attrs\":{\"bg\":\"#ffffff\",\"options\":[\"backgrounds\"],\"alias\":\"background\"}},\"theme_spacing\":{\"children\":{\"~spacing\":{\"attributes\":{\"padding-top\":\"20px\",\"padding-bottom\":\"20px\"}}}},\"theme_dimensions\":{\"widthType\":\"option\",\"width\":\"100%\",\"height\":null},\"border\":{\"color\":\"#000000\",\"size\":\"0px\"}},\"mergedData\":\"\",\"formBlockIds\":[]}]",
"design_type": "3",
"name": "Welcome",
"seo_settings": "[{},{},{},{}]",
"rotation": "0",
"last_save": "0",
"last_auto": "0",
"autosave": "",
"visits_0": "0",
"visits_1": "0",
"visits_2": "0",
"visits_3": "0",
"unique_visits_0": "0",
"unique_visits_1": "0",
"unique_visits_2": "0",
"unique_visits_3": "0",
"convert_0": "0",
"convert_1": "0",
"convert_2": "0",
"convert_3": "0",
"unique_convert_0": "0",
"unique_convert_1": "0",
"unique_convert_2": "0",
"unique_convert_3": "0",
"platform": "0",
"domain": null,
"ssl_enabled": "0",
"date": "1510704945",
"dlm": "1510704945"
},
"account_id": "12345"
}
Retrieves all the information for an existing landing page.
Request Endpoint
GET https://api.ontraport.com/1/LandingPage
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Parameter | Type | Description |
---|---|---|
id |
integer | The landing page ID. Required. |
Retrieve multiple landing pages
curl -X GET 'https://api.ontraport.com/1/LandingPages?sort=name&sortDir=asc&listFields=id%2Cname' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"sort" => "name",
"sortDir" => "asc",
"listFields" => "id,name"
);
$response = $client->landingpage()->retrieveMultiple($requestParams);
Example response:
{
"code": 0,
"data": [
{
"id": "2",
"name": "Thank You"
},
{
"id": "1",
"name": "Welcome"
}
],
"account_id": "12345",
"misc": []
}
Retrieves a collection of landing pages based on a set of parameters. You can limit unnecessary API requests by utilizing criteria and our pagination tools to select only the data set you require.
Request Endpoint
GET https://api.ontraport.com/1/LandingPages
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Parameter | Type | Description |
---|---|---|
ids |
string | A comma separated list of the IDs of the landing pages you wish to retrieve. Entering a value of 0 will result in all landing pages being selected. |
start |
integer | The offset to start your search from. |
range |
integer | The number of landing pages to retrieve. The maximum and default range is 50. |
sort |
string | The field results should be sorted on. |
sortDir |
string | The direction your results should be sorted. Your options are asc and desc . This field must be used in conjunction with the sort parameter. |
condition |
string | A JSON encoded string to more specifically set criteria for which objects you wish to bring back. See criteria examples for more details. |
search |
string | A string to search your landing page objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other landing page fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
externs |
string | If you have a relationship between your landing page object and another object, you may want to include the data from a related field in your results. Each external field is listed in the format {object}//{field} . Multiple fields are separated by commas. |
listFields |
string | A comma separated list of the fields which should be returned in your results. |
Retrieve landing page meta
curl -X GET 'https://api.ontraport.com/1/LandingPages/meta' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$response = $client->landingpage()->retrieveMeta();
Example response:
{
"code": 0,
"data": {
"20": {
"name": "LandingPage",
"fields": {
"name": {
"alias": "Name",
"type": "text"
},
"domain": {
"alias": "Domain",
"type": "text"
},
"visits": {
"alias": "Visits",
"type": "mergefield"
},
"conversions": {
"alias": "Conversions",
"type": "mergefield"
},
"design_type": {
"alias": "Type",
"type": "drop",
"options": {
"0": "Code Mode",
"1": "Legacy Pages",
"2": "Redirect",
"3": "ONTRAPAGES"
}
}
}
}
},
"account_id": "12345"
}
Retrieves the field meta data for the landing page object.
Request Endpoint
GET https://api.ontraport.com/1/LandingPage/meta
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
None
Retrieve landing page collection info
curl -X GET 'https://api.ontraport.com/1/LandingPages/getInfo?search=Welcome' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"search" => "Welcome"
);
$response = $client->landingpage()->retrieveCollectionInfo($requestParams);
Example Response:
{
"code": 0,
"data": {
"listFields": [
"name",
"domain",
"visits",
"conversions"
],
"listFieldSettings": [],
"count": "1"
},
"account_id": "12345"
}
Retrieves information about a collection of landing pages, such as the number of landing pages that match the given criteria.
Request Endpoint
GET https://api.ontraport.com/1/LandingPages/getInfo
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Parameter | Type | Description |
---|---|---|
condition |
string | A JSON encoded string to more specifically set criteria for which landing pages to bring back. See criteria examples for more details. |
search |
string | A string to search your landing page objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to landing page object fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Retrieve hosted URL
curl -X GET 'https://api.ontraport.com/1/landingPage/getHostedURL?id=1' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 1
);
$response = $client->landingpage()->getHostedURL($requestParams);
Example Response:
{
"code": 0,
"data": "http://hostedforms.ontraport.com/12345/1/c196822625fffc4f75dabcbb3c048f38/1",
"account_id": "12345"
}
Retrieves the hosted URL for a landing page by its ID.
Request Endpoint
GET https://api.ontraport.com/1/landingPage/getHostedURL
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Parameter | Type | Description |
---|---|---|
id |
integer | The landing page ID. |
Messages
Object Type ID: 7
Message objects contain data for all of the messages in an account. Supported message types include ONTRAmail, legacy HTML emails, SMS, task messages, and postcards. All of these types can be retrieved through the API, and all but postcards can be created and updated. When modifying message content, pay close attention to the format required to avoid unexpected results.
The message object
{
"id": "3",
"alias": "Test EMail",
"type": "e-mail",
"last_save": "0",
"last_auto": "0",
"autosave": "",
"date": "1502832565",
"mcsent": "0",
"mcopened": "0",
"mcclicked": "0",
"mcabuse": "0",
"mcunsub": "0",
"spam_score": "4.4",
"subject": "Hi, [First Name]!",
"object_type_id": "0",
"dlm": "1510704661",
"transactional_email": "0",
"json_data": "",
"owner": "1",
"from": "owner",
"message_body": "<p>Dear [First Name],</p>\n\n<p>This is the message body.</p>\n\n<p> </p>",
"send_out_name": "",
"reply_to_email": "Contact owner email",
"plaintext": "",
"send_from": "tester@Ontraport.com",
"send_to": "email",
"word_wrap_checkbox": "0",
"utm_tracking": "0"
}
Message attributes
Attribute | Type | Description |
---|---|---|
id |
integer | The message ID. |
alias |
string | The message name. |
type |
string | The message type. Types names map as follows:e-mail => legacy email template => ONTRAmail sms => text message task => task messages postcard => postcard |
last_save |
timestamp | The last time the message was deliberately saved measured in seconds from the Unix Epoch. |
last_auto |
timestamp | The last time the message was automatically saved measured in seconds from the Unix Epoch. |
autosave |
string | The content of the last autosave. |
date |
timestamp | The date the message was created measured in seconds from the Unix Epoch. |
mcsent |
integer | The number of times the message has been sent. |
mcopened |
integer | The rate of messages that have been opened versus sent, represented as a percentage. |
mcclicked |
integer | The rate of clickthroughs in opened messages, represented as a percentage. |
mcabuse |
integer | The rate of complaints about sent messages, represented as a percentage. |
mcunsub |
integer | The rate of opt-outs on this message, represented as a percentage. |
spam_score |
float | The SpamAssassin spam score of the message. The lower the score, the better the rating. Messages with a spam score of 5 or higher will not be sent. |
subject |
string | The email subject line. |
object_type_id |
integer | The ID of the object type associated with the message. The default is 0 for contact objects. This field should only be changed if you are using custom objects. |
dlm |
timestamp | The data and time the message was last modified measured in seconds from the Unix Epoch. |
transactional_email |
integer | A binary integer flag indicating whether or not this message is transactional email. Values are mapped as follows:0 => false 1 => true Transactional email is NOT marketing email. It is email that delivers a product, an invoice, a request for payment for a purchase already made, or other messaging having to do with an existing client relationship. It is not to promote new stuff to an existing client. When you set this flag to 1, the email will be sent even if a contact has already unsubscribed. Because of this, if you send it to someone who isn’t a client and who has unsubscribed, you will be breaking CAN-SPAM and other anti-spam laws. This is your responsibility. In addition, Ontraport can and will suspend your account should we discover marketing messages in emails that you have marked as Transactional Emails. |
json_data |
longtext | The content of an ONTRAmail message. |
owner |
integer | The ID of the user having ownership of the message. |
from |
string | Who the message will be sent from. Options are owner , custom , or the desired user ID. |
message_body |
string | For legacy emails only, the HTML content of the message. |
send_out_name |
string | If the from field is set to custom , the name the message should come from. |
reply_to_email |
string | The "reply to" email address. |
plaintext |
string | For email messages, the plain text version of your email. For SMS messages, the content to be sent. |
send_from |
string | Emails are automatically sent from your default email address. If you would like to send from another email address, this field can contain any validated email address. |
send_to |
string | Used only with custom objects and SMS messages. In custom objects, you can use this field to send to another email in a parent/child relationship. For example, you could send to a related child object instead of the contact's default email address. The field is stored in the format {related_field}//{child_field} , where related_field is the parent field relating one object to another and child_field is the actual email field in the related object you would like to send to. For SMS messages, this field defaults to sms_number . |
word_wrap_checkbox |
integer | A binary flag indicating whether or not long lines are being wrapped. |
utm_tracking |
integer | A binary flag indicating whether or not the message contains UTM tracking information. |
Create a message
curl -X POST -d 'alias=Test%20Legacy%20Email&subject=Hi%2C%20%5BFirst%20Name%5D&type=e-mail&object_type_id=0&from=owner&send_out_name=owner&reply_to_email=Contact%20owner%20email&send_to=email&message_body=Sample%20message%20body' 'https://api.ontraport.com/1/message' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"alias" => "Test Legacy Email",
"subject" => "Hi, [First Name]",
"type" => "e-mail",
"object_type_id" => 0,
"from" => "owner",
"send_out_name" => "owner",
"reply_to_email" => "Contact owner email",
"message_body" => "Sample message body"
);
$response = $client->message()->create($requestParams);
Example Response:
{
"code": 0,
"data": {
"id": 4,
"date": "1502837435"
},
"account_id": "12345"
}
This endpoint will add a new message of designated type to your database.
Request Endpoint
POST https://api.ontraport.com/1/message
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
alias |
string | The message name. |
type |
string | The message type. Types names map as follows:e-mail => legacy email template => ONTRAmail sms => text message task => task messages Postcard messages can be retrieved but not created through the API. |
transactional_email |
integer | A binary integer flag indicating whether or not this message is transactional email. Values are mapped as follows:0 => false 1 => true Transactional email is NOT marketing email. It is email that delivers a product, an invoice, a request for payment for a purchase already made, or other messaging having to do with an existing client relationship. It is not to promote new stuff to an existing client. When you set this flag to 1, the email will be sent even if a contact has already unsubscribed. Because of this, if you send it to someone who isn’t a client and who has unsubscribed, you will be breaking CAN-SPAM and other anti-spam laws. This is your responsibility. In addition, Ontraport can and will suspend your account should we discover marketing messages in emails that you have marked as Transactional Emails. |
subject |
string | The email subject line. |
object_type_id |
integer | The ID of the object type associated with the message. The default is 0 for contact objects. This field should only be changed if you are using custom objects. |
from |
string | Who the message will be sent from. Options are owner , custom , or the desired user ID. |
send_out_name |
string | If the from field is set to custom , the name the message should come from. |
reply_to_email |
string | The "reply to" email address. |
plaintext |
string | For email messages, the plain text version of your email. For SMS messages, the content to be sent. |
send_from |
string | Emails are automatically sent from your default email address. If you would like to send from another email address, this field can contain any validated email address. |
send_to |
string | Used only with custom objects and SMS messages. In custom objects, you can use this field to send to another email in a parent/child relationship. For example, you could send to a related child object instead of the contact's default email address. The field is stored in the format {related_field}//{child_field} , where related_field is the parent field relating one object to another and child_field is the actual email field in the related object you would like to send to. For SMS messages, this field defaults to sms_number . |
message_body |
string | For legacy emails only; the HTML content of the message. |
resource |
string | For ONTRAmail messages only; the content of the message. Note that this can be extremely complex, so you should start by inspecting the resource that is sent when saving a message from inside the app. For SMS messages, use the plaintext field for content. |
task_data |
string | For task messages only; the content of the message. |
due_date |
string | For task messages only; the number of days after assignment the task will be due. |
task_owner |
integer | The ID of the staff user having ownership of the task. |
task_form |
integer | The ID of the form to be filled out upon task completion. The form must already exist and cannot be created with this endpoint. |
utm_tracking |
integer | A binary flag indicating whether or not the message contains UTM tracking information. |
Update a message
curl -X PUT -d 'id=4&alias=New%20Name' 'https://api.ontraport.com/1/message' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678' \
--header 'Content-Type: application/x-www-form-urlencoded'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => "1",
"alias" => "New Name"
);
$response = $client->message()->update($requestParams);
Example Response:
{
"code": 0,
"data": {
"id": "4",
"date": "1502837435"
},
"account_id": "12345"
}
Updates an existing message with given data. The ID of the message to update is required. The other fields should only be used if you want to change the existing value.
Request Endpoint
PUT https://api.ontraport.com/1/message
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
id |
integer | The message ID. Required. |
alias |
string | The message name. |
type |
string | The message type. Types names map as follows:e-mail => legacy email template => ONTRAmail sms => text message task => task messages Postcard messages can be retrieved but not created through the API. |
transactional_email |
integer | A binary integer flag indicating whether or not this message is transactional email. Values are mapped as follows:0 => false 1 => true Transactional email is NOT marketing email. It is email that delivers a product, an invoice, a request for payment for a purchase already made, or other messaging having to do with an existing client relationship. It is not to promote new stuff to an existing client. When you set this flag to 1, the email will be sent even if a contact has already unsubscribed. Because of this, if you send it to someone who isn’t a client and who has unsubscribed, you will be breaking CAN-SPAM and other anti-spam laws. This is your responsibility. In addition, Ontraport can and will suspend your account should we discover marketing messages in emails that you have marked as Transactional Emails. |
subject |
string | The email subject line. |
object_type_id |
integer | The ID of the object type associated with the message. The default is 0 for contact objects. This field should only be changed if you are using custom objects. |
from |
string | Who the message will be sent from. Options are owner , custom , or the desired user ID. |
send_out_name |
string | If the from field is set to custom , the name the message should come from. |
reply_to_email |
string | The "reply to" email address. |
plaintext |
string | For email messages, the plain text version of your email. For SMS messages, the content to be sent. |
send_from |
string | Emails are automatically sent from your default email address. If you would like to send from another email address, this field can contain any validated email address. |
send_to |
string | Used only with custom objects and SMS messages. In custom objects, you can use this field to send to another email in a parent/child relationship. For example, you could send to a related child object instead of the contact's default email address. The field is stored in the format {related_field}//{child_field} , where related_field is the parent field relating one object to another and child_field is the actual email field in the related object you would like to send to. For SMS messages, this field defaults to sms_number . |
message_body |
string | For legacy emails only; the HTML content of the message. |
resource |
string | For ONTRAmail messages only; the content of the message. Note that this can be extremely complex, so you should start by inspecting the resource that is sent when saving a message from inside the app. For SMS messages, use the plaintext field for content. |
task_data |
string | For task messages only; the content of the message. |
due_date |
string | For task messages only; the number of days after assignment the task will be due. |
task_owner |
integer | The ID of the staff user having ownership of the task. |
task_form |
integer | The ID of the form to be filled out upon task completion. The form must already exist and cannot be created with this endpoint. |
Retrieve a specific message
curl -X GET 'https://api.ontraport.com/1/message?id=1' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 1
);
$response = $client->message()->retrieveSingle($requestParams);
Example Response:
{
"code": 0,
"data": {
"id": "1",
"alias": "Test Task",
"type": "Task",
"last_save": "0",
"last_auto": "0",
"autosave": "",
"date": "1502823002",
"mcsent": "0",
"mcopened": "0",
"mcclicked": "0",
"mcabuse": "0",
"mcunsub": "0",
"spam_score": "",
"subject": "Do this",
"object_type_id": "0",
"dlm": "1510704661",
"owner": "1",
"topic": "Do this",
"due_date": "5",
"task_data": "[First Name], get cracking!",
"task_notification": "",
"task_form": "",
"task_owner": "0",
"task_notification_checkbox": "0"
},
"account_id": "12345"
}
Retrieves all the information for an existing message.
Request Endpoint
GET https://api.ontraport.com/1/Message
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The message ID. Required. |
Retrieve multiple messages
curl -X GET 'https://api.ontraport.com/1/Messages?ids=1%2C2%2C3&listFields=id%2Calias%2Ctype' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"ids" => "1,2,3",
"listFields" => "id,alias,type"
);
$response = $client->message()->retrieveMultiple($requestParams);
Example Response:
{
"code": 0,
"data": [
{
"id": "1",
"alias": "Test Task",
"type": "Task"
},
{
"id": "2",
"alias": "ONTRAmail",
"type": "Template"
},
{
"id": "3",
"alias": "Test EMail",
"type": "e-mail"
}
],
"account_id": "12345",
"misc": []
}
Retrieves a collection of messages based on a set of parameters. You can limit unnecessary API requests by utilizing criteria and our pagination tools to select only the data set you require.
Request Endpoint
GET https://api.ontraport.com/1/Messages
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Retrieve message meta
curl -X GET 'https://api.ontraport.com/1/Messages/meta' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$response = $client->message()->retrieveMeta();
Example Response:
{
"code": 0,
"data": {
"7": {
"name": "Message",
"fields": {
"alias": {
"alias": "Name",
"type": "text",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0
},
"name": {
"alias": "Name",
"type": "mergefield",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 1
},
"subject": {
"alias": "Subject",
"type": "text",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1
},
"spam_score": {
"alias": "Spam Score",
"type": "",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1
},
"type": {
"alias": "Type",
"type": "drop",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1,
"options": {
"e-mail": "Email",
"e-mail transactional": "Email (Transactional)",
"Task": "Task",
"sms": "SMS",
"Postcard": "Postcard",
"[\"e-mail\",\"Template\"]": "Email/ONTRAmail",
"Template": "ONTRAmail",
"template transactional": "ONTRAmail (Transactional)"
}
},
"mcsent": {
"alias": "Sent",
"type": "numeric",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 1
},
"mcopened": {
"alias": "Opened",
"type": "percentage",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 1
},
"mcclicked": {
"alias": "Clicked",
"type": "percentage",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 1
},
"mcabuse": {
"alias": "Complaints",
"type": "percentage",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 1
},
"mcunsub": {
"alias": "Opt Outs",
"type": "percentage",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 1
},
"date": {
"alias": "Date Created",
"type": "timestamp",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 1
},
"mcnotopened": {
"alias": "Not Opened",
"type": "percentage",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 1
},
"mcnotclicked": {
"alias": "Not Clicked",
"type": "percentage",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 1
},
"dlm": {
"alias": "Date Modified",
"type": "timestamp",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 0
}
}
}
},
"account_id": "12345"
}
Retrieves the field meta data for the message object.
Request Endpoint
GET https://api.ontraport.com/1/Messages/meta
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Retrieve message collection info
curl -X GET 'https://api.ontraport.com/1/Messages/getInfo' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$conditions = new OntraportAPI\Criteria("type", "=", "email");
$requestParams = array(
"condition" => $conditions->fromArray()
);
$response = $client->message()->retrieveCollectionInfo($requestParams);
Example Response:
{
"code": 0,
"data": {
"listFields": [
"name",
"subject",
"spam_score",
"date",
"type",
"mcsent",
"mcopened",
"mcclicked",
"mcnotopened",
"mcnotclicked",
"mcunsub",
"mcabuse"
],
"listFieldSettings": [],
"count": "4"
},
"account_id": "12345"
}
Retrieves information about a collection of messages, such as the number of messages that match the given criteria.
Request Endpoint
GET https://api.ontraport.com/1/Messages/getInfo
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID. Required. |
condition |
string | A JSON encoded string to more specifically set criteria for which messages you wish to select. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other object fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Offers
Object Type ID: 65
Offer objects allow you to save the details of products, quantities, and prices of frequently used transactions as offers for rapid processing with other Contacts.
Through the offers API, you can create, retrieve, and update offers. You can also retrieve meta for an offer object to obtain more detailed information about its attributes and retrieve information about a collection of offers.
Offers can be associated with many other objects such as transactions and products. You can access additional functionality for adding offers to transactions and adding products to offers using the transaction API and the product API.
The offer object
{
"id": "1",
"name": null,
"public": "1",
"data": "{\"products\":[{\"id\":1,\"name\":\"product\",\"quantity\":1,\"shipping\":true,\"tax\":true,\"type\":\"subscription\",\"price\":[{\"price\":10,\"payment_count\":1,\"unit\":\"week\"}],\"product_type\":null}],\"send_recurring_invoice\":false,\"shipping_charge_reoccurring_orders\":false,\"shipping\":{\"id\":1,\"name\":\"ship\"},\"hasShipping\":true,\"taxes\":[{\"id\":1,\"name\":\"tax\",\"taxShipping\":false,\"rate\":\"7.00\"}],\"hasTaxes\":true,\"invoice_template\":1}"
}
Attributes | Type | Description |
---|---|---|
id |
integer | The offer's ID. |
name |
string | The offer's name. |
public |
integer | A flag that indicates an offer as accessible for processing manual transactions. 0 => Not Accessible 1 => Accessible |
data |
string | A json encoded string containing an offer's data. |
Retrieve a specific offer
curl -X GET 'https://api.ontraport.com/1/Offer?id=1' \
--header 'Accept: application/json' \
--header 'Api-Appid: 2_AppID_12345678' \
--header 'Api-Key: Key5678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 1
);
$response = $client->offer()->retrieveSingle($requestParams);
Example Response:
{
"code": 0,
"data": {
"data": "{\"products\": [{\"quantity\": 2,\"shipping\": false,\"tax\": false,\"price\": [{\"price\": \"2.99\",\"payment_count\": 1,\"unit\": \"month\"}],\"type\": \"single\",\"name\": \"product\",\"id\": \"6\"}],\"taxes\": [],\"shipping\": null,\"invoice_template\": 1,\"hasTaxes\": false,\"hasShipping\": false,\"shipping_charge_reoccurring_orders\": false,\"name\": \"New Offer\"}",
"name": "New Offer",
"public": 1,
"id": 1,
"owner": "1"
},
"account_id": "12345"
}
Retrieves all the information for an existing offer. The only parameter needed is the ID for the offer which is returned in the response upon offer creation.
Request Endpoint
GET https://api.ontraport.com/1/Offer
Required Headers
Api-Appid: 2_AppID_12345678
Api-Key: Key5678
Request Parameters
Parameter | Type | Description |
---|---|---|
id |
integer | The offer ID. Required. |
Retrieve multiple offers
curl -X GET 'https://api.ontraport.com/1/Offers?range=50&search=offer' \
--header 'Api-Appid: 2_AppID_12345678' \
--header 'Api-Key: Key5678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"search" => "offer"
);
$response = $client->offer()->retrieveMultiple($requestParams);
Example Response:
{
"code": 0,
"data": [
{
"id": "2",
"name": "New Offer",
"public": "1",
"data": "{\"products\":[{\"quantity\":2,\"minQuantity\":1,\"maxQuantity\":99,\"total\":\"5.98\",\"shipping\":false,\"tax\":false,\"price\":[{\"price\":\"2.99\",\"payment_count\":1,\"unit\":\"month\",\"id\":723719844393}],\"type\":\"single\",\"quantityEditable\":false,\"index\":0,\"name\":\"product\",\"id\":\"6\",\"uid\":\"cfd02247-0c28-6262-f8be-9e44ec8a299a\"}],\"taxes\":[],\"paymentmethods\":[],\"shipping\":null,\"delay\":0,\"invoice_template\":1,\"subTotal\":5.98,\"grandTotal\":5.98,\"hasTaxes\":false,\"hasShipping\":false,\"paypalValid\":true,\"offerCoupon\":false,\"coupon\":null,\"shipping_charge_reoccurring_orders\":false,\"resorted\":null,\"name\":\"New Offer\"}"
},
{
"id": "3",
"name": "Awesome Offer",
"public": "1",
"data": "{\"products\": [{\"quantity\": 2,\"minQuantity\": 1,\"maxQuantity\": 99,\"total\": \"5.98\",\"shipping\": false,\"tax\": false,\"price\": [{\"price\": \"2.99\",\"payment_count\": 1,\"unit\": \"month\",\"id\": 723719844393}],\"type\": \"single\",\"quantityEditable\": false,\"index\": 0,\"name\": \"product\",\"id\": \"6\",\"uid\": \"cfd02247-0c28-6262-f8be-9e44ec8a299a\"}],\"taxes\": [],\"paymentmethods\": [],\"shipping\": null,\"delay\": 0,\"invoice_template\": 1,\"subTotal\": 5.98,\"grandTotal\": 5.98,\"hasTaxes\": false,\"hasShipping\": false,\"paypalValid\": true,\"offerCoupon\": false,\"coupon\": null,\"shipping_charge_reoccurring_orders\": false,\"resorted\": null,\"name\": \"Awesome Offer\"}"
},
{
"id": "6",
"name": "Intro Offer",
"public": "1",
"data": "{\"products\": [{\"quantity\": 2,\"shipping\": false,\"tax\": false,\"price\": [{\"price\": \"2.99\",\"payment_count\": 1,\"unit\": \"month\"}],\"type\": \"single\",\"name\": \"product\",\"id\": \"6\"}],\"taxes\": [],\"shipping\": null,\"invoice_template\": 1,\"hasTaxes\": false,\"hasShipping\": false,\"shipping_charge_reoccurring_orders\": false,\"name\": \"Intro Offer\"}"
}
],
"account_id": "12345",
"misc": [],
"search": "offer"
}
Retrieves a collection of offers based on a set of parameters. You can limit unnecessary API requests by utilizing criteria and our pagination tools to select only the data set you require.
Request Endpoint
GET https://api.ontraport.com/1/Offers
Required Headers
Api-Appid: 2_AppID_12345678
Api-Key: Key5678
Request Parameters
Parameter | Type | Description |
---|---|---|
ids |
string | An array as a comma-delimited list of the IDs of the offers to retrieve. Entering a value of 0 will result in all offers being selected. |
start |
integer | The offset to return results from. |
range |
integer | The number of offers you want to retrieve. The maximum and default range is 50. |
sort |
string | The field results should be sorted on. |
sortDir |
string | The direction your results should be sorted. Your options are asc and desc . This field must be used in conjunction with the sort parameter. |
condition |
string | A JSON encoded string to more specifically set criteria for which offers to bring back. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your offer objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not offer notes should be searched for the specified string in addition to other offer fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
externs |
string | If you have a relationship between your offer object and another object, you may want to include the data from a related field in your results. Each external field is listed in the format {object}//{field} . Multiple fields are separated by commas. |
listFields |
string | An array as a comma-delimited list of the fields which should be returned in your results. |
Build an offer
<?php
require_once("Ontraport.php");
use OntraportAPI\Ontraport as Client;
use OntraportAPI\Models\Transaction as Transaction;
use OntraportAPI\Models\Offer as Offer;
$client = new Client("2_AppID_12345678","Key5678");
// Create a new Offer
$offer = new Offer("Tater Tot Diet");
$tater_tots = new Product("tater tots", 2.00, 1);
$offer->addProduct($tater_tots, 2, true, true);
$offer->addSubscription(1, Offer::WEEK, 2.00);
$offer->addTax(1, 5.00);
$offer->setShipping(1, 1.00);
$requestParams = $offer->toRequestParams();
$client->offer()->create($requestParams);
// Update an existing offer
$old_offer = $client->offer()->retrieveSingle(array("id" => 3));
$data = json_decode($old_offer, true);
// Create a offer object with old offer data
$offer = Offer::CreateFromResponse($data["data"]);
// Make modifications
$ice_cream = new Product("ice cream", 3.00, 4);
$offer->addProduct($ice_cream, 1, true, true);
$offer->addSubscription(4, Offer::MONTH);
$offer->setName("Healthy Diet");
$requestParams = $offer->toRequestParams();
$client->offer()->update($requestParams);
We have provided you with an Offer model in our SDK that helps simplify the formatting process in building a correct valid offer.
You can build an offer with the help of the Offer and Transaction models in our SDK or build your own request parameter array to create or update an offer. However, the correct formatting of valid offer data will be the user's responsibility to ensure.
Functions
Function | Description |
---|---|
addProduct |
Add a product to the transaction. |
addTrial |
Add a trial to a product in the transaction. |
addSubscription |
Add a subscription to a product in the transaction. Note that both a subscription and a payment plan can not be applied to the same product. |
addPaymentPlan |
Add a payment plan to a product in the transaction. Note that both a subscription and a payment plan can not be applied to the same product. |
deleteProduct |
Delete a product in the transaction. |
deleteTrial |
Delete a trial in a product. |
deleteSubscription |
Delete a subscription in a product. |
deletePaymentPlan |
Delete a payment plan in a product. |
addTax |
Add a tax to the transaction. |
deleteTax |
Delete a tax from the transaction. |
setShipping |
Set the shipping information for the transaction. |
setInvoiceTemplate |
Set the invoice template to use for the transaction. |
sendRecurringInvoice |
Send recurring invoices for each reoccurring order. |
chargeShippingForReoccurringOrders |
Charge shipping for reoccurring orders. |
setName |
Sets the name for the Offer object. |
toRequestParams |
Converts the Offer object to an array to be used as request parameters. |
CreateFromResponse |
Converts an array of offer data into an Offer object. |
addProduct(product, quantity, shipping, taxable)
Users will need to instaniate a new Product object from the Product model to add a product into the offer.
If the product to be added into the offer has a price that differs from the original listed product price, the change to the price
will need to be done using the Product model before passing it into the product
parameter in this function call.
Example calls using the Product object defined by the variable $product
:
addProduct($product, 2);
addProduct($product, 2, false, true);
Parameter | Type | Description |
---|---|---|
product |
Product | The Product object containing the data of an existing product on the account. |
quantity |
integer | The quantity of the product to add to the transaction. |
shipping |
boolean | Whether or not to add the product to shipping slip. (Optional. Defaults to false ) |
taxable |
boolean | Whether or not the product is included into tax calculations. (Optional. Defaults to false ) |
addTrial(product ID, price, payment count, unit)
Parameter | Type | Description |
---|---|---|
product ID |
integer | The ID of the product to apply the trial to. |
price |
double | The price of the trial. |
payment count |
integer | The number of unit that apply to the duration of the trial. |
unit |
constant | The time duration of the trial. |
addSubscription(product ID, unit, price)
Parameter | Type | Description |
---|---|---|
product ID |
integer | The ID of the product to apply the subscription to. |
unit |
constant | The time duration between each reoccurring payment for the product. |
price |
double | The price of the product for this subscription. May be omitted if price for product is defined in other array for the product, otherwise, must be included. |
addPaymentPlan(product ID, price, payment count, unit)
Parameter | Type | Description |
---|---|---|
product ID |
integer | The ID of the product to apply the payment plan to. |
price |
double | The amount to be paid for each reoccurring payment. |
payment count |
integer | The number of unit that apply to the duration of the payment plan. |
unit |
constant | The time duration between each reoccurring payment for the product. |
deleteTrial(product ID), deleteSubscription(product ID), deletePaymentPlan(product ID), deleteProduct(product ID)
Parameter | Type | Description |
---|---|---|
product ID |
integer | The ID of the product associated with the delete operation. |
addTax(tax ID, rate, tax shipping, name)
Parameter | Type | Description |
---|---|---|
tax ID |
integer | The ID of the tax to apply to the transaction. |
rate |
double | The rate of the tax. |
tax shipping |
boolean | Whether or not to include the costs of shipping in this tax calculation. |
name |
string | The name of the tax. (Optional. Defaults to "Tax" ) |
deleteTax(tax ID)
Parameter | Type | Description |
---|---|---|
tax ID |
integer | The ID of the tax to delete from the transaction. |
setShipping(shipping ID, price, name)
Parameter | Type | Description |
---|---|---|
shipping ID |
integer | The ID of the shipping to apply to the transaction. |
price |
double | The cost of the shipping. |
name |
string | The name of the shipping. (Optional. Defaults to "Shipping" ) |
setInvoiceTemplate(Invoice Template ID)
Parameter | Type | Description |
---|---|---|
Invoice Template ID |
integer | The ID of the invoice template to use in this transaction. To suppress invoices, set this to SUPPRESS . |
Constants
Parameter | Constants |
---|---|
unit |
DAY => "day" WEEK => "week" MONTH => "month" QUARTER => "quarter" YEAR => "year" |
Invoice Template ID |
SUPPRESS => -1 DEFAULT_TEMP => 1 |
Create an offer
curl -X POST -d '{"data": "{\"products\": [{\"quantity\": 2,\"shipping\": false,\"tax\": false,\"price\": [{\"price\": \"2.99\",\"payment_count\": 1,\"unit\": \"month\"}],\"type\": \"single\",\"name\": \"product\",\"id\": \"6\"}],\"taxes\": [],\"shipping\": null,\"invoice_template\": 1,\"hasTaxes\": false,\"hasShipping\": false,\"shipping_charge_reoccurring_orders\": false,\"name\": \"New Offer\"}", "name": "New Offer", "public": 1}' 'https://api.ontraport.com/1/Offers' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Accept: application/json' \
--header 'Api-Appid: 2_AppID_12345678' \
--header 'Api-Key: Key5678'
<?php
use OntraportAPI\Ontraport;
use OntraportAPI\Models\Offer as Offer;
$client = new Ontraport("2_AppID_12345678","Key5678");
// Building your own request parameter array to create a new offer
$requestParams = array(
"name" => "New Offer",
"data" => "{\"products\": [{\"quantity\": 2,\"shipping\": false,\"tax\": false,\"price\": [{\"price\": \"2.99\",\"payment_count\": 1,\"unit\": \"month\"}],\"type\": \"single\",\"name\": \"product\",\"id\": \"1\"}],\"taxes\": [],\"shipping\": null,\"invoice_template\": 1,\"hasTaxes\": false,\"hasShipping\": false,\"shipping_charge_reoccurring_orders\": false,\"name\": \"New Offer\"}",
"public" => 1
);
$response = $client->offer()->create($requestParams);
// Using the Offer model
$offer = new Offer("Test Offer");
$product = new Product("product", 2.99, 1);
$offer->addProduct($product, 2, false, false);
$offer->addSubscription(5, Offer::MONTH, 12);
$offer->setInvoiceTemplate(Offer::DEFAULT_TEMP);
$requestParams = $offer->toRequestParams();
// Create the offer
$response = $client->offer()->create($requestParams);
Example Response:
{
"code": 0,
"data": {
"data": "{\"products\": [{\"quantity\": 2,\"shipping\": false,\"tax\": false,\"price\": [{\"price\": \"2.99\",\"payment_count\": 1,\"unit\": \"month\"}],\"type\": \"single\",\"name\": \"product\",\"id\": \"6\"}],\"taxes\": [],\"shipping\": null,\"invoice_template\": 1,\"hasTaxes\": false,\"hasShipping\": false,\"shipping_charge_reoccurring_orders\": false,\"name\": \"New Offer\"}",
"name": "New Offer",
"public": 1,
"id": "1"
},
"account_id": "12345"
}
Creates a new offer object. This endpoint does not allow name duplications. The API will return a error response message if an offer with an existing name is attempting to be created.
Request Endpoint
POST https://api.ontraport.com/1/Offers
Required Headers
Api-Appid: 2_AppID_12345678
Api-Key: Key5678
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameter | Type | Description |
---|---|---|
name |
string | The offer's name. |
public |
integer | A flag that indicates an offer as accessible for processing manual transactions. 0 => Not Accessible 1 => Accessible |
data |
string | A json encoded string containing an offer's data. |
Update an offer
curl -X PUT -d 'id=1&name=Low%20Offer&data={"products":[{"quantity":2,"minQuantity":1,"maxQuantity":99,"total":"5.98","shipping":false,"tax":false,"price":[{"price":"2.99","payment_count":1,"unit":"month","id":563468607972}],"type":"single","quantityEditable":false,"index":0,"name":"product","id":"1","uid":"e9303080-4976-eb25-a46e-37042c62ff94"},{"quantity":2,"minQuantity":1,"maxQuantity":99,"total":"4.00","shipping":false,"tax":true,"price":[{"price":"2.00","payment_count":1,"unit":"month","id":434117561472}],"type":"single","quantityEditable":false,"index":0,"name":"cheescake","id":"3","uid":"9e31822b-8b2d-4dd6-503a-9e12f1601f37"}],"taxes":[{"rate":7.000000000000001,"rules":[],"name":"tax","taxShipping":"false","taxTotal":0.28,"form_id":"0","id":"2"}],"paymentmethods":[],"shipping":null,"delay":0,"invoice_template":1,"subTotal":9.98,"grandTotal":10.26,"hasTaxes":true,"hasShipping":false,"paypalValid":true,"offerCoupon":false,"coupon":null,"shipping_charge_reoccurring_orders":false,"resorted":null,"name":"Low Offer"}' 'https://api.ontraport.com/1/Offers' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Accept: application/json' \
--header 'Api-Appid: 2_AppID_12345678' \
--header 'Api-Key: Key5678'
<?php
use OntraportAPI\Ontraport;
use OntraportAPI\Models\Transaction as Transaction;
use OntraportAPI\Models\Offer as Offer;
$client = new Ontraport("2_AppID_12345678","Key5678");
// Building your own request parameter array to update an offer
$requestParams = array(
"id" => 1,
"name" => "Low Offer",
"data" => "{\"products\":[{\"quantity\":2,\"minQuantity\":1,\"maxQuantity\":99,\"total\":\"5.98\",\"shipping\":false,\"tax\":false,\"price\":[{\"price\":\"2.99\",\"payment_count\":1,\"unit\":\"month\",\"id\":563468607972}],\"type\":\"single\",\"quantityEditable\":false,\"index\":0,\"name\":\"product\",\"id\":\"1\",\"uid\":\"e9303080-4976-eb25-a46e-37042c62ff94\"},{\"quantity\":2,\"minQuantity\":1,\"maxQuantity\":99,\"total\":\"4.00\",\"shipping\":false,\"tax\":true,\"price\":[{\"price\":\"2.00\",\"payment_count\":1,\"unit\":\"month\",\"id\":434117561472}],\"type\":\"single\",\"quantityEditable\":false,\"index\":0,\"name\":\"cheesecake\",\"id\":\"3\",\"uid\":\"9e31822b-8b2d-4dd6-503a-9e12f1601f37\"}],\"taxes\":[{\"rate\":7.000000000000001,\"rules\":[],\"name\":\"tax\",\"taxShipping\":\"false\",\"taxTotal\":0.28,\"form_id\":\"0\",\"id\":\"2\"}],\"paymentmethods\":[],\"shipping\":null,\"delay\":0,\"invoice_template\":1,\"subTotal\":9.98,\"grandTotal\":10.26,\"hasTaxes\":true,\"hasShipping\":false,\"paypalValid\":true,\"offerCoupon\":false,\"coupon\":null,\"shipping_charge_reoccurring_orders\":false,\"resorted\":null,\"name\":\"Low Offer\"}"
);
$response = $client->offer()->update($requestParams);
// Using the Offer model to update offer's name and data
$transaction = new Transaction(1, Transaction::LOG);
// Retrieve the data of the offer to update
$response = $client->offer()->retrieveSingle(array("id" => 1));
$data = json_decode($response, true);
// Create a new offer object with the data
$offer = Offer::CreateFromResponse($data["data"]);
// Modify the data
$response = $client->product()->retrieveSingle(array("id" => 2));
$data = json_decode($response, true);
$product = Product::CreateFromResponse($data["data"]);
$offer->addProduct($product, 1, false, true);
$offer->addTax(1, 7.00, false);
$offer->setName("Low Offer");
// Convert to a new request parameter array
$requestParams = $offer->toRequestParams();
// Update the offer
$response = $client->offer()->update($requestParams);
Example Response:
{
"code": 0,
"data": {
"attrs": {
"name": "Low Offer",
"id": "1"
}
},
"account_id": "12345"
}
Updates an existing offer with given data. The ID of the offer to update is required. The other fields should only be used if you want to change the existing value. Note that the existing value for the parameter will be replaced with your indicated value for that parameter in this request.
Request Endpoint
PUT https://api.ontraport.com/1/Offers
Required Headers
Api-Appid: 2_AppID_12345678
Api-Key: Key5678
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameter | Type | Description |
---|---|---|
id |
integer | The offer's ID. Required. |
name |
string | The offer's name. |
public |
integer | A flag that indicates an offer as accessible for processing manual transactions. 0 => Not Accessible 1 => Accessible |
data |
string | A json encoded string containing an offer's data. |
Retrieve offer object meta
curl -X GET 'https://api.ontraport.com/1/Offers/meta' \
--header 'Accept: application/json' \
--header 'Api-Appid: 2_AppID_12345678' \
--header 'Api-Key: Key5678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$response = $client->offer()->retrieveMeta();
Example Response:
{
"code": 0,
"data": {
"65": {
"name": "Offer",
"fields": {
"name": {
"alias": "Name",
"type": "text"
},
"data": {
"alias": "Data",
"type": "longtext"
},
"public": {
"alias": "Public",
"type": "drop",
"options": {
"0": "Not Accessible",
"1": "Accessible"
}
}
}
}
},
"account_id": 12345
}
Retrieves the field meta data for the offer object.
Request Endpoint
GET https://api.ontraport.com/1/Offers/meta
Required Headers
Api-Appid: 2_AppID_12345678
Api-Key: Key5678
Request Parameters
None
Retrieve offer collection info
curl -X GET 'https://api.ontraport.com/1/Offers/getInfo?search=offer' \
--header 'Accept: application/json' \
--header 'Api-Appid: 2_AppID_12345678' \
--header 'Api-Key: Key5678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"search" => "offer"
);
$response = $client->offer()->retrieveCollectionInfo($requestParams);
Example Response:
{
"code": 0,
"data": {
"listFields": [
"name"
],
"listFieldSettings": [],
"cardViewSettings": [],
"viewMode": [],
"count": "4"
},
"account_id": "12345"
}
Retrieves information about a collection of offers, such as the number of offers that match the given criteria.
Request Endpoint
GET https://api.ontraport.com/1/Offers/getInfo
Required Headers
Api-Appid: 2_AppID_12345678
Api-Key: Key5678
Request Parameters
Parameter | Type | Description |
---|---|---|
condition |
string | A JSON encoded string to more specifically set criteria for which offers to select. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your offer objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not offer notes should be searched for the specified string in addition to other offer fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Open Orders
Object Type ID: 44
For every recurring transaction, an open order is created. An open order is created for a trial period, a payment plan, or a subscription. Open orders represent future purchases which have not been realized yet. Not to be confused with orders, which represent future invoices containing a transaction.
Through the open orders API, you can keep track of purchases which will be created in the future. You can retrieve the data for a single open order or a collection of open orders. You can get information about a collection of open orders which match certain criteria, and retrieve information for the open order object fields.
Open orders are sometimes referred to as subscriptions, although they are created for any type of recurring future payment.
The open order object
{
"id": "1",
"hidden": "0",
"type": "0",
"contact_id": "16",
"product_id": "5",
"order_id": "21",
"gateway_id": "53707",
"invoice_id": "30",
"quantity": "1",
"billing_status": "current",
"final_trial_date": "0",
"cancellation_date": "0",
"date": "1658952492",
"payment_next_date": "1661626800",
"orig_month_date": "0",
"payment_due_amount": null,
"payment_amount": "15.00",
"trial_amount": "0.00",
"payment_made": "1",
"payment_remaining": "0",
"payment_total": "15.00",
"unit": "month",
"count": "0",
"oprid": "0",
"length_of_sub": "0",
"total_price": "15.00",
"payment_remaning": "",
"product_id//name": "Product1"
}
Attributes | Type | Description |
---|---|---|
id |
integer | The ID of the open order. |
hidden |
integer | A flag that indicates whether the order is still open or not. An order is open if it has not been paid, cancelled, or deleted. 0 => Not Hidden 1 => Hidden |
type |
integer | A flag indicating the type of order. 0 => Subscription 1 => Payment plan 2 => Setup fee |
contact_id |
integer | The ID of the contact associated with the open order. |
product_id |
integer | The ID of the contact associated with the open order. |
order_id |
integer | The ID of the order corresponding to the open order. |
gateway_id |
integer | The ID of the gateway used for the open order. |
invoice_id |
integer | The ID of the invoice corresponding to the open order. |
quantity |
integer | The quantity of the product purchased in the open order. |
billing_status |
string | A string describing the billing status of the open order. |
cancellation_date |
timestamp | The date the open order was cancelled, if applicable. |
date |
timestamp | The date the open order was initiated. |
payment_next_date |
timestamp | The date of the next payment, measured in seconds from the Unix Epoch. |
orig_month_date |
timestamp | The date of the first automated billing for the open order, if the unit of the order is monthly. Measured in seconds from the Unix Epoch. |
payment_due_amount |
double | The amount which has not been paid yet for the open order, if the open order is past due. |
payment_amount |
double | The cost of a single product purchased with the open order, before tax or discounts. |
payment_made |
integer | The amount of payments which have been made already in the open order. |
payment_remaining |
integer | The amount of payments still remaining in the open order. If the open order is a recurring subscription, this value is 0. |
payment_total |
double | The total already paid during the open order, including all previous payments. |
unit |
string | The unit of the open order. Can be daily, weekly, monthly, quarterly, or yearly. |
count |
integer | The amount of units from the last payment date to the next payment date. |
oprid |
integer | The ID of the affiliate to be credited for the purchase. |
length_of_sub |
integer | The amount of days the open order has elapsed. |
total_price |
double | The total price of the products, calculated from the product quantity. |
payment_remaning |
integer | An intentionally misspelled field identical to payment_remaining , kept for legacy purposes only. |
product_id//name |
string | The name of the product purchased for the open order. |
Retrieve a single open order
curl -X GET 'https://api.ontraport.com/1/OpenOrder?id=1' \
--header 'Api-Appid: 2_AppID_12345678' \
--header 'Api-Key: Key5678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 1
);
$response = $client->openorder()->retrieveSingle($requestParams);
Example Response:
{
"code": 0,
"data": {
"id": "1",
"hidden": "0",
"type": "0",
"contact_id": "16",
"product_id": "5",
"order_id": "21",
"gateway_id": "53707",
"invoice_id": "30",
"quantity": "1",
"billing_status": "current",
"final_trial_date": "0",
"cancellation_date": "0",
"date": "1658952492",
"payment_next_date": "1661626800",
"orig_month_date": "0",
"payment_due_amount": null,
"payment_amount": "15.00",
"trial_amount": "0.00",
"payment_made": "1",
"payment_remaining": "0",
"payment_total": "15.00",
"unit": "month",
"count": "0",
"oprid": "0",
"length_of_sub": "0",
"total_price": "15.00",
"payment_remaning": "",
"product_id//name": "Product1"
},
"account_id": 12345
}
Retrieves information for an existing open order. The only parameter needed is the ID of the open order.
Request Endpoint
GET https://api.ontraport.com/1/OpenOrder
Required Headers
Api-Key: {api-key}
Api-Appid: {app-id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The ID of the open order. Required. |
Retrieve multiple open orders
curl -X GET 'https://api.ontraport.com/1/OpenOrders?ids=1%2C2&range=50' \
--header 'Api-Appid: 2_AppID_12345678' \
--header 'Api-Key: Key5678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"ids" => "1,2"
);
$response = $client->openorder()->retrieveMultiple($requestParams);
Example Response:
{
"code": 0,
"data": [
{
"id": "1",
"hidden": "0",
"type": "0",
"contact_id": "15",
"product_id": "3",
"order_id": "1",
"gateway_id": "53707",
"invoice_id": "1",
"quantity": "2",
"billing_status": "current",
"final_trial_date": "0",
"cancellation_date": "0",
"date": "1657738820",
"payment_next_date": "1663268400",
"orig_month_date": "0",
"payment_due_amount": null,
"payment_amount": "3.00",
"trial_amount": "0.00",
"payment_made": "2",
"payment_remaining": "0",
"payment_total": "12.00",
"unit": "month",
"count": "0",
"oprid": "0",
"length_of_sub": "15",
"total_price": "6.00",
"payment_remaning": "",
"product_id//name": "Product1"
},
{
"id": "2",
"hidden": "0",
"type": "0",
"contact_id": "16",
"product_id": "5",
"order_id": "2",
"gateway_id": "53707",
"invoice_id": "2",
"quantity": "1",
"billing_status": "current",
"final_trial_date": "0",
"cancellation_date": "0",
"date": "1657739201",
"payment_next_date": "1663268400",
"orig_month_date": "0",
"payment_due_amount": null,
"payment_amount": "15.00",
"trial_amount": "0.00",
"payment_made": "2",
"payment_remaining": "0",
"payment_total": "30.00",
"unit": "month",
"count": "0",
"oprid": "0",
"length_of_sub": "15",
"total_price": "15.00",
"payment_remaning": "",
"product_id//name": "Product2"
}
],
"account_id": 12345,
"misc": []
}
Retrieves a collection of open orders based on a set of parameters. You can limit unnecessary API requests by utilizing criteria and our pagination tools to select only the data set you require.
Request Endpoint
GET https://api.ontraport.com/1/OpenOrders
Required Headers
Api-Key: {api-key}
Api-Appid: {app-id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
ids |
string | An array as a comma-delimited list of the IDs of the open orders to retrieve. Entering a value of 0 will result in all open orders being selected. |
start |
integer | The offset to return results from. |
range |
integer | The number of open orders you want to retrieve. The maximum and default range is 50. |
sort |
string | The field results should be sorted on. |
sortDir |
string | The direction your results should be sorted. Your options are asc and desc . This field must be used in conjunction with the sort parameter. |
condition |
string | A JSON encoded string to more specifically set criteria for which open orders to bring back. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your open orders objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not open order notes should be searched for the specified string in addition to other open order fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
externs |
string | If you have a relationship between your open order object and another object, you may want to include the data from a related field in your results. Each external field is listed in the format {object}//{field} . Multiple fields are separated by commas. |
listFields |
string | An array as a comma-delimited list of the fields which should be returned in your results. |
Retrieve open order collection info
curl -X GET 'https://api.ontraport.com/1/OpenOrders/getInfo?search=Product1' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"search" => "Product1"
);
$response = $client->openorder()->retrieveCollectionInfo($requestParams);
Example Response:
{
"code": 0,
"data": {
"listFields": [
"name",
"contact_id",
"total_price",
"payment_next_date",
"payment_made",
"billing_status",
"date"
],
"listFieldSettings": [],
"cardViewSettings": {
"fields": [
"name",
"contact_id",
"total_price",
"payment_next_date",
"payment_made",
"billing_status",
"date"
]
},
"viewMode": [],
"widgetSettings": {
"map": [
[
"overview"
],
[
"fields"
],
[
"notes",
"tasks",
"settings"
]
],
"widgets": {
"overview": {
"type": "object_widget_overview",
"options": {
"visible": "true",
"excludeFromWidgetSettings": true
}
},
"tasks": {
"type": "object_widget_object_list_text_object_task_widget",
"options": {
"visible": "true",
"objectID": 1,
"header": "Tasks"
}
},
"notes": {
"type": "object_widget_object_list_text_object_notes_widget",
"options": {
"visible": "true",
"objectID": 12,
"header": "Notes"
}
},
"settings": {
"type": "object_widget_settings",
"options": {
"placeAtEndOfColumn": true,
"excludeFromWidgetSettings": true
}
},
"fields": {
"type": "object_widget_fields",
"options": {
"visible": "true",
"excludeFromWidgetSettings": true,
"fields": [
"name",
"contact_id",
"total_price",
"payment_next_date",
"payment_made",
"billing_status",
"date"
]
}
}
},
"listFields": [
"profile_image",
"name",
"contact_id",
"total_price",
"payment_next_date",
"payment_made",
"billing_status",
"date"
]
},
"count": "26",
"sums": {
"total_price": 630
}
},
"account_id": 12345
}
Retrieves information about a collection of open orders, such as the number of open orders that match the given criteria.
Request Endpoint
GET https://api.ontraport.com/1/OpenOrders/getInfo
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
condition |
string | A JSON encoded string to more specifically set criteria for which open orders to select. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your open order objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other open order fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Retrieve open order object meta
curl -X GET 'https://api.ontraport.com/1/OpenOrders/meta?format=byId' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$response = $client->openorder()->retrieveMeta();
Example response:
{
"code": 0,
"data": {
"44": {
"name": "Subscription",
"fields": {
"payment_next_date": {
"alias": "Next Payment Date",
"type": "fulldate",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0
},
"payment_amount": {
"alias": "Payment Amount",
"type": "price",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0
},
"type": {
"alias": "Type",
"type": "drop",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0,
"options": {
"0": "Subscription",
"1": "Payment Plan",
"2": "Setup Fee"
}
},
"name": {
"alias": "Product Name",
"type": "mergefield",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 1,
"extra_data": "<op:merge field='product_id//name'>X</op:merge>"
},
"total_price": {
"alias": "Next Payment Amount",
"type": "price",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1
},
"payment_total": {
"alias": "Payments Total",
"type": "numeric",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1
},
"payment_made": {
"alias": "Payments Made",
"type": "numeric",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1
},
"payment_remaning": {
"alias": "Payments Remaining",
"type": "numeric",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1
},
"payment_due_amount": {
"alias": "Overdue Payment Amount",
"type": "price",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1
},
"date": {
"alias": "Signup Date",
"type": "timestamp",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 1
},
"length_of_sub": {
"alias": "Length of Subscription (days)",
"type": "numeric",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1
},
"billing_status": {
"alias": "Billing Status",
"type": "text",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1
},
"contact_id": {
"alias": "Contact",
"type": "parent",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0,
"parent_object": 0
},
"product_id": {
"alias": "Product",
"type": "parent",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0,
"parent_object": 16
},
"gateway_id": {
"alias": "Gateway",
"type": "parent",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1,
"parent_object": 130
}
}
}
},
"account_id": 12345
}
Retrieves the field meta data for the open order object. Note that open orders are referred to as subscriptions internally.
Request Endpoint
GET https://api.ontraport.com/1/OpenOrders/meta
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
None
Orders
Object Type ID: 52
For every future transaction, an order object is created. An order contains information about a future transaction, such as for an open order or payment plan. When an order is completed, a corresponding purchase is created.
Through the orders API, you can retrieve information about a single order or a collection of orders. You can delete an order or a list of orders. You can get information about an order collection and filter by certain criteria.
The order object
{
"id": "1",
"contact_id": "1",
"offer_id": "1",
"affiliate": "0",
"cc_id": "3",
"name": "Product",
"payment_next_date": "1657612849",
"orig_month_date": "0",
"unit": "week",
"count": "1",
"gateway_id": "53707",
"shipping_address": "1234 Smith Way",
"shipping_city": "Goleta",
"shipping_state": "CA",
"shipping_zip": "93111",
"shipping_country": "US",
"shipping_last_charge": "0",
"shipping_service": null,
"status": "0",
"hidden": "0",
"dlm": "1657612849",
"order_form_json": "{\"taxes\":[],\"shipping\":[],...",
"cancellation_date": "0",
"next_sub": "12.00",
"tax": "0.00",
"shipping": "0.00",
"next_charge": "0.00",
"transactions": "0",
"transactions_remaining": "3",
"charged": "0"
}
Attributes | Type | Description |
---|---|---|
id |
integer | The order's ID. |
contact_id |
integer | The ID of the contact associated with the order. |
offer_id |
integer | The ID of the offer corresponding to the order. |
affiliate |
integer | The ID of the affiliate that referred the contact associated with the order. |
cc_id |
integer | The ID of the credit card used in the order. |
name |
string | The name of the product or products ordered. |
payment_next_date |
timestamp | The date of the next payment, measured in seconds from the Unix Epoch. |
orig_month_date |
timestamp | The date of the first automated billing for the order, if the unit of the order is monthly. Measured in seconds from the Unix Epoch. |
unit |
string | The unit of the open order or payment plan. Can be daily, weekly, monthly, quarterly, or yearly. |
count |
integer | The amount of units from the last payment date to the next payment date, for open orders and payment plans. |
gateway_id |
integer | The ID of the gateway used for the order. |
shipping_address |
string | The shipping address for the order. |
shipping_city |
string | The shipping city for the order. |
shipping_state |
string | The shipping state for the order. |
shipping_zip |
string | The shipping ZIP code for the order. |
shipping_country |
string | The shipping country for the order. |
shipping_last_charge |
string | The last shipping charge for the order. |
shipping_service |
string | The shipping service used for the order. |
status |
integer | A flag that indicates the status of the order. 0 => Current 1 => Past Due |
hidden |
integer | A flag that indicates whether the order is still open or not. An order is open if it has not been paid, cancelled, or deleted. 0 => Not Hidden 1 => Hidden |
dlm |
timestamp | The date the order was last modified, such as a change in status. Measured in seconds from the Unix Epoch. |
order_form_json |
string | A JSON-encoded string containing information about the order form, including data related to taxes, shipping, and contact information. |
cancellation_date |
timestamp | The date that the order was canceled or deleted. Measured in seconds from the Unix Epoch. |
next_sub |
double | The subtotal to be paid on the next payment date. |
tax |
double | The tax added to the order total. |
shipping |
double | The shipping costs added to the order total. |
next_charge |
double | The total amount to be charged on the next payment date, calculated with the next subtotal, tax, and shipping costs. |
transactions |
integer | The amount of successful transactions as a result of the open order or payment plan. |
transactions_remaining |
integer | The amount of transactions remaining, if the order is a payment plan or has a trial period. If the order is a recurring subscription, the value will be 0. |
charged |
double | The total charged as a result of all payments made in the order up to the current date. |
Retrieve a single order
curl -X GET 'https://api.ontraport.com/1/Order?id=1' \
--header 'Api-Appid: 2_AppID_12345678' \
--header 'Api-Key: Key5678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 1
);
$response = $client->order()->retrieveSingle($requestParams);
Example Response:
{
"code": 0,
"data": {
"id": "8",
"contact_id": "18",
"offer_id": "12",
"affiliate": "0",
"cc_id": "4",
"name": "Product1",
"payment_next_date": "1663268400",
"orig_month_date": "1660622770",
"unit": "month",
"count": "1",
"gateway_id": "53707",
"shipping_address": "79140 Aida Hill",
"shipping_city": "South Guillermo",
"shipping_state": "ND",
"shipping_zip": "97105",
"shipping_country": "CK",
"shipping_last_charge": "0",
"shipping_service": null,
"status": "0",
"hidden": "0",
"dlm": "1657746895",
"order_form_json": "{\"taxes\":[],\"shipping\":[],\"shipping_options\":null,...",
"cancellation_date": "0",
"next_sub": "15.00",
"tax": "0.00",
"shipping": "0.00",
"next_charge": "15.00",
"transactions": "1",
"transactions_remaining": "0",
"charged": "15.00"
},
"account_id": 12345
}
Retrieves information for an existing order. The only parameter needed is the ID of the order.
Request Endpoint
GET https://api.ontraport.com/1/Order
Required Headers
Api-Key: {api-key}
Api-Appid: {app-id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The order ID. Required. |
Retrieve multiple orders
curl -X GET 'https://api.ontraport.com/1/Orders?ids=4%2C5&range=2' \
--header 'Api-Appid: 2_AppID_12345678' \
--header 'Api-Key: Key5678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"ids" => "4,5"
);
$response = $client->order()->retrieveMultiple($requestParams);
Example Response:
{
"code": 0,
"data": [
{
"id": "4",
"contact_id": "16",
"offer_id": "7",
"affiliate": "0",
"cc_id": "2",
"name": "Product1",
"payment_next_date": "1663268400",
"orig_month_date": "1660622770",
"unit": "month",
"count": "1",
"gateway_id": "53707",
"shipping_address": "55520 Norris Via",
"shipping_city": "North Hardystad",
"shipping_state": "EC",
"shipping_zip": "51134",
"shipping_country": "YE",
"shipping_last_charge": "0",
"shipping_service": null,
"status": "0",
"hidden": "0",
"dlm": "1657746891",
"order_form_json": "{\"taxes\":[],\"shipping\":[],\"shipping_options\":null,...",
"cancellation_date": "0",
"next_sub": "15.00",
"tax": "0.00",
"shipping": "0.00",
"next_charge": "15.00",
"transactions": "2",
"transactions_remaining": "0",
"charged": "30.00"
},
{
"id": "5",
"contact_id": "17",
"offer_id": "8",
"affiliate": "0",
"cc_id": "3",
"name": "Product1",
"payment_next_date": "1663268400",
"orig_month_date": "1660622770",
"unit": "month",
"count": "1",
"gateway_id": "53707",
"shipping_address": "3853 Vivianne Island",
"shipping_city": "Walterport",
"shipping_state": "FL",
"shipping_zip": "64203",
"shipping_country": "CH",
"shipping_last_charge": "0",
"shipping_service": null,
"status": "0",
"hidden": "0",
"dlm": "1657746892",
"order_form_json": "{\"taxes\":[],\"shipping\":[],\"shipping_options\":null,...",
"cancellation_date": "0",
"next_sub": "60.00",
"tax": "0.00",
"shipping": "0.00",
"next_charge": "60.00",
"transactions": "2",
"transactions_remaining": "0",
"charged": "120.00"
}
],
"account_id": 12345,
"misc": []
}
Retrieves a collection of orders based on a set of parameters. You can limit unnecessary API requests by utilizing criteria and our pagination tools to select only the data set you require.
Request Endpoint
GET https://api.ontraport.com/1/Orders
Required Headers
Api-Key: {api-key}
Api-Appid: {app-id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
ids |
string | An array as a comma-delimited list of the IDs of the orders to retrieve. Entering a value of 0 will result in all orders being selected. |
start |
integer | The offset to return results from. |
range |
integer | The number of orders you want to retrieve. The maximum and default range is 50. |
sort |
string | The field results should be sorted on. |
sortDir |
string | The direction your results should be sorted. Your options are asc and desc . This field must be used in conjunction with the sort parameter. |
condition |
string | A JSON encoded string to more specifically set criteria for which orders to bring back. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your orders objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not order notes should be searched for the specified string in addition to other order fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
externs |
string | If you have a relationship between your order object and another object, you may want to include the data from a related field in your results. Each external field is listed in the format {object}//{field} . Multiple fields are separated by commas. |
listFields |
string | An array as a comma-delimited list of the fields which should be returned in your results. |
Retrieve order collection info
curl -X GET 'https://api.ontraport.com/1/Orders/getInfo?search=Product1' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"search" => "Product1"
);
$response = $client->order()->retrieveCollectionInfo($requestParams);
Example Response:
{
"code": 0,
"data": {
"listFields": [
"name",
"status",
"next_charge",
"dlm",
"payment_next_date",
"transactions",
"charged"
],
"listFieldSettings": [],
"cardViewSettings": {
"fields": [
"name",
"status",
"next_charge",
"dlm",
"payment_next_date",
"transactions",
"charged"
]
},
"viewMode": [],
"widgetSettings": {
"map": [
[
"overview"
],
[
"fields"
],
[
"notes",
"tasks",
"settings"
]
],
"widgets": {
"overview": {
"type": "object_widget_overview",
"options": {
"visible": "true",
"excludeFromWidgetSettings": true
}
},
"tasks": {
"type": "object_widget_object_list_text_object_task_widget",
"options": {
"visible": "true",
"objectID": 1,
"header": "Tasks"
}
},
"notes": {
"type": "object_widget_object_list_text_object_notes_widget",
"options": {
"visible": "true",
"objectID": 12,
"header": "Notes"
}
},
"settings": {
"type": "object_widget_settings",
"options": {
"placeAtEndOfColumn": true,
"excludeFromWidgetSettings": true
}
},
"fields": {
"type": "object_widget_fields",
"options": {
"visible": "true",
"excludeFromWidgetSettings": true,
"fields": [
"name",
"status",
"next_charge",
"dlm",
"payment_next_date",
"transactions",
"charged"
]
}
}
},
"listFields": [
"profile_image",
"name",
"status",
"next_charge",
"dlm",
"payment_next_date",
"transactions",
"charged"
]
},
"count": "7"
},
"account_id": 12345
}
Retrieves information about a collection of orders, such as the number of orders that match the given criteria.
Request Endpoint
GET https://api.ontraport.com/1/Orders/getInfo
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
condition |
string | A JSON encoded string to more specifically set criteria for which orders to select. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your order objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other order fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Retrieve order object meta
curl -X GET 'https://api.ontraport.com/1/Orders/meta?format=byId' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$response = $client->order()->retrieveMeta();
Example response:
{
"code": 0,
"data": {
"52": {
"name": "Order",
"fields": {
"name": {
"alias": "Name",
"type": "text",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0
},
"status": {
"alias": "Status",
"type": "drop",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0,
"options": {
"0": "Current",
"1": "Past Due"
}
},
"shipping_address": {
"alias": "Shipping Address",
"type": "text",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0
},
"shipping_city": {
"alias": "Shipping City",
"type": "text",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0
},
"shipping_state": {
"alias": "Shipping State",
"type": "state",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0
},
"shipping_zip": {
"alias": "Shipping Zip / Postal Code",
"type": "text",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0
},
"next_charge": {
"alias": "Next Charge Amount",
"type": "price",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1
},
"dlm": {
"alias": "Date Last Modified",
"type": "timestamp",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 1
},
"payment_next_date": {
"alias": "Next Charge Date",
"type": "fulldate",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1
},
"transactions": {
"alias": "Transactions",
"type": "text",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1
},
"transactions_remaining": {
"alias": "Transactions Remaining",
"type": "numeric",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1
},
"charged": {
"alias": "Total Charged",
"type": "price",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1
},
"next_sub": {
"alias": "Next Subtotal $",
"type": "price",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1
},
"tax": {
"alias": "Next Tax $",
"type": "price",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1
},
"shipping": {
"alias": "Next Shipping $",
"type": "price",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1
},
"cc_id": {
"alias": "Credit Card",
"type": "parent",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0,
"parent_object": 45
},
"date": {
"alias": "Signup date",
"type": "timestamp",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 1
}
}
}
},
"account_id": 12345
}
Retrieves the field meta data for the order object.
Request Endpoint
GET https://api.ontraport.com/1/Orders/meta
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
None
Delete a single order
curl -X DELETE 'https://api.ontraport.com/1/Order?id=1' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 1
);
$response = $client->order()->deleteSingle($requestParams);
Example Response:
{
"code": 0,
"account_id": "12345"
}
Deletes a specific order by its ID. The order will not be removed from the database: its hidden] will be set to 1 to specify that it is a past order.
Request Endpoint
DELETE https://api.ontraport.com/1/Order
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The ID of the order to delete. Required. |
Delete multiple orders
curl -X DELETE 'https://api.ontraport.com/1/Orders?ids=1%2C%202&range=2' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"ids" => "1,2",
"range" => "2"
);
$response = $client->order()->deleteMultiple($requestParams);
Example Response:
{
"code": 0,
"data": "Deleted",
"account_id": "12345"
}
Deletes a collection of orders based on a set of parameters. The orders can be deleted based on a list of IDs or using our pagination tools for a mass delete.
Request Endpoint
DELETE https://api.ontraport.com/1/Orders
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
ids |
string | An array as a comma-delimited list of the IDs of the orders to delete. Entering a value of 0 will result in all orders being selected. Caution should be used with this endpoint. |
start |
integer | The offset to delete results from. |
range |
integer | The number of orders you want to delete. The maximum and default range is 50. |
condition |
string | A JSON encoded string to more specifically set criteria for which orders to delete. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your order objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not order notes should be searched for the specified string in addition to other order fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. Note that setting this to the value of 1 without any other parameters will delete all orders from your account. |
Products
Object Type ID: 16
Product objects allow you to process transactions and order forms.
Through the products API, you can create, retrieve, update, and delete products. You can also retrieve meta for a product object obtain more detailed information about its attributes and retrieve information about a collection of products.
Products can be associated with many other objects such as transactions, offers, orders, and forms. You can access additional functionality for adding products to transactions or offers using the transactions API.
The product object
{
"id": "1",
"price": "10.00",
"name": "Product",
"description": "",
"date": "1533587732",
"dlm": "1533587732",
"external_id": null,
"product_group": null,
"sku": null,
"taxable": null,
"deleted": false,
"total_income": null,
"total_purchases": null
}
Attributes | Type | Description |
---|---|---|
id |
integer | The product's ID. |
price |
double | The product's price. |
name |
string | The product's name. |
description |
string | The product's description. |
date |
timestamp | The date the product was added, measured in seconds from the Unix Epoch. |
dlm |
timestamp | The date the product was last modified, measured in seconds from the Unix Epoch. |
external_id |
integer | The product's ID in other integrations. |
product_group |
integer | The ID of the product group associated with the product. |
sku |
string | The product's code for integrations. |
taxable |
boolean | Whether or not the product can be included in tax calculations. |
deleted |
boolean | Whether or not the product has been deleted. |
total_income |
double | The product's total income from transactions. |
total_purchases |
integer | The product's total number of purchases from transactions. |
Retrieve a specific product
curl -X GET 'https://api.ontraport.com/1/Product?id=1' \
--header 'Api-Appid: 2_AppID_12345678' \
--header 'Api-Key: Key5678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 1
);
$response = $client->product()->retrieveSingle($requestParams);
Example Response:
{
"code": 0,
"data": {
"id": "1",
"price": "2.99",
"name": "product",
"description": "",
"date": "1533587732",
"dlm": "1533587732",
"external_id": null,
"product_group": null,
"sku": null,
"taxable": null,
"deleted": "false",
"total_income": null,
"total_purchases": null
},
"account_id": "12345"
}
Retrieves all the information for an existing product. The only parameter needed is the ID for the product which is in the response upon product creation.
Request Endpoint
GET https://api.ontraport.com/1/Product
Required Headers
Api-Key: 2_AppID_12345678
Api-Appid: Key5678
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The product ID. Required. |
Retrieve multiple products
curl -X GET 'https://api.ontraport.com/1/Products?ids=1%2C2&range=50' \
--header 'Api-Appid: 2_AppID_12345678' \
--header 'Api-Key: Key5678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"ids" => "1,2"
);
$response = $client->product()->retrieveMultiple($requestParams);
Example Response:
{
"code": 0,
"data": [
{
"id": "1",
"price": "2.99",
"name": "cheesecake",
"description": "",
"date": "1533587732",
"dlm": "1533587732",
"external_id": null,
"product_group": null,
"sku": null,
"taxable": null,
"deleted": "false",
"total_income": "630",
"total_purchases": "73"
},
{
"id": "2",
"price": "1.99",
"name": "tater tots",
"description": "",
"date": "1533663839",
"dlm": "1533663839",
"external_id": null,
"product_group": null,
"sku": null,
"taxable": null,
"deleted": "false",
"total_income": "35",
"total_purchases": "36"
}
],
"account_id": "12345",
"misc": []
}
Retrieves a collection of products based on a set of parameters. You can limit unnecessary API requests by utilizing criteria and our pagination tools to select only the data set you require.
Request Endpoint
GET https://api.ontraport.com/1/Products
Required Headers
Api-Key: 2_AppID_12345678
Api-Appid: Key5678
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
ids |
string | An array as a comma-delimited list of the IDs of the products to retrieve. Entering a value of 0 will result in all products being selected. |
start |
integer | The offset to return results from. |
range |
integer | The number of products you want to retrieve. The maximum and default range is 50. |
sort |
string | The field results should be sorted on. |
sortDir |
string | The direction your results should be sorted. Your options are asc and desc . This field must be used in conjunction with the sort parameter. |
condition |
string | A JSON encoded string to more specifically set criteria for which products to bring back. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your product objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not product notes should be searched for the specified string in addition to other product fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
externs |
string | If you have a relationship between your product object and another object, you may want to include the data from a related field in your results. Each external field is listed in the format {object}//{field} . Multiple fields are separated by commas. |
listFields |
string | An array as a comma-delimited list of the fields which should be returned in your results. |
Build a product
<?php
require_once("Ontraport.php");
use OntraportAPI\Ontraport as Client;
use OntraportAPI\Models\Product as Product;
$client = new Client("2_AppID_12345678","Key5678");
// Create a new Product
$product = new Product("New Product", 2.00);
$requestParams = $product->toRequestParams();
$client->product()->create($requestParams);
// Update a Product
$response = $client->product()->retrieveSingle(array("id" => 1));
$response = json_decode($response, true);
$product = Product::CreateFromResponse($response["data"]);
$product->setPrice(5.00);
$requestParams = $product->toRequestParams();
$client->product()->update($requestParams);
We have provided you with a Product model in our SDK to help you build valid product request parameters.
The Product model can also be used in conjunction with the Transaction model to create or update the product details of a transaction or offer.
Functions
Function | Description |
---|---|
CreateFromResponse |
Converts a pre-decoded array of product data into a Product object. |
toRequestParams |
Converts the Product object to an array to be used as request parameters. |
setPrice |
Sets the price of the product. |
setName |
Sets the name of the product. |
getPrice |
Gets the price of the product. |
getName |
Gets the name of the product. |
getID |
Gets the ID of the product. |
Create a product
curl -X POST -d 'name=product&price=2.99' 'https://api.ontraport.com/1/Products' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Appid: 2_AppID_12345678' \
--header 'Api-Key: Key5678'
<?php
require_once("Ontraport.php");
use OntraportAPI\Ontraport as Client;
use OntraportAPI\Models\Product as Product;
$client = $client = new Client("2_AppID_12345678","Key5678");
$requestParams = array(
"name" => "product",
"price" => 2.99
);
$response = $client->product()->create($requestParams);
// Using the Product model
$product = new Product("product", 2.99);
$requestParams = $product->toRequestParams();
$response = $client->product()->create($requestParams);
Example Response:
{
"code": 0,
"data": {
"name": "product",
"price": "2.99",
"id": "1",
"description": "",
"date": "1533669066",
"dlm": "1533669066",
"external_id": null,
"product_group": null,
"sku": null,
"taxable": null,
"deleted": "false",
"total_income": null,
"total_purchases": null
},
"account_id": "12345"
}
Creates a new product object.
This endpoint allows name duplication in requests, however, the name will automatically be concatenated with (1)
where
the value increments for each duplication.
Request Endpoint
POST https://api.ontraport.com/1/Products
Required Headers
Api-Key: 2_AppID_12345678
Api-Appid: Key5678
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
name |
string | The product's name. |
price |
double | The product's price. |
Update a product
curl -X PUT -d 'id=1&name=product&price=5.00' 'https://api.ontraport.com/1/Products' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Appid: 2_AppID_12345678' \
--header 'Api-Key: Key5678'
<?php
require_once("Ontraport.php");
use OntraportAPI\Ontraport as Client;
use OntraportAPI\Models\Product as Product;
$client = new Client("2_AppID_12345678","Key5678");
$requestParams = array(
"name" => "product",
"price" => 5.00,
"id" => 1
);
$response = $client->product()->update($requestParams);
// Using the Product mode
$response = $client->product()->retrieveSingle(array("id" => 1));
$response = json_decode($response, true);
$product = Product::CreateFromResponse($response["data"]);
$product->setPrice(5.00);
$requestParams = $product->toRequestParams();
$response = $client->product()->update($requestParams);
Example Response:
{
"code": 0,
"data": {
"attrs": {
"price": "5.00",
"description": "",
"dlm": "1533670792",
"external_id": null,
"product_group": null,
"sku": null,
"taxable": null,
"total_income": null,
"total_purchases": null,
"id": "1"
}
},
"account_id": "12345"
}
Updates an existing product with given data. The ID and name of the existing product to update is required. To update the name of the existing product, simply indicate the new value, otherwise, indicate the product's original name. The other fields should only be used if you want to change the existing value.
Request Endpoint
PUT https://api.ontraport.com/1/Products
Required Headers
Api-Key: 2_AppID_12345678
Api-Appid: Key5678
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
name |
string | The product's name. Required. |
price |
double | The product's price. |
id |
integer | The product's ID. Required. |
Delete a specific product
curl -X DELETE 'https://api.ontraport.com/1/Product?id=1' \
--header 'Api-Appid: 2_AppID_12345678' \
--header 'Api-Key: Key5678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => "1"
);
$response = $client->product()->deleteSingle($requestParams);
Example Response:
{
"code": 0,
"account_id": "12345"
}
Deletes a specific product by its ID.
Request Endpoint
DELETE https://api.ontraport.com/1/Product
Required Headers
Api-Key: 2_AppID_12345678
Api-Appid: Key5678
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The ID of the product to delete. Required. |
Delete multiple products
curl -X DELETE 'https://api.ontraport.com/1/Products?ids=3%2C%205&range=50' \
--header 'Api-Appid: 2_AppID_12345678' \
--header 'Api-Key: Key5678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"ids" => "3,5"
);
$response = $client->product()->deleteMultiple($requestParams);
Example Response:
{
"code": 0,
"data": "Deleted",
"account_id": "12345"
}
Deletes a collection of products based on a set of parameters. You can choose the ids for the products to delete or use our pagination tools for a mass delete.
Request Endpoint
DELETE https://api.ontraport.com/1/Products
Required Headers
Api-Key: 2_AppID_12345678
Api-Appid: Key5678
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
ids |
string | An array as a comma-delimited list of the IDs of the products to delete. Entering a value of 0 will result in all products being selected. Caution should be used with this endpoint. |
start |
integer | The offset to delete results from. |
range |
integer | The number of products you want to delete. The maximum and default range is 50. |
condition |
string | A JSON encoded string to more specifically set criteria for which products to delete. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your product objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not product notes should be searched for the specified string in addition to other product fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
externs |
string | If you have a relationship between your product object and another object, you may want to include the data from a related field in your results. Each external field is listed in the format {object}//{field} . Multiple fields are separated by commas. |
listFields |
string | An array as a comma-delimited list of the fields which should be returned in your results. |
Retrieve product object meta
curl -X GET 'https://api.ontraport.com/1/Products/meta' \
--header 'Api-Appid: 2_AppID_12345678' \
--header 'Api-Key: Key5678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$response = $client->product()->retrieveMeta();
Example Response:
{
"code": 0,
"data": {
"16": {
"name": "Product",
"fields": {
"id": {
"alias": "Product Id",
"type": "numeric"
},
"name": {
"alias": "Name",
"type": "text"
},
"price": {
"alias": "Price",
"type": "price"
},
"total_purchases": {
"alias": "Quantity Purchased",
"type": "numeric"
},
"total_income": {
"alias": "Revenue",
"type": "price"
},
"date": {
"alias": "Date Created",
"type": "timestamp"
},
"dlm": {
"alias": "Date Modified",
"type": "timestamp"
}
}
}
},
"account_id": "12345"
}
Retrieve the field meta data for the product object.
Request Endpoint
GET https://api.ontraport.com/1/Products/meta
Required Headers
Api-Key: 2_AppID_12345678
Api-Appid: Key5678
Request Parameters
None
Retrieve product collection info
curl -X GET 'https://api.ontraport.com/1/Products/getInfo?search=product' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"search" => "product"
);
$response = $client->product()->retrieveCollectionInfo($requestParams);
Example Response:
{
"code": 0,
"data": {
"listFields": [
"name",
"price",
"date",
"total_purchases",
"total_income"
],
"listFieldSettings": [],
"cardViewSettings": [],
"viewMode": [],
"count": "1"
},
"account_id": "12345"
}
Retrieves information about a collection of products, such as the number of products that match the given criteria.
Request Endpoint
GET https://api.ontraport.com/1/Products/getInfo
Required Headers
Api-Key: 2_AppID_12345678
Api-Appid: Key5678
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
condition |
string | A JSON encoded string to more specifically set criteria for which products to select. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your product objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not product notes should be searched for the specified string in addition to other product fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Purchase History Logs
Object Type ID: 30
Purchase history logs allow you to view specific information about a purchase's history. They serve as a report of transctions by product.
Through the purchase history log API, you can retrieve information about a single purchase's history or for a collection of purchases. For a collection of purchase history logs, you can retrieve information about specific purchases or filter by certain criteria.
The purchase history log object
{
"id": "1",
"purchase_id": "1",
"date": "1658170805",
"author": "Victor Flaubert",
"details": "Purchase Created.",
"status": "1"
}
Attributes | Type | Description |
---|---|---|
id |
integer | The ID of the purchase history log. |
purchase_id |
integer | The ID of the purchase. |
date |
timestamp | The date the purchase was last modified, such as a change in status. Measured in seconds from the Unix Epoch. |
author |
string | The author of the product purchased. |
details |
string | Details about the purchase, such as if it was purchased from an external source. |
status |
integer | A flag that indicates the status of the purchase. 0 => Collections 1 => Paid 2 => Declined 3 => Voided 4 => Refunded 5 => Written off 7 => Pending |
Retrieve a single purchase log
curl -X GET 'https://api.ontraport.com/1/PurchaseHistoryLog?id=1' \
--header 'Api-Appid: 2_AppID_12345678' \
--header 'Api-Key: Key5678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 1
);
$response = $client->purchaselog()->retrieveSingle($requestParams);
Example Response:
{
"code": 0,
"data": {
"id": "1",
"purchase_id": "1",
"date": "1658170805",
"author": "Victor Flaubert",
"details": "Purchase Created.",
"status": "1"
},
"account_id": 12345
}
Retrieves information for an existing purchase history log. The only parameter needed is the ID of the history log.
Request Endpoint
GET https://api.ontraport.com/1/PurchaseHistoryLog
Required Headers
Api-Key: {api-key}
Api-Appid: {app-id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The ID of the purchase history log. Required. |
Retrieve multiple purchase logs
curl -X GET 'https://api.ontraport.com/1/PurchaseHistoryLogs?ids=5%2C6&range=50' \
--header 'Api-Appid: 2_AppID_12345678' \
--header 'Api-Key: Key5678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"ids" => "5,6"
);
$response = $client->purchaselog()->retrieveMultiple($requestParams);
Example Response:
{
"code": 0,
"data": [
{
"id": "5",
"purchase_id": "9",
"date": "1657742075",
"author": "Victor Flaubert",
"details": "Purchase Created.",
"status": "1"
},
{
"id": "6",
"purchase_id": "10",
"date": "1657746887",
"author": "Victor Flaubert",
"details": "Purchase Created.",
"status": "1"
}
],
"account_id": 12345,
"misc": []
}
Retrieves a collection of purchase history logs based on a set of parameters. You can limit unnecessary API requests by utilizing criteria and our pagination tools to select only the data set you require.
Request Endpoint
GET https://api.ontraport.com/1/PurchaseHistoryLogs
Required Headers
Api-Key: {api-key}
Api-Appid: {app-id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
ids |
string | An array as a comma-delimited list of the IDs of the purchase history logs to retrieve. Entering a value of 0 will result in all history logs being selected. |
start |
integer | The offset to return results from. |
range |
integer | The number of purchase history logs you want to retrieve. The maximum and default range is 50. |
sort |
string | The field results should be sorted on. |
sortDir |
string | The direction your results should be sorted. Your options are asc and desc . This field must be used in conjunction with the sort parameter. |
condition |
string | A JSON encoded string to more specifically set criteria for which purchase history logs to bring back. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your purchase history log objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not purchase history log notes should be searched for the specified string in addition to other history log fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
externs |
string | If you have a relationship between your purchase history log object and another object, you may want to include the data from a related field in your results. Each external field is listed in the format {object}//{field} . Multiple fields are separated by commas. |
listFields |
string | An array as a comma-delimited list of the fields which should be returned in your results. |
Retrieve purchase log collection info
curl -X GET 'https://api.ontraport.com/1/PurchaseHistoryLogs/getInfo?search=10' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"search" => "15"
);
$response = $client->purchaselog()->retrieveCollectionInfo($requestParams);
Example Response:
{
"code": 0,
"data": {
"listFields": [
"date",
"author",
"details"
],
"listFieldSettings": [],
"cardViewSettings": {
"fields": [
"date",
"author",
"details"
]
},
"viewMode": [],
"widgetSettings": {
"map": [
[
"overview"
],
[
"fields"
],
[
"notes",
"tasks",
"settings"
]
],
"widgets": {
"overview": {
"type": "object_widget_overview",
"options": {
"visible": "true",
"excludeFromWidgetSettings": true
}
},
"tasks": {
"type": "object_widget_object_list_text_object_task_widget",
"options": {
"visible": "true",
"objectID": 1,
"header": "Tasks"
}
},
"notes": {
"type": "object_widget_object_list_text_object_notes_widget",
"options": {
"visible": "true",
"objectID": 12,
"header": "Notes"
}
},
"settings": {
"type": "object_widget_settings",
"options": {
"placeAtEndOfColumn": true,
"excludeFromWidgetSettings": true
}
},
"fields": {
"type": "object_widget_fields",
"options": {
"visible": "true",
"excludeFromWidgetSettings": true,
"fields": [
"date",
"author",
"details"
]
}
}
},
"listFields": [
"profile_image",
"date",
"author",
"details"
]
},
"count": "6"
},
"account_id": 12345
}
Retrieves information about a collection of purchase history logs, such as the number of history logs that match the given criteria.
Request Endpoint
GET https://api.ontraport.com/1/PurchaseHistoryLogs/getInfo
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
condition |
string | A JSON encoded string to more specifically set criteria for which purchase history logs to select. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your purchase history log objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other purchase history log fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Retrieve purchase log object meta
curl -X GET 'https://api.ontraport.com/1/PurchaseHistoryLogs/meta?format=byId' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$response = $client->purchaselog()->retrieveMeta();
Example response:
{
"code": 0,
"data": {
"30": {
"name": "PurchaseLog",
"fields": {
"date": {
"alias": "Time",
"type": "timestamp",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 1
},
"author": {
"alias": "Who",
"type": "text",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1
},
"details": {
"alias": "Details",
"type": "text",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1
}
}
}
},
"account_id": 12345
}
Retrieves the field meta data for the purchase history log object.
Request Endpoint
GET https://api.ontraport.com/1/PurchaseHistoryLogs/meta
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
None
Purchases
Object Type ID: 17
Purchases allow you to view and process purchases which have already been made. For every completed sale of a product, a purchase object is created.
Through the purchases API, you can retrieve information about a single purchase or a collection of purchases. You can get information about a purchase collection and filter by certain criteria.
The purchase object
{
"id": "1",
"contact_id": "1",
"affiliate_id": "0",
"product_id": "0",
"owner": "0",
"package_id": "0",
"invoice_id": "0",
"subscription_id": "0",
"order_id": "0",
"oprid": "0",
"sku": null,
"description": "",
"date": "0",
"dlm": "0",
"price": "10",
"name": null,
"quantity": "1",
"coupon_id": "0",
"coupon_code_id": "0",
"discount": "0.00",
"type": "0",
"status": "1",
"level1": "0",
"level2": "0",
"total_price": "10",
"affiliate": null,
"coupon_name": null,
"coupon_code": null
}
Attributes | Type | Description |
---|---|---|
id |
integer | The purchase's ID. |
contact_id |
integer | The ID of the contact associated with the purchase. |
affiliate_id |
integer | The ID of the affiliate that referred the contact associated with the purchase. |
product_id |
integer | The ID of the purchased product. |
owner |
integer | The ID of the user who controls the contact associated with the purchase. |
package_id |
integer | The ID of the package the purchase belongs to. Default 0 if the purchase is not part of a package. |
invoice_id |
integer | The ID of the invoice the purchase belongs to. An invoice can contain multiple purchases. |
subscription_id |
integer | The ID of the subscription the purchase belongs to. Default 0 if the product is not part of a subscription. |
order_id |
integer | The ID of the order the purchase belongs to. Default 0 if the product does not have an order associated with it. |
oprid |
integer | The ID of the affiliate to be credited for the purchase. |
sku |
string | Deprecated. The purchased product's code for integrations. |
description |
string | The description of the product purchased. |
date |
timestamp | The date the purchase was made, measured in seconds from the Unix Epoch. |
dlm |
timestamp | The date the purchase was last modified, such as a change in status. Measured in seconds from the Unix Epoch. |
price |
double | The price of the product purchased. |
name |
string | The name of the product purchased. |
quantity |
integer | The quantity of the product purchased. |
coupon_id |
integer | The ID of the coupon applied to the purchase. |
coupon_code_id |
integer | The ID of the coupon code corresponding to the coupon used, if a coupon was applied to the purchase. |
discount |
double | The amount discounted from the purchase. |
type |
integer | A flag that indicates the type of purchase. 0 => One-time purchase 1 => Subscription 2 => Payment plan 3 => Trial payment |
status |
integer | A flag that indicates the status of the purchase. 0 => Collections 1 => Paid 2 => Declined 3 => Voided 4 => Refunded 5 => Written off 7 => Pending |
level1 |
double | The commission earned by the referrer directly associated with the purchase. |
level2 |
double | The commission earned by the original referrer associated with the purchase in a two-tier partner program. |
total_price |
double | The total price of the purchase, calculated with the discount subtracted from the quantity purchased. |
affiliate |
string | The name of the affiliate that referred the contact associated with the purchase. |
coupon_name |
string | The name of the coupon corresponding to the coupon applied to the purchase. |
coupon_code |
string | The code of the coupon corresponding to the coupon applied to the purchase. |
Retrieve a single purchase
curl -X GET 'https://api.ontraport.com/1/Purchase?id=1' \
--header 'Api-Appid: 2_AppID_12345678' \
--header 'Api-Key: Key5678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 1
);
$response = $client->purchase()->retrieveSingle($requestParams);
Example Response:
{
"code": 0,
"data": {
"id": "1",
"contact_id": "13",
"affiliate_id": "0",
"product_id": "2",
"owner": "1",
"package_id": "0",
"invoice_id": "3",
"subscription_id": "0",
"order_id": "0",
"oprid": "0",
"sku": null,
"description": "",
"history": "",
"date": "1657220046",
"dlm": "1657220046",
"price": "15",
"name": "Product",
"quantity": "2",
"coupon_id": "0",
"coupon_code_id": "0",
"discount": "0.00",
"type": "0",
"status": "1",
"level1": "0",
"level2": "0",
"total_price": "30",
"affiliate": null,
"coupon_name": null,
"coupon_code": null
},
"account_id": 12345
}
Retrieves information for an existing purchase. The only parameter needed is the ID of the purchase.
Request Endpoint
GET https://api.ontraport.com/1/Purchase
Required Headers
Api-Key: {api-key}
Api-Appid: {app-id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The purchase ID. Required. |
Retrieve multiple purchases
curl -X GET 'https://api.ontraport.com/1/Purchases?ids=1%2C2&range=50' \
--header 'Api-Appid: 2_AppID_12345678' \
--header 'Api-Key: Key5678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"ids" => "1,2"
);
$response = $client->purchase()->retrieveMultiple($requestParams);
Example Response:
{
"code": 0,
"data": [
{
"id": "1",
"contact_id": "13",
"affiliate_id": "0",
"product_id": "2",
"owner": "1",
"package_id": "0",
"invoice_id": "3",
"subscription_id": "0",
"order_id": "0",
"oprid": "0",
"sku": null,
"description": "",
"history": "",
"date": "1657220046",
"dlm": "1657220046",
"price": "15",
"name": "Product1",
"quantity": "2",
"coupon_id": "0",
"coupon_code_id": "0",
"discount": "0.00",
"type": "0",
"status": "1",
"level1": "0",
"level2": "0",
"total_price": "30",
"affiliate": null,
"coupon_name": null,
"coupon_code": null
},
{
"id": "2",
"contact_id": "13",
"affiliate_id": "0",
"product_id": "3",
"owner": "1",
"package_id": "0",
"invoice_id": "3",
"subscription_id": "0",
"order_id": "0",
"oprid": "0",
"sku": null,
"description": "",
"history": "",
"date": "1657220046",
"dlm": "1657220046",
"price": "20",
"name": "Product2",
"quantity": "3",
"coupon_id": "0",
"coupon_code_id": "0",
"discount": "0.00",
"type": "0",
"status": "1",
"level1": "0",
"level2": "0",
"total_price": "60",
"affiliate": null,
"coupon_name": null,
"coupon_code": null
}
],
"account_id": 12345,
"misc": []
}
Retrieves a collection of purchases based on a set of parameters. You can limit unnecessary API requests by utilizing criteria and our pagination tools to select only the data set you require.
Request Endpoint
GET https://api.ontraport.com/1/Purchases
Required Headers
Api-Key: {api-key}
Api-Appid: {app-id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
ids |
string | An array as a comma-delimited list of the IDs of the purchases to retrieve. Entering a value of 0 will result in all purchases being selected. |
start |
integer | The offset to return results from. |
range |
integer | The number of purchases you want to retrieve. The maximum and default range is 50. |
sort |
string | The field results should be sorted on. |
sortDir |
string | The direction your results should be sorted. Your options are asc and desc . This field must be used in conjunction with the sort parameter. |
condition |
string | A JSON encoded string to more specifically set criteria for which purchases to bring back. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your purchase objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not purchase notes should be searched for the specified string in addition to other purchase fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
externs |
string | If you have a relationship between your purchase object and another object, you may want to include the data from a related field in your results. Each external field is listed in the format {object}//{field} . Multiple fields are separated by commas. |
listFields |
string | An array as a comma-delimited list of the fields which should be returned in your results. |
Retrieve purchase collection info
curl -X GET 'https://api.ontraport.com/1/Purchases/getInfo?search=15' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"search" => "15"
);
$response = $client->purchase()->retrieveCollectionInfo($requestParams);
Example Response:
{
"code": 0,
"data": {
"listFields": [
"name",
"contact_id",
"price",
"quantity",
"coupon_name",
"total_price",
"date",
"status",
"affiliate"
],
"listFieldSettings": [],
"cardViewSettings": {
"fields": [
"name",
"contact_id",
"price",
"quantity",
"coupon_name",
"total_price",
"date",
"status",
"affiliate"
]
},
"viewMode": [],
"widgetSettings": {
"map": [
[
"overview"
],
[
"fields"
],
[
"notes",
"tasks",
"settings"
]
],
"widgets": {
"overview": {
"type": "object_widget_overview",
"options": {
"visible": "true",
"excludeFromWidgetSettings": true
}
},
"tasks": {
"type": "object_widget_object_list_text_object_task_widget",
"options": {
"visible": "true",
"objectID": 1,
"header": "Tasks"
}
},
"notes": {
"type": "object_widget_object_list_text_object_notes_widget",
"options": {
"visible": "true",
"objectID": 12,
"header": "Notes"
}
},
"settings": {
"type": "object_widget_settings",
"options": {
"placeAtEndOfColumn": true,
"excludeFromWidgetSettings": true
}
},
"fields": {
"type": "object_widget_fields",
"options": {
"visible": "true",
"excludeFromWidgetSettings": true,
"fields": [
"name",
"contact_id",
"price",
"quantity",
"coupon_name",
"total_price",
"date",
"status",
"affiliate"
]
}
}
},
"listFields": [
"profile_image",
"name",
"contact_id",
"price",
"quantity",
"coupon_name",
"total_price",
"date",
"status",
"affiliate"
]
},
"count": "3"
},
"account_id": 12345
}
Retrieves information about a collection of purchases, such as the number of purchases that match the given criteria.
Request Endpoint
GET https://api.ontraport.com/1/Purchases/getInfo
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
condition |
string | A JSON encoded string to more specifically set criteria for which purchases to select. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your purchase objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other purchase fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Retrieve purchase object meta
curl -X GET 'https://api.ontraport.com/1/Purchases/meta?format=byId' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$response = $client->purchase()->retrieveMeta();
Example response:
{
"code": 0,
"data": {
"17": {
"name": "Purchase",
"fields": {
"name": {
"alias": "Name",
"type": "text",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0
},
"price": {
"alias": "Price",
"type": "price",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0
},
"description": {
"alias": "Description",
"type": "longtext",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0
},
"owner": {
"alias": "Owner",
"type": "parent",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0,
"parent_object": 2
},
"quantity": {
"alias": "Quantity",
"type": "numeric",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0
},
"status": {
"alias": "Status",
"type": "drop",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0,
"options": {
"0": "Collections",
"1": "Paid",
"2": "Declined",
"3": "Voided",
"4": "Refunded",
"5": "Write Off"
}
},
"date": {
"alias": "Date",
"type": "timestamp",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 0
},
"id": {
"alias": "Order Number",
"type": "numeric",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 0
},
"dlm": {
"alias": "Date Modified",
"type": "timestamp",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 0
},
"total_price": {
"alias": "Total Purchase",
"type": "price",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 1
},
"affiliate": {
"alias": "Partner",
"type": "text",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 1
},
"contact_id": {
"alias": "Contact",
"type": "parent",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 0,
"parent_object": 0
},
"coupon_name": {
"alias": "Coupon Name",
"type": "text",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 1
},
"coupon_code": {
"alias": "Coupon Code",
"type": "text",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 1
},
"discount": {
"alias": "Discount",
"type": "price",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 1
},
"invoice_id": {
"alias": "Invoice",
"type": "parent",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 1,
"parent_object": 46
}
}
}
},
"account_id": 12345
}
Retrieves the field meta data for the purchase object.
Request Endpoint
GET https://api.ontraport.com/1/Purchases/meta
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
None
Rules
Object Type ID: 6
The rule object was ONTRAPORT’s main automation component in the management of objects in various situations before the release of the Campaign Builder. Rules are set to perform a user-specified “Action” when a certain "Event" occurs, which is also defined in the category of “Triggers”, and such criteria in triggering a rule to act can be further detailed out through user-specified “Conditions”.
Through the rule API, you can retrieve a single rule, a collection of rules, the information of a collection of rules, and the rule object’s meta data. You can also create new rules and update or delete existing rules in your account.
Note:
"campaign" throughout this doc is called "automation" throughout the Ontraport app.
The rule object
{
"id": "1",
"drip_id": "0",
"events": "Contact_added_to_my_database()",
"conditions":"Is_in_category(0)|Is_not_on_fulfillment(1)" ,
"actions":"campaign_builder_action_change(0,1)" ,
"name": "Rule Object",
"pause": "0",
"last_action": "0" ,
"object_type_id": "0",
"date": "1527092161",
"dlm": "1527092380"
}
Rule attributes
Attribute | Type | Description |
---|---|---|
id |
integer | The rule's ID. |
drip_id |
integer | If the rule is a step in a sequence, the ID of that sequence. |
events |
string | The events that trigger rule execution. |
conditions |
string | The criteria that must be met for the rule to act after it is triggered. |
actions |
string | The action to perform when rule is triggered. |
name |
string | The name of the rule |
pause |
integer | A binary integer flag indicating whether or not the rule is paused. Marked as follows:0 => Live 1 => Paused |
last_action |
timestamp | The last time the rule was triggered, measured in seconds from UNIX Epoch. |
object_type_id |
integer | The ID for the type of object the rule is associated with. |
date |
timestamp | The date the rule was added, measured in seconds from UNIX Epoch. |
dlm |
timestamp | The date the rule was last modified, measured in seconds from UNIX Epoch. |
Retrieve a specific rule
curl -X GET 'https://api.ontraport.com/1/Rule?id=1' \
--header 'Accept: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 1
);
$response = $client->rule()->retrieveSingle($requestParams);
?>
Example Response:
{
"code": 0,
"data": {
"id": "1",
"drip_id": null,
"events": "object_completed_task(2)",
"conditions": "Is_subscribed_to_drip(1)|Is_in_category(2)",
"actions": "Add_contact_to_category(1)",
"name": "Test Rule",
"pause": "0",
"last_action": "0",
"object_type_id": "0",
"date": "1524156141",
"dlm": "1527178660"
},
"account_id": "12345"
}
Retrieves all information for an existing rule.
Request URL
GET https://api.ontraport.com/1/Rule
Required Headers
Api-Key: Key5678
Api-Appid: 2_AppID_12345678
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The rule ID. Required. |
Retrieve multiple rules
curl -X GET 'https://api.ontraport.com/1/Rules?range=50&sort=name&sortDir=asc&listFields=events%2C%20object_type_id%2C%20name' \
--header 'Accept: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"sort" => "name",
"sortDir" => "asc",
"listFields" => "events, object_type_id"
);
$response = $client->rule()->retrieveMultiple($requestParams);
?>
Example Response:
{
"code": 0,
"data": [
{
"events": "Contact_added_to_campaign(1)",
"object_type_id": "0",
"name": "Create Me!",
"id": "5"
},
{
"events": "Contact_leaves_campaign(3)",
"object_type_id": "0",
"name": "This Rule",
"id": "1"
},
{
"events": "object_completed_task(2)",
"object_type_id": "1",
"name": "Test Rule",
"id": "6"
}
],
"account_id": "12345",
"misc": []
}
Retrieves a collection of rules based on a set of parameters. You can limit necessary API requests by utilizing criteria and our pagination tools to select only the data set you require.
Request URL
GET https://api.ontraport.com/1/Rules
Required Headers
Api-Key: Key5678
Api-Appid: 2_AppID_12345678
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
ids |
string | An integer array as a comma-delimited list of the IDs of the rules to retrieve. Entering a value of 0 will result in all rules being selected. |
start |
integer | The offset to return results from. |
range |
integer | The number of rules you want to retrieve. The maximum and default range is 50. |
sort |
string | The field results should be sorted on. |
sortDir |
string | The direction your results should be sorted. Your options are asc and desc . This field must be used in conjunction with the sort parameter. |
condition |
string | A JSON encoded string to more specifically set criteria for which rules to bring back. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your rule objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other rule fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
externs |
string | If you have a relationship between your rule object and another object, you may want to include the data from a related field in your results. Each external field is listed in the format {object}//{field} . Multiple fields are separated by commas. |
listFields |
string | A string array as a comma-delimited list of the fields which should be returned in your results. |
Retrieve rule object meta
curl -X GET 'https://api.ontraport.com/1/Rules/meta' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$response = $client->rule()->retrieveMeta();
?>
Example Response:
{
"code": 0,
"data": {
"6": {
"name": "Rule",
"fields": {
"pause": {
"alias": "Status",
"type": "drop",
"options": {
"0": "Live",
"1": "Paused"
}
},
"tags": {
"alias": "Rule Tags",
"type": "list"
},
"name": {
"alias": "Name",
"type": "text"
},
"last_action": {
"alias": "Last Run",
"type": "timestamp"
},
"date": {
"alias": "Date Created",
"type": "timestamp"
},
"dlm": {
"alias": "Date Modified",
"type": "timestamp"
},
"events": {
"alias": "Events",
"type": "longtext"
},
"conditions": {
"alias": "Conditions",
"type": "longtext"
},
"actions": {
"alias": "Actions",
"type": "longtext"
}
}
}
},
"account_id": "12345"
}
Retrieves the field meta data for the rule object.
Request URL
GET https://api.ontraport.com/1/Rules/meta
Required Headers
Api-Key: Key5678
Api-Appid: 2_AppID_12345678
Request Parameters
None
Retrieve rule collection info
curl -X GET 'https://api.ontraport.com/1/Rules/getInfo?search=Rule' \
--header 'Accept: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"search" => "Rule",
);
$response = $client->rule()->retrieveCollectionInfo($requestParams);
?>
Example Response:
{
"code": 0,
"data": {
"listFields": [
"name",
"last_action",
"pause",
"date",
"dlm"
],
"listFieldSettings": [],
"count": "1"
},
"account_id": "12345"
}
Retrieves information about a collection of rules, such as the number of rules that match the given criteria.
Request URL
GET https://api.ontraport.com/1/Rules/getInfo
Required Headers
Api-Key: Key5678
Api-Appid: 2_AppID_12345678
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
condition |
string | A JSON encoded string to more specifically set criteria for which rules to select. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your rule objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other rule fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Build a rule
<?php
require_once(__DIR__."/Models/Rules/RuleBuilder.php");
use OntraportAPI\Models\Rules\RuleBuilder as Builder;
use OntraportAPI\Models\Rules\Events;
use OntraportAPI\Models\Rules\Conditions;
use OntraportAPI\Models\Rules\Actions;
// Build a new rule
$builder = new Builder("Building my Rule!", ObjectType::CONTACT); // object_type_id = 0;
// Add an event
$eventParams = array(1); // parameter '1' for fulfillment id
$builder->addEvent(Events::OBJECT_ADDED_TO_FULFILLMENT, $eventParams);
// Add conditions
$conditionParams = array(1); // parameter '1' for sequence id
$builder->addCondition(Conditions::OBJECT_SUBSCRIBED_SEQUENCE, $conditionParams);
// Indicate "AND" relationship with other condition
$builder->addCondition(Conditions::OBJECT_HAS_TAG, array(1), "AND");
// Add action
$actionParams = array(2); // parameter '2' for task id
$builder->addAction(Actions::ADD_TASK, $actionParams);
// Convert RuleBuilder object to request parameters
$requestParams = $builder->toRequestParams();
// OR create your own request parameter array without usage of RuleBuilder
$requestParams = array(
"name" => "My Own Rule",
"events" => "Contact_subscribed_to_fulfillment(1)",
"conditions" => "Is_subscribed_to_drip(1);Is_in_category(2)",
"actions" => "Send_contact_a_task(2)",
"object_type_id" => 0
);
?>
The correct building of a rule is crucial in a successful creation of a working rule. We have provided you with a RuleBuilder model in our SDK that helps simplify the formatting process in building a correct valid rule.
You can build a rule with the RuleBuilder model in our SDK or build your own request parameter array to create or update a rule. However, please note that the correct formatting of valid rule data will be the user's responsibility to ensure.
Please note that each event, condition, and action has specific parameters pertaining to each one that must be valid and in the correct order. Refer to the following rule tables for the names of each event, condition, and action, and this rule parameter table for the ordering and descriptions of each parameter for each type of rule. You can also refer to these examples for valid rule data construction and correct SDK usage.
Functions
Function | Description |
---|---|
addEvent |
Allows you to add an event with specified event name and event parameters. |
addCondition |
Allows you to add a condition with specified condition name, condition parameters, and operator relationship. |
addAction |
Allows you to add an action with specified action name and action parameters. |
clearEvents |
Clears all existing events in RuleBuilder. |
clearConditions |
Clears all existing conditions in RuleBuilder. |
clearActions |
Clears all existing actions in RuleBuilder. |
removeEventByName |
Removes an event with the given event name. |
removeConditionByName |
Removes a condition with the given condition name. |
removeActionByName |
Removes an action with the given action name. |
toRequestParams |
Converts the RuleBuilder object to an array to be used as request parameters. |
CreateFromResponse |
Converts an array of rule data into a RuleBuilder object. |
addEvent(event, eventParams)
Parameter | Type | Description |
---|---|---|
event |
string | Event name |
eventParams |
array | Array of inputs for all required parameters for event. Refer to this table to ensure you have valid inputs in the correct order. |
addCondition(condition, conditionParams, operator)
Parameter | Type | Description |
---|---|---|
condition |
string | Condition name |
conditionParams |
array | Array of inputs for all required parameters for condition. Refer to this table to ensure you have valid inputs in the correct order. |
operator |
string | Indicates relationship with previous condition. If this is the first condition in your rule, operator is NULL(or you can omit it), if not, operator must be "AND" or "OR". |
addAction(action, actionParams)
Parameter | Type | Description |
---|---|---|
action |
string | Action name |
actionParams |
array | Array of inputs for all required parameters for action. Refer to this table to ensure you have valid inputs in the correct order. |
removeEventByName(name), removeConditionByName(name), removeActionByName(name)
Parameter | Type | Description |
---|---|---|
name |
string | Name of rule to remove. Note that if your rule has multiple events/conditions/actions of the same type, only providing the name will delete all events/conditions/actions with the specified name. To delete a specific one, provide the entire valid events/conditions/actions data consisting of the event name and parameters. Example |
CreateFromResponse(data)
Parameter | Type | Description |
---|---|---|
data |
array | Array containing all data of existing rule. |
Create a rule
<?php
namespace OntraportAPI;
use OntraportAPI\Ontraport as Client;
use OntraportAPI\Models\Rules\RuleBuilder as Builder;
use OntraportAPI\Models\Rules\Events;
use OntraportAPI\Models\Rules\Conditions;
use OntraportAPI\Models\Rules\Actions;
use OntraportAPI\ObjectType;
$api_key = "Key5678";
$app_id = "2_AppID_12345678";
// Instantiate Client
$client = new Client($app_id, $api_key);
// Create new RuleBuilder object to build rule
$builder = new Builder("Create Me!", ObjectType::CONTACT);
// Add Event
$eventParams = array(1); // parameter '1' for sequence id
$builder->addEvent(Events::OBJECT_ADDED_TO_SEQUENCE, $eventParams);
// Add Action
$actionParams = array(1); // parameter '1' for tag id
$builder->addAction(Actions::ADD_OBJECT_TO_TAG , $actionParams);
// Convert RuleBuilder object to array of request parameters
$requestParams = $builder->toRequestParams();
// Create the rule with request parameters
$client->rule()->create($requestParams);
?>
curl -X POST -d 'name=Create%20Me!&events=Contact_added_to_campaign(1)&actions=Add_contact_to_category(1)&object_type_id=0' \ 'https://api.ontraport.com/1/Rules' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Accept: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
Example Response:
{
"code": 0,
"data": {
"name": "Create Me!",
"events": "Contact_added_to_campaign(1)",
"actions": "Add_contact_to_category(1)",
"object_type_id": "0",
"id": "1",
"drip_id": null,
"conditions": "",
"pause": "0",
"last_action": "0",
"date": "1527179185",
"dlm": "1527179185"
},
"account_id": "12345"
}
Creates a new rule and adds it to your database.
TRY IT OUT LIVE
Request URL
POST https://api.ontraport.com/1/Rules
Required Headers
Api-Key: Key5678
Api-Appid: 2_AppID_12345678
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
id |
integer | The rule ID. Required. |
tags |
string | The rule tags. |
name |
string | The rule's name. |
events |
string | The rule's triggers, events that set the rule to act. Required |
conditions |
string | The criteria that must be met for the rule to act after it is triggered. |
actions |
string | The action to perform when rule is triggered. Required |
object_type_id |
integer | Object ID of object rule is related to. Required |
Update a rule
<?php
namespace OntraportAPI;
use OntraportAPI\Ontraport as Client;
use OntraportAPI\Models\Rules\RuleBuilder as Builder;
use OntraportAPI\ObjectType;
use OntraportAPI\Models\Rules\Events;
use OntraportAPI\Models\Rules\Conditions;
use OntraportAPI\Models\Rules\Actions;
$api_key = "Key5678";
$app_id = "2_AppID_12345678";
// Instantiate Client
$client = new Client($app_id, $api_key);
// Retrieve existing rule to update
$existing_rule_id = 3;
$existing_rule = $client->rule()->retrieveSingle("id" => $existing_rule_id);
// Convert json to array of rule data
$rule = json_decode($existing_rule, true);
// Create new RuleBuilder object with array of rule data
$builder = Builder::CreateFromResponse($rule);
// Remove an action by name
$builder->removeActionByName(Actions::ADD_TASK);
// Add new action
$builder->addAction(Actions::ADD_OBJECT_TO_TAG, array(2));
// Convert RuleBuilder object to array of request parameters for easy building process
$requestParams = $builder->toRequestParams();
// Update the rule with your request parameters
$client->rule()->update($requestParams);
?>
curl -X PUT -d 'id=1&actions=Add_contact_to_category(2)&object_type_id=0' \
'https://api.ontraport.com/1/Rules' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Accept: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
Example Response:
{
"code": 0,
"data": {
"attrs": {
"actions": "Add_contact_to_category(2)",
"object_type_id": "0",
"dlm": "1527178660",
"id": "1"
}
},
"account_id": "12345"
}
Updates an existing rule with given data. The rule's ID is required to update a rule. The other fields should only be used if you want to change or insert the existing value. Note that the values in those fields will replace the existing value, not concatenate.
Request URL
PUT https://api.ontraport.com/1/Rules
Required Headers
Api-Key: Key5678
Api-Appid: 2_AppID_12345678
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
id |
integer | The rule ID. Required. |
pause |
integer | A binary integer flag indicating whether or not the rule is paused. Marked as follows:0 => Live 1 => Paused |
tags |
string | The rule tags. |
name |
string | The rule's name. |
events |
string | The rule's triggers, events that set the rule to act. |
conditions |
string | The criteria that must be met for the rule to act after it is triggered. |
actions |
string | The action to perform when rule is triggered. |
object_type_id |
integer | Object ID of object rule is related to. |
Delete a specific rule
curl -X DELETE 'https://api.ontraport.com/1/Rule?id=1' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 1
);
$response = $client->rule()->deleteSingle($requestParams);
Example Response:
{
"code": 0,
"account_id": "12345"
}
Deletes a specific rule by its ID.
Request Endpoint
DELETE https://api.ontraport.com/1/Rule
Required Headers
Api-Key: Key5678
Api-Appid: 2_AppID_12345678
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The ID of the rule to delete. Required. |
Delete multiple rules
curl -X DELETE 'https://api.ontraport.com/1/Rules?ids=1%2C%202&range=2' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"ids" => "1,2",
"range" => "2"
);
$response = $client->rule()->deleteMultiple($requestParams);
Example Response:
{
"code": 0,
"data": "Deleted",
"account_id": "12345"
}
Deletes a collection of rules based on a set of parameters. You can choose the ids for the rules to delete or use our pagination tools for a mass delete. Be very careful using this endpoint with your API key, as rules will be permanently deleted from your database.
Request Endpoint
DELETE https://api.ontraport.com/1/Rules
Required Headers
Api-Key: Key5678
Api-Appid: 2_AppID_12345678
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
ids |
string | An array as a comma-delimited list of the IDs of the rules to delete. Entering a value of 0 will result in all rules being selected. Caution should be used with this endpoint. |
start |
integer | The offset to delete results from. |
range |
integer | The number of rules you want to delete. The maximum and default range is 50. |
condition |
string | A JSON encoded string to more specifically set criteria for which rules to delete. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your rule objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not rule notes should be searched for the specified string in addition to other rule fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. Note that setting this to the value of 1 without any other parameters will delete all rules from your account. |
Events, Conditions, Actions
Refer to the Rule Parameter Table for more details pertaining to each rule's parameters. Additionally, you can also click on each rule, which will redirect you to its rule parameters.
Note: While the use of "contact" is the primary relation in these rule names, majority of the rules are applicable to all custom objects as well.
**not applicable for custom objects, only contacts.
Trigger (i.e. Event) | Name |
---|---|
Contact is created | Contact_added_to_my_database |
A field is updated | field_is_updated |
Contact is added to Sequence | Contact_added_to_campaign |
Contact is removed from Sequence | Contact_leaves_campaign |
Subscription to Sequence is Paused | Subscription_to_drip_is_paused |
Subscription to Sequence is Resumed | Subscription_to_drip_is_unpaused |
Contact is Paused on Campaign | pause_campaign |
Contact is Resumed on Campaign | unpause_campaign |
Contact is added to Tag | Contact_added_to_category |
Contact is removed from Tag | Contact_removed_from_category |
Contact is added to Fulfillment List | Contact_subscribed_to_fulfillment |
Contact is removed from Fulfillment List | Contact_unsubscribed_from_fulfillment |
Today Matches Contact’s Date Field | on_date_field |
Today is Relative to Contact’s Date Field | relative_date_field |
Contact is Added/Removed from Campaign | campaign_builder_object_change |
Task is Completed | object_completed_task |
Contact Submits Form | object_submits_form |
Opens Email | Contact_opens_email |
Clicks an Email link | Contact_clicks_emailanchor |
Sends you an Email (tracked by IMAP Settings) | Contact_sends_Email |
SMS Received from Contact | sms_message_received |
Purchases Product** | Contact_purchases_product |
Gets a refund on a Product** | Contact_receives_refund_on_product |
Visits a Landing Page** | Contact_visits_landingpage_splittest |
Visits a PURL** | Contact_visits_purl_splittest |
Open order is created** | Contact_is_subscribed_to_productsub |
Open order is charged or updated** | Contact_subscription_to_productsub_is_subaction |
Credit card is charged or declined** | Contact_credit_card_is_ccstatus |
Contact visits URL** | contact_visits_url |
Clicks Tracked Link** | clicks_tracked_link |
Is given access to WordPress Membership Level** | Contact_given_access_to_wpintmembershiplevel |
Loses access to WordPress Membership Level** | Contact_removed_from_access_to_wpintmembershiplevel |
Action | Name |
---|---|
Add Contact to Tag | Add_contact_to_category |
Remove Contact from Tag | Remove_contact_from_category |
Add/Remove Contact from Campaign | campaign_builder_action_change |
Pause or Unpause Contact on Campaign | pause_or_unpause_on_camp |
Add Contact to Sequence | Assign_contact_to_drip |
Remove Contact from Sequence | Remove_contact_from_drip |
Remove from all sequences | Remove_contact_from_all_sequences |
Pause Subscription to a sequence | Pause_subscription_to_dripa |
Unpause subscription to a sequence | Unpause_subscription_to_dripa |
Change the value of a field | Change_field_to_fieldvalue |
Add to Lead Router** | Add_to_leadrouter |
Add Contact to Fulfillment List | Assign_to_fulfillment |
Remove Contact from Fulfillment List | Remove_from_fulfillment |
Remove Contact from All Fulfillment Lists | Remove_from_all_fulfillments |
Recharge all transactions that are in collections** | Recharge_all_declined_transactions |
Add Product to Purchase History** | Add_product_to_purchase_history |
Cancel Open Order** | Cancel_open_orders_with_product |
Notify someone with an Email (any email address) | Notify_someone_with_emailmbs |
Send an Email | Send_contact_an_emailmbs |
Send a Postcard** | Send_contact_a_postcard |
Add Task | Send_contact_a_task |
Send as SMS | send_contact_an_sms |
Ping a URL | Ping_APIURL |
Give access to WordPress Membership Level** | Add_access_for_contact_to_wpintmembershiplevel |
Remove access to WordPress Membership Level** | Remove_access_for_contact_to_wpintmembershiplevel |
Update Facebook Custom Audience | facebook_audience_action |
Notify Ontraport User with an SMS | Notify_someone_with_sms |
Rule Parameter Table
The following lists the types and order of parameters pertaining to each rule that is expected when using a rule. Each rule name corresponds to the way it appears in our application on http://ontraport.com.
When constructing your own rule data, rule parameters should be separated by commas, in the order as it descends down the list, and wrapped in parentheses. No whitespace should be between the parameters and commas. Refer to these examples for rule parameters through the usage of our SDK, as well as for constructing valid rule data to make a successful API request.
Note: While the use of "contact" is the primary relation in these rule names, majority of the rules are applicable to all custom objects as well.
**not applicable for custom objects, only contacts.
Trigger (i.e. Event) | Required Parameters | Type |
---|---|---|
Contact is created | none | |
A field is updated | Field ID |
integer |
When a Contact is added to Sequence | Sequence ID |
integer |
When Contact is removed from Sequence | Sequence ID |
integer |
Subscription to Sequence is Paused | Sequence ID |
integer |
Subscription to Sequence is Resumed | Sequence ID |
integer |
Contact is Paused on Campaign | Campaign ID |
integer |
Contact is Resumed on Campaign | Campaign ID |
integer |
Contact is added from Tag | Tag ID |
integer |
Contact is removed from Tag | Tag ID |
integer |
Contact is added to Fulfillment List | Fulfillment ID |
integer |
Contact is removed from Fulfillment List | Fulfillment ID |
integer |
Today Matches Contact’s Date Field | Field |
string (example) |
Today is Relative to Contact’s Date Field (example) | Number Of Units Option Field |
integer constant constant string |
Contact is Added/Removed from Campaign | Option Campaign ID |
constant integer |
Task is Completed | Task ID |
integer |
Contact Submits Form | Form ID Outcome |
integer constant |
Opens Email | Email ID |
integer |
Clicks an Email link | Email ID Link Num |
integer integer |
Sends you an Email (tracked by IMAP Settings) | none | |
SMS Received from Contact | Number ID |
integer |
Purchases Product** | Product ID |
integer |
Gets a refund on a Product** | Product ID |
integer |
Visits a Landing Page** | Landing Page ID |
integer |
Visits a PURL** | PURL ID |
integer |
Open order is created** | Product ID |
integer |
Open order is charged or updated** | Option Order ID |
constant integer |
Credit card is charged or declined** | Option |
constant |
Contact visits URL** | URL |
string |
Clicks Tracked Link** | Tracked Link ID |
integer |
Is given access to WordPress Membership Level** | WP Membership ID |
integer |
Loses access to WordPress Membership Level** | WP Membership ID |
integer |
Condition | Required Parameters | Type |
---|---|---|
Was subscribed to campaign before and after a certain date | Campaign ID Conditional Date |
integer constant timestamp(measured in seconds from the Unix Epoch) |
Has been on campaign for a certain amount of time (example) | Campaign ID Number Units |
integer string ( "n Days" , "n Weeks" , "n Months" ) |
Contact is Paused or Resumed on Campaign | Option Campaign ID |
constant integer |
Has been on a sequence for a certain amount of time | Sequence ID Number Of Units |
integer integer constant |
Was subscribed to sequence before or after a certain date | Sequence ID Conditional Date |
integer constant timestamp(measured in seconds from the Unix Epoch) |
If Contact is subscribed to Sequence | Sequence ID |
integer |
If Contact is not subscribed to Sequence | Sequence ID |
integer |
Subscription to a sequence is paused | Sequence ID |
integer |
Subscription to a sequence is resumed | Sequence ID |
integer |
Field is this value | Field ID Conditional Value |
integer constant string or constant (Input for Value parameter will change depending on your Field) |
Contact has Tag | Tag ID |
integer |
Contact doesn’t have Tag | Tag ID |
integer |
If Contact is subscribed to Fulfillment List | Fulfillment ID |
integer |
If Contact is not subscribed to Fulfillment List | Fulfillment ID |
integer |
Has opened an Email a certain number of times | Email ID Conditional Number |
integer constant integer |
Has clicked an Email link a certain number of times (example) | Email ID and Link Num Conditional Number |
string (formatted like: email_id:link_num )constant integer |
SMS contains an Email address | none | |
SMS does not contain an Email address | none | |
SMS contains text | Text |
string |
SMS does not contain text | Text |
string |
Has spent a certain amount on a product** | Conditional Number Product ID |
constant integer integer |
Has ordered a certain amount of a product** | Conditional Number Product ID |
constant integer integer |
Is subscribed to product** | Product ID |
integer |
Has been subscribed to a product for a certain amount of time** | Product ID Number Units |
integer string ( "n Days" , "n Weeks" , "n Months" ) |
Has visited a WordPress site a certain number of times** | WordPress ID Conditional Number |
integer constant integer |
Has visited a landing page a certain number of times** | Landing Page ID Object Type ID => 0 * Conditional Number |
integer integer constant integer |
Has access to WordPress Membership Level** | WordPress Membership ID |
integer |
Does not have access to WordPress Membership Level** | WordPress Membership ID |
integer |
*object_type_id => 0
because access allowed only for contacts now.
Action | Required Parameters | Type |
---|---|---|
Add Contact to Tag | Tag ID |
integer |
Remove Contact from Tag | Tag ID |
integer |
Add/Remove Contact from Campaign | Option Campaign ID |
constant integer |
Pause or Unpause Contact on Campaign | Option Campaign ID |
constant integer |
Add Contact to Sequence | Sequence ID |
integer |
Remove Contact from Sequence | Sequence ID |
integer |
Remove from all sequences | none | |
Pause Subscription to a sequence | Sequence ID |
integer |
Unpause subscription to a sequence | Sequence ID |
integer |
Change the value of a field | Field ID Value Field Option => "REPLACE" |
integer string string |
Add to Lead Router** | Lead Router ID |
integer |
Add Contact to Fulfillment List | Fulfillment ID |
integer |
Remove Contact from Fulfillment List | Fulfillment ID |
integer |
Remove Contact from All Fulfillment Lists | none | |
Recharge all transactions that are in collections** | none | |
Add Product to Purchase History** | Product ID |
integer |
Cancel Open Order** | Product ID |
integer |
Notify someone with an Email (any email address) | User ID Email ID |
integer integer |
Send an Email | Email ID |
integer |
Send a Postcard** | Postcard ID |
integer |
Add Task | Task ID |
integer |
Send as SMS | SMS ID Number ID |
integer integer |
Ping a URL (example) | Webhook ID |
integer |
Give access to WordPress Membership Level** | WordPress Membership ID |
integer |
Remove access to WordPress Membership Level** | WordPress Membership ID |
integer |
Update Facebook Custom Audience | Add or Remove Custom Audience ID |
string ( add => "add" , remove => "remove" )integer |
Notify Ontraport User with an SMS | User ID SMS ID Email ID |
integer integer integer |
Constants
When the required parameter is Units
, Option
, Conditional
, Outcome
, or Value
, refer to the following constants in the RuleBuilder model and its corresponding values to use in your rule.
Parameter | Constants |
---|---|
Units |
DAYS => 0 WEEKS => 1 MONTHS => 2 |
Option |
BEFORE_FIELD => 0 AFTER_FIELD => 1 CHARGED_AND_SUCCESSFUL => 0 CANCELED => 1 COMPLETED => 2 CHARGED_BUT_DECLINED => 3 CHARGED => 0 DECLINED => 1 RESUMED => 0 PAUSE => 1 UNPAUSE => 0 ADD => 0 REMOVE => 1 |
Conditional |
EQUAL_TO => "Equal To" NOT_EQUAL_TO => "Not Equal To" GREATER_THAN => "Greater Than" LESS_THAN => "Less Than" GREATER_OR_EQUAL_TO => "Greater Than or Equal To" LESS_OR_EQUAL_TO => "Less Than or Equal To" CONTAINS => "Contains" DOES_NOT_CONTAIN => "Does Not Contain" STARTS_WITH => "Starts With" ENDS_WITH => "Ends With" ON => 1 BEFORE => 2 AFTER => 3 |
Outcome |
SUCCESSFUL => 0 (if not an order form, it is always successful) FAILURE => 1 |
Value (Relative Dates) |
TODAY => "TODAY" YESTERDAY => "YESTERDAY" LAST_SUNDAY => "LSUNDAY" LAST_TWO_SUNDAYS => "L2SUNDAY" FIRST_DAY_THIS_MONTH => "FDTMONTH" FIRST_DAY_LAST_MONTH => "FDLMONTH" THIS_DAY_LAST_MONTH => "TDLMONTH" FIRST_DAY_THIS_YEAR => "FDTYEAR" THIS_DAY_LAST_YEAR => "TDLYEAR" SEVEN_DAYS_AGO => "S7DAYS" THIRTY_DAYS_AGO => "S30DAYS" NINETY_DAYS_AGO => "S90DAYS" HUNDRED_TWENTY_DAYS_AGO => "S120DAYS" HUNDRED_EIGHTY_DAYS_AGO => "S180DAYS" TOMORROW => "TOMORROW" FIRST_DAY_NEXT_MONTH => "FDNMONTH" THIS_DAY_NEXT_MONTH => "TDNMONTH" FIRST_DAY_NEXT_YEAR => "FDNYEAR" THIS_DAY_NEXT_YEAR => "TDNYEAR" SEVEN_DAYS_FROM_NOW => "7DFNOW" FOURTEEN_DAYS_FROM_NOW => "14DFNOW" THIRTY_DAYS_FROM_NOW => "30DFNOW" SIXTY_DAYS_FROM_NOW => "60DFNOW" NINETY_DAYS_FROM_NOW => "90DFNOW" HUNDRED_TWENTY_DAYS_FROM_NOW => "120DFNOW" HUNDRED_EIGHTY_DAYS_FROM_NOW => "180DFNOW" |
Value (Card Types) |
VISA => 1 MASTERCARD => 2 AMERICAN_EXPRESS => 3 DISCOVER => 4 PAYPAL => 5 OTHER => 6 |
Value (Months) |
JAN => 1 FEB => 2 MARCH => 3 APRIL => 4 MAY => 5 JUNE => 6 JULY => 7 AUG => 8 SEPT => 9 OCT => 10 NOV => 11 DEC => 12 |
Examples
- When using event, "Today is Relative to Contact’s Date Field", we have the following parameters:
Number Of
,Units
,Option
,Field
The ordering of the array using our SDK would look like this:
array(2, RuleBuilder::WEEKS, RuleBuilder::BEFORE_FIELD, "ccExpirationDate")
Creating your own rule data without the use of our SDK would look like this:
"events" => "relative_date_field(2,1,0,ccExpirationDate)"
Both yield a rule that means "When today is 2 weeks before the contact's Last Card Expiration Date."
- When using condition, "Has clicked an Email link a certain number of times", we have the following parameters:
Email ID and Link Num,
,Conditional
,Number
The ordering of the array would look like this:
array("1:2", RuleBuilder::GREATER_THAN, 5)
Creating your own rule data without the use of our SDK would look like this:
"conditions" => "Has_clicked_emailanchor_condition_n_times(1:2,Greater Than)"
Both yield a rule that means "Has clicked (title of email with id 1) link number 2 greater than 5 times."
- When using condition, "Has been on campaign for a certain amount of time", we have the following parameters:
Campaign ID
,Number Units
The ordering of the array would look like this:
array(1, "2 Weeks")
Creating your own rule data without the use of our SDK would look like this:
"conditions" => "Been_on_campaign_for_timeframe(1,2 Weeks)"
Both yield a rule that means "Has been on (name of campaign withid => 1
) for 2 weeks."
- When using action, "Ping a URL", we have the following parameters:
Webhook ID
Using our SDK, the array would look like this:
array(Webhook ID)
Creating your own rule data without the use of our SDK would look like this:
"actions" => "Ping_APIURL(Webhook ID)"
Both yield a rule that means "Ping the url of the webhook indicated by theWebhook ID
"
Note: The following usage of "Ping a URL" is deprecated.
- When using the following deprecated parameters for "Ping a URL":
URL
,Post Data
,JSON
If we want to use merge fields, the array would look like this:
array("http://ontraport.com[First Name][Last Name]", null, false)
Creating your own rule data without the use of our SDK would look like this:
"actions" => "Ping_APIURL(http://ontraport.com[First Name][Last Name]::::0)"
Both yield a rule that means "Ping the url: http://ontraport.com, but don't send as json."
Transactions
Object Type ID: 46
A transaction object is created when one of your contacts purchases a product.
Through the transactions API, you can retrieve a single transaction or a collection of transactions. You can manually process a transaction, which creates a new transaction object. You can change the status of a transaction, resend an invoice to a contact, rerun a transaction or partner commission, and void, write off, or refund a transaction. You can also retrieve an order, which is an instance of a recurring subscription.
The transaction object
{
"id": "1",
"hidden": "0",
"status": 6,
"contact_id": "1",
"order_id": "0",
"form_id": "0",
"lp_id": null,
"cc_id": "1",
"gateway_id": "25",
"date": "1492624700",
"template_id": "1",
"subtotal": "400.00",
"tax": "0.00",
"shipping": "0.00",
"total": "400.00",
"zip": "",
"city": null,
"state": null,
"county": null,
"tax_city": "0.00",
"tax_state": "0.00",
"tax_county": "0.00",
"external_order_id": "",
"oprid": "0",
"offer_data": "{\"products\":[{\"quantity\":\"20\",\"minQuantity\":\"1\",\"maxQuantity\":\"99\",\"total\":\"400.00\",\"shipping\":\"false\",\"tax\":\"false\",\"price\":[{\"price\":\"20.00\",\"payment_count\":\"1\",\"unit\":\"month\",\"id\":\"97092058792\"}],\"type\":\"\",\"quantityEditable\":\"false\",\"index\":\"0\",\"name\":\"Lambas Bread\",\"description\":\"\",\"owner\":\"1\",\"date\":\"1492622772\",\"dlm\":\"1492622772\",\"level1\":\"0\",\"level2\":\"0\",\"external_id\":\"null\",\"product_group\":\"null\",\"offer_to_affiliates\":\"true\",\"trial_period_unit\":\"day\",\"trial_period_count\":\"0\",\"trial_price\":\"0\",\"setup_fee\":\"0\",\"delay_start\":\"0\",\"sku\":\"null\",\"setup_fee_when\":\"immediately\",\"setup_fee_date\":\"0\",\"product_type\":\"digital\",\"subscription_fee\":\"0\",\"subscription_count\":\"0\",\"subscription_unit\":\"day\",\"download_limit\":\"0\",\"download_time_limit\":\"0\",\"taxable\":\"null\",\"deleted\":\"false\",\"total_income\":\"null\",\"total_purchases\":\"null\",\"id\":\"5\",\"uid\":\"bd068323-5782-54cd-3980-1fe6637cdbfe\"}],\"shipping\":\"null\",\"delay\":\"0\",\"invoice_template\":\"1\",\"subTotal\":\"400\",\"grandTotal\":\"400.00\",\"hasTaxes\":\"false\",\"hasShipping\":\"false\",\"paypalValid\":\"true\",\"offerCoupon\":\"false\",\"coupon\":\"null\",\"shipping_charge_reoccurring_orders\":\"false\",\"resorted\":\"null\",\"name\":\"Introductory Offer\",\"id\":\"3\"}",
"last_recharge_date": "1492643964",
"recharge_attempts": "2",
"recharge": null,
"contact_name": "Mary Smith"
}
Transaction attributes
Attribute | Type | Description |
---|---|---|
id |
string | The transaction's ID. |
hidden |
integer | A binary integer flag designating whether or not the transaction is assessible. Integer codes map as follows:0 => Accessible 1 => Hidden |
status |
integer | The status of the transaction. Integer codes are mapped as follows:0 => Collections 1 => Paid 2 => Refunded 4 => Void 5 => Declined 6 => Written off 7 => Pending |
contact_id |
integer | The ID of the contact who made the transaction. |
contact_name |
string | The full name of the contact who made the transaction. |
order_id |
integer | If the transaction resulted from a subscription purchase, the ID of the associated order. |
form_id |
integer | If the transaction resulted from a purchase made via a form, the ID of that form. |
lp_id |
integer | If the transaction resulted from a purchase made via a landing page, the ID of that landing page. |
cc_id |
integer | The ID of the credit card used to charge the transaction. |
gateway_id |
integer | The ID of the payment gateway used to complete the transaction. |
date |
timestamp | The date and time the transaction was made measured in seconds from the Unix Epoch. |
template_id |
integer | The ID of the invoice template sent to the contact. |
subtotal |
double | The amount of the transaction prior to tax and shipping. |
tax |
double | The amount of the tax on the transaction. |
tax_city |
double | The amount of any city tax on the transaction. |
tax_state |
double | The amount of any state tax on the transaction. |
tax_county |
double | The amount of any county tax on the transaction. |
shipping |
double | The cost of shipping for the transaction. |
total |
double | The total amount of the transaction. |
zip |
string | The zip code for the billing address. |
city |
string | The city for the billing address. |
state |
string | The state for the billing address. |
county |
string | The county for the billing address. |
external_order_id |
integer | If a sale comes from another system, the order ID sent from that system. |
oprid |
integer | The ID of the affiliate to be credited for the transaction. |
offer_data |
string | JSON encoded offer data. The offer object contains all information about products, quantities, coupons, tax and shipping. |
last_recharge_date |
timestamp | If the transaction has been recharged, the date and time of the last attempt measured in seconds from the Unix Epoch. |
recharge_attempts |
integer | If the transaction has been recharged, the count of the number of times this has been attempted. |
recharge |
integer | A binary integer flag indicating whether or not the transaction should be recharged. Values are mapped as follows:0 => false 1 => true |
Retrieve a single transaction
curl -X GET 'https://api.ontraport.com/1/Transaction?id=1' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 1
);
$response = $client->transaction()->retrieveSingle($requestParams);
Example Response:
{
"code": 0,
"data": {
"id": "1",
"hidden": "0",
"status": 6,
"contact_id": "1",
"order_id": "0",
"form_id": "0",
"lp_id": null,
"cc_id": "1",
"gateway_id": "25",
"date": "1492624700",
"template_id": "1",
"subtotal": "400.00",
"tax": "0.00",
"shipping": "0.00",
"total": "400.00",
"zip": "",
"city": null,
"state": null,
"county": null,
"tax_city": "0.00",
"tax_state": "0.00",
"tax_county": "0.00",
"external_order_id": "",
"oprid": "0",
"offer_data": "{\"products\":[{\"quantity\":\"20\",\"minQuantity\":\"1\",\"maxQuantity\":\"99\",\"total\":\"400.00\",\"shipping\":\"false\",\"tax\":\"false\",\"price\":[{\"price\":\"20.00\",\"payment_count\":\"1\",\"unit\":\"month\",\"id\":\"97092058792\"}],\"type\":\"\",\"quantityEditable\":\"false\",\"index\":\"0\",\"name\":\"Lambas Bread\",\"description\":\"\",\"owner\":\"1\",\"date\":\"1492622772\",\"dlm\":\"1492622772\",\"level1\":\"0\",\"level2\":\"0\",\"external_id\":\"null\",\"product_group\":\"null\",\"offer_to_affiliates\":\"true\",\"trial_period_unit\":\"day\",\"trial_period_count\":\"0\",\"trial_price\":\"0\",\"setup_fee\":\"0\",\"delay_start\":\"0\",\"sku\":\"null\",\"setup_fee_when\":\"immediately\",\"setup_fee_date\":\"0\",\"product_type\":\"digital\",\"subscription_fee\":\"0\",\"subscription_count\":\"0\",\"subscription_unit\":\"day\",\"download_limit\":\"0\",\"download_time_limit\":\"0\",\"taxable\":\"null\",\"deleted\":\"false\",\"total_income\":\"null\",\"total_purchases\":\"null\",\"id\":\"5\",\"uid\":\"bd068323-5782-54cd-3980-1fe6637cdbfe\"}],\"shipping\":\"null\",\"delay\":\"0\",\"invoice_template\":\"1\",\"subTotal\":\"400\",\"grandTotal\":\"400.00\",\"hasTaxes\":\"false\",\"hasShipping\":\"false\",\"paypalValid\":\"true\",\"offerCoupon\":\"false\",\"coupon\":\"null\",\"shipping_charge_reoccurring_orders\":\"false\",\"resorted\":\"null\",\"name\":\"Introductory Offer\",\"id\":\"3\"}",
"last_recharge_date": "1492643964",
"recharge_attempts": "2",
"recharge": null,
"contact_name": "Mary Smith"
},
"account_id": "12345"
}
Retrieves all the information for an existing transaction.
Request Endpoint
GET https://api.ontraport.com/1/Transaction
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The transaction ID. Required. |
Retrieve multiple transactions
curl -X GET 'https://api.ontraport.com/1/Transactions?ids=1%2C2%2C3&sort=contact_id&sortDir=desc&listFields=id%2Ccontact_id%2Ctotal' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"ids" => "1,2,3",
"sort" => "contact_id",
"sortDir" => "desc",
"listFields" => "id,contact_id,total"
);
$response = $client->transaction()->retrieveMultiple($requestParams);
Example Response:
{
"code": 0,
"data": [
{
"id": "3",
"contact_id": "3",
"total": "400.00",
"date": 1492702394,
"status": 7
},
{
"id": "2",
"contact_id": "2",
"total": "400.00",
"date": 1492702394,
"status": 7
},
{
"id": "1",
"contact_id": "1",
"total": "400.00",
"date": 1492702394,
"status": 7
}
],
"account_id": "12345",
"misc": []
}
Retrieves a collection of transactions based on a set of parameters. You can limit unnecessary API requests by utilizing criteria and our pagination tools to select only the data set you require.
Request Endpoint
GET https://api.ontraport.com/1/Transactions
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
ids |
string | An integer array as a comma-delimited list of the IDs of the transactions to retrieve. Entering a value of 0 will result in all transactions being selected. |
start |
integer | The offset to return results from. |
range |
integer | The number of transactions you want to retrieve. The maximum and default range is 50. |
sort |
string | The field results should be sorted on. |
sortDir |
string | The direction your results should be sorted. Your options are asc and desc . This field must be used in conjunction with the sort parameter. |
condition |
string | A JSON encoded string to more specifically set criteria for which transactions to bring back. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your transaction objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other transaction fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
externs |
string | If you have a relationship between your transaction object and another object, you may want to include the data from a related field in your results. Each external field is listed in the format {object}//{field} . Multiple fields are separated by commas. |
listFields |
string | A string array as a comma-delimited list of the fields which should be returned in your results. |
Retrieve transaction object meta
curl -X GET 'https://api.ontraport.com/1/Transactions/meta' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$response = $client->transaction()->retrieveMeta();
{
"code": 0,
"data": {
"46": {
"name": "Invoice",
"fields": {
"date": {
"alias": "Date Created",
"type": "timestamp"
},
"status": {
"alias": "Status",
"type": "drop",
"options": {
"0": "Collections",
"1": "Paid",
"2": "Refunded",
"3": "Partially Refunded",
"4": "Voided",
"5": "Declined",
"6": "Write Off",
"7": "Pending"
}
},
"total": {
"alias": "Total",
"type": "price"
},
"tax": {
"alias": "Total Tax",
"type": "price"
},
"subtotal": {
"alias": "Subtotal",
"type": "price"
},
"shipping": {
"alias": "Shipping",
"type": "price"
},
"zip": {
"alias": "Tax Zip",
"type": "text"
},
"city": {
"alias": "Tax City",
"type": "text"
},
"state": {
"alias": "Tax State",
"type": "text"
},
"county": {
"alias": "Tax County",
"type": "text"
},
"tax_city": {
"alias": "Tax City Amount",
"type": "price"
},
"tax_state": {
"alias": "Tax State Amount",
"type": "price"
},
"tax_county": {
"alias": "Tax County Amount",
"type": "price"
},
"contact_name": {
"alias": "Contact Name",
"type": "text"
},
"gateway_id": {
"alias": "Gateway",
"type": "parent",
"parent_object": 130
}
}
}
},
"account_id": "50"
}
Retrieves the field meta data for the transaction object.
Request Endpoint
GET https://api.ontraport.com/1/Transactions/meta
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
None
Retrieve transaction collection info
curl -X GET 'https://api.ontraport.com/1/Transactions/getInfo?search=400&searchNotes=true' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"search" => "400"
);
$response = $client->transaction()->retrieveCollectionInfo($requestParams);
Example Response:
{
"code": 0,
"data": {
"listFields": [
"status",
"total",
"contact_name",
"date"
],
"listFieldSettings": [],
"count": "3",
"sums": {
"total": 1200
}
},
"account_id": "12345"
}
Retrieves information about a collection of transactions, such as the number of transactions that match the given criteria.
Request Endpoint
GET https://api.ontraport.com/1/Transactions/getInfo
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
condition |
string | A JSON encoded string to more specifically set criteria for which transactions to select. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your transaction objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other transaction fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Convert transaction to collections
curl -X PUT -d 'id=1' 'https://api.ontraport.com/1/transaction/convertToCollections' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 1
);
$response = $client->transaction()->convertToCollections($requestParams);
Example Response:
{
"code": 0,
"account_id": "12345"
}
Marks a transaction as in collections.
Request Endpoint
PUT https://api.ontraport.com/1/transaction/convertToCollections
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
id |
integer | The transaction ID. Required. |
Convert transaction to declined
curl -X PUT -d 'id=1' 'https://api.ontraport.com/1/transaction/convertToDecline' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 1
);
$response = $client->transaction()->convertToDeclined($requestParams);
Example Response:
{
"code": 0,
"account_id": "12345"
}
Marks a transaction as declined.
Request Endpoint
PUT https://api.ontraport.com/1/transaction/convertToDecline
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
id |
integer | The transaction ID. Required. |
Mark transaction as paid
curl -X PUT -d 'id=4' 'https://api.ontraport.com/1/transaction/markPaid' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 4
);
$response = $client->transaction()->markAsPaid($requestParams);
Example Response:
{
"code": 0,
"data": [],
"account_id": "12345"
}
Marks a transaction as paid.
Request Endpoint
PUT https://api.ontraport.com/1/transaction/markPaid
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
id |
integer | The transaction ID. Required. |
Retrieve an order
curl -X GET 'https://api.ontraport.com/1/transaction/order?id=2' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 2
);
$response = $client->transaction()->retrieveOrder($requestParams);
Example Response:
{
"code": 0,
"data": {
"products": [],
"shipping": "null",
"delay": "0",
"invoice_template": "1",
"subTotal": "10000000",
"grandTotal": "10000000.00",
"hasTaxes": "false",
"hasShipping": "false",
"paypalValid": "false",
"offerCoupon": "false",
"coupon": "null",
"shipping_charge_reoccurring_orders": "false",
"resorted": "null",
"name": "Awesome Offer",
"data": "{\"products\":[{\"quantity\":1,\"minQuantity\":1,\"maxQuantity\":99,\"total\":\"10000000.00\",\"shipping\":false,\"tax\":false,\"price\":[{\"price\":\"10000000.00\",\"payment_count\":1,\"unit\":\"year\",\"id\":250271583026}],\"type\":\"subscription\",\"quantityEditable\":\"false\",\"index\":0,\"name\":\"Mithril\",\"uid\":\"42c5547e-38cc-b61b-69b4-26f67d03ed9a\",\"id\":\"6\",\"description\":\"\",\"owner\":\"1\",\"date\":\"1492641931\",\"dlm\":\"1492641931\",\"level1\":\"0\",\"level2\":\"0\",\"external_id\":null,\"product_group\":null,\"offer_to_affiliates\":\"true\",\"trial_period_unit\":\"day\",\"trial_period_count\":\"0\",\"trial_price\":\"0\",\"setup_fee\":\"0\",\"delay_start\":\"0\",\"sku\":null,\"setup_fee_when\":\"immediately\",\"setup_fee_date\":\"0\",\"product_type\":\"digital\",\"subscription_fee\":\"0\",\"subscription_count\":\"0\",\"subscription_unit\":\"day\",\"download_limit\":\"0\",\"download_time_limit\":\"0\",\"taxable\":null,\"deleted\":\"false\",\"total_income\":null,\"total_purchases\":null}],\"taxes\":[],\"paymentmethods\":[],\"shipping\":null,\"delay\":0,\"invoice_template\":1,\"subTotal\":10000000,\"grandTotal\":\"10000000.00\",\"hasTaxes\":false,\"hasShipping\":false,\"paypalValid\":false,\"offerCoupon\":false,\"coupon\":null,\"shipping_charge_reoccurring_orders\":false,\"resorted\":null,\"name\":\"Awesome Offer\"}",
"public": "1",
"referenced": "0",
"id": "4",
"offer_id": "5",
"order_id": "2",
"payment_next_date": "1524178068",
"status": "1",
"gateway_id": "1",
"affiliate_id": "0"
},
"account_id": "12345"
}
Retrieves all information about a specified order.
Request Endpoint
GET https://api.ontraport.com/1/transaction/order
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Parameter | Type | Description |
---|---|---|
id |
integer | The transaction ID. Required. |
Update an order
curl -X PUT -d '{ \
"offer": { \
"products": [ \
{ \
"price": [ \
{ \
"price": 10.00, \
"id": 1 \
} \
], \
"id": 1 \
} \
], \
"offer_id": 8, \
"order_id": 1, \
"cc_id": 2 \
} \
}' 'https://api.ontraport.com/1/transaction/order'
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678' \
--header 'Content-Type: application/json'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$data = array(
$data = array(
"offer" => array(
"products" => array(
array(
"price" => array(
array(
"price" => 10,
"id" => 1
)
),
"id" => 5
),
),
"offer_id" => 8,
"order_id" => 3,
"cc_id" => 1
)
);
$client->transaction()->updateOrder($data);
Example Response:
{
"code": 0,
"data": {
"id": "1",
"contact_id": "9",
"offer_id": "9",
"affiliate": "0",
"cc_id": 1,
"name": "Widget",
"payment_next_date": "1515441600",
"orig_month_date": "0",
"unit": "month",
"count": "1",
"gateway_id": "3",
"shipping_address": null,
"shipping_city": null,
"shipping_state": null,
"shipping_zip": null,
"shipping_country": null,
"shipping_last_charge": "0",
"shipping_service": null,
"status": "0",
"hidden": "0",
"dlm": "1512762376",
"order_form_json": null,
"cancellation_date": "0",
"next_sub": "40.00",
"tax": "0.00",
"shipping": "0.00",
"next_charge": "10.00",
"transactions": "1",
"transactions_remaining": "0",
"charged": "10.00"
},
"account_id": "12345"
}
Updates an order to include new offer data. For example, to update the credit card tied to the recurring subscription.
Request Endpoint
PUT https://api.ontraport.com/1/transaction/order
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/json
Request Parameters
Parameters should be sent in the request body as a JSON-encoded string.
Parameter | Type | Description |
---|---|---|
offer |
Offer | The product and pricing offer for the transaction. Required. Array keys must include: products => array[Product] order_id => integer offer_id => integer cc_id => integer Array keys may include: taxes => array[Tax] shipping => array[Shipping] delay => integer subTotal => number grandTotal => number hasTaxes => boolean hasShipping => boolean shipping_charge_recurring_orders => boolean ccExpirationDate => string If offer data is not provided, the order will be deleted. |
Build a manual transaction
<?php
require_once("Ontraport.php");
use OntraportAPI\Ontraport as Client;
use OntraportAPI\Models\Transaction as Transaction;
use OntraportAPI\Models\Product as Product;
use OntraportAPI\Models\Offer as Offer;
$client = new Client("2_AppID_12345678","Key5678");
// Create a new product
$product = new Product("poke", 2.00);
$params = $product->toRequestParams();
$response = $client->product()->create($params);
$response = json_decode($response, true);
$product_id = $response["data"]["id"];
// Create a new transaction
$transaction = new Transaction(1, 1, 1);
// Build the offer for the transaction
$offer = new Offer("My New Offer");
$offer->addProduct(5, 1, true, true, array("owner" => 1, "price" => 12, "name" => "Lambas Bread"));
$offer->addTrial(5, 5, 1, Offer::DAY);
$offer->addPaymentPlan(5, 6, 2, Offer::MONTH);
$offer->setShipping(1, 5.00, "Test Ship");
$offer->addTax(1, 7.00, true);
$offer->setInvoiceTemplate(Offer::SUPPRESS);
$transaction->sendRecurringInvoice(true);
// Load the newly built offer into the transaction
$transaction->loadOffer($offer);
// Save the data up until now as a new Offer
$requestParams = $offer->toRequestParams();
$client->offer()->create($requestParams);
// Continue making offer modifications for the transaction to be processed manually
$data = $client->product()->retrieveMultiple(array("search" => "tater tots"));
$data = json_decode($data, true);
$product = Product::CreateFromResponse($data["data"][0]);
// Add product with Product object
$offer->addProduct($product, 2, true, false);
$offer->setShipping(1, 2.00, "Shipment");
$transaction->loadOffer($offer);
$requestParams = $transaction->toRequestParams();
$client->transaction()->processManual($requestParams);
We have provided you with a Transaction model in our SDK that helps simplify the formatting process in building a correct valid transaction to process manually.
You can build a transaction with the Transaction model in our SDK or build your own request parameter array to process a transaction manually. Please note that the correct formatting of valid transaction data will be the user's responsibility to ensure.
The transaction model is meant to be used in conjunction with the Offer model to build a successful transaction. By utilizing the Offer model, you can build an offer and then proceed to load that offer data into the Transaction.
Functions
Function | Description |
---|---|
loadOffer |
Load an existing offer into the transaction. |
setBillingAddress |
Set the billing address for the payer. May be omitted if contact has a default card selected. |
setPayer |
Set the payment information for the transaction. May be omitted if contact has a default card selected. |
setInvoiceTemplate |
Set the invoice template to use for the transaction. |
sendRecurringInvoice |
Send recurring invoices for each reoccurring order. |
toRequestParams |
Converts the transaction object to an array to be used as request parameters. |
Transaction(contact ID, charge now, gateway ID)
Parameter | Type | Description |
---|---|---|
contact ID |
integer | The ID of the contact to process the transaction with. |
charge now |
constant | Whether or not to charge the transaction now or to log it. |
gateway ID |
integer | The ID of the gateway to use to process the payment. May be omitted if logging a transaction. |
loadOffer(offer)
Note that calling this will replace the existing transaction data, if any, in your Transaction object. Make sure to call this function after the instantiation of the Transaction object to prevent any unwanted overwritten data.
Parameter | Type | Description |
---|---|---|
offer |
Offer | An Offer object containing an offer's data. |
setPayer(payer)
If credit card and billing information already exist for this contact, you may use the ID of an existing credit card
to choose which stored credit card the transaction is charged to. In this case, you may omit the
setBillingAddress
function call from the request.
If credit card and billing information are already on file for this client and you want
this transaction to be charged to the contact's default credit card, you do not need call setPayer
and setBillingAddress
.
Otherwise, if you call setPayer
with information of the new payer to charge, you must also call
setBillingAddress
to set the billing address for this payer.
Note that calling this function a second time will replace the value used from the previous call.
Parameter | Type | Description |
---|---|---|
payer |
array integer |
The information of the new payer to charge in this transaction. Array must contain the following keys: ccnumber , code , expire_month , expire_year OR The ID of an existing credit card in the contact. (Note that this does not need to be set if the default credit card for the contact is desired.) |
setBillingAddress(address)
If you call setPayer
with information of the new payer to charge, you must also call
setBillingAddress
to set the billing address for that payer. Otherwise, you may omit this function call from the request.
Parameter | Type | Description |
---|---|---|
address |
array | The information of the new billing address corresponding to the new payer. Array must contain the following keys: address , address2 (optional), city , state , zip , country . |
setInvoiceTemplate(Invoice Template ID)
Parameter | Type | Description |
---|---|---|
Invoice Template ID |
integer | The ID of the invoice template to use in this transaction. To suppress invoices, set this to SUPPRESS . |
Constants
Parameter | Constants |
---|---|
charge now |
LOG => "chargeLog" CHARGE_NOW => "chargeNow" |
Invoice Template ID |
SUPPRESS => -1 DEFAULT_TEMP => 1 |
Process a transaction manually
curl -X POST -d '{
"contact_id": 1,
"chargeNow": "chargeNow",
"trans_date": 1369820760000,
"invoice_template": 1,
"gateway_id": 1,
"offer": {
"products": [
{
"quantity": 1,
"shipping": false,
"tax": false,
"price": [
{
"price": 10,
"payment_count": 0,
"unit": "month",
"id": 314159265
}
],
"type": "subscription",
"owner": 1,
"offer_to_affiliates": true,
"trial_period_unit": "day",
"trial_period_count": 0,
"setup_fee_when": "immediately",
"setup_fee_date": "string",
"delay_start": 0,
"subscription_count": 0,
"subscription_unit": "month",
"taxable": false,
"id": 5
}
]
},
"billing_address": {
"address": "123 XYZ St.",
"city": "Santa Barbara",
"state": "CA",
"zip": "93101",
"country": "US"
}, \
"payer": {
"ccnumber": "4111111111111111",
"code": "123",
"expire_month": 1,
"expire_year": 2035
}
}' 'https://api.ontraport.com/1/transaction/processManual' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"contact_id" => 1,
"chargeNow" => "chargeNow",
"trans_date" => 1369820760000,
"invoice_template" => 1,
"gateway_id" => 1,
"cc_id" => 1,
"offer" => array(
"products" => array(
array(
"quantity" => 1,
"shipping" => false,
"tax" => false,
"price" => array(
array(
"price" => 10,
"payment_count" => 0,
"unit" => "month",
"id" => 314159265
)
),
"type" => "subscription",
"owner" => 1,
"offer_to_affiliates" => true,
"trial_period_unit" => "day",
"trial_period_count" => 0,
"setup_fee_when" => "immediately",
"setup_fee_date" => "string",
"delay_start" => 0,
"subscription_count" => 0,
"subscription_unit" => "month",
"taxable" => false,
"id" => 5
)
)
),
"billing_address" => array(
"address" => "123 XYZ St",
"city" => "Santa Barbara",
"state" => "CA",
"zip" => "93101",
"country" => "US"
),
"payer" => array(
"ccnumber" => "4111111111111111",
"code" => "123",
"expire_month" => 1,
"expire_year" => 2035
)
);
$response = $client->transaction()->processManual($requestParams);
Example Response (processed transactions): *Note that invoice ID can be used interchangeably with transaction ID.
{
"code":0,
"data":{
"result_code":1,
"transaction_id":"1",
"external_txn":"000TEST",
"message":"Success!",
"invoice_id":1
}
}
Processes a transaction for a contact. Please note that this request requires valid parameters for all associated members of the transaction or the request will fail. If you have doubled-checked all parameters and the request is still failing, check that the payload JSON format is correct by using JSONLint. Additionally, you can also use the Transaction model to simplify the process in building a request parameter array.
If credit card and billing information already exist for this contact, you may use the cc_id
parameter and can choose
which stored credit card the transaction is charged to. In this case, you may omit billing_address
and payer
from the request.
If credit card and billing information are already on file for this client and you want this transaction to be charged to the contact's default credit card,
you do not need to submit cc_id
, billing_address
or payer
.
Note that trans_date
is given in milliseconds elapsed since midnight on 1/1/1970.
If you would like to log a transaction without actually processing it, you can use this endpoint with chargeNow
set to
"chargeLog". You can see an example of this here.
Request Endpoint
POST https://api.ontraport.com/1/transaction/processManual
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/json
Request Parameters
Parameter | Type | Description |
---|---|---|
contact_id |
integer | The ID of the contact for whom a transaction should be created. Required. |
chargeNow |
string | Whether a transaction should be charged or simply logged. Should be set to "chargeNow". Required. |
external_order_id |
string | Optional external order id that you can save within the generated transaction |
trans_date |
integer | The time of the transaction represented in milliseconds since the Unix Epoch. |
invoice_template |
integer | The ID of the invoice template to use for this transaction. The default invoice ID is 1. Required. |
gateway_id |
integer | The ID of the gateway to use for this transaction. Note that this is the ID of the gateway object itself and not the external_id of the gateway. A transaction can't succeed without a valid gateway. Required. |
cc_id |
integer | The ID of the credit card to charge for this transaction. Note that this is only required if the request does not contain billing_address and payer and the default credit card is not desired. |
create_open_order_on_decline |
string | For open orders, whether we create an open order if there's a today charge which declines. Optional Defaults to true . |
offer |
Offer | The product and pricing offer for the transaction. Required. Array keys may include: products => array[Product] taxes => array[Tax] shipping => array[Shipping] delay => integer subTotal => number grandTotal => number hasTaxes => boolean hasShipping => boolean shipping_charge_recurring_orders => boolean ccExpirationDate => string |
billing_address |
Address | The complete billing address information for this transaction. Only required if not already on file for this contact. Array keys may include: address => string address2 => string city => string state => string zip => string country => string |
payer |
Payer | The credit card information for this transaction. Only required if not already on file for this contact. Array keys may include: ccnumber => string cctoken => Token code => string expire_month => integer expire_year => integer |
Offer
An offer needs to be included with each manual transaction. This includes information on products, tax, and shipping. If invalid information is included in your offer, your request will fail.
Parameter | Type | Description |
---|---|---|
products |
array[Product] | An array of products to include in your offer. Required. Array keys may include: quantity => integer total => number shipping => boolean tax => boolean price => array[Price] type => string owner => integer level1 => number level2 => number offer_to_affiliates => boolean trial_period_unit => string trial_period_count => integer trial_price => number setup_fee => number setup_fee_when => string setup_fee_date => string delay_start => integer subscription_fee => number subscription_count => integer subscription_unit => integer taxable => boolean id => integer |
taxes |
array[Tax] | An array of taxes to be applied to your offer. Array keys may include: id => integer rate => number name => string taxShipping => boolean taxTotal => number form_id => integer |
shipping |
array[Shipping] | An array of shipping detail to be applied to your offer. Array keys may include: id => integer name => string price => number form_id => integer |
delay |
integer | The number of days to delay the start of the offer. |
subTotal |
number | The product total cost before tax, shipping and discounts. |
grandTotal |
number | The total cost of the entire offer. |
hasTaxes |
boolean | Indicates whether or not there are applicable taxes for this offer. |
hasShipping |
boolean | Indicates whether or not shipping should be applied to this offer. |
shipping_charge_recurring_orders |
boolean | Indicates whether or not shipping charges should be applied to recurring orders. |
send_recurring_invoice |
boolean | For subscriptions, indicates whether or not an invoice should be sent with every recurring order. This value defaults to false. |
ccExpirationDate |
string | The expiration date of the credit card on file. |
Address
If billing address information is not already on file for a contact, this information must be included with any manual transaction. Address information does not need to be included if it is already on file.
Parameter | Type | Description |
---|---|---|
address |
string | The contact's billing address. Required. |
address2 |
string | Any additional address information for the contact, such as building or suite number. |
city |
string | The contact's city. Required. |
state |
string | The contact's state. Required. |
zip |
string | The contact's zip code. Required. |
country |
string | The contact's country. Required. |
Payer
Payer information is stored for contacts with credit card information on file. If this information is not currently on file for a contact, it needs to be included in order to successfully process a transaction.
Parameter | Type | Description |
---|---|---|
ccnumber |
string | The contact's full credit card number. Required if cctoken not present. |
code |
string | The CVV code for the contact's credit card. Recommended. Only used if ccnumber present. |
cctoken |
Token | The card token data. Required if ccnumber not present. |
expire_month |
integer | The expiration month, in digits, of the credit card to be processed. Required. |
expire_year |
integer | The four-digit expiration year of the credit card to be processed. Required. |
Token
Token data for token-based gateway implementations. Only used if ccnumber
isn't present.
At present, only tokens for the Stripe gateway are supported.
Parameter | Type | Description |
---|---|---|
token |
array | The token data for this specific gateway. For Stripe Token, an example would be {"card_id": "card_XXXXX", "customer_id": "cus_XXXXX"} . Required. |
card_type |
string | The type of this card. Supported values are visa , mastercard , amex , discover and diners . Required. |
last4 |
string | The last four digits of the card number. Required. |
Products
An array of products is included with every offer. If valid, existing products are not included, a transaction can't be processed.
Parameter | Type | Description |
---|---|---|
quantity |
integer | The total number of this item to be included in the purchase. Required. |
total |
number | The total amount of this purchase. Required. |
shipping |
boolean | Indicates whether or not there is a cost to ship this product. |
taxable |
boolean | Indicates whether or not this product should be taxed. |
price |
array[Price] | An array of pricing elements associated with this product. Array keys may include: price => number payment_count => integer unit => string id => integer |
type |
string | The type of product. Values can be:subscription => a recurring purchase item one_time => a single purchase item payment_plan => a product paid for on installment |
owner |
integer | The ID of the user controlling the product. |
level1 |
number | The partner level 1 commission percentage, if any. |
level2 |
number | The partner level 2 commission percentage, if any. |
offer_to_affiliates |
boolean | Indicates whether or not this product is offered to affiliates. |
trial_period_unit |
string | If there is a trial period for the product, indicates the units of length of the trial period. Options can be: day , week , month , quarter , year . |
trial_period_count |
integer | Indicates the length of the trial period. Must be used in conjunction with trial_period_unit . |
trial_price |
number | The price of the product during the trial period. |
setup_fee |
number | The cost of of any one-time set-up fee, if applicable. |
setup_fee_when |
string | Indicates when the setup fee should be applied. Values can be: immediately , after_trial , on_date . |
setup_fee_date |
timestamp | If the value for setup_fee_when is on_date , the date of when the setup fee should be applied in seconds elapsed since the Unix Epoch. |
delay_start |
integer | The number of days to delay the start of a subscription. |
subscription_fee |
number | The cost of any additional fee for a subscription product. |
subscription_count |
integer | The number of subscriptions. |
subscription_unit |
string | Indicates how often a subscription product is delivered. Options can be: day , week , month , quarter , year . |
id |
integer | The product ID. This must be the ID of an existing product or your request will fail. Required. |
Tax
An array of tax data can be included with an offer where taxes are applicable.
Parameter | Type | Description |
---|---|---|
id |
integer | The ID of the existing tax object to apply to the offer. Required. |
rate |
number | The rate at which the offer should be taxed. |
name |
string | The name of the tax to be applied. |
taxShipping |
boolean | Indicates whether or not shipping charges should be taxed. |
taxTotal |
number | The total amount of the applied taxes. |
form_id |
integer | The ID of the related form, if any. |
Shipping
An array of shipping data can be included with an offer where shipping is applicable.
Parameter | Type | Description |
---|---|---|
id |
integer | The ID of the shipping method being applied to the offer. This must be an existing shipping method. Required. |
name |
string | The name of the shipping method being used. |
price |
number | The cost of charges incurred for this shipping method. |
form_id |
integer | The ID of the related form, if any. |
Price
An array of price data should be included with products.
Parameter | Type | Description |
---|---|---|
id |
integer | The ID of the pricing item. |
price |
number | The price of the product. |
payment_count |
integer | If a payment plan item, the number of payments to be made. |
unit |
string | The units of time of payments. Options can be: day , week , month , quarter , year . |
Log a transaction
curl -X POST -d '{
"contact_id": 1,
"chargeNow": "chargeLog",
"invoice_template": 1,
"offer": {
"products": [
{
"quantity": 1,
"owner": 1,
"id": 1
}
]
}
}' 'https://api.ontraport.com/1/transaction/processManual' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"contact_id" => 1,
"invoice_template" => 1,
"chargeNow" => "chargeLog",
"offer" => array(
"products" => array(
array(
"quantity" => 1,
"owner" => 1,
"id" => 1
)
)
)
);
$response = $client->transaction()->processManual($requestParams);
Example Response:
{
"code": 0,
"data": {
"invoice_id": 3
},
"account_id": "12345"
}
If you would like to pass in a previously charged transaction to be logged in Ontraport without actually charging your contact, you can use
the transaction/processManual endpoint
with the chargeNow
field set to "chargeLog".
Far less data is needed to simply log a transaction than to manually process one. The gateway, payer, and billing details are unnecessary in this case. The mandatory information in this case include a contact ID, the "chargeLog" designation, and product and pricing details.
Request Endpoint
POST https://api.ontraport.com/1/transaction/processManual
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/json
Request Parameters
Parameter | Type | Description |
---|---|---|
contact_id |
integer | The ID of the contact for whom a transaction should be created. Required. |
chargeNow |
string | Whether a transaction should be charged or simply logged. Should be set to "chargeLog". Required. |
external_order_id |
string | Optional external order id that you can save within the generated transaction |
trans_date |
integer | The time of the transaction represented in milliseconds since the Unix Epoch. |
invoice_template |
integer | The ID of the invoice template to use for this transaction. The default invoice ID is 1. If you would like to suppress the sending of invoices for logged transactions, this parameter should be set to -1. |
offer |
Offer | The product and pricing offer for the transaction. Required. Array keys must include: products => array[Product] |
Refund a transaction
curl -X PUT -d '{
"ids": [
2
]
}' 'https://api.ontraport.com/1/transaction/refund' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => 0,
"ids" => array(2)
);
$response = $client->transaction()->refund($requestParams);
Example Response:
{
"code": 0,
"data": "Refunded",
"account_id": "12345"
}
Refunds a previously charged transaction.
Request Endpoint
PUT https://api.ontraport.com/1/transaction/refund
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/json
Request Parameters
Parameters should be sent in the request body as a JSON-encoded string.
Parameter | Type | Description |
---|---|---|
ids |
array[int] | An array of the IDs of the transactions to refund. Entering a value of 0 will result in all transactions being selected. Required. |
start |
integer | The offset to return results from. |
range |
integer | The number of transactions you want to refund. The maximum and default range is 50. |
condition |
string | A JSON encoded string to more specifically set criteria for which transactions to bring back. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your transaction objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other transaction fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Rerun a transaction
curl -X POST -d '{"ids": [1]}' 'https://api.ontraport.com/1/transaction/rerun' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => 0,
"ids" => array(1)
);
$response = $client->transaction()->rerun($requestParams);
Example Response:
{
"code": 0,
"data": 1,
"account_id": "12345"
}
Reruns a previously charged transaction.
Request Endpoint
POST https://api.ontraport.com/1/transaction/rerun
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/json
Request Parameters
Parameters should be sent in the request body as a JSON-encoded string.
Parameter | Type | Description |
---|---|---|
ids |
array[int] | An array of the IDs of the transactions to rerun. Entering a value of 0 will result in all transactions being selected. |
start |
integer | The offset to return results from. |
range |
integer | The number of transactions you want to rerun. The maximum and default range is 50. |
condition |
string | A JSON encoded string to more specifically set criteria for which transactions to bring back. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your transaction objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other transaction fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Rerun a transaction's commissions
curl -X PUT -d '{"ids": [1]}' 'https://api.ontraport.com/1/transaction/rerunCommission' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => 0,
"ids" => array(1)
);
$response = $client->transaction()->rerunCommission($requestParams);
Example Response:
{
"code": 0,
"data": "Re-ran commissions",
"account_id": "99"
}
Reruns partner commissions for a previously charged transaction.
Request Endpoint
PUT https://api.ontraport.com/1/transaction/rerunCommission
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/json
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
ids |
array[int] | An array of the IDs of the transactions to rerun commissions for. Entering a value of 0 will result in all transactions being selected. |
start |
integer | The offset to return results from. |
range |
integer | The number of transactions you want to rerun commissions for. The maximum and default range is 50. |
condition |
string | A JSON encoded string to more specifically set criteria for which transactions to bring back. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your transaction objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other transaction fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Resend an invoice
curl -X POST -d '{
"objectID": 0,
"ids": [
2
]
}' 'https://api.ontraport.com/1/transaction/resendInvoice' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => 0,
"ids" => array(1)
);
$response = $client->transaction()->resendInvoice($requestParams);
Example Response:
{
"code": 0,
"data": "",
"account_id": "12345"
}
Resends an invoice for a previously charged transaction.
Request Endpoint
POST https://api.ontraport.com/1/transaction/resendInvoice
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/json
Request Parameters
Parameters should be sent in the request body as a JSON-encoded string.
Parameter | Type | Description |
---|---|---|
ids |
array[int] | An array of the IDs of the transactions to resend invoices for. Entering a value of 0 will result in all transactions being selected. |
start |
integer | The offset to return results from. |
range |
integer | The number of transactions you want to resend invoices for. The maximum and default range is 50. |
condition |
string | A JSON encoded string to more specifically set criteria for which transactions to bring back. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your transaction objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other transaction fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Void a transaction
curl -X PUT -d '{
"ids": [
1
]
}' 'https://api.ontraport.com/1/transaction/void' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => 0,
"ids" => array(1)
);
$response = $client->transaction()->void($requestParams);
Example Response:
{
"code": 0,
"data": "Voided",
"account_id": "12345"
}
Voids a previously charged transaction.
Request Endpoint
PUT https://api.ontraport.com/1/transaction/void
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/json
Request Parameters
Parameters should be sent in the request body as a JSON-encoded string.
Parameter | Type | Description |
---|---|---|
ids |
array[int] | An array of the IDs of the transactions to void. Entering a value of 0 will result in all transactions being selected. |
start |
integer | The offset to return results from. |
range |
integer | The number of transactions you want to void. The maximum and default range is 50. |
condition |
string | A JSON encoded string to more specifically set criteria for which transactions to void. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your transaction objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other transaction fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Write off a transaction
curl -X PUT -d '{
"objectID": 0,
"ids": [
1
]}' 'https://api.ontraport.com/1/transaction/writeOff' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => 0,
"ids" => array(1)
);
$response = $client->transaction()->writeOff($requestParams);
Example Response:
{
"code": 0,
"data": 1,
"account_id": "12345"
}
Writes off a previously charged transaction.
Request Endpoint
PUT https://api.ontraport.com/1/transaction/writeOff
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/json
Request Parameters
Parameters should be sent in the request body as a JSON-encoded string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID. Required. |
ids |
array[int] | An array of the IDs of the transactions to write off. Entering a value of 0 will result in all transactions being selected. |
start |
integer | The offset to return results from. |
range |
integer | The number of transactions you want to write off. The maximum and default range is 50. |
condition |
string | A JSON encoded string to more specifically set criteria for which transactions to write off. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your transaction objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other transaction fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Tags
Object Type ID: 14
Tags are labels which allow you to create groups of contacts or custom objects. Groups can be created using tags based on certain factors such as if a contact filled out a form, or purchased a product. Tags can be used to send follow-up messages, such as a referral, to a group of contacts who fit a particular category.
Through the tag API, you can retrieve a single tag and a collection of tags. You can retrieve the information of a collection of tags, and the field information for a tag. You can create a new tag, or update the information of an existing tag. You can also delete a single tag, or a list of tags.
The tag object
{
"tag_id": "1",
"tag_name": "Filled out a form",
"object_type_id": "0"
}
Attributes | Type | Description |
---|---|---|
tag_id |
integer | The ID of the tag. |
tag_name |
string | The name of the tag. |
object_type_id |
integer | The ID of the type of object the tag was added to. If the tag was added to a contact, this value will be 0. |
Retrieve a specific tag
curl -X GET 'https://api.ontraport.com/1/Tag?id=1' \
--header 'Accept: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 1
);
$response = $client->tag()->retrieveSingle($requestParams);
?>
Example Response:
{
"code": 0,
"data": {
"tag_id": "1",
"tag_name": "Purchased a product",
"object_type_id": "0"
},
"account_id": 12345
}
Retrieves all information for an existing tag.
Request URL
GET https://api.ontraport.com/1/Tag
Required Headers
Api-Key: {api-key}
Api-Appid: {app-id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The tag ID. Required. |
Retrieve multiple tags
curl -X GET 'https://api.ontraport.com/1/Tags?ids=1%2C2&range=50' \
--header 'Accept: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"sort" => "name",
"sortDir" => "asc"
);
$response = $client->tag()->retrieveMultiple($requestParams);
?>
Example Response:
{
"code": 0,
"data": [
{
"tag_id": "1",
"tag_name": "The first tag",
"object_type_id": "0"
},
{
"tag_id": "2",
"tag_name": "The second tag",
"object_type_id": "0"
}
],
"account_id": 12345,
"misc": []
}
Retrieves a collection of tags based on a set of parameters. You can limit necessary API requests by utilizing criteria and our pagination tools to select only the data set you require.
Request URL
GET https://api.ontraport.com/1/Tags
Required Headers
Api-Key: {api-key}
Api-Appid: {app-id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
ids |
string | An integer array as a comma-delimited list of the IDs of the tags to retrieve. Entering a value of 0 will result in all tags being selected. |
start |
integer | The offset to return results from. |
range |
integer | The number of tags you want to retrieve. The maximum and default range is 50. |
sort |
string | The field results should be sorted on. |
sortDir |
string | The direction your results should be sorted. Your options are asc and desc . This field must be used in conjunction with the sort parameter. |
condition |
string | A JSON encoded string to more specifically set criteria for which tags to bring back. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your tag objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other tag fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
externs |
string | If you have a relationship between your tag object and another object, you may want to include the data from a related field in your results. Each external field is listed in the format {object}//{field} . Multiple fields are separated by commas. |
listFields |
string | A string array as a comma-delimited list of the fields which should be returned in your results. |
Retrieve tag object meta
curl -X GET 'https://api.ontraport.com/1/Tags/meta?format=byId' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$response = $client->tag()->retrieveMeta();
?>
Example Response:
{
"code": 0,
"data": {
"14": {
"name": "Tag",
"fields": {
"tag_name": {
"alias": "Name",
"type": "text",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0
},
"tag_id": {
"alias": "Id",
"type": "numeric",
"required": 0,
"unique": 0,
"editable": 0,
"deletable": 0
}
}
}
},
"account_id": 12345
}
Retrieves the field meta data for the tag object.
Request URL
GET https://api.ontraport.com/1/Tags/meta
Required Headers
Api-Key: {api-key}
Api-Appid: {app-id}
Request Parameters
None
Retrieve tag collection info
curl -X GET 'https://api.ontraport.com/1/Tags/getInfo?search=Purchased' \
--header 'Accept: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"search" => "Purchased",
);
$response = $client->tag()->retrieveCollectionInfo($requestParams);
?>
Example Response:
{
"code": 0,
"data": {
"listFields": [
"tag_name"
],
"listFieldSettings": [],
"cardViewSettings": {
"fields": [
"tag_name"
]
},
"viewMode": [],
"widgetSettings": {
"map": [
[
"overview"
],
[
"fields"
],
[
"notes",
"tasks",
"settings"
]
],
"widgets": {
"overview": {
"type": "object_widget_overview",
"options": {
"visible": "true",
"excludeFromWidgetSettings": true
}
},
"tasks": {
"type": "object_widget_object_list_text_object_task_widget",
"options": {
"visible": "true",
"objectID": 1,
"header": "Tasks"
}
},
"notes": {
"type": "object_widget_object_list_text_object_notes_widget",
"options": {
"visible": "true",
"objectID": 12,
"header": "Notes"
}
},
"settings": {
"type": "object_widget_settings",
"options": {
"placeAtEndOfColumn": true,
"excludeFromWidgetSettings": true
}
},
"fields": {
"type": "object_widget_fields",
"options": {
"visible": "true",
"excludeFromWidgetSettings": true,
"fields": [
"tag_name"
]
}
}
},
"listFields": [
"profile_image",
"tag_name"
]
},
"count": "6"
},
"account_id": 12345
}
Retrieves information about a collection of tags, such as the number of tags that match the given criteria.
Request URL
GET https://api.ontraport.com/1/Tags/getInfo
Required Headers
Api-Key: {api-key}
Api-Appid: {app-id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
condition |
string | A JSON encoded string to more specifically set criteria for which tags to select. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your tag objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other tag fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Create a tag
curl -X POST -d 'tag_name=api_tag&object_type_id=0' 'https://api.ontraport.com/1/Tags' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"tag_name" => "api_tag",
"object_type_id" => 0
);
$response = $client->tag()->create($requestParams);
Example Response:
{
"code": 0,
"data": {
"tag_name": "api_tag",
"object_type_id": "0",
"tag_id": "1"
},
"account_id": 12345
}
Using this API endpoint, you can add a new tag to your database. When creating a new tag, you need to specify the tag's name as well as the type of object the tag will be used for. You cannot create a new tag with the same name as a tag of the same object type, although tags for different objects can share the same name.
Request Endpoint
POST https://api.ontraport.com/1/Tags
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
tag_name |
string | The name of the tag to create. Required. |
object_type_id |
integer | The ID of the object type the tag will be added to. Contacts have an ID of 0, while custom object IDs start at 10000. If no ID is specified, the tag will be created for contacts. |
Update a tag
curl -X PUT -d 'id=1&tag_name=updated_tag' 'https://api.ontraport.com/1/Tags' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 1,
"tag_name" => "updated_tag"
);
$response = $client->tag()->update($requestParams);
Example Response:
{
"code": 0,
"data": {
"attrs": {
"tag_name": "updated_tag",
"id": null
}
},
"account_id": 12345
}
Updates an existing tag's name from its ID. All objects with this tag will be updated to have the tag with the new name. A tag cannot be updated to have the same name as an existing tag of the same object type.
Request Endpoint
PUT https://api.ontraport.com/1/Tags
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
id |
integer | The ID of the tag to update. Required. |
tag_name |
string | The new name for the tag. Required. |
Delete a specific tag
curl -X DELETE 'https://api.ontraport.com/1/Tag?id=1' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 1
);
$response = $client->tag()->deleteSingle($requestParams);
Example Response:
{
"code": 0,
"account_id": "12345"
}
Deletes a specific tag by its ID. Any objects with this tag will have the tag removed.
Request Endpoint
DELETE https://api.ontraport.com/1/Tag
Required Headers
Api-Key: {api-key}
Api-Appid: {app-id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The ID of the tag to delete. Required. |
Delete multiple tags
curl -X DELETE 'https://api.ontraport.com/1/Tags?ids=1%2C%202&range=50' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"ids" => "1,2"
);
$response = $client->tag()->deleteMultiple($requestParams);
Example Response:
{
"code": 0,
"data": "Deleted",
"account_id": "12345"
}
Deletes a collection of tags based on a set of parameters. You can choose the IDs for the tags to delete or use our pagination tools for a mass delete. Be very careful using this endpoint with your API key, as tags will be permanently deleted from your database.
Request Endpoint
DELETE https://api.ontraport.com/1/Tags
Required Headers
Api-Key: {api-key}
Api-Appid: {app-id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
ids |
string | An array as a comma-delimited list of the IDs of the tags to delete. Entering a value of 0 will result in all tags being selected. Caution should be used with this endpoint. |
start |
integer | The offset to delete results from. |
range |
integer | The number of tags you want to delete. The maximum and default range is 50. |
condition |
string | A JSON encoded string to more specifically set criteria for which tags to delete. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your tag objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not tag notes should be searched for the specified string in addition to other tag fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. Note that setting this to the value of 1 without any other parameters will delete all tags from your account. |
Tasks
Object Type ID: 1
A task object is created when a task is assigned to a contact or other object.
Through the task API, you can retrieve a single task or a collection of tasks, as well as update the data for a task. You can also assign, cancel, reschedule, and mark tasks as complete.
The task object
{
"id": "1",
"owner": "1",
"drip_id": "0",
"contact_id": "32",
"step_num": "0",
"subject": "Do this.",
"date_assigned": "1491929050",
"date_due": "1522341850",
"date_complete": null,
"status": "0",
"type": "0",
"details": "Fred, please complete this task.",
"hidden": "0",
"call_outcome_id": "0",
"item_id": "7",
"notifications": "{\"notifications_sent\":[false]}",
"rules": null,
"object_type_id": "0",
"object_name": "Contacts"
}
Task attributes
Attribute | Type | Description |
---|---|---|
id |
integer | The task's ID. |
owner |
integer | The user who has control of the task. |
drip_id |
integer | If the task is a step in a sequence, the ID of that sequence. |
contact_id |
integer | The ID of the contact the task is related to. |
step_num |
integer | If the task is a step in a sequence, the order in the sequence of that step. |
subject |
string | The subject line of the task email. |
date_assigned |
timestamp | The date and time the task was assigned. |
date_due |
timestamp | The date and time the task should be completed by. |
date_complete |
timestamp | The date and time the task was marked as completed. |
status |
integer | The task completion status. Integer codes are mapped as follows:0 => Pending 1 => Complete 2 => Cancelled |
type |
integer | The task type. Integer codes are mapped as follows:-1 => Fulfillment tasks 0 => Normal tasks (default) |
details |
string | The content of the task message. |
hidden |
integer | A binary integer flag designating whether or not the task is accessible. Integer codes map as follows:0 => Not hidden 1 => Hidden |
call_outcome_id |
integer | If the task has an outcome, the ID of that outcome. Task outcomes are user-defined and stored as a related object. |
item_id |
integer | The ID of the task message. The task message is the generic template the task was created from. |
notifications |
string | A JSON encoded string including information about sent notifications. |
rules |
string | If the task has rules associated with it, the events, conditions and actions of those rules. |
object_type_id |
integer | The ID for the type of object the task is associated with. |
object_name |
string | The name of the type of object the task is associated with. |
Retrieve a specific task
curl -X GET 'https://api.ontraport.com/1/Task?id=1' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 1
);
$response = $client->task()->retrieveSingle($requestParams);
Example Response:
{
"code": 0,
"data": {
"id": "1",
"owner": "1",
"drip_id": "0",
"contact_id": "32",
"step_num": "0",
"subject": "Do this.",
"date_assigned": "1491929050",
"date_due": "1522341850",
"date_complete": null,
"status": "0",
"type": "0",
"details": "Fred, please complete this task.",
"hidden": "0",
"call_outcome_id": "0",
"item_id": "7",
"notifications": "{\"notifications_sent\":[false]}",
"rules": null,
"object_type_id": "0",
"object_name": "Contacts"
},
"account_id": "12345"
}
Retrieves all the information for an existing task.
Request URL
GET https://api.ontraport.com/1/Task
Required Headers
Api-Key: Key5678
Api-Appid: 2_AppID_12345678
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The task ID. Required. |
Retrieve multiple tasks
curl -X GET 'https://api.ontraport.com/1/Tasks?sort=date_due&sortDir=desc&listFields=id%2Csubject%2Cdate_due' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"sort" => "date_due",
"sortDir" => "desc",
"listFields" => "id,subject,date_due"
);
$response = $client->task()->retrieveMultiple($requestParams);
Example response:
{
"code": 0,
"data": [
{
"id": "2",
"subject": "Do this.",
"date_due": "1713628490",
"owner": "1"
},
{
"id": "1",
"subject": "Help!",
"date_due": "1605628490",
"owner": "1"
},
{
"id": "3",
"subject": "Follow up with this contact",
"date_due": "1493152240",
"owner": "1"
}
],
"account_id": "12345",
"misc": []
}
Retrieves a collection of tasks based on a set of parameters. You can limit unnecessary API requests by utilizing criteria and our pagination tools to select only the data set you require.
Request URL
GET https://api.ontraport.com/1/Tasks
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
ids |
string | An integer array as a comma-delimited list of the IDs of the tasks to retrieve. Entering a value of 0 will result in all tasks being selected. |
start |
integer | The offset to return results from. |
range |
integer | The number of tasks you want to retrieve. The maximum and default range is 50. |
sort |
string | The field results should be sorted on. |
sortDir |
string | The direction your results should be sorted. Your options are asc and desc . This field must be used in conjunction with the sort parameter. |
condition |
string | A JSON encoded string to more specifically set criteria for which tasks to bring back. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your task objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other task fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
externs |
string | If you have a relationship between your task object and another object, you may want to include the data from a related field in your results. Each external field is listed in the format {object}//{field} . Multiple fields are separated by commas. |
listFields |
string | A string array as a comma-delimited list of the fields which should be returned in your results. |
Retrieve task object meta
curl -X GET 'https://api.ontraport.com/1/Tasks/meta' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$response = $client->task()->retrieveMeta();
Example Response:
{
"code": 0,
"data": {
"1": {
"name": "Task",
"fields": {
"owner": {
"alias": "Assignee",
"type": "parent",
"parent_object": 2
},
"contact_id": {
"alias": "Contact",
"type": "parent"
},
"call_outcome_id": {
"alias": "Outcome",
"type": "parent",
"parent_object": 66
},
"subject": {
"alias": "Subject",
"type": "text"
},
"details": {
"alias": "Details",
"type": "longtext"
},
"date_assigned": {
"alias": "Date Assigned",
"type": "timestamp"
},
"date_complete": {
"alias": "Date Complete",
"type": "timestamp"
},
"date_due": {
"alias": "Date Due",
"type": "fulldate"
},
"item_id": {
"alias": "Task",
"type": "parent",
"parent_object": 7
},
"status": {
"alias": "Status",
"type": "drop",
"options": {
"0": "Pending",
"1": "Complete",
"2": "Canceled"
}
},
"drip_id": {
"alias": "Sequence",
"type": "parent",
"parent_object": 5
},
"object_type_id": {
"alias": "Object",
"type": "parent",
"parent_object": "99"
},
"object_name": {
"alias": "Related Object",
"type": "related_data"
}
}
}
},
"account_id": "12345"
}
Retrieves the field meta data for the task object.
Request URL
GET https://api.ontraport.com/1/Tasks/meta
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
None
Retrieve task collection info
curl -X GET 'https://api.ontraport.com/1/Tasks/getInfo?search=Test' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"search" => "Task"
);
$response = $client->task()->retrieveCollectionInfo($requestParams);
Example Response:
{
"code": 0,
"data": {
"listFields": [
"owner",
"subject",
"status",
"date_assigned",
"date_due",
"date_complete",
"contact_id",
"call_outcome_id"
],
"listFieldSettings": [],
"count": "2"
},
"account_id": "50"
}
Retrieves information about a collection of tasks, such as the number of tasks that match the given criteria.
Request URL
GET https://api.ontraport.com/1/Tasks/getInfo
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
condition |
string | A JSON encoded string to more specifically set criteria for which tasks to select. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your task objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other task fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Update a task
curl -X PUT -d 'id=1&status=2' 'https://api.ontraport.com/1/Tasks' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 1,
"status" => 2
);
$response = $client->task()->update($requestParams);
Example Response:
{
"code": 0,
"data": {
"attrs": {
"status": "2",
"id": "1"
}
},
"account_id": "12345"
}
Updates a task with a new assignee, due date, or status.
Request URL
PUT https://api.ontraport.com/1/Tasks
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
id |
integer | The task ID. Required. |
owner |
integer | The ID of the task assignee. |
date_due |
timestamp | The date and time the task should be due measured in seconds from the Unix Epoch. |
status |
string | The task's status. Integer codes map as follows:0 => Pending 1 => Complete 2 => Cancelled |
Assign a task
curl -X POST -d '{
"object_type_id": 0,
"ids": [
31
],
"group_id": 0,
"message": {
"id": 6,
"type": "Task",
"due_date": 7,
"task_owner": 0
}
}' 'https://api.ontraport.com/1/task/assign' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"object_type_id" => 0,
"ids" => array(5),
"group_id" => array(0),
"message" => array(
"id" => 1,
"type" => "Task",
"due_date" => 7,
"task_owner" => 0
)
);
$response = $client->task()->assign($requestParams);
Example Response:
{
"code": 0,
"account_id": "12345"
}
Assigns a task to one or more contacts.
Request URL
POST https://api.ontraport.com/1/task/assign
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/json
Request Parameters
Parameters should be sent in the request body as a JSON-encoded string.
Parameter | Type | Description |
---|---|---|
object_type_id |
integer | The object type ID of the object type tasks will be assigned to. This value is 0 for contacts. Required. |
ids |
array[int] | An array of the IDs of contacts to assign a task to. (group_id may be substituted for ids ). |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
message |
TaskMessage | An array of data for the task message to assign to contacts. See below for descriptions of the parameters which should be included in this array. |
Task Message
When assigning a task through the API, you can include an array of data pertaining to the task message. You can specify which task message to use and the due date and assignee of the task.
Parameter | Type | Description |
---|---|---|
id |
integer | The task message ID. |
type |
integer | The task type. Integer codes are mapped as follows:-1 => Fulfillment tasks 0 => Normal tasks (default) |
due_date |
timestamp | The date and time the task will be due, measured in seconds from the Unix Epoch. |
task_owner |
integer | The ID of the user responsible for the task. |
Cancel a task
curl -X POST -d '{
"objectID": 0,
"ids": [
1
]
}' 'https://api.ontraport.com/1/task/cancel' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"objectID" => 0,
"ids" => array(
1
)
);
$response = $client->task()->cancel($requestParams);
Example Response:
{
"code": 0,
"account_id": "12345"
}
Cancels one or more tasks.
To affect a single task or list of specific tasks, specify ids
in the body of your request.
Otherwise, you should use performAll
and other criteria to select a group of tasks to cancel.
Request URL
POST https://api.ontraport.com/1/task/cancel
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/json
Request Parameters
Parameters should be sent in the request body as a JSON-encoded string.
Parameter | Type | Description |
---|---|---|
objectID |
integer | The object type ID. Required. |
ids |
array[int] | An array of the IDs of the tasks to cancel. Entering a value of 0 will result in all tasks being selected. |
start |
integer | The offset to return results from. |
range |
integer | The number of tasks you want to cancel. The maximum and default range is 50. |
condition |
string | A JSON encoded string to more specifically set criteria for which tasks to bring back. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your task objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other task fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Complete a task
curl -X POST -d '{
"object_type_id": 0,
"ids": [
3
],
"data": {
"outcome": ":=success",
"task_form_lastname": "Green"
}
}' 'https://api.ontraport.com/1/task/complete' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"object_type_id" => 0,
"ids" => array(3),
"data" => array(
"outcome" => ":=success",
"task_form_lastname" => "Green"
)
);
$response = $client->task()->complete($requestParams);
Example Response:
{
"code": 0,
"account_id": "12345"
}
Marks one or more tasks as completed.
To affect a single task or list of specific tasks, specify ids
in the body of your request.
Otherwise, you should use performAll
and other criteria to select a group of tasks to complete.
Request URL
POST https://api.ontraport.com/1/task/complete
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/json
Request Parameters
Parameters should be sent in the request body as a JSON-encoded string.
Parameter | Type | Description |
---|---|---|
object_type_id |
integer | The ID of the object type to mark a task as complete for. This value defaults to 0 for a contact object. Required. |
ids |
array[int] | An array of the object IDs the task should be marked as completed for. (group_id can be substituted for ids ). |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
data |
TaskData | An array of task data, including:outcome => string followup => TaskFollowup task_form_{fieldname} => string See below for a description of these parameters. |
Task Data
When you mark a task as completed, you have the option of specifying additional actions to be taken. This optional array of task data allows you to create a task outcome, assign a followup task, and update any task fields as needed.
Parameter | Type | Description |
---|---|---|
outcome |
string | Task outcome name. This must start with ":=" For example, ":=signed". |
followup |
TaskFollowup | An array of task followup data, including:message_id => integer due_date => integer task_owner => integer See a description of those parameters below. |
task_form_{field} |
string | These fields can be used to update associated object data when completing a task. For example, set task_form_title to "New title" to change the contact's title. |
Task Followup
If you want to create another task to follow up upon task completion, you can include an array of data for a followup task. This allows you to specify the message you want to use in addition to the due date and assignee of the new task.
Parameter | Type | Description |
---|---|---|
message_id |
integer | Message ID of a new task to be created for further followup. This task message must currently exist. New task messages can be created using the objects/create endpoint with objectID set to 1. |
due_date |
integer | The due date of the new task, given as number of days from current date. |
task_owner |
integer | The ID of the user responsible for the new task. |
task_notification_checkbox |
integer | A binary integer flag indicating whether or not to send email notifications from the Contact's email. |
Reschedule a task
curl -X POST -d '{
"id": 2,
"newtime": 1713628490
}' 'https://api.ontraport.com/1/task/reschedule' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 2,
"newtime" => 1713628490
);
$response = $client->task()->reschedule($requestParams);
Example Response:
{
"code": 0,
"account_id": "12345"
}
Reschedules a task for a different date and time.
Request URL
POST https://api.ontraport.com/1/task/reschedule
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/json
Request Parameters
Parameters should be sent in the request body as a JSON-encoded string.
Field | Type | Description |
---|---|---|
id |
integer | The task ID. Required. |
newtime |
timestamp | The date and time the task should be rescheduled for, measured in seconds from the Unix Epoch. |
Webhooks
Object Type ID: 145
You can use webhooks subscriptions to receive notifications about events occurring within your Ontraport account.
Events you can currently subscribe to are as follows:
Event | Triggered When | Details |
---|---|---|
object_create | A new contact or custom object is added | Event |
object_submits_form | Any contact or custom object fills out the specified form | Event |
sub_tag | Any contact or custom object is added to the specified tag | Event |
unsub_tag | Any contact or custom object is removed from the specified tag | Event |
The webhook object
{
"id": "27",
"event": "sub_tag(1)",
"data": "{\"format\":\"notify\"}",
"url": "https://www.testurl.com",
"last_hook": 1516128699,
"last_code": 200,
"last_payload":"{\"webhook_id\":\"10\",\"object_type_id\":\"0\",\"event\":{\"type\":\"sub_tag\",\"tag_id\":\"1\"},\"data\":{\"id\":\"1\",\"firstname\":\"Michael\",\"lastname\":\"Brown\",\"email\":\"mbrown@ontraport.com\"},\"timestamp\":1519774345}"
}
Attributes | Type | Description |
---|---|---|
id |
integer | The webhook ID. |
event |
string | The event triggering the webhook. |
data |
string | Additional json-formatted data regarding the format of the payload |
url |
string | The URL the payload should be sent to. |
last_code |
string | The last HTTP response code. |
last_hook |
timestamp | The date and time of the last webhook, measured in seconds from the Unix Epoch. |
last_payload |
string | The form-encoded contents of the last payload. |
Payload data formats
You can limit the amount of data sent in webhooks by specifying a data format.
Notify
data: {"format":"notify"}
A simple notification is good for when you want to be notified that an event occurs, but you don't need a lot of information about the related object or you would like to handle retrieving the information about that object through a separate API call.
Lightweight
data: {"format":"lightweight"}
A lightweight notification is available for contacts and custom objects, and is useful when you would like to have basic fields sent, but don't need all of the fields for that record. In the case, the ID, first name, last name, and email for the contact will be returned. If this flag is included for a custom object, the ID in addition to the first three custom fields for that object will be returned.
Custom
data: {"format":"custom","payload":"firstname=[First Name]&lastname=[Last Name]","http_method":"post","max_retries":"3","headers":{"api-key":"123","api-appid":"test123"}}
Using a custom webhook format provides access to additional functionality, like specifying http method, http headers, and the exact payload you want to send. These parameters will be ignored if the custom
format is not specified.
Parameter | Details |
---|---|
headers |
Any headers you would like send along with your request. We will automatically detect the Content-Type of your payload if it is JSON or form-encoded. If we cannot detect a type we will default to plain text. If you send a Content-Type header, it will override any detection we perform. |
http_method |
We support GET, POST, PUT, PATCH, and DELETE, |
payload |
This custom payload mimics the format in Ontraport webhook nodes and rules. You can declare a query string or JSON body and include Ontraport contact mergefields. We will detect the mergefields and merge the desired data in. |
max_retries |
The number of times you would like us to resubmit a particular request upon failure. |
Retrieve a specific webhook
curl -X GET 'https://api.ontraport.com/1/Webhook?id=23' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 23
);
$response = $client->webhook()->retrieveSingle($requestParams);
Example Response:
{
"code": 0,
"data": {
"id": "27",
"event": "sub_tag(1)",
"data": "{\"format\":\"notify\"}",
"url": "https://www.testurl.com",
"last_hook": 1516128699,
"last_code": 200,
"last_payload":"{\"webhook_id\":\"10\",\"object_type_id\":\"0\",\"event\":{\"type\":\"sub_tag\",\"tag_id\":\"1\"},\"data\":{\"id\":\"1\",\"firstname\":\"Michael\",\"lastname\":\"Brown\",\"email\":\"mbrown@ontraport.com\"},\"timestamp\":1519774345}"
},
"account_id": "12345"
}
Retrieves all the information for an existing webhook. The only parameter needed is the ID for the webhook.
Request Endpoint
GET https://api.ontraport.com/1/Webhook
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The webhook ID. Required. |
Retrieve multiple webhooks
curl -X GET 'https://api.ontraport.com/1/Webhooks?listFields=id%2Cevent%2Curl' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"listFields" => "id,event,url"
);
$response = $client->webhook()->retrieveMultiple($requestParams);
Example response:
{
"code": 0,
"data": [
{
"id": "8",
"event": "sub_tag(1)",
"url": "https://testsite.com"
},
{
"id": "10",
"event": "unsub_tag(2)",
"url": "https://testsite.com"
},
{
"id": "15",
"event": "object_create(0)",
"url": "https://testsite2.com"
}
],
"account_id": "12345",
"misc": []
}
Retrieves a collection of webhooks based on a set of parameters. You can limit unnecessary API requests by utilizing criteria and our pagination tools to select only the data set you require.
Request Endpoint
GET https://api.ontraport.com/1/Webhooks
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
ids |
string | An array as a comma-delimited list of the IDs of the webhooks to retrieve. Entering a value of 0 will result in all webhooks being selected. |
start |
integer | The offset to return results from. |
range |
integer | The number of webhooks you want to retrieve. The maximum and default range is 50. |
sort |
string | The field results should be sorted on. |
sortDir |
string | The direction your results should be sorted. Your options are asc and desc . This field must be used in conjunction with the sort parameter. |
condition |
string | A JSON encoded string to more specifically set criteria for which webhooks to bring back. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your webhook objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not webhook notes should be searched for the specified string in addition to other webhook fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
externs |
string | If you have a relationship between your webhook object and another object, you may want to include the data from a related field in your results. Each external field is listed in the format {object}//{field} . Multiple fields are separated by commas. |
listFields |
string | An array as a comma-delimited list of the fields which should be returned in your results. |
Retrieve webhook object meta
curl -X GET 'https://api.ontraport.com/1/Webhooks/meta' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$response = $client->webhook()->retrieveMeta();
Example Response:
{
"code": 0,
"data": {
"145": {
"name": "Webhook",
"fields": {
"event": {
"alias": "Event",
"type": "longtext"
},
"data": {
"alias": "Data",
"type": "longtext"
},
"url": {
"alias": "URL",
"type": "longtext"
},
"last_code": {
"alias": "Last Response Code",
"type": "numeric"
},
"last_hook": {
"alias": "Last Webhook",
"type": "timestamp"
},
"last_payload": {
"alias": "Last Payload",
"type": "longtext"
}
}
}
},
"account_id": "12345"
}
Retrieves the field meta data for the webhook object.
Request Endpoint
GET https://api.ontraport.com/1/Webhooks/meta
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
None
Subscribe to a webhook
curl -X POST -d 'url=https%3A%2F%2Ftestme.com&event=object_create(0)' 'https://api.ontraport.com/1/Webhook/subscribe' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"event" => "object_create(0)",
"url" => "https://testme.com"
);
$client->webhook()->subscribe($requestParams);
Example Response:
{
"code": 0,
"data": {
"url": "https://testme.com",
"event": "object_create(0)",
"id": 3,
"owner": "1"
},
"account_id": "12345"
}
Subscribes to a new webhook.
Request Endpoint
POST https://api.ontraport.com/1/Webhook/subscribe
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Content-Type: application/x-www-form-urlencoded
Request Parameters
Parameters should be sent in the request body as a URL-encoded string.
Parameter | Type | Description |
---|---|---|
url |
string | The URL to send the payload to. |
event |
string | The event to subscribe to. |
data |
string | Additional information about the format of the payload. |
Unsubscribe from a webhook
curl -X DELETE 'https://api.ontraport.com/1/Webhook/unsubscribe?id=2' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"id" => 2
);
$response = $client->webhook()->unsubscribe($requestParams);
Example Response:
{
"code": 0,
"data": "Deleted",
"account_id": "12345"
}
Unsubscribe from a specific webhook by its ID.
Request Endpoint
DELETE https://api.ontraport.com/1/Webhook/unsubscribe
Required Headers
Api-Key: {api_key}
Api-Appid: {app_id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The ID of the webhook to unsubscribe from. Required. |
Webhook Events
Form is submitted
# Subscribe to this event with a standard payload
curl -X POST -d 'url=https%3A%2F%2Ftestsite.com&event=object_submits_form(1)&data=%7B%22format%22%3A%22lightweight%22%7D' 'https://api.ontraport.com/1/Webhook/subscribe' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
// Subscribe to this event with a standard payload
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"event" => "object_submits_form(1)",
"url" => "https://testsite.com"
);
$client->webhook()->subscribe($requestParams);
Example Payload:
{
"webhook_id":"1",
"object_type_id":"0",
"event": {
"type":"object_submits_form",
"form_id":"4"
},
"data": {
"id":"14",
"owner":"owner",
"firstname":"Manuel",
"lastname":"Romero",
"email":"mromero@ontraport.com",
"birthday":"",
"date":"1-26-2018",
"dla":"1-26-2018",
"contact_cat":"",
"bulk_mail":"Single Opt-in",
"bulk_sms":"Unsubscribed",
"referer":"0",
"dlm":"1-26-2018",
"system_source":"0",
"import_id":"0",
"visits":"0",
"freferrer":"0",
"lreferrer":"0",
"n_lead_source":"",
"n_content":"",
"n_term":"",
"n_media":"0",
"n_medium":"",
"n_campaign":"",
"l_lead_source":"",
"l_content":"",
"l_term":"",
"l_medium":"",
"l_campaign":"",
"aff_sales":"0",
"aff_amount":"0",
"program_id":"0",
"mrcAmount":"$0.00",
"mrcUnpaid":"$0.00",
"mriInvoiceNum":"0",
"mriInvoiceTotal":"$0.00",
"ccType":"",
"ccExpirationMonth":"",
"ccExpirationYear":"0",
"ccExpirationDate":"",
"mrcResult":"",
"bindex":"0",
"spent":"$0.00",
"grade":"0",
"unique_id": "D4GD000"
},
"timestamp":"1514940140"
}
This event triggers when a contact or custom object submits a specific form.
Event Name
object_submits_form
Event Parameters
The single parameter indicates the ID of the specific form or form block to trigger the webhook for. Not providing this ID will cause an error upon subscription to the webhook.
If you would like the webhook to be triggered upon submission of a standalone ONTRAform or Smart Form, the parameter passed in is simply the form ID.
object_submits_form(1)
You can also trigger this webhook based on the submission of a form block within a landing page. In this case, a form block ID must be passed in. To determine the block ID of the form in your landing page, you can retrieve a list of IDs using the getBlocksByFormName endpoint. The list will return IDs with an "f" prepended if the block refers to a standalone form, and with an "lp" prepended if the block exists within a landingpage. When saving a webhook, the prefix is stripped from the ID.
object_submits_form(3.0.96bbda26-83fa-10ae-dd9a-5381b1fbf3dd)
Payload Format
Payload is sent as JSON.
Payload Data
Attribute | Type | Description |
---|---|---|
webhook_id |
integer | The webhook ID. |
object_type_id |
integer | The object type ID of the object triggering the event. |
event[type] |
string | The name of the triggering event. |
event[form_id] |
integer | The form ID. |
data |
array | The attributes of the object triggering the event. This data can be limited to a simple ID, limited to just essential fields, or contain the full array of object data. For a contact, full data looks like this. Custom object data will vary. |
timestamp |
timestamp | The date and time of the webhook, measured in seconds from the Unix Epoch. |
Object is created
curl -X POST -d 'url=https%3A%2F%2Ftestsite.com&event=object_create(0)' 'https://api.ontraport.com/1/Webhook/subscribe' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
// Be notified when a new contact is created
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"event" => "object_create(0)",
"url" => "https://testsite.com",
"data" => "{\"format\":\"notify\"}"
);
$client->webhook()->subscribe($requestParams);
Example Payload:
{
"webhook_id":"2",
"object_type_id":"0",
"event": {
"type":"object_create"
},
"data": {
"id":"10"
},
"timestamp":"1514940140"
}
This event triggers on the creation of a new contact or custom object record.
Event Name
object_create
Event Parameters
The single parameter indicates the object type ID of the contact or custom object to trigger the webhook for. Not providing this ID will cause an error upon subscription to the webhook.
object_create(0)
Payload Format
Payload is sent as JSON.
Payload Data
Attribute | Type | Description |
---|---|---|
webhook_id |
integer | The webhook ID. |
object_type_id |
integer | The object type ID of the object triggering the event. |
event[type] |
string | The name of the triggering event. |
data |
array | The attributes of the object triggering the event. This data can be limited to a simple ID, limited to just essential fields, or contain the full array of object data. For a contact, full data looks like this. Custom object data will vary. Note that at different points during object creation, more or less data may be saved for a contact. For example, when contacts are added in-app, the contact object is created first and fields are subsequently updated, meaning object_create will send an ID and updated date fields. If a contact is created via the API, all data included in the request will sent with the webhook. |
timestamp |
timestamp | The date and time of the webhook, measured in seconds from the Unix Epoch. |
Tag is added
# Subscribe to this event, request a lightweight payload
curl -X POST -d 'url=https%3A%2F%2Ftestsite.com&event=sub_tag(4)&data=%7B%22format%22%3A%22lightweight%22%7D' 'https://api.ontraport.com/1/Webhook/subscribe' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
// Subscribe to this event, request a lightweight payload
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"event" => "sub_tag(4)",
"url" => "https://testsite.com",
"data" => "{\"format\":\"lightweight\"}"
);
$client->webhook()->subscribe($requestParams);
Example Payload:
{
"webhook_id":"3",
"object_type_id":"0",
"event": {
"type":"sub_tag",
"tag_id":"4"
},
"data": {
"id":"8",
"firstname":"Mary",
"lastname":"Smith",
"email":"mary@ontraport.com"
},
"timestamp":"1514940140"
}
This event triggers when a specific tag is added to a contact or custom object.
Event Name
sub_tag
Event Parameters
The single parameter indicates the ID of the specific tag to trigger the webhook for. Not providing the tag ID will cause an error upon subscription to the webhook.
sub_tag(4)
Payload Format
Payload is sent as JSON.
Payload Data
Attribute | Type | Description |
---|---|---|
webhook_id |
integer | The webhook ID. |
object_type_id |
integer | The object type ID of the object triggering the event. |
event[type] |
string | The name of the triggering event. |
event[tag_id] |
integer | The tag ID. |
data |
array | The attributes of the object triggering the event. This data can be limited to a simple ID, limited to just essential fields, or contain the full array of object data. For a contact, full data looks like this. Custom object data will vary. |
timestamp |
timestamp | The date and time of the webhook, measured in seconds from the Unix Epoch. |
Tag is removed
# Subscribe to this event, request a lightweight payload
curl -X POST -d 'url=https%3A%2F%2Ftestsite.com&event=unsub_tag(4)&data=%7B%22format%22%3A%22lightweight%22%7D' 'https://api.ontraport.com/1/Webhook/subscribe' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
// Subscribe to this event, request a lightweight payload
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"event" => "unsub_tag(4)",
"url" => "https://testsite.com",
"data" => "{\"format\":\"lightweight\"}"
);
$client->webhook()->subscribe($requestParams);
Example Payload:
{
"webhook_id":"4",
"object_type_id":"0",
"event": {
"type":"unsub_tag",
"tag_id":"4"
},
"data": {
"id":"8",
"firstname":"Mary",
"lastname":"Smith",
"email":"mary@ontraport.com"
},
"timestamp":"1514940140"
}
This event triggers when a specific tag is removed from a contact or custom object.
Event Name
unsub_tag
Event Parameters
The single parameter indicates the ID of the specific tag to trigger the webhook for. Not providing the tag ID will cause an error upon subscription to the webhook.
unsub_tag(4)
Payload Format
Payload is sent as JSON.
Payload Data
Attribute | Type | Description |
---|---|---|
webhook_id |
integer | The webhook ID. |
object_type_id |
integer | The object type ID of the object triggering the event. |
event[type] |
string | The name of the triggering event. |
event[tag_id] |
integer | The tag ID. |
data |
array | The attributes of the object triggering the event. This data can be limited to a simple ID, limited to just essential fields, or contain the full array of object data. For a contact, full data looks like this. Custom object data will vary. |
timestamp |
timestamp | The date and time of the webhook, measured in seconds from the Unix Epoch. |
Contact purchases product
curl -X POST -d 'url=https%3A%2F%2Ftestsite.com&event=purchase_product(1)' 'https://api.ontraport.com/1/Webhook/subscribe' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
// Be notified when a new purchase is created
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"event" => "purchase_product(1)",
"url" => "https://testsite.com"
);
$client->webhook()->subscribe($requestParams);
Example Payload:
{
"webhook_id":"5",
"object_type_id":"0",
"event": {
"type":"purchase_product",
"purchase":{
"owner":1,
"type":0,
"contact_id":1,
"product_id":1,
"name":"Goo",
"price":"10.00",
"description":"",
"date":1514940140,
"dlm":1514940140,
"quantity":1,
"invoice_id":1,
"oprid":"",
"discount":"0.00",
"status":0,
"id":1
},
"product_id":"1"
},
"data": {
"id":"1",
"owner":"owner",
"firstname":"Manuel",
"lastname":"Romero",
"email":"mromero@ontraport.com",
"birthday":"",
"date":"1-26-2018",
"dla":"1-26-2018",
"contact_cat":"",
"bulk_mail":"Single Opt-in",
"bulk_sms":"Unsubscribed",
"referer":"0",
"dlm":"1-26-2018",
"system_source":"0",
"import_id":"0",
"visits":"0",
"freferrer":"0",
"lreferrer":"0",
"n_lead_source":"",
"n_content":"",
"n_term":"",
"n_media":"0",
"n_medium":"",
"n_campaign":"",
"l_lead_source":"",
"l_content":"",
"l_term":"",
"l_medium":"",
"l_campaign":"",
"aff_sales":"0",
"aff_amount":"0",
"program_id":"0",
"mrcAmount":"$0.00",
"mrcUnpaid":"$0.00",
"mriInvoiceNum":"0",
"mriInvoiceTotal":"$0.00",
"ccType":"",
"ccExpirationMonth":"",
"ccExpirationYear":"0",
"ccExpirationDate":"",
"mrcResult":"",
"bindex":"0",
"spent":"$0.00",
"grade":"0",
"unique_id": "D4GD000"
},
"timestamp":"1514940140"
}
This event triggers on the creation of a purchase for a specific product.
Event Name
purchase_product
Event Parameters
The single parameter indicates the ID of the specific product to trigger the webhook for. Not providing this ID will cause an error upon subscription to the webhook.
purchase_product(1)
Payload Format
Payload is sent as JSON.
Payload Data
Attribute | Type | Description |
---|---|---|
webhook_id |
integer | The webhook ID. |
object_type_id |
integer | The object type ID of the object triggering the event. |
event[type] |
string | The name of the triggering event. |
event[purchase] |
string | The json of the purchase object. |
event[product_id] |
string | The id of the product in the triggering event. |
event[invoice_id] |
string | The id of the invoice in the triggering event. |
data |
array | The attributes of the object triggering the event. This data can be limited to a simple ID, limited to just essential fields, or contain the full array of object data. For a contact, full data looks like this. Note that at different points during object creation, more or less data may be saved for a contact. For example, when contacts are added in-app, the contact object is created first and fields are subsequently updated, meaning object_create will send an ID and updated date fields. If a contact is created via the API, all data included in the request will sent with the webhook. |
timestamp |
timestamp | The date and time of the webhook, measured in seconds from the Unix Epoch. |
Transaction created with product
curl -X POST -d 'url=https%3A%2F%2Ftestsite.com&event=transaction_created_with_product(1)' 'https://api.ontraport.com/1/Webhook/subscribe' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
// Be notified when a new purchase is created
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"event" => "transaction_created_with_product(1)",
"url" => "https://testsite.com"
);
$client->webhook()->subscribe($requestParams);
Example Payload:
{
"webhook_id":"5",
"object_type_id":"0",
"event": {
"type":"transaction_created_with_product",
"product":{
"name":"alpha",
"description":"One magical alpha",
"date":"",
"dlm":1598449466,
"external_id":null,
"product_group":null,
"sku":null,
"taxable":null,
"deleted":"false",
"id":1,
"price":"5.00",
"quantity":"1",
"minQuantity":"1",
"maxQuantity":"99",
"total":"5.00",
"shipping":"false",
"tax":"false",
"type":"one_time",
"quantityEditable":"false",
"index":"0",
"owner":"1",
"level1":"0",
"level2":"0",
"offer_to_affiliates":"true",
"trial_period_unit":"day",
"trial_period_count":"0",
"trial_price":"0",
"setup_fee":"0",
"delay_start":"0",
"setup_fee_when":"immediately",
"setup_fee_date":"0",
"product_type":"digital",
"subscription_fee":"0",
"subscription_count":"0",
"subscription_unit":"day",
"download_limit":"0",
"download_time_limit":"0",
"total_income":null,
"total_purchases":null,
"uid":"30"
},
"invoice":{
"id":1,
"contact_id":5,
"transaction_id":"0",
"date":1598449466,
"template_id":3,
"subtotal":"968",
"tax":"3.63",
"shipping":"2.00",
"total":"973.63",
"zip":"93105",
"offer_data":"{\"products\":[{\"quantity\":2,\"total\":\"918.00\",\"shipping\":false,\"tax\":true,\"price\":[{\"price\":\"459.00\",\"payment_count\":1,\"unit\":\"day\",\"id\":602780304444}],\"type\":\"single\",\"owner\":\"1\",\"date\":\"0\",\"dlm\":\"0\",\"name\":\"Frisbee 3\",\"deleted\":false,\"total_income\":null,\"total_purchases\":null,\"id\":\"1\"}],\"taxes\":false,\"paymentmethods\":[{\"name\":\"\",\"type\":\"placeholder\"},{\"name\":\"Test Dummy\",\"type\":\"dummy\",\"date\":\"1360374265\",\"status\":\"0\",\"external_id\":\"994\",\"id\":\"1\"}],\"shipping\":false,\"delay\":0,\"invoice_template\":1,\"subTotal\":840,\"grandTotal\":\"840.00\",\"hasTaxes\":false,\"hasShipping\":false,\"shipping_charge_reoccurring_orders\":true,\"id\":45}",
"status":7,
"dlm":1598449466
},
"product_id":"1"
},
"data": {
"id":"1",
"owner":"owner",
"firstname":"Manuel",
"lastname":"Romero",
"email":"mromero@ontraport.com",
"birthday":"",
"date":"1-26-2018",
"dla":"1-26-2018",
"contact_cat":"",
"bulk_mail":"Single Opt-in",
"bulk_sms":"Unsubscribed",
"referer":"0",
"dlm":"1-26-2018",
"system_source":"0",
"import_id":"0",
"visits":"0",
"freferrer":"0",
"lreferrer":"0",
"n_lead_source":"",
"n_content":"",
"n_term":"",
"n_media":"0",
"n_medium":"",
"n_campaign":"",
"l_lead_source":"",
"l_content":"",
"l_term":"",
"l_medium":"",
"l_campaign":"",
"aff_sales":"0",
"aff_amount":"0",
"program_id":"0",
"mrcAmount":"$0.00",
"mrcUnpaid":"$0.00",
"mriInvoiceNum":"0",
"mriInvoiceTotal":"$0.00",
"ccType":"",
"ccExpirationMonth":"",
"ccExpirationYear":"0",
"ccExpirationDate":"",
"mrcResult":"",
"bindex":"0",
"spent":"$0.00",
"grade":"0",
"unique_id": "D4GD000"
},
"timestamp":"1514940140"
}
This event triggers on the creation of a invoice for a specific product.
Event Name
transaction_created_with_product
Event Parameters
The single parameter indicates the ID of the specific product to trigger the webhook for. Not providing this ID will cause an error upon subscription to the webhook.
transaction_created_with_product(1)
Payload Format
Payload is sent as JSON.
Payload Data
Attribute | Type | Description |
---|---|---|
webhook_id |
integer | The webhook ID. |
object_type_id |
integer | The object type ID of the object triggering the event. |
event[type] |
string | The name of the triggering event. |
event[product] |
string | The json of the product object. |
event[invoice] |
string | The json of the invoice object. |
event[product_id] |
string | The id of the product_id in the triggering event. |
data |
array | The attributes of the object triggering the event. This data can be limited to a simple ID, limited to just essential fields, or contain the full array of object data. For a contact, full data looks like this. Note that at different points during object creation, more or less data may be saved for a contact. For example, when contacts are added in-app, the contact object is created first and fields are subsequently updated, meaning object_create will send an ID and updated date fields. If a contact is created via the API, all data included in the request will sent with the webhook. |
timestamp |
timestamp | The date and time of the webhook, measured in seconds from the Unix Epoch. |
Webhook Log
Object Type ID: 187
The Webhook log contains a max of 10,000 entries. These entries are the tracked history of all sucessful webhooks from the past 2 days and all unsuccessful webhooks from the past 7 days. Additionally, Webhooks seen within the Webhook Log are webhooks that have been sent from preferences in the Ontraport App or from an Ontraport API webhook subscription.
The webhhook_log object
{
"id": "9",
"date": "1685575007",
"request": "{\n\t\"url\": \"https:\\/\\/webhook.site\\/123456\",\n\t\"headers\": [\n\t\t\"content-type: application\\/x-www-form-urlencoded\"\n\t],\n\t\"payload\": \"ye\",\n\t\"http_method\": \"POST\"\n}",
"response_code": "200",
"response_data": "{\n\t\"response\": \"HTTP\\/1.1 200 OK\\r\\nServer: nginx\\r\\nContent-Type: text\\/plain; charset=UTF-8\\r\\nTransfer-Encoding: chunked\\r\\nVary: Accept-Encoding\\r\\nX-Request-Id: 0b44f121-5d80-4634-981b-272586dcbdba\\r\\nX-Token-Id: 0cc62a86-b752-4e5b-ab86-8afc9dd0243a\\r\\nCache-Control: no-cache, private\\r\\nDate: Wed, 31 May 2023 23:16:46 GMT\\r\\n\\r\\n\",\n\t\"http_code\": 200,\n\t\"errno\": 0,\n\t\"headerSize\": 299\n}",
"name": "<a href=\"#!/rule/edit&id=1\" class=\"ussr-component-collection-cell-data \" title=\"webhook rule \">webhook rule</a>",
"origin_object": "Contact",
"webhook_type": "Global Rules",
"webhook_id": null
}
Attribute | Type | Description |
---|---|---|
id |
bigint | The webhook log's id |
date |
bigint | The date the related webhook was sent |
request |
text | The payload and request headers sent in the related webhook |
response_code |
integer | The HTTP response code received from the related webhook's destination server |
response_data |
text | The response data and headers received from the destination server |
name |
text | The name of the specific Ontraport system that triggered the webhook, linked to the edit screen of that system within the web app |
origin_object |
text | The Ontraport object related to this webhook |
webhook_type |
text | The Ontraport system that sent the related webhook |
webhook_id |
bigint | The id of the related webhook, only not null if the webhook_type is API |
Retrieve a specific Webhook Log
curl -X GET 'https://api.ontraport.com/1/WebhookLog?id=1' \
--header 'Accept: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
COMING SOON
Example Response:
{
"code": 0,
"data": {
"id": "1",
"date": "1685575007",
"request": "{\n\t\"url\": \"https:\\/\\/webhook.site\\/123456\",\n\t\"headers\": [\n\t\t\"content-type: application\\/x-www-form-urlencoded\"\n\t],\n\t\"payload\": \"ye\",\n\t\"http_method\": \"POST\"\n}",
"response_code": "200",
"response_data": "{\n\t\"response\": \"HTTP\\/1.1 200 OK\\r\\nServer: nginx\\r\\nContent-Type: text\\/plain; charset=UTF-8\\r\\nTransfer-Encoding: chunked\\r\\nVary: Accept-Encoding\\r\\nX-Request-Id: 0b44f121-5d80-4634-981b-272586dcbdba\\r\\nX-Token-Id: 0cc62a86-b752-4e5b-ab86-8afc9dd0243a\\r\\nCache-Control: no-cache, private\\r\\nDate: Wed, 31 May 2023 23:16:46 GMT\\r\\n\\r\\n\",\n\t\"http_code\": 200,\n\t\"errno\": 0,\n\t\"headerSize\": 299\n}",
"name": "<a href=\"#!/rule/edit&id=1\" class=\"ussr-component-collection-cell-data \" title=\"webhook rule \">webhook rule</a>",
"origin_object": "Contact",
"webhook_type": "Global Rules",
"webhook_id": null
},
"account_id": 60
}
Retrieves all information for an existing Webhook.
Request URL
GET https://api.ontraport.com/1/WebhookLog
Required Headers
Api-Key: {api-key}
Api-Appid: {app-id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
id |
integer | The Webhook ID. Required. |
Retrieve multiple Webhook Logs
curl -X GET 'https://api.ontraport.com/1/WebhookLogs?ids=1%2C2&range=50' \
--header 'Accept: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
COMING SOON
Example Response:
{
"code": 0,
"data": [
{
"id": "1",
"date": "1685575007",
"request": "{\n\t\"url\": \"https:\\/\\/webhook.site\\/0cc62a86-b752-4e5b-ab86-8afc9dd0243a\",\n\t\"headers\": [\n\t\t\"content-type: application\\/x-www-form-urlencoded\"\n\t],\n\t\"payload\": \"ye\",\n\t\"http_method\": \"POST\"\n}",
"response_code": "200",
"response_data": "{\n\t\"response\": \"HTTP\\/1.1 200 OK\\r\\nServer: nginx\\r\\nContent-Type: text\\/plain; charset=UTF-8\\r\\nTransfer-Encoding: chunked\\r\\nVary: Accept-Encoding\\r\\nX-Request-Id: 0b44f121-5d80-4634-981b-272586dcbdba\\r\\nX-Token-Id: 0cc62a86-b752-4e5b-ab86-8afc9dd0243a\\r\\nCache-Control: no-cache, private\\r\\nDate: Wed, 31 May 2023 23:16:46 GMT\\r\\n\\r\\n\",\n\t\"http_code\": 200,\n\t\"errno\": 0,\n\t\"headerSize\": 299\n}",
"name": "<a href=\"#!/rule/edit&id=1\" class=\"ussr-component-collection-cell-data \" title=\"webhook rule \">webhook rule</a>",
"origin_object": "Contact",
"webhook_type": "Global Rules",
"webhook_id": null
},
{
"id": "2",
"date": "1685576349",
"request": "{\n\t\"url\": \"https:\\/\\/webhook.site\\/0cc62a86-b752-4e5b-ab86-8afc9dd0243a\",\n\t\"headers\": [\n\t\t\"content-type: application\\/x-www-form-urlencoded\"\n\t],\n\t\"payload\": \"ye\",\n\t\"http_method\": \"POST\"\n}",
"response_code": "200",
"response_data": "{\n\t\"response\": \"HTTP\\/1.1 200 OK\\r\\nServer: nginx\\r\\nContent-Type: text\\/plain; charset=UTF-8\\r\\nTransfer-Encoding: chunked\\r\\nVary: Accept-Encoding\\r\\nX-Request-Id: 4cc92e9c-3030-4025-926c-4000e13f9c59\\r\\nX-Token-Id: 0cc62a86-b752-4e5b-ab86-8afc9dd0243a\\r\\nCache-Control: no-cache, private\\r\\nDate: Wed, 31 May 2023 23:39:09 GMT\\r\\n\\r\\n\",\n\t\"http_code\": 200,\n\t\"errno\": 0,\n\t\"headerSize\": 299\n}",
"name": "<a href=\"#!/rule/edit&id=1\" class=\"ussr-component-collection-cell-data \" title=\"webhook rule \">webhook rule</a>",
"origin_object": "Contact",
"webhook_type": "Global Rules",
"webhook_id": null
}
],
"account_id": 60,
"misc": []
}
Retrieves a collection of Webhook Logs based on a set of parameters. You can limit necessary API requests by utilizing criteria and our pagination tools to select only the data set you require.
Request URL
GET https://api.ontraport.com/1/WebhookLogs
Required Headers
Api-Key: {api-key}
Api-Appid: {app-id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
ids |
string | An integer array as a comma-delimited list of the IDs of the Webhook Logs to retrieve. Entering a value of 0 will result in all Webhook Logs being selected. |
start |
integer | The offset to return results from. |
range |
integer | The number of Webhook Logs you want to retrieve. The maximum and default range is 50. |
sort |
string | The field results should be sorted on. |
sortDir |
string | The direction your results should be sorted. Your options are asc and desc . This field must be used in conjunction with the sort parameter. |
condition |
string | A JSON encoded string to more specifically set criteria for which Webhook Logs to bring back. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your Webhook Log objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other Webhook Log fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
externs |
string | If you have a relationship between your Webhook Log object and another object, you may want to include the data from a related field in your results. Each external field is listed in the format {object}//{field} . Multiple fields are separated by commas. |
listFields |
string | A string array as a comma-delimited list of the fields which should be returned in your results. |
Retrieve Webhook Log object meta
curl -X GET 'https://api.ontraport.com/1/WebhookLogs/meta?format=byId' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
COMING SOON
Example Response:
{
"code": 0,
"data": {
"187": {
"name": "WebhookLog",
"fields": {
"date": {
"alias": "Date",
"type": "timestamp",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0
},
"request": {
"alias": "Request",
"type": "longtext",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0
},
"response_data": {
"alias": "Response Data",
"type": "longtext",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0
},
"origin_object": {
"alias": "Object",
"type": "longtext",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0
},
"webhook_type": {
"alias": "Type",
"type": "longtext",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0
},
"response_code": {
"alias": "Response Code",
"type": "numeric",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0
},
"webhook_id": {
"alias": "Webhook ID",
"type": "numeric",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0
},
"name": {
"alias": "Name",
"type": "longtext",
"required": 0,
"unique": 0,
"editable": 1,
"deletable": 0
}
}
}
},
"account_id": 123456
}
Retrieves the field meta data for the Webhook Log object.
Request URL
GET https://api.ontraport.com/1/WebhookLogs/meta
Required Headers
Api-Key: {api-key}
Api-Appid: {app-id}
Request Parameters
None
Retrieve Webhook Log collection info
curl -X GET 'https://api.ontraport.com/1/WebhookLogs/getInfo?search=Purchased' \
--header 'Accept: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
COMING SOON
Example Response:
{
"code": 0,
"data": {
"listFields": [
"request",
"response_code",
"response_data",
"date"
],
"listFieldSettings": [],
"cardViewSettings": {
"fields": [
"request",
"response_code",
"response_data",
"date"
]
},
"viewMode": [],
"widgetSettings": {
"map": [
[
"overview"
],
[
"fields"
],
[
"notes",
"tasks",
"settings"
]
],
"widgets": {
"overview": {
"type": "object_widget_overview",
"options": {
"visible": "true",
"excludeFromWidgetSettings": true
}
},
"tasks": {
"type": "object_widget_object_list_text_object_task_widget",
"options": {
"visible": "true",
"objectID": 1,
"header": "Tasks"
}
},
"notes": {
"type": "object_widget_object_list_text_object_notes_widget",
"options": {
"visible": "true",
"objectID": 12,
"header": "Notes"
}
},
"settings": {
"type": "object_widget_settings",
"options": {
"placeAtEndOfColumn": true,
"excludeFromWidgetSettings": true
}
},
"fields": {
"type": "object_widget_fields",
"options": {
"visible": "true",
"excludeFromWidgetSettings": true,
"fields": [
"request",
"response_code",
"response_data",
"date"
]
}
}
},
"listFields": [
"profile_image",
"request",
"response_code",
"response_data",
"date"
]
},
"count": "2"
},
"account_id": 123456
}
Retrieves information about a collection of Webhook Logs, such as the number of Webhook Logs that match the given criteria.
Request URL
GET https://api.ontraport.com/1/WebhookLogs/getInfo
Required Headers
Api-Key: {api-key}
Api-Appid: {app-id}
Request Parameters
Request parameters should be appended to the URL as a query string.
Parameter | Type | Description |
---|---|---|
condition |
string | A JSON encoded string to more specifically set criteria for which Webhook Logs to select. For example, to check that a field equals a certain value. See criteria examples for more details. |
search |
string | A string to search your Webhook Log objects for. |
searchNotes |
boolean | A boolean flag used in conjunction with the search parameter to indicate whether or not notes should be searched for the specified string in addition to other Webhook Log fields. |
group_id |
integer | The group id of objects to act upon. If set to a non-zero value, performAll should be set to 1. |
performAll |
integer | A binary integer flag to be used in conjunction with group_id . A value of 1 indicates that specified action should be performed on all members of a group. Be sure that group_id has a non-zero value when using this parameter unless you want to affect all objects in a collection. |
Use Cases
This section contains a number of useful multistep processes which can be completed via the API. Explanations of the steps involved are detailed below, and code samples are included at the right. Example PHP scripts are written using our official PHP client library.
Add UTM variables by name
# Update a contact using UTM variable names
curl -X PUT -d 'id=7&n_lead_source=New%20Lead%20Source&n_campaign=New%20Campaign&use_utm_names=true' 'https://api.ontraport.com/1/Contacts' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
// Update a contact using UTM variable names
$requestParams = array(
"id" => 7,
"use_utm_names" => true, // Enables passing utm names instead of IDs
"n_lead_source" => "New Lead Source", // Lead source is created if it does not exist
"n_campaign" => "New Campaign" // Tracking campaign is created if it does not exist
);
$response = $client->contact()->update($requestParams);
Example Response:
{
"code": 0,
"data": {
"attrs": {
"dlm": "1530897270",
"n_lead_source": "3",
"n_campaign": "4",
"id": "7"
}
},
"account_id": "12345"
}
When creating or updating contacts, you may want to add or update UTM variables by name rather than ID. Though the default behavior is to accept IDs, names can be passed in the following manner:
1. Create or update a contact
- Make a POST request to /Contacts, a PUT request to /Contacts or a POST request to /Contacts/saveorupdate. This flag can also be set with the related generic objects endpoints with an object type ID of 0.
- Make sure to include the flag
use_utm_names
set to true with your request data. - Any UTM variable sent along with this request will be handled as a name.
- When you pass a UTM name that does not already exist, it will be created.
- The response data will contain the ID of the saved or newly created UTM name.
Change gateways on an open order
# Retrieve the gateway data for your current gateway to obtain the external_id
curl -X GET 'https://api.ontraport.com/1/object?objectID=70&id=1' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
> Example Response:
{
"code": 0,
"data": {
"name": "Dummy",
"status": 0,
"date": "1503003727",
"type": "dummy",
"id": "1",
"external_id": "53713",
"owner": "1"
},
"account_id": "12345"
}
# Bring back all of the orders with a gateway ID that matches the external_id
curl -X GET --header 'https://api.ontraport.com/1/objects?objectID=52&condition=%5B%7B%20%22field%22%3A%7B%22field%22%3A%22gateway_id%22%7D%2C%20%22op%22%3A%22%3D%22%2C%20%22value%22%3A%7B%22value%22%3A%2253713%22%7D%20%7D%5D&listFields=id%2Coffer_id%2Ccontact_id%2Cgateway_id' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
> Example Response:
{
"code": 0,
"data": [
{
"id": "2",
"offer_id": "15",
"contact_id": "1",
"gateway_id": "53713"
},
{
"id": "3",
"offer_id": "16",
"contact_id": "7",
"gateway_id": "53713"
}
],
"account_id": "12345",
"misc": []
}
# Retrieve the offer for each order
curl -X GET --header 'https://api.ontraport.com/1/object?objectID=65&id=15' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
> Example Response:
{
"code": 0,
"data": {
"id": "15",
"name": null,
"public": "0",
"data": "{\"products\":[{\"quantity\":\"1\",\"minQuantity\":\"1\",\"maxQuantity\":\"99\",\"total\":\"10.00\",\"shipping\":\"false\",\"tax\":\"false\",\"price\":[{\"price\":\"10.00\",\"payment_count\":\"1\",\"unit\":\"month\",\"id\":\"270337994670\"}],\"type\":\"subscription\",\"quantityEditable\":\"false\",\"index\":\"0\",\"name\":\"Slime\",\"description\":\"\",\"owner\":\"1\",\"date\":\"1503354425\",\"dlm\":\"1503354425\",\"level1\":\"0\",\"level2\":\"0\",\"external_id\":\"null\",\"product_group\":\"null\",\"offer_to_affiliates\":\"true\",\"trial_period_unit\":\"day\",\"trial_period_count\":\"0\",\"trial_price\":\"0\",\"setup_fee\":\"0\",\"delay_start\":\"0\",\"sku\":\"null\",\"setup_fee_when\":\"immediately\",\"setup_fee_date\":\"0\",\"product_type\":\"digital\",\"subscription_fee\":\"0\",\"subscription_count\":\"0\",\"subscription_unit\":\"day\",\"download_limit\":\"0\",\"download_time_limit\":\"0\",\"taxable\":\"null\",\"deleted\":\"false\",\"total_income\":\"null\",\"total_purchases\":\"null\",\"id\":\"2\",\"uid\":\"eaf93424-a5f2-ef69-6013-9555f127191c\"}],\"shipping\":\"null\",\"delay\":\"0\",\"invoice_template\":\"1\",\"subTotal\":\"10\",\"grandTotal\":\"10.00\",\"hasTaxes\":\"false\",\"hasShipping\":\"false\",\"paypalValid\":\"false\",\"offerCoupon\":\"false\",\"coupon\":\"null\",\"shipping_charge_reoccurring_orders\":\"false\",\"resorted\":\"null\"}",
"referenced": "1"
},
"account_id": "12345"
}
# Update the gateway ID of each order
curl -X PUT -d '{
"objectID":0,
"contact_id":"1",
"gateway_id":1,
"offer":{
"products":[
{
"quantity":"1",
"minQuantity":"1",
"maxQuantity":"99",
"total":"10.00",
"shipping":"false",
"tax":"false",
"price":[
{
"price":"10.00",
"payment_count":"1",
"unit":"month",
"id":"270337994670"
}
],
"type":"subscription",
"quantityEditable":"false",
"index":"0",
"name":"Slime",
"description":"",
"owner":"1",
"date":"1503354425",
"dlm":"1503354425",
"level1":"0",
"level2":"0",
"external_id":"null",
"product_group":"null",
"offer_to_affiliates":"true",
"trial_period_unit":"day",
"trial_period_count":"0",
"trial_price":"0",
"setup_fee":"0",
"delay_start":"0",
"sku":"null",
"setup_fee_when":"immediately",
"setup_fee_date":"0",
"product_type":"digital",
"subscription_fee":"0",
"subscription_count":"0",
"subscription_unit":"day",
"download_limit":"0",
"download_time_limit":"0",
"taxable":"null",
"deleted":"false",
"total_income":"null",
"total_purchases":"null",
"id":"2",
"uid":"eaf93424-a5f2-ef69-6013-9555f127191c"
}
],
"shipping":"null",
"delay":"0",
"invoice_template":"1",
"subTotal":"10",
"grandTotal":"10.00",
"hasTaxes":"false",
"hasShipping":"false",
"paypalValid":"false",
"offerCoupon":"false",
"coupon":"null",
"shipping_charge_reoccurring_orders":"false",
"resorted":"null",
"offer_id":"15",
"order_id":"2"
}
}' 'https://api.ontraport.com/1/transaction/order' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
require_once(dirname(__FILE__) . "/pathto/Ontraport.php");
use OntraportAPI\Ontraport as Client;
use OntraportAPI\ObjectType;
$api_key = "Key5678";
$app_id = "2_AppID_12345678";
$from_gateway = 2;
$to_gateway = 1;
// Instantiate client
$client = new Client($app_id, $api_key);
// Retrieve external gateway ID
$params = array(
"objectID" => ObjectType::GATEWAY, // Object type ID: 70
"id" => $from_gateway
);
if ($from_gateway_external = json_decode($client->object()->retrieveSingle($params), true))
{
$from_gateway_external = $from_gateway_external["data"]["external_id"];
// Retrieve all orders with a specific gateway
$conditions = new OntraportAPI\Criteria("gateway_id", "=", $from_gateway_external);
$order_params = array(
"objectID" => ObjectType::ORDER, // Object type ID: 52
"condition" => $conditions->fromArray()
);
}
// Make sure to paginate requests so you can retrieve all matching orders
$pages = json_decode($client->object()->retrieveMultiplePaginated($order_params), true);
foreach ($pages as $page)
{
foreach ($page["data"] as $order)
{
$order_id = $order["id"];
$offer_id = $order["offer_id"];
$contact_id = $order["contact_id"];
// Retrieve offer
$params = array(
"objectID" => ObjectType::OFFER, // Object type ID: 65
"id" => $offer_id
);
$offer = json_decode($client->object()->retrieveSingle($params), true);
$offer_data = json_decode($offer["data"]["data"], true);
// Update order with new gateway -- if offer data isn't included, the order will be deleted
$update_order_data = array(
"objectID" => ObjectType::CONTACT, // Object type ID: 0
"contact_id" => $contact_id,
"gateway_id" => $to_gateway,
"offer" => $offer_data
);
$update_order_data["offer"]["offer_id"] = $offer_id;
$update_order_data["offer"]["order_id"] = $order_id;
$client->transaction()->updateOrder($update_order_data);
}
}
If you are changing card processors, you may want to change the gateway for your subscription orders. This can be accomplished through the API with a few steps.
1. Retrieve the gateway data for your current gateway to obtain the external_id
- Make a GET request to the /object endpoint with object ID: 70.
- The
external_id
will be returned in the response data.
2. Bring back all of the orders with a gateway ID that matches the external_id
- Make a GET request to the /objects endpoint with object ID: 52.
- Use a condition to check that the order's
gateway_id
field is equal to the gateway'sexternal_id
. - If you will have more than 50 matching results, you will need to utilize pagination.
3. Retrieve the offer for each order
- If you only want to update the gateway for an order, you will want to provide the original offer data.
- The easiest way to make sure your offer data is valid is to retrieve the current offer data for the order and pass it back in.
- Make a GET request to the /object endpoint with object ID: 65.
4. Update the gateway ID of each order
- Make a PUT request to the /transaction/order endpoint.
- You must include an
objectID
, thegateway_id
for your new gateway, and thecontact_id
for the order. - The
offer
field should contain the offer data you retrieved in the previous call. - You need to add two parameters to the offer data:
offer_id
andorder_id
, which can both be obtained from the order response. Without these two parameters, the update will not succeed.
Completed task outcomes/followups
# Create your followup task message and retain the id
curl -X POST -d 'alias=Followup%20Task&subject=Follow%20up&type=Task&object_type_id=0&from=owner&task_data=%5BFirst%20Name%5D%2C%20please%20follow%20up%20on%20this%20task.&due_date=5&task_owner=1' 'https://api.ontraport.com/1/message' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
> Example Response:
{
"code": 0,
"data": {
"id": 16,
"date": "1503594192"
},
"account_id": "12345"
}
# Mark your primary task completed, create outcome and assign followup task
curl -X POST -d '{ \
"object_type_id": 0, \
"ids": [ \
2 \
], \
"data": { \
"outcome": ":=Pending", \
"followup": { \
"message_id": 16, \
} \
} \
}' 'https://api.ontraport.com/1/task/complete' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
> Example Response:
{
"code": 0,
"account_id": "12345"
}
<?php
require_once(dirname(__FILE__) . "/api/sdks/php/src/Ontraport.php");
use OntraportAPI\Ontraport as Client;
use OntraportAPI\Models\Rules\RuleBuilder as Builder;
use OntraportAPI\Models\Rules\Events;
use OntraportAPI\Models\Rules\Conditions;
use OntraportAPI\Models\Rules\Actions;
use OntraportAPI\ObjectType;
$api_key = "Key5678";
$app_id = "2_AppID_12345678";
$initial_task_id = 1;
// Instantiate client
$client = new Client($app_id, $api_key);
// Create follow-up task
$task_params = array(
"alias" => "Followup Task",
"type" => "Task",
"object_type_id" => ObjectType::CONTACT, // Object type ID: 0
"subject" => "Follow up",
"from" => "owner",
"task_data" => "[First Name], please follow up on this task.",
"due_date" => 5,
"task_owner" => 1
);
if ($task = json_decode($client->message()->create($task_params), true))
{
$followup_task_id = $task["data"]["id"];
// Mark task as completed with specific outcome, assign followup task
$complete_params = array(
"object_type_id" => ObjectType::CONTACT, // Object type ID: 0
"ids" => array($initial_task_id),
"data" => array(
"outcome" => ":=Pending",
"followup" => array(
"message_id" => $followup_task_id,
)
)
);
$client->task()->complete($complete_params);
// You can also create a rule that adds a tag to a contact when a task is completed
$tag_id = 1;
$builder = new Builder("Completed Task", ObjectType::CONTACT);
$eventParams = array($initial_task_id);
$builder->addEvent(Events::TASK_COMPLETED, $eventParams);
$actionParams = array($tag_id);
$builder->addAction(Actions::ADD_OBJECT_TO_TAG, $actionParams);
$requestParams = $builder->toRequestParams();
$client->rule()->create($requestParams);
}
When managing tasks, you may want to monitor task outcomes and follow up task completion with additional tasks. The following is an example of how to mark a task completed, create an outcome for that task, and assign a secondary followup task using the API. You can also have the option of adding tags to objects that have completed that task by creating a rule to trigger when that occurs.
1. Create your followup task message
- Make a POST request to the /message endpoint.
- The task's
id
will be returned in the response data.
2. Mark your primary task completed, create outcome and assign followup task
- Make a POST request to the /task/complete endpoint.
- In the
data
array'soutcome
field, include the name of the task outcome you want to create and assign to the completed task. Note that the string must be in the following format: ":=outcome". - The
data
array'sfollowup
field needs to contain at least themessage_id
of the followup task you created.
3. Create a rule to trigger when a task is marked as completed for an object.
- Build a rule
- Make a POST request to the /rules/create endpoint.
- In the
eventParams
array'stask_id
field, include theid
of the task you want to trigger the rule. - In the
actionParams
array'stag_id
field, include theid
of the tag you want to add to the object when the rule is triggered.
Create and assign a task
# Create your task message and retain the `id` field from the response data
curl -X POST -d 'alias=Test%20Task&subject=Task%20Assignment&type=Task&object_type_id=0&from=owner&task_data=%5BFirst%20Name%5D%2C%20please%20complete%20this%20task.&due_date=3&task_owner=1' 'https://api.ontraport.com/1/message' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
> Example Response:
{
"code": 0,
"data": {
"id": 17,
"date": "1503595111"
},
"account_id": "12345"
}
# Assign the task for your contact using the task message `id` you just created
curl -X POST -d '{ \
"object_type_id": 0, \
"ids": [ \
1 \
], \
"message": { \
"id": 17 \
} \
}' 'https://api.ontraport.com/1/task/assign' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
require_once(dirname(__FILE__) . "/pathto/Ontraport.php");
use OntraportAPI\Ontraport as Client;
use OntraportAPI\ObjectType;
$api_key = "Key5678";
$app_id = "2_AppID_12345678";
$contact_id = 1;
// Instantiate client
$client = new Client($app_id, $api_key);
// Create task
$task_params = array(
"alias" => "Test Task",
"type" => "Task",
"object_type_id" => ObjectType::CONTACT, // Object type ID: 0
"subject" => "Task Assignment",
"from" => "owner",
"task_data" => "[First Name], please complete this task.",
"due_date" => 3,
"task_owner" => 1
);
$task = json_decode($client->message()->create($task_params), true);
$task_id = $task["data"]["id"];
// Assign task
$assign_params = array(
"object_type_id" => ObjectType::CONTACT, // Object type ID: 0
"ids" => array(1),
"message" => array(
"id" => $task_id
)
);
$client->task()->assign($assign_params);
1. Create your task message
- Make a POST request to the /message endpoint.
- The task's
id
will be returned in the response data.
2. Create a task assignment
- Make a POST request to the /task/assign endpoint.
- In the
message
array, include at least the ID of the task message you created.
Create and update a rule
# Create a new tag for new contacts
curl -X POST -d 'tag_name=New%20Contact&object_type_id=0' 'https://api.ontraport.com/1/Tags' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Accept: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
> Example Response:
{
"code": 0,
"data": {
"tag_name": "New Contact",
"object_type_id": "0",
"tag_id": "4",
"group_id": "0"
},
"account_id": "12345"
}
# Create a rule to trigger whenever a new contact is added
curl -X POST -d 'name=Create%20Me&event=Contact_added_to_my_database()&action=Add_contact_to_category(4)' \
'https://api.ontraport.com/1/Rules' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
> Example Response:
{
"code": 0,
"data": {
"name": "Create Me",
"id": 1,
"drip_id": null,
"events": "Contact_added_to_my_database()" ,
"conditions": "",
"actions": "Add_contact_to_category(4)",
"pause": "0",
"last_action": "0",
"object_type_id": "0",
"date": "1527092122",
"dlm": "1527092122"
},
"account_id": "12345"
}
# Update an existing rule's trigger
curl - PUT -d 'id=2&events=Contact_added_to_campaign(0)''https://api.ontraport.com/1/Rules' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
> Example Response:
{
"code": 0,
"data": {
"id": 1,
"drip_id": null,
"events": "Contact_added_to_campaign(0)" ,
"dlm": "1527092161"
},
"account_id": "12345"
}
<?php
require_once(dirname(__FILE__) . "/pathto/Ontraport.php");
use OntraportAPI\Ontraport as Client;
use OntraportAPI\Models\Rules\RuleBuilder as Builder;
use OntraportAPI\Models\Rules\Events;
use OntraportAPI\Models\Rules\Conditions;
use OntraportAPI\Models\Rules\Actions;
use OntraportAPI\ObjectType;
$api_key = "Key5678";
$app_id = "2_AppID_12345678";
// Create a new tag for new contacts
$client = new Client($app_id, $api_key);
$requestParams = array(
"objectID" => ObjectType::TAG,
"tag_name" => "New Contact",
"object_type_id" => ObjectType::CONTACT
);
$tag = json_decode($client->object()->create($requestParams), true);
$tag_id = $tag["data"]["tag_id"];
// Build your new rule to add to "New Contact" tag whenever a new contact is added
$builder = new Builder("My new Rule", ObjectType::CONTACT);
// Add trigger and action
$builder->addEvent(Events::OBJECT_CREATED, array());
$builder->addAction(Actions::ADD_OBJECT_TO_TAG, array($tag_id));
$builder->addConditions(Conditions::OBJECT_NO_TAG, array($tag_id));
$builder->addConditions(Conditions::OBJECT_NO_TAG, array(1)); // existing tag with id 1
// Convert from Rule Builder object to request parameters
$requestParams = $builder->toRequestParams();
// Create rule
$rule = json_decode($client->rule()->create($requestParams), true);
$rule_id = $rule["data"]["id"];
// Update a Rule
// Retrieve rule we just created
$json_rule = $client->rule()->retrieveSingle(array("id" => $rule_id));
$rule = json_decode($json_rule, true);
// Convert rule to Rule Builder object using data of rule
$rule = Builder::CreateFromResponse($rule["data"]);
// Remove an existing condition with a duplicate condition type in rule by specifying full rule data
$rule->removeConditionByName(Conditions::OBJECT_NO_TAG . "(1)");
// Clear the existing actions
$rule->clearActions();
// Change the action for the rule, add to campaign whenever new contact is added
$eventParams = array(Builder::ADD, 1);
$rule->addAction(Actions::ADD_REMOVE_OBJECT_FROM_CAMPAIGN, $eventParams);
// Convert from Rule Builder object to request parameters
$requestParams = $rule->toRequestParams();
// Update rule
$client->rule()->update($requestParams);
1. Build your rule
- Create a new Rule Builder object to help you build your rule.
- Convert your Rule Builder object into request parameters with
toRequestParams
function.
2. Create your rule
- Make a POST request to the /Rules endpoint.
- The rule's
id
and all the data for the rule will be returned in the response data.
3. Update your rule
- Make a PUT request to the /Rules endpoint.
- GET an existing rule from the account and convert it to a Rule Builder object.
- Build and update your existing rule.
- Convert your Rule Builder object into request parameters with
toRequestParams
function. - The rule's
id
and the updated data for the rule will be returned in the response data.
Create transaction offers
# Create a tax object and retain the entire response `data` array
curl -X POST -d 'name=Retail&rate=8.75' 'https://api.ontraport.com/1/Taxes' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
> Example Response:
{
"code": 0,
"data": {
"name": "Retail",
"rate": "8.75",
"id": "11",
"form_id": "0",
"rules": ""
},
"account_id": "12345"
}
# Create a shipping object and retain the entire response `data` array
curl -X POST -d 'name=Ground&price=10' 'https://api.ontraport.com/1/ShippingMethods' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
> Example Response:
{
"code": 0,
"data": {
"name": "Ground",
"price": "10.00",
"id": "1",
"form_id": "0",
"rules": ""
},
"account_id": "12345"
}
# Create a product object and retain at least the `id` and `price` from the response data
curl -X POST -d 'name=Test&price=50' 'https://api.ontraport.com/1/Products' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
> Example Response:
{
"code": 0,
"data": {
"name": "Gadget",
"price": "50",
"id": "11",
"description": "",
"owner": "1",
"date": "1503589761",
"dlm": "1503589761",
"level1": "0",
"level2": "0",
"external_id": null,
"product_group": null,
"offer_to_affiliates": "true",
"trial_period_unit": "day",
"trial_period_count": "0",
"trial_price": "0",
"setup_fee": "0",
"delay_start": "0",
"shipping": "0",
"sku": null,
"type": "one_time",
"setup_fee_when": "immediately",
"setup_fee_date": "0",
"product_type": "digital",
"subscription_fee": "0",
"subscription_count": "0",
"subscription_unit": "day",
"download_limit": "0",
"download_time_limit": "0",
"taxable": null,
"deleted": "false",
"total_income": null,
"total_purchases": null
},
"account_id": "12345"
}
# Process your transaction, including created product, tax, and shipping in your offer data
curl -X POST -d '{
"contact_id":1,
"chargeNow":"chargeNow",
"trans_date":1369820760000,
"invoice_template":1,
"gateway_id":1,
"offer": {
"products": [
{
"quantity":1,
"shipping":true,
"tax":true,
"price": [
{
"price":"200"
}
],
"type":"single",
"owner":1,
"taxable":true,
"id":"11"
}
],
"taxes": [
{
"name":"Retail",
"rate":"8.75",
"id":"11",
"form_id":"0",
"rules":""
}
],
"shipping": [
{
"name":"Ground",
"price":"10.00",
"id":"1",
"form_id":"0",
"rules":""
}
],
"hasTaxes":true,
"hasShipping":true
},
"billing_address": {
"address":"123 XYZ St",
"city":"Santa Barbara",
"state":"CA","zip":"93101",
"country":"US"},
"payer": {
"ccnumber":"4111111111111111",
"code":"123",
"expire_month":1,
"expire_year":2035
}
}' 'https://api.ontraport.com/1/transaction/processManual' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
require_once(dirname(__FILE__) . "/pathto/Ontraport.php");
use OntraportAPI\Ontraport as Client;
use OntraportAPI\ObjectType;
use OntraportAPI\Models\Transaction as Transaction;
use OntraportAPI\Models\Product as Product;
use OntraportAPI\Models\Offer as Offer;
$api_key = "Key5678";
$app_id = "2_AppID_12345678";
$contact_id = 1;
$gateway_id = 1;
$invoice_id = 1;
// Instantiate client
$client = new Client($app_id, $api_key);
// Instantiate transaction
$transaction = new Transaction($contact_id, Transaction::CHARGE_NOW, $gateway_id);
// Create tax
$tax_params = array(
"objectID" => ObjectType::TAX, // Object type ID: 63
"name" => "Retail",
"rate" => "8.75"
);
$tax = json_decode($client->object()->create($tax_params), true);
$tax_data = $tax["data"];
// Create shipping
$shipping_params = array(
"objectID" => ObjectType::SHIPPING_METHOD, // Object type ID: 64
"name" => "Ground",
"price" => "10"
);
$shipping = json_decode($client->object()->create($shipping_params), true);
$shipping_data = $shipping["data"];
// Create product
$product = new Product("Gadget", 200);
$product_params = $product->toRequestParams();
$product = json_decode($client->product()->create($product_params), true);
$product_data = $product["data"];
// Create an Offer
$offer = new Offer("transaction offer");
$offer->addProduct(Product::CreateFromResponse($product_data), 1, true, true);
$offer->addTax($tax_data["id"], $tax_data["rate"], false, $tax_data["name"]);
$offer->setShipping($shipping_data["id"], $shipping_data["price"], $shipping_data["name"]);
// Load offer into transaction
$transaction->loadOffer($offer);
// Set payment information
$address = array(
"address" => "123 XYZ St",
"city" => "Santa Barbara",
"state" => "CA",
"zip" => "93101",
"country" => "US"
);
$payer = array(
"ccnumber" => "4111111111111111",
"code" => "123",
"expire_month" => 1,
"expire_year" => 2035
);
$transaction->setPayer($payer);
$transaction->setBillingAddress($address);
$transaction->setInvoiceTemplate($invoice_id);
// Process transaction
$transaction_params = $transaction->toRequestParams();
$client->transaction()->processManual($transaction_params);
Processing manual transactions through the API can require some complicated data. This is an example of how to create some of the pieces of an offer, such as products, tax, and shipping, prior to initiating a manual transaction.
1. Create a tax object
- Make a POST request to the /object endpoint using object ID: 63.
- You will need to retain all the
data
from the response.
2. Create a shipping object
- Make a POST request to the /object endpoint using object ID: 64.
- You will need to retain all the
data
from the response.
3. Create a new product
- Make a POST request to the /product.
- You will need to retain at least the
id
andprice
fields from the responsedata
array.
4. Process your transaction
- Make a POST request to the /transaction/processManual endpoint.
- Include your created tax, shipping and product object data within your offer.
- Review the types of required parameters carefully as they can change depending on your usage and account details -- if all of the data is not provided as expected, the transaction will fail.
Create and load an offer
# Retrieve the products for this offer
curl -X GET 'https://api.ontraport.com/1/Products?range=50&condition=%5B%7B%20%22field%22%3A%7B%22field%22%3A%22price%22%7D%2C%20%22op%22%3A%22%3C%3D%22%2C%20%22value%22%3A%7B%22value%22%3A%225.00%22%7D%20%7D%5D'
--header 'Accept: application/json' \
--header 'Api-Appid: 2_AppID_12345678' \
--header 'Api-Key: Key5678' \
> Example Response:
{
"code": 0,
"data": [
{
"id": "4",
"price": "3.00",
"name": "Earl Grey Tea",
"description": "",
"date": "1534186302",
"dlm": "1534186302",
"external_id": null,
"product_group": null,
"sku": null,
"taxable": null,
"deleted": "false",
"total_income": null,
"total_purchases": null
},
{
"id": "6",
"price": "2.00",
"name": "Citrus Extract Tea",
"description": "",
"date": "1534186353",
"dlm": "1534186353",
"external_id": null,
"product_group": null,
"sku": null,
"taxable": null,
"deleted": "false",
"total_income": null,
"total_purchases": null
},
{
"id": "7",
"price": "5.00",
"name": "French Macaroons",
"description": "",
"date": "1534186378",
"dlm": "1534186378",
"external_id": null,
"product_group": null,
"sku": null,
"taxable": null,
"deleted": "false",
"total_income": null,
"total_purchases": null
}
],
"account_id": "12345",
"misc": []
}
# Create the offer with products and tax
curl -X POST -d '{"data": "{\"products\":[{\"quantity\":1,\"minQuantity\":1,\"maxQuantity\":99,\"total\":\"3.00\",\"shipping\":false,\"tax\":true,\"price\":[{\"price\":\"3.00\",\"payment_count\":1,\"unit\":\"month\"5}],\"type\":\"subscription\",\"quantityEditable\":\"false\",\"index\":0,\"name\":\"Earl Grey Tea\",\"id\":\"4\",\"description\":\"\",\"date\":\"1534186302\",\"dlm\":\"1534186302\",\"external_id\":null,\"product_group\":null,\"taxable\":null,\"deleted\":\"false\",\"total_income\":null,\"total_purchases\":null},{\"quantity\":1,\"minQuantity\":1,\"maxQuantity\":99,\"total\":\"2.00\",\"shipping\":false,\"tax\":true,\"price\":[{\"price\":\"2.00\",\"payment_count\":1,\"unit\":\"month\"}],\"type\":\"subscription\",\"quantityEditable\":\"false\",\"index\":0,\"name\":\"Citrus Extract Tea\",\"id\":\"6\",\"description\":\"\",\"date\":\"1534186353\",\"dlm\":\"1534186353\",\"external_id\":null,\"product_group\":null,\"taxable\":null,\"deleted\":\"false\",\"total_income\":null,\"total_purchases\":null},{\"quantity\":1,\"minQuantity\":1,\"maxQuantity\":99,\"total\":\"5.00\",\"shipping\":false,\"tax\":true,\"price\":[{\"price\":\"5.00\",\"payment_count\":1,\"unit\":\"month\"}],\"type\":\"subscription\",\"quantityEditable\":\"false\",\"index\":0,\"name\":\"French Macaroons\",\"id\":\"7\",\"description\":\"\",\"date\":\"1534186378\",\"dlm\":\"1534186378\",\"external_id\":null,\"product_group\":null,\"taxable\":null,\"deleted\":\"false\",\"total_income\":null,\"total_purchases\":null}],\"taxes\":[{\"rate\":7.00,\"name\":\"Monthly\",\"taxShipping\":\"false\",\"taxTotal\":0.7,\"form_id\":\"0\",\"id\":\"2\"}],\"paymentmethods\":[],\"shipping\":null,\"delay\":0,\"invoice_template\":1,\"subTotal\":10,\"grandTotal\":10.7,\"hasTaxes\":true,\"hasShipping\":false,\"paypalValid\":false,\"offerCoupon\":false,\"coupon\":null,\"shipping_charge_reoccurring_orders\":false,\"resorted\":null,\"name\":\"Monthly Subscription\"}", "name": "Monthly Subscription" }' 'https://api.ontraport.com/1/Offers' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Accept: application/json' \
--header 'Api-Appid: 2_AppID_12345678' \
--header 'Api-Key: Key5678'
> Example Response:
{
"code":0,
"data":{
"data":"{\"products\":[{\"quantity\":1,\"minQuantity\":1,\"maxQuantity\":99,\"total\":\"3.00\",\"shipping\":false,\"tax\":true,\"price\":[{\"price\":\"3.00\",\"payment_count\":1,\"unit\":\"month\"5}],\"type\":\"subscription\",\"quantityEditable\":\"false\",\"index\":0,\"name\":\"Earl Grey Tea\",\"id\":\"4\",\"description\":\"\",\"date\":\"1534186302\",\"dlm\":\"1534186302\",\"external_id\":null,\"product_group\":null,\"taxable\":null,\"deleted\":\"false\",\"total_income\":null,\"total_purchases\":null},{\"quantity\":1,\"minQuantity\":1,\"maxQuantity\":99,\"total\":\"2.00\",\"shipping\":false,\"tax\":true,\"price\":[{\"price\":\"2.00\",\"payment_count\":1,\"unit\":\"month\"}],\"type\":\"subscription\",\"quantityEditable\":\"false\",\"index\":0,\"name\":\"Citrus Extract Tea\",\"id\":\"6\",\"description\":\"\",\"date\":\"1534186353\",\"dlm\":\"1534186353\",\"external_id\":null,\"product_group\":null,\"taxable\":null,\"deleted\":\"false\",\"total_income\":null,\"total_purchases\":null},{\"quantity\":1,\"minQuantity\":1,\"maxQuantity\":99,\"total\":\"5.00\",\"shipping\":false,\"tax\":true,\"price\":[{\"price\":\"5.00\",\"payment_count\":1,\"unit\":\"month\"}],\"type\":\"subscription\",\"quantityEditable\":\"false\",\"index\":0,\"name\":\"French Macaroons\",\"id\":\"7\",\"description\":\"\",\"date\":\"1534186378\",\"dlm\":\"1534186378\",\"external_id\":null,\"product_group\":null,\"taxable\":null,\"deleted\":\"false\",\"total_income\":null,\"total_purchases\":null}],\"taxes\":[{\"rate\":7.00,\"name\":\"Monthly\",\"taxShipping\":\"false\",\"taxTotal\":0.7,\"form_id\":\"0\",\"id\":\"2\"}],\"paymentmethods\":[],\"shipping\":null,\"delay\":0,\"invoice_template\":1,\"subTotal\":10,\"grandTotal\":10.7,\"hasTaxes\":true,\"hasShipping\":false,\"paypalValid\":false,\"offerCoupon\":false,\"coupon\":null,\"shipping_charge_reoccurring_orders\":false,\"resorted\":null,\"name\":\"Monthly Subscription\"}",
"name":"Monthly Subscription",
"id":"1",
"public":"1"
},
"account_id":"12345"
}
# Process a transaction for a new contact with the offer
curl -X POST -d '{
"contact_id": 2,
"chargeNow": "chargeNow",
"trans_date": 1369820760000,
"invoice_template": 1,
"gateway_id": 1,
"offer": {
"products": [{
"quantity": 1,
"shipping": false,
"tax": true,
"price": [{
"price": 3.00,
"payment_count": 1,
"unit": "month",
"id": 314159265
}],
"type": "subscription",
"owner": 1,
"taxable": true,
"name": "Earl Grey Tea",
"id": 4
},
{
"quantity": 1,
"shipping": false,
"tax": true,
"price": [{
"price": 3.00,
"payment_count": 1,
"unit": "month",
"id": 314159265
}],
"type": "subscription",
"owner": 1,
"taxable": true,
"name": "Citrus Extract Tea",
"id": 6
},
{
"quantity": 1,
"shipping": false,
"tax": true,
"price": [{
"price": 3.00,
"payment_count": 1,
"unit": "month",
"id": 314159265
}],
"type": "subscription",
"owner": 1,
"taxable": true,
"name": "French Macaroons",
"id": 7
}
]
},
"tax": [{
"name": "Monthly",
"id": 2,
"rate": 7.00
}]
}' 'https://api.ontraport.com/1/transaction/processManual' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
require_once(dirname(__FILE__) . "/pathto/Ontraport.php");
use OntraportAPI\Ontraport as Client;
use OntraportAPI\ObjectType;
use OntraportAPI\Models\Transaction as Transaction;
use OntraportAPI\Models\Product as Product;
use OntraportAPI\Models\Offer as Offer;
$api_key = "Key5678";
$app_id = "2_AppID_12345678";
$contact_id = 1;
$client = new Client($app_id, $api_key);
$offer = new Offer("subscription");
// Retrieve the products for this offer
$condition = new OntraportAPI\Criteria("price", "<=", 5.00);
$products = $client->product()->retrieveMultiplePaginated(array("condition" => $condition->fromArray()));
$products = json_decode($products, true);
// Add all products to offer with monthly subscriptions
foreach ($products as $page)
{
$product_data = $page["data"];
foreach ($product_data as $data)
{
$product = Product::CreateFromResponse($data);
$offer->addProduct($product, 1, false, true);
$offer->addSubscription($data["id"], Offer::MONTH);
}
}
// Tax applies to all the products
$tax = $client->object()->retrieveSingle(array("objectID" => ObjectType::TAX, "search" => "Monthly"));
$tax = json_decode($tax, true);
$tax_data = $tax["data"][0];
$offer->addTax($tax_data["id"], $tax_data["rate"]);
// Create the offer
$requestParams = $offer->toRequestParams();
$client->offer()->create($requestParams);
// Load the offer to process a transaction for another contact
$contact_id = 2;
$gateway_id = 1;
$transaction = new Transaction($contact_id, Transaction::CHARGE_NOW, $gateway_id);
$transaction->loadOffer($offer);
// Process the transaction
$requestParams = $transaction->toRequestParams();
$client->transaction()->processManual($requestParams);
If your transactions frequently use the same transaction details, an offer can be created to speed up the process of logging or charging transactions by allowing users to simply load a pre-existing offer with those details into the transaction.
1. Build your offer
- Create a new Offer object to build your offer details.
- Save your Offer object through the
create
function.
2. Create your offer
- Make a POST request to the /offer endpoint.
3. Load your offer into a new transaction
- Load the offer into the new transaction using the
loadOffer
function.
4. Process a transaction with the offer
- Make a POST request to the /transaction/processManual endpoint.
Get all contacts with a tag
# Retrieve a count of all contacts with desired tag from response data
curl -X GET 'https://api.ontraport.com/1/objects/getInfo?objectID=138&condition=%5B%7B%20%22field%22%3A%7B%22field%22%3A%22tag_id%22%7D%2C%20%22op%22%3A%22%3D%22%2C%20%22value%22%3A%7B%22value%22%3A%223%22%7D%20%7D%5D' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
> Example Response:
{
"code": 0,
"data": {
"listFields": [
""
],
"listFieldSettings": [],
"count": "64"
},
"account_id": "12345"
}
# Make sequential requests to retrieve all tag subscribers by increasing `start` by `range` until `count` is reached
curl -X GET 'https://api.ontraport.com/1/objects?objectID=138&start=0&range=50&condition=%5B%7B%20%22field%22%3A%7B%22field%22%3A%22tag_id%22%7D%2C%20%22op%22%3A%22%3D%22%2C%20%22value%22%3A%7B%22value%22%3A%223%22%7D%20%7D%5D' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
curl -X GET 'https://api.ontraport.com/1/objects?objectID=138&start=50&range=50&condition=%5B%7B%20%22field%22%3A%7B%22field%22%3A%22tag_id%22%7D%2C%20%22op%22%3A%22%3D%22%2C%20%22value%22%3A%7B%22value%22%3A%223%22%7D%20%7D%5D' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
> The `object_id` field in the response data contains ID of each contact
{
"code": 0,
"data": [
{
"id": "1",
"object_id": "1",
"tag_id": "3"
}
],
"account_id": "12345",
"misc": []
}
<?php
require_once("pathto/Ontraport.php");
use OntraportAPI\Ontraport as Client;
use OntraportAPI\ObjectType;
$api_key = "Key5678";
$app_id = "2_AppID_12345678";
$tag_id = 1;
// Instantiate client
$client = new Client($app_id, $api_key);
// Build condition object
$condition = new OntraportAPI\Criteria("tag_id", "=", $tag_id);
// Using pagination, retrieve the contact IDs from the tag subscriber objects
$result = $client->object()->retrieveMultiplePaginated(
array(
"objectID" => ObjectType::TAG_SUBSCRIBER, // Object type ID: 138
"condition" => $condition->fromArray(),
"start" => 0,
"range" => 50
)
);
You may want to retrieve a list of all the contacts having a specific tag. Because you can only bring back a maximum of fifty objects per API request, you will need to utilize pagination tools. The tag subscriber object, object ID number 138, will provide you a list of all related objects and tags.
1. Construct a condition object
- Check that the
tag_id
field is equal to the ID of the tag you want to find in contacts.
2. Retrieve a count of tag subscribers matching that condition
- Make a GET request to the /objects/getInfo endpoint to retrieve a count of all tag subscribers related to that tag.
- If you are using our SDK, you can skip this step.
3. Using pagination, retrieve those tag subscribers
- Make sequential GET requests to the /objects endpoint until all subscribers have been retrieved
- The
object_id
field references the contact object'sid
field. - If you are using our SDK,
the
retrieveMultiplePaginated()
function handles the pagination for you.
Log a transaction manually
curl -X POST -d '{
"contact_id": 1,
"chargeNow": "chargeLog",
"invoice_template": 1,
"offer": {
"products": [
{
"quantity": 1,
"shipping": false,
"tax": false,
"price": [
{
"price": 40.00,
"id": 1
}
],
"type": "single",
"owner": 1,
"id": 1
}
]
}
}' 'https://api.ontraport.com/1/transaction/processManual' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
use OntraportAPI\Ontraport;
$client = new Ontraport("2_AppID_12345678","Key5678");
$requestParams = array(
"contact_id" => 1,
"chargeNow" => "chargeLog",
"offer" => array(
"products" => array(
array(
"quantity" => 1,
"shipping" => false,
"tax" => false,
"price" => array(
array(
"price" => 40,
"payment_count" => 0,
"id" => 1
)
),
"type" => "single",
"owner" => 1,
"id" => 1
)
)
)
);
$response = $client->transaction()->processManual($requestParams);
Example Response:
{
"code": 0,
"data": {
"invoice_id": 3
},
"account_id": "12345"
}
If you would like to pass in a previously charged transaction to be logged in Ontraport without actually charging your contact, you can use
the transaction/processManual endpoint
with the chargeNow
field set to "chargeLog".
Far less data is needed to simply log a transaction than to manually process one. The gateway, payer, and billing details are unnecessary in this case. The mandatory information in this case include a contact ID, the "chargeLog" designation, and product and pricing details.
Product-specific coupons
# Create a new product and retain the `id` from the response data
curl -X POST -d '{
"objectID": 16,
"name": "Widget",
"price": "1000"
}' 'https://api.ontraport.com/1/objects' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
> Example Response:
{
"code": 0,
"data": {
"name": "Widget",
"price": "1000",
"id": "21",
"description": "",
"owner": "1",
"date": "1503598868",
"dlm": "1503598868",
"level1": "0",
"level2": "0",
"external_id": null,
"product_group": null,
"offer_to_affiliates": "true",
"trial_period_unit": "day",
"trial_period_count": "0",
"trial_price": "0",
"setup_fee": "0",
"delay_start": "0",
"shipping": "0",
"sku": null,
"type": "one_time",
"setup_fee_when": "immediately",
"setup_fee_date": "0",
"product_type": "digital",
"subscription_fee": "0",
"subscription_count": "0",
"subscription_unit": "day",
"download_limit": "0",
"download_time_limit": "0",
"taxable": null,
"deleted": "false",
"total_income": null,
"total_purchases": null
},
"account_id": "12345"
}
# Create a product specific coupon using the `id` of the product you just created
curl -X POST -d '{
"objectID": 123,
"name": "$100 off Widgets",
"type": "personal",
"discount_type": "flat",
"discount_value": "100",
"discount_description": "Save $100 on Widget purchase.",
"valid_type": "time",
"valid_timeframe": "240",
"status": "Valid",
"product_selection": "specific",
"products": [21]
}' 'https://api.ontraport.com/1/objects' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
> Example Response:
{
"code": 0,
"data": {
"id": 13
},
"account_id": "12345"
}
# Create a message with the coupon code and expiration date in the body
curl -X POST -d 'alias=Coupon%20Message&subject=Save%20%24100%20on%20a%20Widget!&type=e-mail&object_type_id=0&from=owner&message_body=%5BFirst%20Name%5D%2C%20your%20single%20use%20coupon%20code%20%5BONTRACOUPON_13_code%5D%20expires%20%5BONTRACOUPON_13_expiration%5D.' 'https://api.ontraport.com/1/message' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
require_once(dirname(__FILE__) . "/pathto/Ontraport.php");
use OntraportAPI\Ontraport as Client;
use OntraportAPI\ObjectType;
$api_key = "Key5678";
$app_id = "2_AppID_12345678";
// Instantiate client
$client = new Client($app_id, $api_key);
// Create product
$product_params = array(
"objectID" => ObjectType::PRODUCT, // Object type ID: 16
"name" => "Widget",
"price" => "1000"
);
$product = json_decode($client->object()->create($product_params), true);
$product_id = $product["data"]["id"];
// Create product specific coupon
$coupon_params = array(
"objectID" => ObjectType::COUPON, // Object type ID: 123
"name" => "$100 off Widgets",
"type" => "personal",
"discount_type" => "flat",
"discount_value" => "100",
"discount_description" => "Save $100 on Widget purchase.",
"valid_type" => "time",
"valid_timeframe" => "240",
"status" => "Valid",
"product_selection" => "specific",
"products" => array($product_id)
);
$coupon = json_decode($client->object()->create($coupon_params), true);
$coupon_id = $coupon["data"]["id"];
// Create a message containing the coupon code
$client->message()->create(
array(
"alias" => "Coupon Message",
"type" => "e-mail",
"object_type_id" => ObjectType::CONTACT, // Object type ID: 0
"subject" => "Save $100 on a Widget!",
"from" => "owner",
"message_body" => "[First Name], your single use coupon code [ONTRACOUPON_{$coupon_id}_code] expires [ONTRACOUPON_{$coupon_id}_expiration]."
)
);
Coupons can either be general or product specific, and can either be general use group coupons or generated specifically for individuals. This is an example of how to create a product and a coupon for that product, and then create a message capable of sending individual coupon codes for this product to your contacts:
1. Create a new product
- Make a POST request to the /object endpoint using object ID: 16.
2. Create a product-specific coupon
- Make a POST request to the /object endpoint using object ID: 123.
- In order to make the coupon specific to your product, you must set the
product_selection
field to "specific", and include aproduct
array containing the ID of the product you created.
3. Create your message with your coupon code and expiration date in the body
- Make a POST request to the /message endpoint.
- In the
message_body
, include bracketed merge fields for your coupon's code and expiration.- Coupon code mergefields are formatted:
[ONTRACOUPON_{coupon_id}_code]
- Expiration date mergefields are formatted:
[ONTRACOUPON_{coupon_id}_expiration]
- Coupon code mergefields are formatted:
Sales reporting
# Retrieve sales report information meeting minimum and maximum date conditions
curl -X GET 'https://api.ontraport.com/1/objects/getInfo?objectID=95&condition=%5B%7B%20%20%20%22field%22%3A%7B%22field%22%3A%22date%22%7D%2C%20%20%20%22op%22%3A%22%3E%22%2C%20%20%20%22value%22%3A%7B%22value%22%3A%221500768000%22%7D%20%7D%2C%20%22AND%22%2C%20%7B%20%20%20%22field%22%3A%7B%22field%22%3A%22date%22%7D%2C%20%20%20%22op%22%3A%22%3C%22%2C%20%20%22value%22%3A%7B%22value%22%3A%221503528963%22%7D%20%7D%5D' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
> Example Reponse:
{
"code": 0,
"data": {
"listFields": [
"date",
"product_id",
"contact_id",
"source",
"status",
"attempted",
"paid",
"declined",
"refunded",
"voided",
"tax",
"net"
],
"listFieldSettings": [],
"count": "9",
"sums": {
"attempted": 263,
"paid": 213,
"declined": 50,
"refunded": 0,
"voided": 0,
"tax": 0,
"net": 213
}
},
"account_id": "12345"
}
<?php
require_once(dirname(__FILE__) . "/pathto/Ontraport.php");
use OntraportAPI\Ontraport as Client;
use OntraportAPI\ObjectType;
$api_key = "Key5678";
$app_id = "2_AppID_12345678";
$min_date = 1500768000;
$max_date = 1503528963;
// Instantiate client
$client = new Client($app_id, $api_key);
// Construct minimum date condition
$conditions = new OntraportAPI\Criteria("date", ">", $min_date);
// Add maximum date condition
$conditions->andCondition("date", "<", $max_date);
// Retrieve data
$params = array(
"objectID" => ObjectType::PRODUCT_SALES_LOG_REPORT, // Object type ID: 95
"condition" => $conditions->fromArray()
);
$purchase_log = json_decode($client->object()->retrieveCollectionInfo($params), true);
echo "Total purchased: $" . $purchase_log["data"]["sums"]["paid"] . "\n";
echo "Total declined: $" . $purchase_log["data"]["sums"]["declined"] . "\n";
There are a number of different ways to retrieve sales reporting via the API. Sometimes you may not want the details but just to retrieve the total amount of sales meeting a certain criteria, such as sales within a designated time period. The following is an example of how to retrieve high level sales reporting within a minimum and maximum date:
1. Retrieve sales report information meeting minimum and maximum date conditions
- Construct a condition checking that the
date
field is greater than the minimum date and greater than the manximum date. - Make a GET request to the /objects/getInfo endpoint using object ID: 95 and the condition constructed above.
- The resulting data will include in its
sums
array sales reporting details such as total purchases attempted, total paid, total declined, etc.
Search message subject
# Retrieve messages meeting condition
curl -X GET 'https://api.ontraport.com/1/Messages?condition=%5B%7B%20%22field%22%3A%7B%22field%22%3A%22subject%22%7D%2C%20%22op%22%3A%22LIKE%22%2C%20%22value%22%3A%7B%22value%22%3A%22%25subject%25%22%7D%20%7D%5D'
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
require_once("pathto/Ontraport.php");
use OntraportAPI\Ontraport as Client;
$api_key = "Key5678";
$app_id = "2_AppID_12345678";
// Instantiate client
$client = new Client($app_id, $api_key);
// Create a condition checking for your phrase in the subject line
$conditions = new OntraportAPI\Criteria("subject", "LIKE", "%Test%");
// Retrieve messages matching that condition
$messages = $client->message()->retrieveMultiplePaginated(array("condition" => $conditions->fromArray()));
If you have many messages, you may want to search the subject line (or another field) to find one with specific content. This can be easily accomplished via our API:
1. Construct a condition object
- Construct a condition object checking that the
subject
field (or other field, such asmessage_body
) either equals or matches the text you are looking for. - You can use the equality operator (=) to check for an exact match, or "LIKE" in combination with wildcards. The percent sign (%) used as a wildcard can represent zero, one, or multiple characters. The underscore (_) used as a wildcard can represent a single character.
2. Retrieve messages meeting condition
- Pass the condition object you constructed in to a GET request to the /Messages endpoint to retrieve matching messages.
- If this is a broad search, you should utilize pagination to make sure you retrieve all of the results. If you are looking for only a few results, pagination won't be necessary.
Tracked links in messages
# Create a tracked link, retaining the `id` and `turl_code` from the response data
curl -X POST -d '{
"objectID":80,
"name":"Test Tracked Link",
"url":"http:\/\/testtracking.com"
}' 'https://api.ontraport.com/1/objects' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
> Example Response:
{
"code": 0,
"data": {
"objectID": 80,
"name": "Test Tracked Link",
"url": "http://testtracking.com",
"id": 10,
"turl_code": "http://tester.ontraport.com/tl/10"
},
"account_id": "12345"
}
# Create a message with a tracked link retrieved from `turl_code` in the body
curl -X POST -d 'alias=Tracked%20Link%20message&subject=Cool%20free%20stuff!&type=e-mail&object_type_id=0&from=owner&message_body=%5BFirst%20Name%5D%2C%20check%20out%20the%20free%20content%20on%20%3Ca%20href%3D%22http%3A%2F%2Ftester.ontraport.com%2Ftl%2F10%22%3Eour%20site%3C%2Fa%3E!' 'https://api.ontraport.com/1/message' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
# Create a rule to perform an action if the tracked link is clicked
curl -X POST -d '{
"objectID": 6,
"name": "Tracked Link Rule",
"events": "clicks_tracked_link(10)",
"actions": "Add_contact_to_category(1)"
}' 'https://api.ontraport.com/1/objects' \
--header 'Content-Type: application/json' \
--header 'Api-Key: Key5678' \
--header 'Api-Appid: 2_AppID_12345678'
<?php
require_once(dirname(__FILE__) . "/pathto/Ontraport.php");
use OntraportAPI\Ontraport as Client;
use OntraportAPI\Models\Rules\RuleBuilder as Builder;
use OntraportAPI\Models\Rules\Events;
use OntraportAPI\Models\Rules\Conditions;
use OntraportAPI\Models\Rules\Actions;
use OntraportAPI\ObjectType;
$api_key = "Key5678";
$app_id = "2_AppID_12345678";
// Instantiate client
$client = new Client($app_id, $api_key);
// Create tracked link
$link_params = array(
"objectID" => ObjectType::TRACKED_LINK, // Object type ID: 80
"name" => "Test Tracked Link",
"url" => "http://testtracking.com"
);
$tracked_link = json_decode($client->object()->create($link_params), true);
$tracking_url = $tracked_link["data"]["turl_code"];
$link_id = $tracked_link["data"]["id"];
// Create message with tracked link in the content
$client->message()->create(
array(
"alias" => "Tracked Link Message",
"type" => "e-mail",
"object_type_id" => ObjectType::CONTACT, // Object type ID: 0
"subject" => "Cool free stuff!",
"from" => "owner",
"message_body" => "[First Name], check out the free content on <a href=\"" . $tracking_url . "\">our site</a>!"
)
);
// You can also create a rule to run when the tracked link is clicked
$tag_id = 2;
// Create a new Rule Builder to build your rule
$builder = new Builder("Tracked Link Rule", 0);
// Add event to set rule to act whenever tracked link is clicked
$event = Events::TRACKED_LINKED_CLICKED;
$eventParams = array($link_id);
$builder->addEvent($event, $eventParams);
// Add action for rule to add the object to the tag when rule is triggered
$action = Actions::ADD_OBJECT_TO_TAG;
$actionParams = array($tag_id);
$builder->addAction($action, $actionParams);
// Convert builder object into request parameters
$requestParams = $builder->toRequestParams();
// Create the rule with the request parameters
$client->rule()->create($requestParams);
Tracked links allow you to keep tabs on how effective your emails and landing pages are at directing traffic where you want it to go. You can create tracked links through the API and add them to messages. If you have global rules enabled, you can also create rules for actions to be taken when the link is clicked:
1. Create a tracked link
- Make a POST request to the /object endpoint using object ID: 80. Make sure the
url
you pass in begins with a valid protocol such as http:// or https:// or your request will fail. - You will need the
id
andturl_code
fields from the response data.
2. Create your message with the tracked link in the body
- Make a POST request to the /message endpoint.
- In the
message_body
, include an HTML link to the tracking URL in the tracked link response data'sturl_code
field.
3. Create a rule to perform an action if the tracked link is clicked
- Make a POST request to the /object endpoint using object ID: 6.
- The
event
field would containclicks_tracked_link({link_id})
. - The
action
field can contain a directive to:- Add a tag to the contact:
Add_contact_to_category({tag_id})
- Send the contact an email:
Send_contact_an_emailmbs({message_id})
- Add the contact to a campaign:
campaign_builder_action_change(0,{campaign_id})
- Or many other options
- Add a tag to the contact:
API Change Log
Every SDK related change will be indicated in this change log with the SDK type and version number:
SDK-PHP v. 1.1.1
For bug fixes and small changes, there will be a minor increment. For new functionalities, such as models or new SDK wrapper classes, there will be a middle increment. For large changes that may break previous working SDK versions, there will be a whole version increment.
Keep your integrations updated by subscribing to our changes!
Sep 28 2023 |
---|
- Added new
create_open_order_on_decline
parameter for theTransaction/processManual
endpoint which determines whether an open order is created if there's a non-zero today charge which declines. Previously, an open order was always created.
Aug 07 2023 |
---|
- The
cctoken
subfield ofpayer
can be used when creating a manual transaction to specify a Stripe Token instead of an actual credit card number.
Aug 02 2023 |
---|
- The field
sku
is no longer populated with data. It is now deprecated and removed from the response data in the GET /Purchases endpoints.
May 31 2023 |
---|
- Exposed
GET /WebhookLog
endpoint. Exposed GETWebhookLogs
, GETWebhookLogs/meta
and GETWebhookLogs/getInfo
endpoints.
Jun 03 2022 |
---|
- Added documentation for image fields, describing the rehosting behavior and a request/response example
Apr 13 2022 |
---|
- Changed invalid email response for Objects/getByEmail endpoint from a 400 to a 404.
Dec 08 2021 |
---|
- Added documentation for list type field.
Feb 06 2020 |
---|
- A section has been added documenting all of the API calls for Groups. A section has been added listing most of the field types and how to use them + what to expect back.
Jan 09 2020 |
---|
- Integer field
group_id
has been added to replacegroup_ids
to more accurately reflect the actual behavior of the parameter: a collection can only be limited by a single group at a time. The existing parametergroup_ids
will no longer be documented, but will continue to function as-is.
Oct 22 2019 |
---|
- The field
num_purchased
is deprecated and will be removed from response data in the future. Please make sure integrations that rely on this field are updated.
Oct 22 2019 |
---|
- Added a 422 response code which will now be returned when email address fields are sent invalid addresses
Oct 02 2019 |
---|
- Previously, the raw percentage for the Conversion Rate in Landing Pages and Forms must be obtained by dividing two separate fields.
- The upcoming changes will contain the following
- The existing field
unique_lpconvert
will now hold the raw percentage Conversion Rate for Landing Pages as opposed to the number of conversions. - The new field
unique_convert
will replaceunique_fillouts
as the field mapped to Conversion Rate for NG Field Aliases. - The new field
unique_convert
will hold the raw percentage Conversion Rate for Forms.
- The existing field
- Please check if your integrations contain these field usages and adjust accordingly.
Jul 23 2019 |
---|
- Documented
time_since_dla
,updateCampaign
, andip_addy_display
fields in Contacts section. - Corrected the
type
field in Credit Cards section to reflect6 => Other
instead of5 => Other
. - Documented
campaigns
andrevenue
fields in Forms section and updated example response forForms/meta
endpoint. - Documented new fields,
unique_visits_0
tounique_visits_3
,convert_0
toconvert_3
,unique_convert_0
tounique_convert_3
, andseo_settings
for Landing Pages. - Documented
utm_tracking
field for Message section. - Documented default fields in custom objects and
ip_addy_display
field in Objects section. - Documented
task_notification_checkbox
for Task section. - Corrected the type from integer to double for
subtotal
,tax
,tax_city
,tax_state
,tax_county
,shipping
, andtotal
fields and documentedcc_id
in Transactions section.
Jul 11 2019 |
---|
- Creating or updating the Rule action, PING URL, now only requires a 'Webhook ID' parameter.
- Old parameters (url, post_data, json_flag) are now deprecated.
Jun 27 2019 |
---|
- Added
unique_id
field to ORM objects. This field cannot be edited, but can be sent along with update or saveorupdate requests to indicate which object's data should be updated.
Jun 19 2019 |
---|
- Added Getting HTML for OntraForms
- Can now pull form HTML for OntraForms. Deprecated getSmartFormHTML in SDK. Now use getFormHTML for both OntraForms as well as SmartForms.
Dec 18 2018 |
---|
- Notice: Beginning February 1,2019, Ontraport package level permissions and user permissions will apply to API requests. Please check the user permissions for the owners of your API credentials and make sure they align with the needs of your integration.
Nov 20 2018 |
---|
- Added
unsetShipping
method in Offer SDK. - Modified
sendRecurringInvoice
,chargeShippingForReoccurringOrders
Transaction and Offer SDK functions.
Nov 12 2018 |
---|
- Added
Product
andOffer
wrapper classes and models. - Added
Transaction
model forPOST /processManual
endpoint.
Nov 08 2018 |
---|
- Exposed
PUT /PartnerProduct
,POST /PartnerProduct
,DELETE /PartnerProduct
endpoints to allow for adding Partner Products to Partner Programs.
Oct 11 2018 | SDK-PHP v. 1.1.1 |
---|
- RuleBuilder Model bug fix for
CreateFromResponse
function
Jul 31 2018 | SDK-PHP v. 1.1.0 |
---|
- Added Rule SDK, RuleBuilder Model, and Field Editor Model.
Jul 30 2018 |
---|
- Exposed
DELETE /Rule
andDELETE /Rules
endpoints and allowed for deleting rules through the API.
Jun 26 2018 |
---|
- Changes include the addition of a new field,
use_utm_names
, for Contacts.
Jun 21 2018 |
---|
- Added
Objects/fieldeditor
endpoint for adding and removing fields and sections from objects.
Mar 27 2018 |
---|
- Added transactional_email field to message object.
Mar 22 2018 | SDK-PHP v. 1.0.4 |
---|
- Webhook and Form SDK wrappers
Mar 06 2018 |
---|
- Exposed
GET /Webhooks
endpoint. ExposedWebhook/subscribe
andWebhook/unsubscribe
endpoint. - Allowed subscribing to the following events:
object_create
,sub_tag
,unsub_tag
,object_submits_form
.
Feb 26 2018 |
---|
- Unset passwords from response data.
Jan 25 2018 | SDK-PHP v. 1.0.3 |
---|
- Handle Rate Limiting in API
Dec 22 2017 |
---|
- Added rate limiting headers to API responses.
Dec 12 2017 |
---|
- Added
CreditCard/setDefault
endpoint to allow setting the status of a credit card to default. - Included updated order in response data for
transactions/setOrder
.
Nov 30 2017 | SDK-PHP v. 1.0.2 |
---|
- Enabled retrieving credit card objects via the API and added a wrapper class in the PHP SDK.
Nov 17 2017 | SDK-PHP v. 1.0.2 |
---|
- Added
ObjectType
class to SDK to allow the use of constants for supported object type IDs.
Nov 16 2017 | SDK-PHP v. 1.0.2 |
---|
- New class of constants for object type IDs
Nov 10 2017 |
---|
- Added
all
parameter to allow retrieving an array of all matching IDs with/objects/getByEmail
.
Nov 07 2017 |
---|
- Added
date
field to sequences, rules, forms, upsell forms, partner programs, and landing pages to indicate the date the object was created. Note that this field will not contain data for any objects created prior to November 7, 2017. - Added
dlm
field to sequences, rules, forms, messages, upsell forms, partner programs, and landing pages to indicate the date the object was last modified.
Nov 02 2017 |
---|
- Allowed updating the
external_order_id
when processing manual transactions.
Oct 11 2017 | SDK-PHP v. 1.0.1 |
---|
- Added new SDK methods in objects, messages, and campaign builder items
Sep 08 2017 | SDK-PHP v. 1.0 |
---|
- Updated documentation:
- Added documentation for message endpoints.
- Added 'Try It Out Live' buttons for each endpoint.
- Added example scripts for multi-step use cases.
- Updated SDK:
- Added method to construct conditions.
- Added method to paginate multiple GET requests.
- Added messages and campaign builder items.
- Added endpoints to retrieve information on CampaignBuilder campaigns.
- Added
objects/getByEmail
. With this endpoint, you can retrieve contacts and custom objects by email instead of ID. - Removed old and unnecessary fields from API responses. Removed fields include:
- Messages:
tags
,private
,platform
,rules
,mta
,filebox
,my_file_list
Sep 01 2017 |
---|
cc_id
attribute was added to transaction objects. Transactions can now be charged to any of multiple credit cards on file for a contact.
Aug 09 2017 |
---|
- Added
objects/tagByName
. With this endpoint, you can create a tag if it doesn't exist and add it to an object. You can also remove a tag from an object by name
Jul 25 2017 |
---|
- Order objects (
objectID => 52
) can now be deleted via the API. - Calls to
/update
and/saveorupdate
endpoints will now return all updated fields and the ID of the object in the response.
May 25 2017 |
---|
- Old documentation is accessible at https://api.ontraport.com/live.
- Old fields will no longer be returned in API responses. Obsolete fields include:
- Contacts:
notes
,status
,category
,lead_source
,visits
,lastvisit
,lastaction
,referer
- Tasks:
history
,flags
,notify_manager
,notes
- Landingpages:
platform
- Forms:
fields
,fieldoptions
,fieldsrequired
,form_format
,raw_data
,attach
- Transactions:
transaction_id
- Contacts:
RSS Feeds
Instead of checking our API Change Log every day to look out for new changes to our API, stay updated by subscribing to our RSS Feed. RSS feeds give users the ability to receive content updates from websites and quickly be linked to the corresponding changes. There are numerous feed consumption methods for users to easily view all their feeds via one interface. These methods are usually called "feed readers" or "feed aggregators".
Listed below are various tools you may use to get yourself set up. After getting setup, simply visit our RSS Feed by clicking this which will redirect you to the RSS Feed link you will need to stay subscribed to our updates!
Browser Built-In Feed Readers |
---|
- Google Chrome:
- Mozilla Firefox
- Live Bookmark (Note: Unavailable after Firefox 63)
Mobile Feed Readers |
---|
Email-Based Feed Readers |
---|