This documentation has been archived and may contain outdated information. For the latest API details and enhanced functionality, please visit our new LeadDyno REST API documentation.
In this article
Overview
Resources
- Visitors
- Leads
- Purchases
- Commissions
-
Affiliates
- Get all affiliates
- Get a count of all affiliates
- Create a new affiliate
- Get an affiliate by email
- Get an affiliate by ID
- Get an affiliate by affiliate code
- Update an affiliate
- Get all leads for an affiliate
- Get all commissions for an affiliate
- Get commissions for an affiliate filtering by status
- Get the commission total for an affiliate
- Create a commission for an affiliate
- Archive an affiliate
- Unarchive an affiliate
- Sub IDs
- Campaigns
- Custom Fields
Overview
LeadDyno offers a REST-ful API for integration with your website. It has predictable, resource-based URLs and utilizes standard HTTP response codes and verbs.
Authentication
All calls to the LeadDyno API must include a key
parameter which is set to your private key, available in the Account - Profile section of the application.
Error Handling
LeadDyno uses standard HTTP Error codes to communicate errors.
When an error occurs, we strive to provide useful context information in the body of the response, as shown in the following examples:
Example Error Bodies: // General errors will be described with a string {"error":"A Descriptive Error Message"} // More specific errors are typically nested in a hash, // with the key being the bad field {"error":{"email":["is invalid"]}}
Versioning
The LeadDyno API is versioned via a path prefix.
The current version of the API is 1.0
and it is available at
https://api.leaddyno.com/v1/
Parameters
Parameters can be passed to the LeadDyno API as query parameters, form-encoded or JSON format, as appropriate for the HTTP verb.
Required parameters are bolded. All other parameters are optional.
Limits
The API limit is 200 requests per minute.
Resources
Visitors
Visitors are unique visitors to your website and are typically created with the LeadDyno javascript library, although you may wish to create them yourself if you are implementing a pure server-to-server integration with LeadDyno.
Visitors may be associated with an affiliate, campaign, and/or other sources.
affiliate | - | A minimal affiliate object associated with the visitor |
campaign | - | A minimal campaign object associated with the visitor |
created_at | - | When the visitor was created |
id | - | The visitor's ID |
lead | - | A minimal lead associated with the visitor |
referrer | - | The HTTP referrer object associated with the visitor |
search_term | - | The search term associated with the visitor |
tracking_code | - | The unique tracking code associated with the visitor |
updated_at | - | When the visitor was last updated |
url | - | The initial URL that the visitor landed on |
Base URL: https://api.leaddyno.com/v1/visitors Example Object: { "affiliate": { "email": "example@example.com", "id": 20, }, "campaign": { "code": "UserRecommendations", "id": 11, }, "created_at": "2013-04-08T21:47:35Z", "id": 1177, "lead": { "email": "8-6-1@test.com", "id": 32 }, "referrer": null, "search_term": null, "tracking_code": "72e2b089e149a14f5d67252059273241400b6f9c", "updated_at": "2013-04-08T21:47:35Z", "url": { "id": 1, "url": "http://example.com/demo" } }
page
parameter to request additional pages.Parameters
page | The page to return |
Definition: GET https://api.leaddyno.com/v1/visitors Curl: $ curl https://api.leaddyno.com/v1/visitors -G -d key=[YOUR_PRIVATE_KEY] Response: [ { "affiliate": { "email": "testaffiliate1715@leaddyno.com", "id": 20 }, "campaign": { "code": "UserRecommendations", "id": 11 }, "created_at": "2013-04-08T21:47:35Z", "id": 1178, "lead": null, "referrer": null, "search_term": null, "tracking_code": "72e2b089e149a14f5d67252059273241400b6f9c", "updated_at": "2013-04-08T21:47:35Z", "url": null }, ... ]
Get a count of all visitors
Definition: GET https://api.leaddyno.com/v1/visitors/count Curl: $ curl https://api.leaddyno.com/v1/visitors/count -G -d key=[YOUR_PRIVATE_KEY] Response: {"count":2342}
Create a new visitor
Creates a new visitor and returns the visitor
Parameters
agent | The user agent string of the visitor's browser |
code | An affiliate code |
referrer | The HTTP referrer of the visitor |
remote_ip | The remote IP of the visitor |
tracking_code | A unique tracking code for this visitor. (One will be generated and returned if it is not provided.) |
url | The initial URL the visitor arrived on (including query parameters) |
Definition: POST https://api.leaddyno.com/v1/visitors Curl: $ curl https://api.leaddyno.com/v1/visitors -d key=[YOUR_PRIVATE_KEY] -d url=http://example.com Response: { "id": 1454, "created_at": "2013-05-22T04:45:00Z", "updated_at": "2013-05-22T04:45:00Z", "tracking_code": "ebc4eb90-2805-4347-85ed-c71c62c377bc", "lead": null, "url": { "id": 49, "url": "http://example.com" }, "referrer": null, "affiliate": null, "campaign": null, "search_term": null }
Create many visitors
Takes a JSON array of objects with properties identical to the parameters in the Create endpoint.
Definition: POST https://api.leaddyno.com/v1/visitors/import Curl: $ curl https://api.leaddyno.com/v1/visitors/import -X POST -H "Content-Type:application/json" \ -d '{"key":"[YOUR_PRIVATE_KEY]",\ "visitors":[{"url":"http://example.com"},\ {"url":"http://example.com"}]}' Response: [ { "id": 1457, "created_at": "2013-05-22T05:59:29Z", "updated_at": "2013-05-22T05:59:29Z", "tracking_code": "49b03cee-b430-4e6f-a441-864430d6588c", "url": { "id": 49, "url": "http://example.com" }, "referrer": null, "affiliate": null, "campaign": null, "search_term": null }, ... ]
Get a visitor by tracking code
tracking_code | The tracking code of the visitor |
Definition: GET https://api.leaddyno.com/v1/visitors/by_tracking_code Curl: $ curl https://api.leaddyno.com/v1/visitors/by_tracking_code -G \ -d key=[YOUR_PRIVATE_KEY] \ -d tracking_code=49b03cee-b430-4e6f-a441-864430d6588c Response: {"id": 1457, "created_at": "2013-05-22T05:59:29Z", "updated_at": "2013-05-22T05:59:29Z", "tracking_code": "49b03cee-b430-4e6f-a441-864430d6588c", "url": { "id": 49, "url": "http://example.com" }, "referrer": null, "affiliate": null, "campaign": null, "search_term": null }
Get a visitor by ID
Definition: GET https://api.leaddyno.com/v1/visitors/{:id} Curl: $ curl https://api.leaddyno.com/v1/visitors/1457 -G \ -d key=[YOUR_PRIVATE_KEY] Response: {"id": 1457, "created_at": "2013-05-22T05:59:29Z", "updated_at": "2013-05-22T05:59:29Z", "tracking_code": "49b03cee-b430-4e6f-a441-864430d6588c", "url": { "id": 49, "url": "http://example.com" }, "referrer": null, "affiliate": null, "campaign": null, "search_term": null }
Leads
Leads are visitors to your site that have given you an email address. As with visitors, the recommended pattern is that they are created using the LeadDyno javascript library, however, you can implement your own lead capture logic if you wish.
Leads may be associated with an affiliate, campaign, and/or other sources.
Leads typically have a visitor associated with them, but not always (e.g. if they were created manually).
Fields
affiliate | A minimal affiliate object associated with the lead |
campaign | A minimal campaign object associated with the lead |
custom_status | A custom, user-defined status of the lead |
created_at | When the lead was created |
The lead's email | |
first_name | The first name of the lead |
id | The lead ID |
last_name | The last name of the lead |
referrer | The HTTP referrer object associated with the visitor |
search_term | The search term associated with the visitor |
status | The LeadDyno status of the lead ('Customer' or 'Registered') |
tracking_code | The unique tracking code associated with the visitor |
updated_at | When the visitor was last updated |
url | The initial URL that the visitor landed on |
Base URL: https://api.leaddyno.com/v1/leads Example Object: { "id": 13072, "email": "test-8-17-11@test.com", "created_at": "2012-08-17T21:46:13Z", "updated_at": "2013-05-14T06:36:28Z", "status": "Registered", "custom_status": null, "first_name": null, "last_name": null, "latest_visitor": { "id": 191, "tracking_code": "b7855c0727c72c23a771129670329954da050219" }, "url": null, "referrer": null, "affiliate": { "id": 17, "email": "aff1_1359503627_per@leaddyno.com" }, "campaign": null, "search_term": null, "tracking_code": "b7855c0727c72c23a771129670329954da050219" }
Get all leads
page
parameter to request additional pages. page | The page to return |
created_before | Only return records created before the given date Date format: 2020-06-20 21:28:35 UTC |
created_after | Only return records created after the given date Date format: 2020-06-20 21:28:35 UTC |
Definition: GET https://api.leaddyno.com/v1/leads Curl: $ curl https://api.leaddyno.com/v1/leads -G \ -d key=[YOUR_PRIVATE_KEY] Response: [ { "id": 2, "email": "example@example.com", "created_at": "2012-07-27T21:30:51Z", "updated_at": "2012-07-27T21:30:51Z", "status": "Registered", "custom_status": null, "first_name": null, "last_name": null, "latest_visitor": null, "url": null, "referrer": null, "affiliate": null, "campaign": null, "search_term": null, "tracking_code": null }, ... ]
Get a count of all leads
Definition: GET https://api.leaddyno.com/v1/leads/count Curl: $ Curl: https://api.leaddyno.com/v1/leads/count -G -d key=[YOUR_PRIVATE_KEY] Response: {"count":169}
Create a new lead
Creates a new lead and returns it in JSON form.
Parameters
agent | The user agent string of the visitor's browser |
code | An affiliate code |
Required The email of the lead | |
referrer | The HTTP referrer of the visitor |
remote_ip | The remote IP of the visitor |
tracking_code | The unique tracking code for this lead. (One will be generated and returned if it is not provided.) |
url | The initial URL the visitor arrived on (including query parameters) |
Definition: POST https://api.leaddyno.com/v1/leads Curl: $ curl https://api.leaddyno.com/v1/leads \ -d key=[YOUR_PRIVATE_KEY] \ -d email=example@example.com Response: { "id": 14376, "email": "example@example.com", "created_at": "2013-05-23T22:18:42Z", "updated_at": "2013-05-23T22:18:42Z", "status": "Registered", "custom_status": null, "first_name": null, "last_name": null, "latest_visitor": { "id": 1459, "tracking_code": "5b6d32b4-8b29-4060-bb73-800c4f8b2b4f" }, "url": null, "referrer": null, "affiliate": null, "campaign": null, "search_term": null, "tracking_code": "5b6d32b4-8b29-4060-bb73-800c4f8b2b4f" }
Create many leads
Takes a JSON array of objects with properties identical to the parameters in the Create endpoint.
Definition: POST https://api.leaddyno.com/v1/leads/import Curl: $ curl https://api.leaddyno.com/v1/leads/import -X POST -H "Content-Type:application/json" \ -d '{"key":"[YOUR_PRIVATE_KEY]",\ "leads":[{"email":"example2@example.com"}, {"email":"example3@example.com"}]}' Response: [ { "id": 14377, "email": "example2@example.com", "created_at": "2013-05-23T22:25:10Z", "updated_at": "2013-05-23T22:25:10Z", "status": "Registered", "custom_status": null, "first_name": null, "last_name": null, "latest_visitor": { "id": 1461, "tracking_code": "e51931e1-49a7-451c-acf3-aeca2dc2d2ed" }, "url": null, "referrer": null, "affiliate": null, "campaign": null, "search_term": null, "tracking_code": "e51931e1-49a7-451c-acf3-aeca2dc2d2ed" }, ... ]
Get a lead by email
The tracking code of the visitor |
Definition: GET https://api.leaddyno.com/v1/leads/by_email Curl: $ curl https://api.leaddyno.com/v1/leads/by_email -G \ -d key=[YOUR_PRIVATE_KEY] \ -d email=example@example.com Response: { "id": 14377, "email": "example2@example.com", "created_at": "2013-05-23T22:25:10Z", "updated_at": "2013-05-23T22:25:10Z", "status": "Registered", "custom_status": null, "first_name": null, "last_name": null, "latest_visitor": { "id": 1461, "tracking_code": "e51931e1-49a7-451c-acf3-aeca2dc2d2ed" }, "url": null, "referrer": null, "affiliate": null, "campaign": null, "search_term": null, "tracking_code": "e51931e1-49a7-451c-acf3-aeca2dc2d2ed" }
Get a lead by ID
Definition: GET https://api.leaddyno.com/v1/leads/{:id} Curl: $ curl https://api.leaddyno.com/v1/leads/14377 -G \ -d key=[YOUR_PRIVATE_KEY] Response: { "id": 14377, "email": "example2@example.com", "created_at": "2013-05-23T22:25:10Z", "updated_at": "2013-05-23T22:25:10Z", "status": "Registered", "custom_status": null, "first_name": null, "last_name": null, "latest_visitor": { "id": 1461, "tracking_code": "e51931e1-49a7-451c-acf3-aeca2dc2d2ed" }, "url": null, "referrer": null, "affiliate": null, "campaign": null, "search_term": null, "tracking_code": "e51931e1-49a7-451c-acf3-aeca2dc2d2ed" }
Update a lead
The email address of the lead | |
first_name | The first name of the lead |
last_name | The last name of the lead |
custom_status | The user-defined custom status of the lead |
Definition: PUT https://api.leaddyno.com/v1/leads/{:id} Curl: $ curl https://api.leaddyno.com/v1/leads/14377 -X PUT \ -d key=[YOUR_PRIVATE_KEY] \ -d custom_status=party_rockin Response: { "id": 14377, "email": "example2@example.com", "created_at": "2013-05-23T22:25:10Z", "updated_at": "2013-05-23T22:39:04Z", "status": "Registered", "custom_status": "party_rockin", "first_name": null, "last_name": null, "latest_visitor": { "id": 1461, "tracking_code": "e51931e1-49a7-451c-acf3-aeca2dc2d2ed" }, "url": null, "referrer": null, "affiliate": null, "campaign": null, "search_term": null, "tracking_code": "e51931e1-49a7-451c-acf3-aeca2dc2d2ed" }
Get all purchases for a lead
Description
Returns a list of purchases for a specific lead.
Parameters
Parameter | Description | Required |
id | The Lead ID | yes |
page |
Specifies the page number for retrieving paginated results. Each page contains up to 100 records. Default: 1 |
No |
include_line_items |
When set to |
No |
Definition
GET https://api.leaddyno.com/v1/leads/{:id}/purchases
Example
curl https://api.leaddyno.com/v1/leads/14377/purchases -G \
-d key=[YOUR_PRIVATE_KEY]
Response
[{
"id": 899,
"created_at": "2024-06-24T12:27:54Z",
"updated_at": "2024-07-15T18:33:45Z",
"cancelled": false,
"currency": "USD",
"purchase_code": "767478658",
"note": null,
"purchase_amount": "193.51",
"commission_amount_override": null,
"cancellation": null,
"lead": {
"id": 1557,
"email": "lead14377@example.com"
},
"affiliate": {
"id": 17168,
"email": "affiliate@example.com"
},
"plan": {
"id": 30,
"code": "default"
},
"line_items": [
{
"sku": "SKU-184",
"description": "Rerum et explicabo.",
"quantity": "7.0",
"amount": "805.97"
},
{
"sku": "SKU-369",
"description": "Et ut.",
"quantity": "2.0",
"amount": "27.18"
},
...]
},
...]
Cancel all purchases for a lead
source | A user-defined string defining where the cancellation is coming from |
effective_date | The effective date of the cancellation (defaults to now) |
cancellation_code | A user-supplied cancellation code (optional, if none is given one will be generated) |
Definition: DELETE https://api.leaddyno.com/v1/leads/{:id}/purchases Curl: $ curl https://api.leaddyno.com/v1/leads/14377/purchases -X DELETE \ -d key=[YOUR_PRIVATE_KEY] Response: [ { "id": 233, "created_at": "2013-05-04T22:55:04Z", "updated_at": "2013-05-23T23:20:30Z", "cancelled": true, "purchase_code": "2ae9ff57-531b-4b84-9d91-48eebd221147", "note": null, "purchase_amount": "1000.0", "commission_amount_override": null, "cancellation": { "id": 7, "cancellation_code": "46444178-ab04-4172-938e-0dc55991accb", "effective_date": "2013-05-24T04:28:04Z", "source": null }, "lead": { "id": 14372, "email": "a@b.com" }, "affiliate": { "id": 58, "email": "affiliate@example.com" }, ... ]
Purchases
Purchases are what convert leads into Customers and create affiliate compensation
Leads into Customers and create affiliate compensation | Fields
affiliate | A minimal affiliate object associated with the purchase |
cancellation | Cancellation data |
cancelled | true if the purchase has been canceled |
commission_amount_override | An immediate commissions override amount (optional) |
created_at | When the purchase was created |
id | The purchase ID |
lead | The lead that made the purchase |
plan | The compensation plan that the purchase was made at |
purchase_amount | The amount of the purchase (optional, required only for percentage calculations) |
purchase_code | The purchase code for the purchase |
note | Any notes associated with the purchase |
updated_at | When the visitor was last updated |
Base URL: https://api.leaddyno.com/v1/purchases Example Object: { "id": 225, "created_at": "2013-04-23T21:20:27Z", "updated_at": "2013-05-15T16:40:16Z", "cancelled": true, "purchase_code": "c92e8c80-f45a-4cb6-8949-674f56d792d7", "note": null, "purchase_amount": null, "commission_amount_override": null, "cancellation": { "id": 4 }, "lead": { "id": 14361, "email": "4-23-13-1@test.com" }, "affiliate": null, "plan": { "id": 7, "code": "basic" } }
Get all purchases
Description
Returns a list of all purchases. The purchases are returned in sorted order, with the most recent purchases last, 100 at a time. You can use the page
parameter to request additional pages.
Parameters
Parameter | Description | Required |
page |
Specifies the page number for retrieving paginated results. Each page contains up to 100 records. Default: 1 |
No |
created_after |
Filters purchases to include only those created after the specified timestamp. It is exclusive, meaning it will not include purchases created exactly at the specified time. Type: String (ISO 8601 format) Example: |
No |
created_before |
Filters purchases to include only those created before the specified timestamp. It is exclusive, meaning it will not include purchases created exactly at the specified time. Type: String (ISO 8601 format) Example: |
No |
include_line_items |
When set to |
No |
affiliates_only | When set to true , it returns only purchases referred by affiliates. Default: false
|
No |
Definition
GET https://api.leaddyno.com/v1/purchases
Example
curl https://api.leaddyno.com/v1/purchases -G \
-d key=[YOUR_PRIVATE_KEY] \
-d created_after="2024-06-24T12:26" \
-d created_before="2024-06-24T12:28" \
-d include_line_items=false \
-d affiliates_only=false
Response
[{
"id": 899,
"created_at": "2024-06-24T12:27:54Z",
"updated_at": "2024-07-15T18:33:45Z",
"cancelled": false,
"currency": "USD",
"purchase_code": "767478658",
"note": null,
"purchase_amount": "193.51",
"commission_amount_override": null,
"cancellation": null,
"lead": {
"id": 1557,
"email": "lead14377@example.com"
},
"affiliate": {
"id": 17168,
"email": "affiliate@example.com"
},
"plan": {
"id": 30,
"code": "default"
},
"line_items": [
{
"sku": "SKU-184",
"description": "Rerum et explicabo.",
"quantity": "7.0",
"amount": "805.97"
},
{
"sku": "SKU-369",
"description": "Et ut.",
"quantity": "2.0",
"amount": "27.18"
},
...]
},
...]
Get a count of all purchases
Definition: GET https://api.leaddyno.com/v1/purchases/count Curl: $ curl https://api.leaddyno.com/v1/purchases/count -G \ -d key=[YOUR_PRIVATE_KEY] Response: {"count":88}
Create a new purchase
Creates a new purchase and returns it in JSON form.
Parameters
The email of the customer who made the purchase | |
purchase_code | A unique identifier for this purchase (optional, a unique id will be generated if not supplied) |
purchase_amount | The purchase amount (optional, used for percentage commission calculations) |
plan_code | The code of the commission plan to use when calculating affiliate commissions |
code | The code of the affiliate you want the purchase to be assigned to (optional, and will depend on first source wins settings etc) |
commission_amt_override | A commission amount that will create an immediate fixed-amount commission associated with the purchase, overriding any plan definition. |
description | A text description of the purchase. |
Definition: POST https://api.leaddyno.com/v1/purchases Curl: $ curl https://api.leaddyno.com/v1/purchases \ -d key=[YOUR_PRIVATE_KEY] \ -d email=example@example.com Response: { "id": 237, "created_at": "2013-05-23T23:34:04Z", "updated_at": "2013-05-23T23:34:04Z", "cancelled": false, "purchase_code": "3382740b-4778-44dc-9f2f-c2b32999f7bf", "note": null, "purchase_amount": null, "commission_amount_override": null, "cancellation": null, "lead": { "id": 14376, "email": "example@example.com" }, "affiliate": null, "plan": { "id": 7, "code": "basic" } }
Create a new purchase with line items
The email of the customer who made the purchase | |
purchase_code | A unique identifier for this purchase (optional, a unique id will be generated if not supplied) |
purchase_amount | The purchase amount (optional, used for percentage commission calculations) |
line_items | Array of line_items objects which include SKU, quantity, description, and amount. |
plan_code | The code of the commission plan to use when calculating affiliate commissions |
code | The code of the affiliate you want the purchase to be assigned to (optional, and will depend on first source wins settings etc) |
commission_amount_override | A commission amount that will create an immediate fixed-amount commission associated with the purchase, overriding any plan definition. |
description | A text description of the purchase. |
Definition: POST https://api.leaddyno.com/v1/purchases Curl: $ curl -H "Content-Type: application/json" https://api.leaddyno.com/v1/purchases \ -d '{"key":"[YOUR_PRIVATE_KEY]", "email":"purchaser@example.com", "purchase_amount":"50", "purchase_code": "PURCH001", "line_items":[ {"sku":"sku1","quantity":"2","description":"Product One","amount":"15"}, {"sku":"sku2", "quantity":"1","description":"Product Two","amount":"20"} ] }' Response: { "id": 237, "created_at": "2013-05-23T23:34:04Z", "updated_at": "2013-05-23T23:34:04Z", "cancelled": false, "purchase_code": "PURCH001", "note": null, "purchase_amount": 50, "commission_amount_override": null, "cancellation": null, "lead": { "id": 14376, "email": "purchaser@example.com" }, "affiliate": null, "plan": { "id": 7, "code": "basic" } }
Get a purchase by purchase code
Description
Retrieves detailed information about a specific purchase identified by its purchase code.
Parameters
Parameter | Description | Required |
purchase_code | The unique identifier for a purchase | yes |
include_line_items |
When set to |
No |
Definition
GET https://api.leaddyno.com/v1/purchases/by_purchase_code
Example
curl https://api.leaddyno.com/v1/purchases/by_purchase_code -G \
-d key=[YOUR_PRIVATE_KEY] \
-d purchase_code=7da9e8e7-84c8-431d-9535-8a6171c3824d
Response
[{
"id": 899,
"created_at": "2024-06-24T12:27:54Z",
"updated_at": "2024-07-15T18:33:45Z",
"cancelled": false,
"currency": "USD",
"purchase_code": "7da9e8e7-84c8-431d-9535-8a6171c3824d",
"note": null,
"purchase_amount": "193.51",
"commission_amount_override": null,
"cancellation": null,
"lead": {
"id": 1557,
"email": "lead14377@example.com"
},
"affiliate": {
"id": 17168,
"email": "affiliate@example.com"
},
"plan": {
"id": 30,
"code": "default"
},
"line_items": [
{
"sku": "SKU-184",
"description": "Rerum et explicabo.",
"quantity": "7.0",
"amount": "805.97"
},
{
"sku": "SKU-369",
"description": "Et ut.",
"quantity": "2.0",
"amount": "27.18"
},
...]
},
...]
Get a purchase by ID
Description
Retrieves detailed information about a specific purchase identified by its ID.
Parameters
Parameter | Description | Required |
id | The purchase ID | yes |
include_line_items |
When set to |
No |
Definition
GET https://api.leaddyno.com/v1/purchases/{:id}
Example
curl https://api.leaddyno.com/v1/purchases/{:id} -G \
-d key=[YOUR_PRIVATE_KEY]
Response
[{
"id": 899,
"created_at": "2024-06-24T12:27:54Z",
"updated_at": "2024-07-15T18:33:45Z",
"cancelled": false,
"currency": "USD",
"purchase_code": "767478658",
"note": null,
"purchase_amount": "193.51",
"commission_amount_override": null,
"cancellation": null,
"lead": {
"id": 1557,
"email": "lead14377@example.com"
},
"affiliate": {
"id": 17168,
"email": "affiliate@example.com"
},
"plan": {
"id": 30,
"code": "default"
},
"line_items": [
{
"sku": "SKU-184",
"description": "Rerum et explicabo.",
"quantity": "7.0",
"amount": "805.97"
},
{
"sku": "SKU-369",
"description": "Et ut.",
"quantity": "2.0",
"amount": "27.18"
},
...]
},
...]
Get all commissions from a purchase
Description
Retrieves information about commissions from a specific purchase.
Parameters
Parameter | Description | Required |
id | The purchase ID | yes |
page |
Specifies the page number for retrieving paginated results. Each page contains up to 10 records. Default: 1 |
No |
Definition
GET https://api.leaddyno.com/v1/purchases/{:id}/commissions
Example
curl https://api.leaddyno.com/v1/purchases/{:id}/commissions -G \
-d key=[YOUR_PRIVATE_KEY]
Response
Response: [
{ "id": 1, "amount": "20.0", "currency": "USD", "cancelled": true, "paid": false, "purchase": { "id": 134499228, ... }, "affiliate": { "id": 6678456, ... } },
...
]
Cancel a purchase by ID
source | A user-defined string defining where the cancellation is coming from |
effective_date | The effective date of the cancellation (defaults to now) |
cancellation_code | A user-supplied cancellation code (optional, if none is given one will be generated) |
Definition: DELETE https://api.leaddyno.com/v1/purchases/{:id} Curl: $ curl https://api.leaddyno.com/v1/purchases/207 -X DELETE \ -d source=api \ -d key=[YOUR_PRIVATE_KEY] Response: { "id":207, "created_at":"2013-04-22T22:41:16Z", "updated_at":"2013-05-23T23:20:29Z", "cancelled":true, "purchase_code":"7da9e8e7-84c8-431d-9535-8a6171c3824d", "note":null, "purchase_amount":null, "commission_amount_override":null, "cancellation":{ "id":103, "cancellation_code":"f668e05b-1528-4bf8-9547-cffec7dc3da9", "effective_date":"2013-05-24T04:12:02Z", "source":"api" }, "lead":{ "id":14311, "email":"example@example.com" }, "affiliate":{ "id":17, "email":"affiliate@example.com" }, "plan":{ "id":7, "code":"basic" } }
Commissions
Get all commissions
page | Which page you are requesting. |
per_page | The number of records per page. |
Definition: GET https://api.leaddyno.com/v1/commissions Curl: $ curl https://api.leaddyno.com/v1/commissions -G \ -d key=[YOUR_PRIVATE_KEY] Response: { "page": 1, "per_page": 100, "commissions": [{ "id": 1, "amount": "20.0", "currency": "USD", "cancelled": true, "paid": false, "purchase": { "id": 134499228, ... }, "affiliate": { "id": 6678456, ... } }] }
Get commission totals
start_date | The start date of the range of commissions that you are requesting. Format as: "yyyy-mm-dd". Defaults to the beginning of time. |
end_date | The end date of the range of commissions that you are requesting. Format as: "yyyy-mm-dd". Defaults to the present time. |
Definition: GET https://api.leaddyno.com/v1/commissions/totals Curl: $ curl https://api.leaddyno.com/v1/commissions/totals -G \ -d start_date=2019-09-30 \ -d end_date=2020-09-30 \ -d key=[YOUR_PRIVATE_KEY] Response: { "total_count": 130, "total_cancelled_count": 52, "total_due_count": 44, "total_paid_count": 34, "total_cost": "78351.69", "total_cancelled_cost": "640.88", "total_due_cost": "1807.16", "total_paid_cost": "75903.65" }
Affiliates
affiliate_url | The affiliate link for this affiliate, which they can use to drive traffic to your site and which will be tied back to them. |
affiliate_dashboard_url | The affiliate dashboard URL for this affiliate, which the affiliate can use to track their progress, share their affiliate link, etc. |
created_at | When the affiliate was created |
The email of the affiliate | |
first_name | The first name of the affiliate |
id | The affiliate ID |
last_name | The last name of the affiliate |
updated_at | When the affiliate was last updated |
referring_affiliate | the email of the referring affiliate, if any |
total_leads | the total number of leads associated with the affiliate |
total_visitors | the total number of visitors associated with the affiliate |
total_purchases | the total number of purchases associated with the affiliate |
Base URL: https://api.leaddyno.com/v1/affiliates Example Object: { "id": 47, "email": "example@example.com", "first_name": "", "last_name": "", "created_at": "2013-01-16T23:46:35Z", "updated_at": "2013-01-16T23:46:35Z", "affiliate_url": "http://examplesite.com?afmc=aacaceaea97000c42fdfe145765debc5884f6558", "affiliate_dashboard_url": "https://app.leaddyno.com/p/f3007c9507a4faa1036be113d5a1cce3be648b24" }
Get all affiliates
page
parameter to request additional pages. page | The page to return |
created_before | Only return records created before the given date Date format: 2020-06-20 21:28:35 UTC |
created_after | Only return records created after the given date Date format: 2020-06-20 21:28:35 UTC |
Definition: GET https://api.leaddyno.com/v1/affiliates Curl: $ curl https://api.leaddyno.com/v1/affiliates -G \ -d key=[YOUR_PRIVATE_KEY] Response: [ { "id": 47, "email": "example@example.com", "first_name": "", "last_name": "", "created_at": "2013-01-16T23:46:35Z", "updated_at": "2013-01-16T23:46:35Z", "affiliate_url": "http://examplesite.com?afmc=aacaceaea97000c42fdfe145765debc5884f6558", "affiliate_dashboard_url": "https://app.leaddyno.com/p/f3007c9507a4faa1036be113d5a1cce3be648b24" }, ... ]
Get a count of all affiliates
Definition: GET https://api.leaddyno.com/v1/affiliates/count Curl $ curl https://api.leaddyno.com/v1/affiliates/count -G -d key=[YOUR_PRIVATE_KEY] Response: {"count":35}
Create a new affiliate
Creates a new affiliate and returns it in JSON form. If an affiliate with the given email already exists it will be returned unchanged.
Parameters
The email of the affiliate | |
first_name | The first name of the affiliate |
last_name | The last name of the affiliate |
affiliate_code | A custom, user-generated, unique affiliate code for the affiliate (can be used as a discount code) |
affiliate_type | The affiliate type/group that this affiliate should be |
paypal_email | The PayPal email of this affiliate (if different) |
Definition: POST https://api.leaddyno.com/v1/affiliates Curl: $ curl https://api.leaddyno.com/v1/affiliates \ -d key=[YOUR_PRIVATE_KEY] \ -d email=example@example.com Response: { "id": 289, "email": "example@example.com", "first_name": null, "last_name": null, "created_at": "2013-05-24T05:28:24Z", "updated_at": "2013-05-24T05:28:24Z", "affiliate_url": "https://api.leaddyno.com/demo?afmc=fa314a936cf254401a998926cc2b7c423f669eb7", "affiliate_dashboard_url": "https://api.leaddyno.com/p/6a2b4f844d3bd4a4fbe389172253c9b956c792df" }
Get an affiliate by email
The email of the affiliate |
Definition: GET https://api.leaddyno.com/v1/affiliates/by_email Curl: $ curl https://api.leaddyno.com/v1/affiliates/by_email -G \ -d email=example@example.com \ -d key=[YOUR_PRIVATE_KEY] Response: { "id": 289, "email": "example@example.com", "first_name": null, "last_name": null, "created_at": "2013-05-24T05:28:24Z", "updated_at": "2013-05-24T05:28:24Z", "affiliate_url": "https://api.leaddyno.com/demo?afmc=fa314a936cf254401a998926cc2b7c423f669eb7", "affiliate_dashboard_url": "https://api.leaddyno.com/p/6a2b4f844d3bd4a4fbe389172253c9b956c792df" }
Get an affiliate by ID
Definition: GET https://api.leaddyno.com/v1/affiliates/{:id} Curl: $ curl https://api.leaddyno.com/v1/affiliates/289 -G \ -d key=[YOUR_PRIVATE_KEY] Response: { "id": 289, "email": "example@example.com", "first_name": null, "last_name": null, "created_at": "2013-05-24T05:28:24Z", "updated_at": "2013-05-24T05:28:24Z", "affiliate_url": "https://api.leaddyno.com/demo?afmc=fa314a936cf254401a998926cc2b7c423f669eb7", "affiliate_dashboard_url": "https://api.leaddyno.com/p/6a2b4f844d3bd4a4fbe389172253c9b956c792df" }
Get an affiliate by affiliate code
Definition: GET https://api.leaddyno.com/v1/affiliates/by_affiliate_code Curl: $ curl https://api.leaddyno.com/v1/affiliates/by_affiliate_code -G \ -d affiliate_code=robin_affiliate_code \ -d key=[YOUR_PRIVATE_KEY] Response: { "id": 289, "email": "example@example.com", "first_name": null, "last_name": null, "created_at": "2013-05-24T05:28:24Z", "updated_at": "2013-05-24T05:28:24Z", "affiliate_url": "https://api.leaddyno.com/demo?afmc=fa314a936cf254401a998926cc2b7c423f669eb7", "affiliate_dashboard_url": "https://api.leaddyno.com/p/6a2b4f844d3bd4a4fbe389172253c9b956c792df" }
Update an affiliate
The email of the affiliate | |
first_name | The first name of the affiliate |
last_name | The last name of the affiliate |
affiliate_code | A custom, user-generated, unique affiliate code for the affiliate (can be used as a discount code) |
affiliate_type | The affiliate type/group that this affiliate should be |
paypal_email | The PayPal email of this affiliate (if different) |
Definition: PUT https://api.leaddyno.com/v1/affiliates/{:id} Curl: $ curl https://api.leaddyno.com/v1/affiliates/289 -X PUT \ -d key=[YOUR_PRIVATE_KEY] \ -d first_name=Joe Response: { "id":289, "email":"example@example.com", "first_name":"Joe", "last_name":null, "created_at":"2013-05-24T05:28:24Z", "updated_at":"2013-05-24T05:40:32Z", "affiliate_url":"https://api.leaddyno.com/demo?afmc=fa314a936cf254401a998926cc2b7c423f669eb7", "affiliate_dashboard_url":"https://api.leaddyno.com/p/6a2b4f844d3bd4a4fbe389172253c9b956c792df" }
Get all leads for an affiliate
page | The page to return |
Definition: GET https://api.leaddyno.com/v1/affiliates/{:id}/leads Curl: $ curl https://api.leaddyno.com/v1/affiliates/289/leads -G \ -d key=[YOUR_PRIVATE_KEY] Response: [ { "id":14374, "email":"5-6-13-2a@test.com", "created_at":"2013-05-06T16:15:43Z", "updated_at":"2013-05-14T06:36:41Z", "status":"Registered", "custom_status":null, "first_name":null, "last_name":null, "latest_visitor":{ "id":1337, "tracking_code":"d3132b4d-afbb-4adc-970c-547553659ea6" }, .. ]
Get all commissions for an affiliate
page | The page to return |
Definition: GET https://api.leaddyno.com/v1/affiliates/{:id}/commissions Curl: $ curl https://api.leaddyno.com/v1/affiliates/289/commissions -G \ -d key=[YOUR_PRIVATE_KEY] Response: [ { "id":14374, "email":"5-6-13-2a@test.com", "created_at":"2013-05-06T16:15:43Z", "updated_at":"2013-05-14T06:36:41Z", "status":"Registered", "custom_status":null, "first_name":null, "last_name":null, "latest_visitor":{ "id":1337, "tracking_code":"d3132b4d-afbb-4adc-970c-547553659ea6" }, .. ]
Get the commissions for an affiliate filtering by status
Parameters
page | The number of the page that you are requesting. |
per_page | The number of records per page. (Default: 20 | Maximo: 200) |
status | The status to be filtered ('cancelled', 'paid', 'pending', 'due', 'unpaid', 'live') |
Definition
GET https://api.leaddyno.com/v1/affiliates/{:id}/commissions/filter
Example
curl https://api.leaddyno.com/v1/affiliates/289/commissions/filter?page=1&per_page=20&status=paid -G \
-d key=[YOUR_PRIVATE_KEY]
Response
{
"page"=>1,
"per_page"=>20,
"total_entries"=>2,
"commissions"=>[
{
"id"=>1,
"date"=>"2022-05-19",
"due_at"=>"2022-05-19T18:01:24Z",
"amount"=>"100.0",
"currency"=>"USD",
"payment_type"=>"cash",
"custom_singular"=>"",
"custom_plural"=>"",
"cancelled"=>false,
"note"=>nil,
"paid"=>true,
"purchase"=>{
"id"=>1,
"created_at"=>"2022-05-19T18:01:24Z",
"updated_at"=>"2022-05-19T18:01:24Z",
"cancelled"=>false,
"currency"=>"USD",
"purchase_code"=>"x11",
"note"=>nil,
"purchase_amount"=>"100.0",
"commission_amount_override"=>nil,
"cancellation"=>nil,
"lead"=>{
"id"=>1,
"email"=>"lead1@example.com"
},
"affiliate"=>nil,
"plan"=>nil
},
"affiliate"=>{
"id"=>1,
"email"=>"affiliate1@example.com"
}
}
]
}
Get the commission total for an affiliate
Description
Retrieve the total commission data (due, pending, paid, and total) in the default currency for a specific affiliate.
Parameters
Parameter | Description | Required |
id | The affiliate ID | yes |
Definition
GET https://api.leaddyno.com/v1/affiliates/{:id}/commissions_total
Example
curl https://api.leaddyno.com/v1/affiliates/289/commissions_total -G \
-d key=[YOUR_PRIVATE_KEY]
Response
{
"currency": "USD",
"due": "18.0",
"pending": "0.0",
"paid": "1041.0",
"total": "1059.0"
}
Create a commission for an affiliate
amount | The commission amount |
currency | The commission currency code (‘USD’, ‘EUR'). If not provided it will consider the user’s default currency - For more info, check out this article on Personalizing LeadDyno |
Definition:
POST https://api.leaddyno.com/v1/affiliates/{:id}/commissions
Curl:
$ curl https://api.leaddyno.com/v1/affiliates/{:id}/commissions -X POST \
-d key=[YOUR_PRIVATE_KEY] \
-d currency=USD \
-d amount=42.00 \
-d note="Note description test" \
-d due_at=2022-05-30T13:46:06Z
Response:
{
"id":4275,
"date":"2022-05-30",
"due_at":"2022-05-30T13:46:06Z",
"amount":"42.0",
"currency":"USD",
"payment_type":"cash",
"cancelled":false,
"note":"Note description test",
"paid":false,
"purchase":null,
"affiliate":{"id":123456,"email":"affiliate@example.com"}}
}
Archive an affiliate
Definition: POST https://api.leaddyno.com/v1/affiliates/{:id}/archive Curl: $ curl https://api.leaddyno.com/v1/affiliates/{:id}/archive \ -d key=[YOUR_PRIVATE_KEY] Example Response: { "id": 1, "email": "example@example.com", "archived": true, "first_name": null, "last_name": null, "created_at": "2013-05-24T05:28:24Z", "updated_at": "2013-05-24T05:28:24Z", "affiliate_url": "https://api.leaddyno.com/demo?afmc=fa314a936cf254401a998926cc2b7c423f669eb7", "affiliate_dashboard_url": "https://api.leaddyno.com/p/6a2b4f844d3bd4a4fbe389172253c9b956c792df" }
Unarchive an affiliate
Definition: POST https://api.leaddyno.com/v1/affiliates/{:id}/unarchive Curl: $ curl https://api.leaddyno.com/v1/affiliates/{:id}/unarchive \ -d key=[YOUR_PRIVATE_KEY] Example Response: { "id": 1, "email": "example@example.com", "archived": false, "first_name": null, "last_name": null, "created_at": "2013-05-24T05:28:24Z", "updated_at": "2013-05-24T05:28:24Z", "affiliate_url": "https://api.leaddyno.com/demo?afmc=fa314a936cf254401a998926cc2b7c423f669eb7", "affiliate_dashboard_url": "https://api.leaddyno.com/p/6a2b4f844d3bd4a4fbe389172253c9b956c792df" }
Sub IDs
id | The ID of the Sub ID, used to reference it in API calls. |
name | A piece of text representing the name of this Sub ID. Visible in the app UI. |
url | The URL that the Sub ID points to. |
affiliate_id | The ID of the affiliate to whom the Sub ID belongs. |
Base URL: https://api.leaddyno.com/v1/affiliates/{:id}/subids Example Object: { "id": 1, "name": "Example Sub ID", "url": "https://leaddyno.com/contact", "affiliate_id": 1 }
Get all Sub IDs for an affiliate
id | The ID of the affiliate whose Sub IDs you are requesting. |
o | Column to order by. Acceptable values: visitors_total, leads_total, purchases_total, url, name. |
oa | Order ascending or descending. Leave empty for descending. Pass any value for ascending. |
page | The number of the page that you are requesting. |
per_page | The number of records per page. Default of 12. |
Definition: GET https://api.leaddyno.com/v1/affiliates/{:id}/subids Curl: $ curl https://api.leaddyno.com/v1/affiliates/1/subids -G \ -d key=[YOUR_PRIVATE_KEY] Response: [ { "id": 5, "name": "Example Sub ID", "url": "https://leaddyno.com/contact", "affiliate_id": 1 }, ... ]
Get a Sub ID for an affiliate
Definition: GET https://api.leaddyno.com/v1/affiliates/{:id}/subids/{:sub_id} Curl: $ curl https://api.leaddyno.com/v1/affiliates/1/subids/5 -G \ -d key=[YOUR_PRIVATE_KEY] Response: { "id": 5, "name": "Example Sub ID", "url": "https://leaddyno.com/contact", "affiliate_id": 1 }
Create a Sub ID
url | The URL of the new Sub ID |
name | The name of the new Sub ID. |
Definition: POST https://api.leaddyno.com/v1/affiliates/{:id}/create_subid Curl: $ curl https://api.leaddyno.com/v1/affiliates/1/subids -G -d name="Example Sub ID" \ -d url="https://leaddyno.com/contact" \ -d key=[YOUR_PRIVATE_KEY] Response: { "id": 5, "name": "Example Sub ID", "url": "https://leaddyno.com/contact", "affiliate_id": 1 }
Delete a Sub ID
Definition: DELETE https://api.leaddyno.com/v1/affiliates/{:id}/subids/{:sub_id} Curl: $ curl https://api.leaddyno.com/v1/affiliates/1/subids/5 -X DELETE \ -d key=[YOUR_PRIVATE_KEY] Response: true
Campaigns
created_at | When the affiliate was created |
code | The code for the campaign |
id | The id for the campaign |
updated_at | When the affiliate was last updated |
Base URL: https://api.leaddyno.com/v1/campaigns Example Object: { "id": 7, "created_at": "2012-08-02T13:46:06Z", "updated_at": "2013-05-15T18:12:00Z", "code": "ExampleCampaign" }
Get all campaigns
page
parameter to request additional pages | Parameters
page | The page to return |
created_before | Only return records created before the given date Date format: 2020-06-20 21:28:35 UTC |
created_after | Only return records created after the given date Date format: 2020-06-20 21:28:35 UTC |
Definition: GET https://api.leaddyno.com/v1/campaigns Curl: $ curl https://api.leaddyno.com/v1/affiliates -G \ -d key=[YOUR_PRIVATE_KEY] Response: [ { "id": 7, "created_at": "2012-08-02T13:46:06Z", "updated_at": "2013-05-15T18:12:00Z", "code": "ExampleCampaign" }, ... ]
Get a count of all campaigns
Definition: GET https://api.leaddyno.com/v1/campaigns/count Curl: $ curl https://api.leaddyno.com/v1/affiliates/count -G \ -d key=[YOUR_PRIVATE_KEY] Response: {"count":12}
Get a campaign by ID
Definition: GET https://api.leaddyno.com/v1/affiliates/{:id} Curl: $ curl https://api.leaddyno.com/v1/campaign/7 -G \ -d key=[YOUR_PRIVATE_KEY] Response: { "id": 7, "created_at": "2012-08-02T13:46:06Z", "updated_at": "2013-05-15T18:12:00Z", "code": "ExampleCampaign" }
Get all leads for a campaign
page | The page to return |
Definition: GET https://api.leaddyno.com/v1/campaigns/{:id}/leads Curl: $ curl https://api.leaddyno.com/v1/campaigns/7/leads -G \ -d key=[YOUR_PRIVATE_KEY] Response: [ { "id":14374, "email":"5-6-13-2a@test.com", "created_at":"2013-05-06T16:15:43Z", "updated_at":"2013-05-14T06:36:41Z", "status":"Registered", "custom_status":null, "first_name":null, "last_name":null, "latest_visitor":{ "id":1337, "tracking_code":"d3132b4d-afbb-4adc-970c-547553659ea6" }, .. ]
Custom Fields
Get all custom fields
required | Flag to request required fields as well as optional ones. Set to true to get a list of both optional and required fields. |
Definition: GET https://api.leaddyno.com/v1/custom_fields Curl: $ curl https://api.leaddyno.com/v1/custom_fields -G \ -d key=[YOUR_PRIVATE_KEY] Response: ["Optional field 1", "Required field 1"]
Create a custom field
new_field | The name of the new custom field. |
is_required | Whether or not the field is required for new affiliate sign ups. Can be set to true or false. |
Definition: POST https://api.leaddyno.com/v1/custom_fields Curl: $ curl https://api.leaddyno.com/v1/custom_fields \ -d new_field="Field name goes here" \ -d is_required=false \ -d key=[YOUR_PRIVATE_KEY] Response: true
Delete a custom field
field_name | The name of the custom field that you want to delete. |
Definition: DELETE https://api.leaddyno.com/v1/custom_fields Curl: $ curl https://api.leaddyno.com/v1/custom_fields -X DELETE \ -d field_name="Will be deleted" \ -d key=[YOUR_PRIVATE_KEY] Response: true