REST API Introduction

In this article

Overview
Resources

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 Setting 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.

Fields
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"
    }
  }
		

Get all visitors

Returns a list of all visitors to your site. The visitors are returned in sorted order, with the most recent visitors last, 100 at a time. You can use the  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

Returns the total number of 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

Creates up to 100 visitors at a time
Parameters

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

Parameters
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
  }<br>
		

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
email 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"
  }<br>
	

Get all leads

Returns a list of all leads. The leads are returned in sorted order, with the most recent leads last, 100 at a time. You can use the  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/leads

  Curl:
  $ curl https://api.leaddyno.com/v1/leads -G
         -d key=[YOUR_PRIVATE_KEY]

  Response:
  [
    {
      "id": 2,
      "email": "carsongross@gmail.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
    },
    ...
  ]<br>
		

Get a count of all leads

Returns the total number of leads
Definition: GET https://api.leaddyno.com/v1/leads/count    <strong>Curl:</strong>   $ 

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
email 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"
  }<br>
		

Create many leads

Creates up to 100 leads at a time. 
Parameters

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

Parameters
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"
  }<br>
		

Update a lead

Parameters
email 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

Definition: GET https://api.leaddyno.com/v1/leads/{:id}/purchases

  Curl:
  $ curl https://api.leaddyno.com/v1/leads/14377/purchases -G \
         -d key=[YOUR_PRIVATE_KEY]

  Response:
  [
    {
      "id": 233,
      "created_at": "2013-05-04T22:55:04Z",
      "updated_at": "2013-05-23T23:20:30Z",
      "cancelled": false,
      "purchase_code": "2ae9ff57-531b-4b84-9d91-48eebd221147",
      "note": null,
      "purchase_amount": "1000.0",
      "commission_amount_override": null,
      "cancellation": null,
      "lead": {
        "id": 14372,
        "email": "a@b.com"
      },
      "affiliate": {
        "id": 58,
        "email": "carsongross@yahoo.com"
      },
      "plan": {
        "id": 8,
        "code": "plus"
      }
    },
    ...
  ]<br>
		

Cancel all purchases for a lead

Parameters
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": "carsongross@yahoo.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

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
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/purchases

  Curl:
  $ curl https://api.leaddyno.com/v1/purchases -G
         -d key=[YOUR_PRIVATE_KEY]

  Response:
  [
    {
      "id": 207,
      "created_at": "2013-04-22T22:41:16Z",
      "updated_at": "2013-05-23T23:20:29Z",
      "cancelled": false,
      "purchase_code": "7da9e8e7-84c8-431d-9535-8a6171c3824d",
      "note": null,
      "purchase_amount": null,
      "commission_amount_override": null,
      "cancellation": null,
      "lead": {
        "id": 14311,
        "email": "example@example.com"
      },
      "affiliate": {
        "id": 172,
        "email": "affiliate@example.com"
      },
      "plan": {
        "id": 73,
        "code": "basic"
      }
    },
    ...
  ]
		

Get a count of all purchases

Returns the total number of 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

email 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"
    }
  }<br>
		

Create a new purchase with line items

Creates a new purchase with line items and returns it in JSON form |  Parameters
email 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"
    }
  }<br>
		

Get a purchase by purchase code

Parameters
purchase_code The purchase code
Definition: GET https://api.leaddyno.com/v1/purchases/by_purchase_code

  Curl:
  $ curl https://api.leaddyno.com/v1/purchases/by_purchase_code -G \
         -d purchase_code=7da9e8e7-84c8-431d-9535-8a6171c3824d \
         -d key=[YOUR_PRIVATE_KEY]

  Response:
  {
    "id": 207,
    "created_at": "2013-04-22T22:41:16Z",
    "updated_at": "2013-05-13T21:56:51Z",
    "cancelled": false,
    "purchase_code": "7da9e8e7-84c8-431d-9535-8a6171c3824d",
    "note": null,
    "purchase_amount": null,
    "commission_amount_override": null,
    "cancellation": null,
    "lead": {
      "id": 14311,
      "email": "example@example.com"
    },
    "affiliate": {
      "id": 17,
      "email": "example@example.com"
    }
  }<br>
		
Get a purchase by ID
Definition: GET https://api.leaddyno.com/v1/purchases/{:id}

  Curl:
  $ curl https://api.leaddyno.com/v1/purchases/207 -G \
         -d key=[YOUR_PRIVATE_KEY]

  Response:
  {
    "id": 207,
    "created_at": "2013-04-22T22:41:16Z",
    "updated_at": "2013-05-13T21:56:51Z",
    "cancelled": false,
    "purchase_code": "7da9e8e7-84c8-431d-9535-8a6171c3824d",
    "note": null,
    "purchase_amount": null,
    "commission_amount_override": null,
    "cancellation": null,
    "lead": {
      "id": 14311,
      "email": "example@example.com"
    },
    "affiliate": {
      "id": 17,
      "email": "example@example.com"
    }
  }<br>
		
Cancel a purchase by ID
Parameters
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

Parameters
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

Parameters
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

Affiliates are people who can recommend your service |  Fields
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
email 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

Returns a list of all affiliates. The affiliates are returned in sorted order, with the most recent affiliates last, 100 at a time. You can use the  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/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

Returns the total number of 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

email 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

Parameters
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

Parameters
email 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

Parameters
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

Parameters
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"
      },
      ..
  ]
		

Create a commission for an affiliate

Parameters
amount The commission amount
currency The commission currency code (e.g. 'EUR', defaults to 'USD')
 Definition:
    POST https://api.leaddyno.com/v1/affiliates/{:id}/commissions

  Curl:
  $ curl https://api.leaddyno.com/v1/affiliates/289/commissions \
         -d amount=42.00 \
         -d key=[YOUR_PRIVATE_KEY]

  Response:
  {
    "id":4275,
    "date":"2013-05-23",
    "amount":"42.0",
    "currency":"USD",
    "cancelled":false,
    "note":null,
    "paid":false,
    "purchase":null
  }
		

Archive an affiliate

    Definition: POST https://api.leaddyno.com/v1/{: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/{: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

Fields
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

  Parameters
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

  Parameters
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

Campaigns are entities used to track non-Affiliate based marketing traffic |  Fields
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

Returns a list of all campaigns. The campaigns are returned in sorted order, with the most recent campaigns last, 100 at a time. You can use the  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

Returns the total number of 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

Parameters
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

Parameters
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

Parameters
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

  Parameters
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
		

As always, are here to help. Contact us at any time and our Support team will be there for you.