Kartra API: Inbound > Leads. This article is for developers.

You can retrieve the profile info of one specific lead from your contacts database. To do so, we will search the lead’s email with the function get_lead.

TypeParametersData type
POSTget_lead*string

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

Example

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

Request results

ParametersData typeValues
lead_detailsstringJSON-encoded object containing the lead details
JSON parametersData typeValues
idstringLead's unique identifier id
first_namestringLead's first name
middle_namestringLead's middle name
last_namestringLead's last name
emailstringLead's email address
date_joinedstringDate the lead was registered, in EST timezone with the format: 'YYYY-MM-DD HH:MM:SS'
phone_country_codestringLead's phone country code
phonestringLead's phone
ipstringLead's IP address
addressstringLead's mailing address
zipstringLead's zip / postal code
citystringLead's city
statestringLead's state
countrystringLead's country
lead_picturestringURL to Lead’s thumbnail image
scoreintegerLead score in points
sourcestringThe source of the Lead. Possible values are:
  • 'single-optin' - if the Lead was created by completing a single opti-n form.
  • 'double-optin' - if the Lead was created by completing a double opt-in form.
  • 'helpdesk' - if the Lead was created by submitting a helpdesk ticket or starting a live chat.
  • 'affiliate-signup' - if the Lead was created by signing up to promote a product as an affiliate.
  • 'checkout' - if the Lead was created after buying a product.
  • 'import' - if the Lead was created by the lead import system.
  • 'api' - if the Lead was created by the API.
  • 'manual' - if the Lead was created manually from the Kartra account interface.
source_idstringFor internal purposes (you can ignore)
ip_countrystringThe country where the lead ip is located
websitestringURL to Lead’s website
facebookstringURL to Lead’s Facebook page
twitterstringURL to Lead’s Twitter page
linkedinstringURL to Lead’s LinkedIn page
lead_preferred_time_zonestringLead's preferred time zone
notesstringNotes in the lead profile
blacklistedintegerLead's email delivery status. Possible values are:
  • 0 - Lead is not blacklisted
  • 1 - Lead is blacklisted
custom_fields **arrayData contained in each custom field, in the following format:
{
    "field_id": integer,
    "field_identifier": string,
    "field_type": string,
    "field_value": [
        {
            "option_id": integer,
            "option_value": string,
        },
        {
            "option_id": integer,
            "option_value": string,
        }
    ]
  }

field_id: Unique field ID reference

field_identifier: Unique text identifier chosen when the field was created

field_type: Field type (Possible values: input_field, text_area, drop_down, radio_button, checkbox)

field_value: The contents of the field saved for the particular lead. In the case of input_field and text_area this will be text (string). For all other fields, the value will be an array that includes the ID and description of the lead's selection.

  • option_id: Unique option ID reference
  • option_value: Option value

When the field type is a checkbox, the values can be multiple.

gdpr_lead_statusintegerGDPR status for the lead. Possible values are:
  • 0 - GDPR status off - Your account has GDPR deactivated
  • 1 - GDPR status not subject - The lead's IP is from a country not subject to GDPR
  • 2 - GDPR status accepted - The lead has accepted the GDPR terms
  • 3 - GDPR status not accepted - The lead hasn't accepted the GDPR terms
  • 4 - GDPR status unknown - The lead's location could not be determined
  • 5 - GDPR status pending
gdpr_lead_status_datestringThe date when the GDPR status was captured, in EST timezone, with the format: 'YYYY-MM-DD HH:MM:SS'.
gdpr_lead_status_ipstringThe IP where the Lead GDPR Status was captured.
gdpr_lead_communications
integerStatus of the lead's communication consent. Possible values are:
  • 0 - Lead hasn't agreed to be contacted
  • 1 - Lead has agreed to be contacted

** All custom fields will be returned, even if they are empty for a specific lead.

Tags and lists. All the lead's assigned tags and list subscriptions are retrieved.

