developer.leaddyno.com

REST API Introduction


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

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 visitors 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"
    }
  }
            
List All Visitors

Returns a list of all visitors to your site. The visitors are returned in sorted order, with 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 visitors 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
  }
  
Import An Array of Visitors

Creates up to 100 visitors at a time.

Parameters

Takes a JSON array of objects with properties identical to the the parameters in the Create end point.

  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
    },
    ...
  ]
  
Retrieve 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
  }
  
Retrieve 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 be 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"
  }
            
List All Leads

Returns a list of all leads. The leads are returned in sorted order, with 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/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
    },
    ...
  ]
            
Get A Count of All Leads

Returns the total number of 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 its in JSON form.

Parameters
agent The user agent string of the visitors 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"
  }
  
Import An Array of Leads

Creates up to 100 leads at a time.

Parameters

Takes a JSON array of objects with properties identical to the the parameters in the Create end point.

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

Fields
affiliate A minimal affiliate object associated with the purchase
cancellation Cancellation data
cancelled true if the purchase has been cancelled
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"
    }
  }
            
List All Purchases

Returns a list of all purchases. The purchases are returned in sorted order, with most recent purchases 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/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 its 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 calcuations)
plan_code The code of the commission plan to use when calculating affiliate commissions
commission_amount_override A commission amount that will create an immediate fixed-amount commission associated with the purchase, overriding any plan definition.
  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

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 calcuations)
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
commission_amount_override A commission amount that will create an immediate fixed-amount commission associated with the purchase, overriding any plan definition.
  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"
    }
  }
  
Retrieve 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"
    }
  }
  
Retrieve 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"
    }
  }
  
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"
    }
  }
  
 

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 thier 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
  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"
  }
            
List All Affiliates

Returns a list of all affiliates. The affiliates are returned in sorted order, with most recent purchases 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/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 affilate code for the affiliate (can be used as a discount code)
  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"
  }
  
Retrieve 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"
  }
  
Retrieve 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"
  }
  
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 affilate code for the affiliate (can be used as a discount code)
  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
  }
  
 

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"
  }
            
List All Campaigns

Returns a list of all campaigns. The campaigns are returned in sorted order, with most recent campaigns 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/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}

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