Receive automated messages direct to your system in real-time.
Tradedoubler's Conversions API lets you create automated notifications for all of your conversions (leads and sales), which you will receive in real-time. You can:
The Conversions API enables you to work more efficiently by receiving transaction notifications in real-time rather than having to run static reports from an interface.
Do not have an affiliate program with Tradedoubler? Contact us
In order to access the Conversions API you need an account with Tradedoubler. Once you have an account, you can pick up your unique token by logging on and going to "Settings" > "Tokens". The token for the Conversions API is under the system "CONVERSIONS".
Tokens are 40 character hexadecimal SHA-1 strings.
The domain api.tradedoubler.com is CORS enabled, meaning that you can use client side XMLHttpRequest without getting cross-domain security issues, even when posting or deleting!
Please note however that CORS is not yet fully implemented in all browsers, so you may want to go for JSONP for client side requests.
When posting your request you need to tell the service what type of content you are posting. The service can read JSON so use application/json
.
We only accept UTF-8 as the character set so please make sure that you use that and specify it in the Content-Type header.
JSON: Content-Type: application/json; charset=utf-8
The create service allows you to add new subscriptions.
The syntax for the service is:
HTTPS POST https://api.tradedoubler.com/1.0/conversions/subscriptions[.xml|.json|empty]?token={token}
There is one required key in the request:
Name | Description | Type |
---|---|---|
token | Your unique token, identifying you as a service subscriber. | String |
The table below explains the features of the create service.
Name | Description |
---|---|
Filters | Use filters to restrict when a message is sent to you. For example, you may want to restrict the messages to conversions that come from a specific program. You can use program, publisher site, event, event type and message type IDs in your filters. |
Receivers | The receiver is the part of your system that will receiver the message. This can be done using GET (pull) or POST (push) HTTP methods. If you are using GET you will create a URL containing the attributes you wish to receive in the message. If you are using POST you will create a response body stating the attributes you wish to receive. For POST you will also need to state the format being used (i.e. JSON, XML or custom) so Tradedoubler can encode the message correctly. |
Currency conversion | If necessary you can have the order value and commissions of all messages in a subscription converted into a single currency. |
Custom attribute | You can create your own custom attribute and define rules to decide how to populate it. This is useful if you have internal events or reporting IDs that need mapping to Tradedoubler attributes. You define the Tradedoubler attributes you want to use as input (e.g. program ID, event ID, etc.), the name of your custom attribute and rules to map between the two. For example, you may wish to look for conversions where programId=123 and eventId=123, then have your custom attribute populated with 12345. |
This tables shows all the attributes you can use when creating a subscription.
Name | Description | Type | Required |
---|---|---|---|
subscriptionName | Enter a name for the subscription. | String | No |
filter | Used to hold information about subscription filters/restrictions (i.e. only return data for program ID 123). Filters can include any number of program, publisher site, event, event type and message type IDs. Exclude if you do not want to apply any filters. | N/A - parent parameter | No |
programIds | IDs of the programs you wish to restrict this subscription to. Only data for the entered program IDs will be returned. Exclude if you want to receive data for all your programs. | Integer (list when multiple) | No |
siteIds | IDs of your publisher sites you wish to restrict this subscription to. Only data for the entered site IDs will be returned. Exclude if you want to receive data for all your sites. | Integer (list when multiple) | No |
eventIds | IDs of the events you wish to restrict this subscription to. Only data for the entered event IDs will be returned. Exclude if you want to receive data for all your events. | Integer (list when multiple) | No |
eventTypeIds | IDs of the event type you wish to restrict this subscription to. Only data for the entered event type IDs will be returned. Exclude if you want to receive data for all your events. See here for a list of available IDs. | Integer (list when multiple) | No |
messageTypeIds | Define the message types you want to receive for this subscription. See here for more information on message types. | Integer (list when multiple) | Yes |
receivers | Used to hold information about data receivers (i.e. where the data will be sent). Every subscription must have at least one receiver and can use GET or POST. | N/A - parent parameter | Yes |
httpMethod | Define whether you want to use POST or GET for your receiver. | String | Yes |
receiverUrl | For GET subscriptions this should be the base URL and the attributes you want included. For POST subscriptions it should just be the base URL. See here for a list of available attributes. | String | Yes |
receiverBody | Used for POST subscriptions (not to be included when creating a GET receiver). Enter the attributes you wish to receive in the POST message body. See here for a list of available attributes. | String | Yes (for POST) |
receiverFormat | Used for POST subscriptions (not to be included when creating a GET receiver). Define the format of the content in the receiverBody (JSON, XML or custom). This will be used by Tradedoubler to apply the correct encoding to the message body. | String | Yes (for POST) |
disabled | Boolean flag to enable/disable the receiver. Default value is false | Bool | No |
currencyConversion | You can choose to convert the order values to a currency of your choosing. Define the currency you wish to use from the ISO 4217 standard. | String | No |
customAttribute | Used to hold information about a custom attribute and mapping rules. Multiple Tradedoubler attributes can be mapped to a single custom attributes. Multiple mapping rules can be set up. | N/A - parent parameter | No |
tdAttributes | Define the transaction attribute(s) to use as input. These are the attributes that the service will check when attempting to match a transaction to your mapping rules. See here for a list of available attributes. | String (array when multiple) | No |
userAttribute | Define the name of your new attribute. | String | No |
rules | rules is used to create the mapping table. Use inputs to define the value(s) you are looking for in the tdAttributes. Use output to define the value to be used as userAttribute when a match is found. | Array | No |
disabled | Boolean flag to enable/disable the subscription. Default value is false | Bool | No |
This is an example of how to create a subscription with every option included.
{ "subscriptionName":"My first real time postback", "filter": { "programIds": [1234,5678], "siteIds": [1234,5678], "eventIds": [1234,5678], "eventTypeIds": [5], "messageTypeIds": [1] }, "receivers": [ { "httpMethod": "GET", "receiverUrl": "http://mysite1.com?orderNum=${orderNumber}&orderVal=${orderValue}&goalId=${goalId}", "disabled":false }, { "httpMethod": "POST", "receiverUrl": "http://mysite1.com", "receiverBody": "eventId=${eventId}, programId=${programId}, goalId=${goalId}", "receiverFormat": "custom", "disabled":false } ], "currencyConversion": { "to": "USD" }, "customAttribute" : { "tdAttributes": ["programId", "eventId"], "userAttribute": "goalId", "rules": [ {"inputs": ["123", "456"], "output": "10"}, {"inputs": ["12345", "67890"], "output": "20"} ] }, "disabled":false }
The example above structured the receiverUrl with name:value pairs. You can also choose to include only the values like so:
{ "receivers": [ { "httpMethod": "GET", "receiverUrl": "http://mysite1.com/${orderNumber}/${orderValue}" } ] }
Filters are optional and can be included or excluded as needed. If you wish to receive data for all programs and events you can exclude all filters. This is a GET subscription that will send data for all programs and events associated with the publisher to one receiver.
{ "receivers": [ { "httpMethod": "GET", "receiverUrl": "http://mysite1.com?orderNum=${orderNumber}&orderVal=${orderValue}" } ] }
You can also subscribe to event types (i.e. clicks, leads and sales) rather than specific event IDs. This will send data for all events of the defined type. This is an example of a GET subscription for all post-click sales events (event type ID 5) to be sent to a single receiver.
{ "filter": { "eventTypeIds": [5] }, "receivers": [ { "httpMethod": "GET", "receiverUrl": "http://mysite1.com?orderNum=${orderNumber}&orderVal=${orderValue}" } ] }
If the subscription creation is successful you will receive a 'HTTP Created 201' response code and a copy of the subscription settings in the response body. It will also include the subscriptionId assigned to the new subscription. Here is an example of a response body:
JSON:
{ "subscriptionId": "5485d003af4be0f76fbdddc8", "filter": { "eventTypeIds": [5] }, "receivers": [ { "httpMethod": "GET", "receiverUrl": "http://mysite1.com?orderNum=${orderNumber}&orderVal=${orderValue}", "disabled":false } ] }
XML:
<?xml version="1.0" encoding="UTF-8"?> <subscription> <subscriptionId>5485d003af4be0f76fbdddc8</subscriptionId> <filter> <eventTypeIds> <id>5</id> </eventTypeIds> </filter> <receivers> <receiver> <httpMethod>GET</httpMethod> <receiverUrl>http://mysite1.com?orderNum=${orderNumber}&orderVal=${orderValue}</receiverUrl> <disabled>false</disabled> </receiver> </receivers> <disabled>false</disabled> </subscription>
If something goes wrong we will attempt to explain the problem. See error management for details on error messages.
The update service allows you to edit existing subscriptions.
The syntax for the service is:
HTTPS PUT https://api.tradedoubler.com/1.0/conversions/subscriptions/{subscriptionId}?token={token}
There are two required keys in the request:
Name | Description | Type |
---|---|---|
subscriptionId | The ID of the subscription you want to update. | String |
token | Your unique token, identifying you as a service subscriber. | String |
You can use the same attributes as in the create service (see Message attributes for more information).
The information you include in the update request will overwrite all existing settings in the subscription. For this reason you must include all elements for the subscription, not just the ones you want to change.
Take the following example as an existing subscription:
{ "filter": { "programIds": [1234,5678], "eventIds": [1234,5678] }, "receivers": [ { "httpMethod": "GET", "receiverUrl": "http://mysite1.com?orderNum=${orderNumber}&orderVal=${orderValue}", "disabled":false } ] }
If you want to update the subscription by removing the programId 1234, you would use this request:
{ "filter": { "programIds": [5678], "eventIds": [1234,5678] }, "receivers": [ { "httpMethod": "GET", "receiverUrl": "http://mysite1.com?orderNum=${orderNumber}&orderVal=${orderValue}", "disabled":false } ] }
If the update is successful you will receive a 'HTTP OK 200' response code and a copy of the new subscription settings in the response body as follows:
{ "subscriptionId": "5485d003af4be0f76fbdddc8", "filter": { "programIds": [5678], "eventIds": [1234,5678] }, "receivers": [ { "httpMethod": "GET", "receiverUrl": "http://mysite1.com?orderNum=${orderNumber}&orderVal=${orderValue}", "disabled":false } ] }
XML:
<?xml version="1.0" encoding="UTF-8"?> <subscription> <subscriptionId>5485d003af4be0f76fbdddc8</subscriptionId> <filter> <programIds> <id>5678</id> </programIds> <eventIds> <id>1234</id> <id>5678</id> </eventIds> </filter> <receivers> <receiver> <httpMethod>GET</httpMethod> <receiverUrl>http://mysite1.com?orderNum=${orderNumber}&orderVal=${orderValue}</receiverUrl> <disabled>false</disabled> </receiver> </receivers> <disabled>false</disabled> </subscription>
When you no longer need a subscription you can delete it using the delete service.
The syntax for this service is:
HTTPS DELETE https://api.tradedoubler.com/1.0/conversions/subscriptions/{subscriptionId}?token={token}
There are two required keys in the request:
Name | Description | Type |
---|---|---|
subscriptionId | The ID of the subscription you want to delete. | String |
token | Your unique token, identifying you as a service subscriber. | String |
If the update is successful you will receive a 'HTTP OK 200' response code. There will be no response body.
You can search for subscriptions you already have set up using the list service.
The syntax for this service is:
HTTPS GET https://api.tradedoubler.com/1.0/conversions/subscriptions?token={token}
There is one required key in the request:
Name | Description | Type |
---|---|---|
token | Your unique token, identifying you as a service subscriber. | String |
This request will return the details for all of your subscriptions.
You can receive details of specific subscriptions by adding the subscriptionId parameter to the request as follows:
HTTPS GET https://api.tradedoubler.com/1.0/conversions/subscriptions/{subscriptionId}?token={token}
If the list request is successful you will receive a 'HTTP OK 200' response code and the search results in the response body. Full details will be returned for each subscription matching the search terms.
This is an example of a request for all subscriptions:
JSON:
[ { "subscriptionId": "5485d003af4be0f76fbdddc8", "filter": { "programIds": [5678], "eventIds": [1234,5678] }, "receivers": [ { "httpMethod": "GET", "receiverUrl": "http://mysite1.com?orderNum=${orderNumber}&orderVal=${orderValue}", "disabled":false } ] }, { "subscriptionId": "54c8dd9caf4bf61a0abb9466", "filter": { "programIds": [1234], "eventIds": [5678] }, "receivers": [ { "httpMethod": "GET", "receiverUrl": "http://mysite1.com?orderNum=${orderNumber}&orderVal=${orderValue}", "disabled":false } ] } ]
XML:
<?xml version="1.0" encoding="UTF-8"?> <subscriptions> <subscription> <subscriptionId>5485d003af4be0f76fbdddc8</subscriptionId> <filter> <programIds> <id>5678</id> </programIds> <eventIds> <id>1234</id> <id>5678</id> </eventIds> </filter> <receivers> <receiver> <httpMethod>GET</httpMethod> <receiverUrl>http://mysite1.com?orderNum=${orderNumber}&orderVal=${orderValue}</receiverUrl> <disabled>false</disabled> </receiver> </receivers> <disabled>false</disabled> </subscription> <subscription> <subscriptionId>54c8dd9caf4bf61a0abb9466</subscriptionId> <filter> <programIds> <id>1234</id> </programIds> <eventIds> <id>5678</id> </eventIds> </filter> <receivers> <receiver> <httpMethod>GET</httpMethod> <receiverUrl>http://mysite1.com?orderNum=${orderNumber}&orderVal=${orderValue}</receiverUrl> <disabled>false</disabled> </receiver> </receivers> <disabled>false</disabled> </subscription> </subscriptions>
This is an example of a request for a specific subscription
JSON:
{ "subscriptionId": "5485d003af4be0f76fbdddc8", "filter": { "programIds": [5678], "eventIds": [1234,5678] }, "receivers": [ { "httpMethod": "GET", "receiverUrl": "http://mysite1.com?orderNum={orderNumber}&orderVal={orderValue}", "disabled": false } ] }
XML:
<?xml version="1.0" encoding="UTF-8"?> <subscription> <subscriptionId>5485d003af4be0f76fbdddc8</subscriptionId> <filter> <programIds> <id>5678</id> </programIds> <eventIds> <id>1234</id> <id>5678</id> </eventIds> </filter> <receivers> <receiver> <httpMethod>GET</httpMethod> <receiverUrl>http://mysite1.com?orderNum=${orderNumber}&orderVal=${orderValue}</receiverUrl> <disabled>false</disabled> </receiver> </receivers> <disabled>false</disabled> </subscription>
If an error occurs we will try to explain it using these error codes:
Module | Error code | HTTP code | HTTP status | Description |
---|---|---|---|---|
Open API | 1 | 400 | Bad request | Missing token |
Open API | 2 | 403 | Forbidden | Invalid token |
Open API | 3 | 404 | Not found | Invalid API version |
Open API | 4 | 404 | Not found | Invalid module version |
Open API | 5 | 500 | Internal server error | Service not responding |
Open API | 6 | 404 | Not found | Missing version |
Open API | 7 | 404 | Not found | Missing module |
Conversions API | CON_200 | 403 | Forbidden | Subscription with ID {0} is not related to subscriber |
Conversions API | CON_210 | 404 | Not found | Subscription with ID {0} does not exist |
Conversions API | CON_220 | 404 | Not found | Program with ID {0} does not exist or is not active |
Conversions API | CON_230 | 403 | Forbidden | You do not have access to data for this program: {0} |
Conversions API | CON_240 | 403 | Forbidden | You do not have access to data for this event: {0} |
Conversions API | CON_250 | 400 | Bad request | Request must contain a receiver |
Conversions API | CON_260 | 400 | Bad request | Receiver must contain a request method |
Conversions API | CON_270 | 400 | Bad request | Invalid syntax used in receiverUrl: {0} |
Conversions API | CON_280 | 400 | Bad request | Unsupported protocol used in receiverUrl: {0} |
Conversions API | CON_290 | 400 | Bad request | Invalid syntax used in receiverBody {0} |
Conversions API | CON_300 | 405 | Method not allowed | HTTP method '{0}' is not supported for request |
Conversions API | CON_310 | 400 | Bad request | Request is syntactically incorrect |
Conversions API | CON_320 | 400 | Bad request | receiverFormat must be supplied for POST method |
Conversions API | CON_330 | 400 | Bad request | User of type {0} is not supported |
Conversions API | CON_340 | 500 | Internal server error | An unknown server-side error has occurred |
Conversions API | CON_350 | 400 | Bad request | Incorrect subscription content; field {0}. {1} |
Conversions API | CON_360 | 400 | Bad request | Content type {0} not supported |
Conversions API | CON_370 | 400 | Bad request | GET requests can not contain a receiverBody |
Conversions API | CON_380 | 400 | Bad request | GET requests can not contain a receiverFormat |
Conversions API | CON_390 | 400 | Bad request | {0} receiverFormat is not supported |
Conversions API | CON_400 | 400 | Bad request | The provided currency is not supported |
Conversions API | CON_410 | 400 | Bad request | At least one message type ID must be selected |
Conversions API | CON_420 | 400 | Bad request | Advertiser is not allowed to subscribe to message type: Payment Prepared(9) |
Conversions API | CON_430 | 400 | Bad request | You do not have access to data for this site ID: {0}. |
Conversions API | CON_440 | 400 | Bad request | {0} is not an accepted attribute. Please check the spelling. |
Other than the above, you can get generic HTTP errors. These are described here by W3C
The most common HTTP errors are:
HTTP code | HTTP status | Description |
---|---|---|
400 | Bad Request | Invalid XML, JSON or date format |
404 | Not Found | The URL does not exist |
405 | Method Not Allowed | Invalid HTTP method (e.g. GET instead of POST) |
406 | Not Acceptable | Requesting invalid content type (e.g text/plain instead of application/xml) |
415 | Unsupported Media Type | Sending invalid content type |
500 | Internal Server Error | Service down |
This section includes supporting material for you to use during implementation. Please get in touch with your Tradedoubler contact if you need anything else.
A transaction will move through different states during it's lifetime (e.g. tracked, pending and approved). Tradedoubler can send automated messages for each state and you can choose which ones you want to receive for each subscription. For example, you may wish to receive a message when a transaction is tracked and then when it becomes approved. Or you may wish to receive a message for every state so you can track every step of the journey. The table below provides an explanation of each message type.
Name | Description | messageTypeId |
---|---|---|
Tracked | The transaction has been tracked by Tradedoubler and passed validation. Once tracked a transaction can become invalid, paused, pending or tracked_approved. | 1 |
Invalid | The transaction failed one or more of Tradedoubler's validation tests. In some situations a transaction that has been tracked can still become invalid (e.g. if the transaction was paused, when becoming un-paused it will be validated again). | 2 |
Paused | The program related to the transaction is paused and so the transaction is held at this stage. | 3 |
Pending | The event related to the transaction has a pending period during which advertisers can amend, approve or deny the transaction (e.g. 30 days). | 4 |
Tracked_Approved | The event related to the transaction does not have a pending period so it instantly becomes approved. | 5 |
Pending_Approved | A transaction on a pending event has been approved. This can be done by the advertiser within the pending period or by Tradedoubler's systems at the end of the pending period. | 6 |
Paused_Deleted | If a paused program is closed without payment of invoices, existing paused transactions will be deleted. | 7 |
Deleted | A transaction has been denied during the pending period or subsequently deleted. | 8 |
Name | Description | Type |
---|---|---|
adId | Ad/banner ID. | Integer |
advertiserId | Tradedoubler advertiser organisation ID. | Integer |
autoApproveDate * | Date when the transaction will be auto-approved if not handled by the advertiser. | Date (ISO 8601) |
autoDenyDate * | Date when the transaction will be auto-denied if not handled by the advertiser. | Date (ISO 8601) |
batchId | ID of the batch file that contained the transaction. | Integer |
currencyId | Currency code. | String (ISO 4217) |
deniedReasonId * | Reason ID for denied transactions (provided by advertiser). See here for more information. | Integer |
epi | Extra publisher information. | String |
epi2 | Extra publisher information 2. | String |
eventId | Tradedoubler event ID. | Integer |
eventTypeId | Tradedoubler event type ID. | Integer |
locationId | Campaign ad location ID. | Integer |
mediaCost | Alternative method of assigning Tradedoubler commission for Technology clients. | Float |
messageTypeId | See here for a list of available IDs. | Integer |
orderNumber | The advertiser's unique order number. | String |
orderValue | Order value of the transaction. | Float |
pendingStatusDateChanged * | Date of changes to pending status (i.e. approved or denied). | Date (ISO 8601) |
productId | Product feed ID. | String |
productName | Taken from the reportInfo attribute. The advertiser's product name. Multiple items will be pipe delimited. | String |
productNumber | Taken from the reportInfo attribute. The advertiser's unique product ID (e.g. SKU). Multiple items will be pipe delimited. | String |
productQuantity | Taken from the reportInfo attribute. The quantity of the product purchased. Multiple items will be pipe delimited. | String |
productValue | Taken from the reportInfo attribute. The value of a single product. Multiple items will be pipe delimited. | String |
programCountry | Program country. | String |
programId | Tradedoubler program ID. | Integer |
publisherCommission | Publisher commission. | Float |
reportInfo ** | Report info (product information). Contains productNumber, productName, productValue and productQuantity as a single, concatenated string. Multiple items will be pipe delimited. | String |
sequenceNumber | Messages for the same transaction may be received out of order. The sequenceNumber can be used to identify the correct order of messages for a given transaction. | String |
siteId | Publisher site ID. | Integer |
siteName | Publisher site name. | String |
tdCommission | Tradedoubler commission. | Float |
timeOfEvent | Time of conversion (i.e. lead, sale, in-app event, etc.). | Date (ISO 8601) |
timeOfVisit | Time of visit (i.e. impression or click). For post-click validation this will be populated with the time of click. For post-impression validation this will be populated with time of impression. | Date (ISO 8601) |
transactionId | Unique transaction ID. Composed of orderNumber_eventId_advertiserId. | String |
visitorId ** | Visitor ID set at the time of impression/click. Called TDUID (Tradedoubler Unique ID). | String |
ID | Description |
---|---|
4 | Post-click lead |
5 | Post-click sale |
9 | Post-impression lead |
10 | Post-impression sale |
ID | Description |
---|---|
1 | Accepted manually |
2 | Accepted through batch |
3 | Accepted by auto-approve |
4 | Denied by auto-deny |
5 | Deleted by affiliate denial |
6 | Application/credit check denied |
7 | Fraudulent order/application |
8 | Duplication/sale accredited to another source |
9 | Order yet to be fulfilled |
10 | Returned goods |
11 | Out of stock |
12 | Unfulfilled payment |
13 | Invalid lead |
14 | Order cancelled |
15 | Callback number shown |
16 | Insufficient information |
17 | Order not found |
18 | Sale already accredited to publisher |
19 | Voucher incorrectly used |
21 | Accepted using API |
22 | Deleted using API |