tag_namestringTag name
list_namestringList name
activeintegerLead's list subscription status. Possible values are:
  • 0 - Lead is not subscribed to list.
  • 1 - Lead is subscribed to list.

Sequences. Details of all the lead's sequence subscriptions are retrieved.

sequence_namestringSequence name
stepstringSequence step number
statusstringStatus of the lead in the sequence. Possible values are:
  • 'active'
  • 'unsubscribed'
namestringMembership name
level_namestringMembership access level name
activeintegerStatus of the Lead's access to a membership level. Possible values are:
  • 0 - Lead has access to the membership level.
  • 1 - Lead does not have access to the membership level.

Transactions. Details for all transaction events for the lead are retrieved.

idintegerTransaction unique identifier.
product_namestringPurchased product internal name.
price_pointstringPrice point number.
transaction_typestringType of transaction event. Possible values are:
  • 'Sale'
  • 'Refund'
  • 'Cancellation'
  • 'Rebill'
  • 'Chargeback'
  • 'Failed'
  • 'Partial_refund'
transaction_amountfloatAmount charged, attempted, or returned for the transaction.
transaction_datestringDate the transaction was processed in the format: 'YYYY-MM-DD HH:MM:SS'.

Calendars. Details for all the lead's calendar appointments are retrieved.

calendar_idinteger The calendar id.
calendar_namestring The calendar name.
class_idinteger The calendar class id.
class_namestring The calendar class name.
subscription_idinteger The id of the Lead subscription to the calendar.
calendar_subscription_statusstring The status of the Lead subscription to class. Possible values are:
  • 'Active'
  • 'Pending'
  • 'Completed'
  • 'Declined'
  • 'Cancelled'
vendor_idintegerAccount id of the calendar owner.
vendor_timezonestringVendor timezone.
hostsarrayHost details for a calendar appointment, in the following format:
{
    "host_first_name": "host",
    "host_last_name": "host",
    "host_email_address": "hostemail@gmail.com"
}

eventsarrayDate (in EST timezone) and duration of a calendar appointment, in the following format:
{
    "event_date": "YYYY-MM-DD HH:MM",
    "event_duration": "MM"
}
ics_calendar_linkstringURL of the calendar ICS file

Surveys. Details for all the lead's completed surveys are retrieved.

survey_idintegerSurvey identifier
survey_namestringSurvey name
survey_typeintegerSurvey type. Possible values are:
  • '1 - Survey'
  • '2 - Quiz'
survey_scorestringSurvey score
survey_completion_timeintegerTime the lead completed the survey
survey_completion_datestringDate each survey was completed, in EST timezone, with the format: ‘YYYY-MM-DD HH:MM:SS’.
questionsarrayThe details of each survey question, in the following format:
{
    "question_id": integer,
    "question_title": string,
    "question_correct": integer,
    "answers": array,
    {
        "option_id": integer,
        "option_value": string,
    }
}

question_id: Question ID

question_title: Question title

question_correct: (0 - Not subject to score, 1 - correct, 2 - incorrect)

answers: The lead's answers

  • option_id: Option ID
  • option_value: Option value (lead response)


Success message example

