About API in ONTRAPORT
Before diving into programming world, lots of integrations have already been built. Check out our Integrations page for a listing of the ones we know about
ONTRAPORT has two available APIs for use by developers.
We recommend using the new API whenever possible as more endpoints are available for manipulating data inside ONTRAPORT.
For backward compatibility and easier use of post data in webhooks, etc., the legacy API can be used. It uses a familiar XML format. For advanced, more object orientated use with JSON support, the new API is a better choice.
Our API documentation can be found at https://api.ontraport.com/doc.
If you'd like to access our PHP client library, visit https://github.com/Ontraport/SDK-PHP
Obtain a API App ID and API Key (see below) and visit our interactive API documentation at https://api.ontraport.com/live.
After entering the API App ID and API Key at the top you can create and test API calls at api.ontraport.com/doc.
To find the available objects in your account:
- Click the Objects section
- Open GET /objects/meta
- Under Parameters > Format select byName
- Click the Try It Out! button.
The Response will include all of the objects you can access. For example, within the "data" array shown in the image below, the first string, "Contact" is the object name, and the "id": 0 attribute is the objectID for the Contact object (Contacts database).
All accounts will include the first ten objects in this table. Many more objects are listed in the response. In addition, some accounts have Custom Objects that generate dozens of object IDs for each one of their data elements.
|Object Name||Object ID|
We cannot assist you in learning how to program using the API. But for those of you already coding, we are happy to help with specific questions about code you have written that is producing an error. Please include the code in a plain text file and attach it to an email to firstname.lastname@example.org. Include a description of the error you are receiving. One of our developers will respond to your request during normal business hours.
How to Obtain an API Key
Navigate to Admin > ONTRAPORT API Instructions and Key Manager
Click the New API Key button
- If you receive the API Application form, fill it out and submit it. When your API application is approved return here and generate the key as shown below. Approval takes one to two business days.
Select the Contact Owner and Permissions you'd like to access
NOTE: In most cases you will get an API App ID and API Key immediately. Our support team may reach out to you with a few questions about your request. Keep an eye on your admin email inbox; if any questions are not answered your key could be deactivated.
Why Are You Asking Me Questions About My API Key Request?
We need to ask these brief questions to help protect both you and each of our other existing customers from potential exploits that could hurt their marketing efforts. If asked, please reply with the answers to these questions.
1. What will you be using the API for?
(If there is a specific program you need a key for let us know. For example Lead Pages, UltraCart, Optimize Press, etc.)
2. If you'll be bringing in leads, where are they coming from?
(Be sure to include any relevant URLs where contacts will be opting in)
3. Are they also going into any other systems/being mailed elsewhere?
(Will the leads coming in be mailed using another piece of software?)
As always if you have any questions about acceptable use or just support in general, don't hesitate to ask - We'd be glad to help!
Our Legacy API
The following articles contain information for the legacy API, including XML code samples: