Kartra Documentation TECHNICAL DOCUMENTATION

Section 4: Lead: Retrieving data

This will allow you to retrieve the profile info of one specific lead from your contacts database. In order to do so, we will search the lead’s email with the function get_lead.

Type Parameters Values
POST get_lead Array, email is a string **

** Required: the lead’s email is required to identify the lead.

Here is an example:

'get_lead' => [
   'email' => 'JoeSmith@domain.com',
]

 

Here are the results returned by get_lead:

Parameters Values
id string
first_name string
middle_name string
last_name string
email string
date_joined string (YYYY-MM-DD HH:MM:SS)
phone_country_code string
phone string
ip string
address string
zip string
city string
state string
country string
lead_picture string (URL to lead’s thumbnail image)
score integer (lead score in points)
source string, values are:

  • ‘single-optin’ – if the lead was created by filling a single optin form.
  • ‘double-optin’ – if the lead was created by filling a double confirm optin form.
  • ‘helpdesk’ – if the lead was created by submitting a helpdesk ticket or starting a live chat.
  • ‘affiliate-signup’ – if the lead was created when by signing up as an affiliate to promote any of your products.
  • ‘checkout’ – if the lead was created upon ordering any of your product.
  • ‘import’ – if the lead was created via the import system.
  • ‘api’ – if the lead was created through the API.
  • ‘manual’ – if the lead was created manually from within your Kartra account interface.
source_id string, only for internal purposes (you can ignore)
ip_country United States
website string (URL to lead’s website)
facebook string (URL to lead’s facebook page)
twitter string (URL to lead’s twitter page)
linkedin string (URL to lead’s linkedin page)
google_plus string (URL to lead’s google+ page)
notes string
blacklisted integer, possible values

  • 0 – Lead is not blacklisted
  • 1 – Lead is blacklisted
lead_deleted integer, possible values

  • 0 – Lead is not deleted
  • 1 – Lead is deleted
lead_deleted_date string (YYYY-MM-DD HH:MM:SS)
custom_fields * array of objects with the following structure:

{
    "field_id":integer, // the unique id reference
    "field_identifier":string, // the unique identifier chosen when it was created
    "field_type":string, // the field type (values: input_field, text_area, drop_down,
 radio_button, checkbox)
    // the value saved for the particular lead. In the case of input_field and text_area
 this will be string, if not it will be an array with the below structure
    // in the case of checkboxes the values can be multiple
    "field_value":[
        {
            "option_id":integer, // the unique id reference
            "option_value":string, // option value
        },
        {
            "option_id":integer,
            "option_value":string,
        }
    ]
  }
gdpr_lead_status integer, possible values:

  • 0 – For GDPR status off – Your account has GDPR deactivated
  • 1 – For GDPR status not subject – The lead’s IP is from a country not subject to GDPR
  • 2 – For GDPR status accepted – The lead has accepted the GDPR terms
  • 3 – For GDPR status not accepted – The lead hasn’t accepted the GDPR terms
  • 4 – For GDPR status unknown – The lead’s location could not be determined
  • 5 – For GDPR status pending
gdpr_lead_status_date string (YYYY-MM-DD HH:MM:SS)
gdpr_lead_status_ip string
gdpr_lead_communications
integer, possible values:

  • 0 – Lead hasn’t agreed to be contacted
  • 1 – Lead has agreed to be contacted
tags tag_name
string
lists list_name
string
active
integer (0 or 1)
sequences sequence_name
string
step
string
status
string (“active” or “unsubscribed”)
memberships name
string
level_name
string
active
integer (0 or 1)
transactions id
string
product_name
string
price_point
string
transaction_type
string (“Sale”, “Refund”, “Cancelation”, “Rebill” or “Chargeback”)
transaction_amount
string
transaction_date
string (YYYY-MM-DD HH:MM:SS)

 

* All custom fields recorded for that particular lead will be returned, even if they are empty.

 

Here’s an example of success message when retrieving a lead’s data:

{
    "status":"Success",
    "lead_details":{
        "id":"1234",
        "first_name":"test",
        "middle_name":"test",
        "last_name":"test",
        "last_name2":"test",
        "company":"test",
        "sales_tax_id":"test",
        "email":"test@test.co",
        "username":"test123",
        "date_joined":"2019-03-26 06:35:31",
        "phone_country_code":"+40",
        "phone":"123456",
        "ip":"1.1.1.1",
        "address":"test",
        "zip":"test",
        "city":"test",
        "state":"CA",
        "country":"US",
        "lead_picture":"https:\/\/s3.amazonaws.com\/kartra\/internal\/default_user.png",
        "score":"0",
        "source":"checkout",
        "source_id":"1234",
        "ip_country":"United States",
        "website":"https:\/\/google.com",
        "facebook":"test",
        "twitter":"test",
        "linkedin":"test",
        "google_plus":"test",
        "referring_id":"1234",
        "blacklisted":"0",
        "lead_deleted":"0",
        "lead_deleted_date":"0000-00-00 00:00:00",
        "gdpr_lead_status":"2",
        "gdpr_lead_status_date":"2019-03-26 06:35:31",
        "gdpr_lead_communications":"1",
        "gdpr_lead_status_ip":"1.1.1.1",
        "tags":[
            {
                "tag_name":"test"
            }
        ],
        "lists":[
            {
                "list_name":"test",
                "active":"1"
            }
        ],
        "sequences":[
            {
                "tree_name":"test",
                "step":"2",
                "status":"active"
            }
        ],
        "transactions":[
            {
                "transaction_id":"1234",
                "product_name":"test product",
                "product_price_point":"1",
                "transaction_type":"Sale",
                "transaction_amount":"300.00",
                "transaction_date":"2019-03-26 06:35:33"
            }
        ],
        "memberships":[
            {
                "name":"test",
                "level_name":"standard",
                "active":"1"
            }
        ],
	"custom_fields":[
	    {
		"field_id":"323",
		"field_identifier":"color",
		"field_type":"checkbox",
		"field_value":[
	           {
			"option_id":"1",
			"option_value":"red",
		   },
		   {
			"option_id":"2",
			"option_value":"blue",
		   }
		]
	    },
	    {
		"field_id":"324",
		"field_identifier":"gender",
		"field_type":"drop_down",
		"field_value":[
	            {
			"option_id":"1",
			"option_value":"male",
		    }
		]
	   },
	   {
		"field_id":"325",
		"field_identifier":"favorite_dish",
		"field_type":"input_field",
		"field_value":"beef lasagna",
	   }
	]
    }

}

© 2020 Kartra All Rights Reserved