{
    "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": "123456789",
        "ip": "1.1.1.1",
        "address": "test",
        "zip": "test",
        "city": "test",
        "state": "CA",
        "country": "US",
        "lead_picture": "https:\/\/s3.amaz[...]nal\/default_user.png",
        "score": "0",
        "source": "checkout",
        "source_id": "1234",
        "ip_country": "United States",
        "website": "https:\/\/google.com",
        "facebook": "test",
        "twitter": "test",
        "linkedin": "test",
        "lead_preferred_time_zone": "America/New_York",
        "referring_id": "1234",
        "blacklisted": "0",
        "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": "Your Product Name",
                "product_price_point": "1",
                "transaction_type": "Sale",
                "transaction_amount": "300.00",
                "transaction_date": "2019-03-26 06:35:33"
            }
        ],
        "memberships": [
            {
                "name": "Your Course Name",
                "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",
     }
  ],
        "calendars": [
           {
                "calendar_name": "Your First Calendar",
                "calendar_id": "123",
                "class_name": "Master Class",
                "class_id": "22",
                "subscription_id": "1885",
                "calendar_subscription_status": "Cancelled",
                "vendor_id": "321",
                "vendor_timezone": "America/New_York",
                "hosts": [
                    {
                         "host_first_name": "John",
                         "host_last_name": "Doe",
                         "host_email_address": "johndoe@sample.com"
                    },
                    {
                         "host_first_name": "Janet",
                         "host_last_name": "Smith",
                         "host_email_address":"janetsmith@sample.com"
                    }
                ],
                "events": [
                    {
                        "event_date": "2020-12-09 09:00",
                        "event_duration": 60
                    },
                    {
                        "event_date": "2020-12-10 09:00",
                        "event_duration": 40
                    }
                ]
           },
           {
                "calendar_name": "Your Second Calendar",
                "calendar_id": "33",
                "class_name": "Beginner's Class",
                "class_id": "11",
                "subscription_id": "245",
                "calendar_subscription_status": "Active",
                "vendor_id": "321",
                "vendor_timezone": "America/Detroit",
                "hosts":[
                    {
                         "host_first_name": "John",
                         "host_last_name": "Doe",
                         "host_email_address":"johndoe@sample.com"
                    },
                    {
                         "host_first_name": "Janet",
                         "host_last_name": "Smith",
                         "host_email_address":"janetsmith@sample.com"
                    }
                ],
                "events": [
                    {
                        "event_date": "2020-12-14 09:00",
                        "event_duration": 60
                    },
                    {
                        "event_date": "2020-12-19 09:00",
                        "event_duration": 40
                    }
                ],
                "ics_calendar_link": "https://app.kartra.com/calendar/ics/"
           }
        ],
        "surveys": [
            {
                "survey_id": "123",
                "survey_name": "Your Survey",
                "survey_type": "1",
                "survey_score": "N/A",
                "survey_completion_time": "65",
                "survey_completion_date": "2021-07-01 06:35:33",
                "questions": [
                    {
                         "question_id": "146",
                         "question_title": "Age",
                         "question_correct": "0",
                         "answers": [
                             {
                                 "option_id": "105",
                                 "option_value": "Between 18 and 30"
                             }
                         ]
                    },
                    {
                         "question_id": "147",
                         "question_title": "What pets do you like",
                         "question_correct": "0",
                         "answers": [
                             {
                                 "option_id": "109",
                                 "option_value": "Cats"
                             },
                             {
                                 "option_id": "110",
                                 "option_value": "Dogs"
                             }
                         ]
                    }
                ]
            },
            {
                "survey_id": "127",
                "survey_name": "Your Quiz",
                "survey_type": "2",
                "survey_score": "50",
                "survey_completion_time": "75",
                "survey_completion_date": "2021-07-02 06:35:33",
                "questions": [
                    {
                         "question_id": "150",
                         "question_title": "5+5",
                         "question_correct": "1",
                         "answers":[
                             {
                                 "option_id": "125",
                                 "option_value": "10"
                             }
                         ]
                    },
                    {
                         "question_id": "151",
                         "question_title": "Question",
                         "question_correct": "2",
                         "answers": [
                             {
                                 "option_id": "131",
                                 "option_value": "Cats"
                             },
                             {
                                 "option_id": "132",
                                 "option_value": "Dogs"
                             }
                         ]
                    }
                ]
            }
        ]
    }
}

Errors

Type NumberMessageCause
234No lead foundThe lead was not found in our database.
245Lead is deletedThe lead has been deleted.

Error message example:

{
  "status": "Error",
  "message": "No lead found",
  "type": "234"
}