Data Query API Documentation

The below documentation illustrates how to use the LeadExec Data API.

Note: For account and settings based API, please visit the LeadExec Account API for documentation.


Query Leads

POST Query Lead Records

This method allows you to query the leads database and perform searching.

Request Parameters

Parameter Type Position Required Description
access_token string header required Authentication token (See Authentication)
LeadTypeUID integer url_segment required The identifier of the lead type to query against.
Query object body optional Filter query to apply to your search. For information on how to format your query, please contact support.

Example request shows how to query for a loan amount greater or equal to 150000
SortFields array body optional Which fields do you want to order the results by
Fields array body optional Which fields do you want to return
StartDate date body required Start date of the search (UTC)
EndDate date body required End date of the search (UTC)
Skip integer body optional Number of records to skip before returning
Take integer body Number of records to take in the return

Response Properties

Due to the dynamic nature of LeadExec, each lead type's response will be different.

Leads are broken up into the following sections (not all sections will apply to every lead)

  • UID

    The main identifeir of the lead throughout the system.

  • Properties

    General properties of the lead, this will include were the lead came from, the current state of the lead, as well as when it was processed.

  • Fields

    Field information is dynamic depending on the lead type. Fields also may not exist on every lead. If you would like to generate a list of possible field, use the account API located at https://api.leadexec.net

  • TCPAInformation

    If your account is signed up to use the LeadExec TCPA Consent System, this section will contain TCPA information regarding consent request and validation.

  • SendInformation

    This section will display revenue, send count, as well as each location the lead was sent to.

  • LastUpdated

    This value displays the last time this lead was updated.

Request

POST /v1/leads/query/[LeadTypeUID] HTTP/1.1
host: apidata.leadexec.net
content-type: application/json
Authorization: Bearer [access_token]

{
    "Query": {
        "LoanAmount": {
            "$gte": 150000
        }
        ...
    },
    "SortFields": [
        "",
    ],
    "SortOrder": 0,
    "Fields": [
        ""
    ],
    "StartDate": "2020-10-23T12:24:36-07:00",
    "EndDate": "2020-10-23T12:24:36-07:00",
    "Skip": 0,
    "Take": 0
}
                            
POST /v1/leads/query/[LeadTypeUID] HTTP/1.1
host: apidata.leadexec.net
content-type: application/xml
Authorization: Bearer [access_token]

<XMLQueryRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/LeadExec.API.Data.Models">
<EndDate>2020-10-23T11:35:35-07:00</EndDate>
<Fields xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:string></d2p1:string>
</Fields>
<Query>{ &quot;LoanAmount&quot;: { &quot;$gte&quot;: 150000 } }</Query>
<Skip>0</Skip>
<SortFields xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:string></d2p1:string>
</SortFields>
<SortOrder>ASC</SortOrder>
<StartDate>2020-10-23T11:35:35-07:00</StartDate>
<Take>0</Take>
</XMLQueryRequest>
                                

Response

{
    "QueryTotal": 0,
    "SentCount": 0,
    "Skip": 0,
    "Take": 0,
    "Leads": [
    {
        "UID": 0,
        "Properties": {
            "Channel": "",
            "TeamAssigned": "",
            "LeadSourceUID": 0,
            "LeadSource": "",
            "DateAdded": "2019-09-08T07:25:49.87Z",
            "FileUID": 0,
            "AccountUID": 0,
            "Account": "",
            "LeadSourceSubID": "",
            "IsValid": true,
            "InvalidReason": "",
            "MaxSell": 1,
            "Price": 0.0,
            "Category": "N/A",
            "Lat": 30.00,
            "Long": -75.00,
            "Timezone": "",
            "QualityControlledOn": "2019-09-08T07:25:52.9Z",
            "InQualityControl": false,
            "QualityControlledBy": "Automation",
            "QualityControlResponse": "Bypass QC",
            "QualityControlResult": true,
            "CallVerified": false,
            "ReturnStatus": "Not Returned",
            "LeadGrade": "",
            "Flagged": false,
            "CallDuration": 0,
            "CallResult": "",
            "IVRNumber": 0,
            "RecordID": "",
            "AnalyticsUID": 0,
            "VisitID": "",
            "SearchEngine": "",
            "Keyword": "",
            "UserAssigned": "Not Assigned",
            "TCPACompliant": true
        },
        "Fields": {
            "FirstName": "",
            "LastName": "",
            "StreetAddress": "",
            "City": "",
            "State": "",
            "PostalCode": "",
            "Country": "",
            "IPAddress": "",
            "EmailAddress": "",
            "Phone": 0,
            ...
        },
        "TCPAInformation": {
            "RequestDate": "2019-09-08T07:24:52.957Z",
            "IPAddress": "192.168.1.1",
            "ReferrerURL": "",
            "ConsentText": "",
            "RequestID": 0,
            "VisitID": "",
            "Received": "2019-09-08T07:25:49.87Z",
            "FirstName": "",
            "LastName": "",
            "Address": "",
            "City": "",
            "State": "",
            "PostalCode": "",
            "Country": "UA",
            "PhoneNumber": "0",
            "IPLat": 0.0,
            "IPLong": 0.0,
            "IsMobile": "True",
            "ConsentGiven": true,
            "ConsentTextRequested": true,
            "Browser": "",
            "OS": "",
            "Referrer": "",
            "SearchTerm": "N/A",
            "FormURL": "",
            "TimeOnSite": 0,
            "TimeOnForm": 0,
            "DateConsentTextRequested": "2019-09-08T07:24:52.957Z"
        },
        "SendInformation": {
            "Revenue": 0.0,
            "SendCount": 1,
            "Sends": [
            {
                "SendUID": 0,
                "ClientUID": 0,
                "Client": "",
                "ClientGroup": "",
                "DateSent": "2019-09-08T07:26:05.967Z",
                "Valid": true,
                "Price": 0.0,
                "PostData": "",
                "Response": "",
                "Location": 0,
                "Emailed": false,
                "Forwarded": false,
                "RecordID": "",
                "DeliveryDuration": 0,
                "ClientAccountUID": 0,
                "ClientAccount": "",
                "ClientOrderUID": 0,
                "InvoiceUID": 0,
                "RevShare": 0.0,
                "Automated": true,
                "LeadNotes": "",
                "LastReadDate": "2019-09-08T07:26:07.11Z",
                "FirstReadDate": "2019-09-08T07:26:07.11Z",
                "ReadCount": 1,
                "LastReturnAction": 0,
                "LastActionDate": "2019-09-08T07:25:49.87Z",
                "LastReturnActionReason": "",
                "AssignedReadDate": null,
                "NextAppointmentDate": "0001-01-01T00:00:00Z",
                "EmailReads": [
                    {
                    "DateOpened": "2019-09-08T07:26:07.11Z",
                    "IPAddress": ""
                    }
                ],
                "Appointments": []
            }]
        },
        "LastUpdated": "2020-09-29T18:17:00.832Z"
    }]
}

<QueryResult>
    <QueryTotal>1</QueryTotal>
    <SentCount>1</SentCount>
    <Skip>0</Skip>
    <Take>1</Take>
    <Leads>
        <Lead>
            <UID></UID>
            <Properties>
                <Channel></Channel>
                <TeamAssigned></TeamAssigned>
                <LeadSourceUID></LeadSourceUID>
                <LeadSource></LeadSource>
                <DateAdded>2019-09-08T07:25:49.87Z</DateAdded>
                <FileUID>0</FileUID>
                <AccountUID></AccountUID>
                <Account></Account>
                <LeadSourceSubID></LeadSourceSubID>
                <IsValid>true</IsValid>
                <InvalidReason></InvalidReason>
                <MaxSell>1</MaxSell>
                <Price>0</Price>
                <Category>N/A</Category>
                <Lat>30.00</Lat>
                <Long>-75.00</Long>
                <Timezone></Timezone>
                <QualityControlledOn>2019-09-08T07:25:52.9Z</QualityControlledOn>
                <InQualityControl>false</InQualityControl>
                <QualityControlledBy>Automation</QualityControlledBy>
                <QualityControlResponse>Bypass QC</QualityControlResponse>
                <QualityControlResult>true</QualityControlResult>
                <CallVerified>false</CallVerified>
                <ReturnStatus>Not Returned</ReturnStatus>
                <LeadGrade></LeadGrade>
                <Flagged>false</Flagged>
                <CallDuration>0</CallDuration>
                <CallResult></CallResult>
                <IVRNumber>0</IVRNumber>
                <RecordID></RecordID>
                <AnalyticsUID>0</AnalyticsUID>
                <VisitID></VisitID>
                <SearchEngine></SearchEngine>
                <Keyword></Keyword>
                <UserAssigned>Not Assigned</UserAssigned>
                <TCPACompliant>true</TCPACompliant>
            </Properties>
            <Fields>
                <FirstName></FirstName>
                <LastName></LastName>
                <StreetAddress></StreetAddress>
                <City></City>
                <State></State>
                <PostalCode></PostalCode>
                <Country></Country>
                <IPAddress></IPAddress>
                <EmailAddress></EmailAddress>
                <Phone></Phone>
                ...
            </Fields>
            <TCPAInformation>
                <RequestDate>2019-09-08T07:24:52.957Z</RequestDate>
                <IPAddress>192.168.1.1</IPAddress>
                <ReferrerURL></ReferrerURL>
                <ConsentText></ConsentText>
                <RequestID></RequestID>
                <VisitID></VisitID>
                <Received>2019-09-08T07:25:49.87Z</Received>
                <FirstName></FirstName>
                <LastName></LastName>
                <Address></Address>
                <City></City>
                <State></State>
                <PostalCode></PostalCode>
                <Country></Country>
                <PhoneNumber></PhoneNumber>
                <IPLat>0</IPLat>
                <IPLong>0</IPLong>
                <IsMobile>True</IsMobile>
                <ConsentGiven>true</ConsentGiven>
                <ConsentTextRequested>true</ConsentTextRequested>
                <Browser></Browser>
                <OS></OS>
                <Referrer></Referrer>
                <SearchTerm>N/A</SearchTerm>
                <FormURL></FormURL>
                <TimeOnSite>0</TimeOnSite>
                <TimeOnForm>0</TimeOnForm>
                <DateConsentTextRequested>2019-09-08T07:24:52.957Z</DateConsentTextRequested>
            </TCPAInformation>
            <SendInformation>
                <Revenue>0</Revenue>
                <SendCount>1</SendCount>
                <Sends>
                    <Send>
                        <SendUID></SendUID>
                        <ClientUID></ClientUID>
                        <Client></Client>
                        <ClientGroup></ClientGroup>
                        <DateSent>2019-09-08T07:26:05.967Z</DateSent>
                        <Valid>true</Valid>
                        <Price>0</Price>
                        <PostData></PostData>
                        <Response></Response>
                        <Location>0</Location>
                        <Emailed>false</Emailed>
                        <Forwarded>false</Forwarded>
                        <RecordID></RecordID>
                        <DeliveryDuration></DeliveryDuration>
                        <ClientAccountUID></ClientAccountUID>
                        <ClientAccount>Default</ClientAccount>
                        <ClientOrderUID>0</ClientOrderUID>
                        <InvoiceUID>0</InvoiceUID>
                        <RevShare>0</RevShare>
                        <Automated>true</Automated>
                        <LeadNotes></LeadNotes>
                        <LastReadDate>2019-09-08T07:26:07.11Z</LastReadDate>
                        <FirstReadDate>2019-09-08T07:26:07.11Z</FirstReadDate>
                        <ReadCount>1</ReadCount>
                        <LastReturnAction>0</LastReturnAction>
                        <LastActionDate>2019-09-08T07:25:49.87Z</LastActionDate>
                        <LastReturnActionReason></LastReturnActionReason>
                        <AssignedReadDate />
                        <NextAppointmentDate>0001-01-01T00:00:00Z</NextAppointmentDate>
                        <EmailReads>
                            <EmailRead>
                                <DateOpened>2019-09-08T07:26:07.11Z</DateOpened>
                                <IPAddress></IPAddress>
                            </EmailRead>
                        </EmailReads>
                    </Send>
                </Sends>
            </SendInformation>
            <LastUpdated>2020-09-29T18:17:00.832Z</LastUpdated>
        </Lead>
    </Leads>
</QueryResult>


Query Leads

POST Query Inbound PING Records

This method allows you to query the inbound PINGs database.

Request Parameters

Parameter Type Position Required Description
access_token string header required Authentication token (See Authentication)
LeadTypeUID integer url_segment required The identifier of the lead type to query against.
StartDate date body required Start date of the search (UTC)
EndDate date body required End date of the search (UTC)
SortOrder string body optional The sort order of the date created

ASC
DESC
Skip integer body optional Number of records to skip before returning
Take integer body Number of records to take in the return

Request

POST /v1/pings/inbound/query/[LeadTypeUID] HTTP/1.1
host: apidata.leadexec.net
content-type: application/json
Authorization: Bearer [access_token]

{
    "StartDate": "2020-10-23T12:24:36Z",
    "EndDate": "2020-10-23T12:24:36Z",
    "SortOrder": "ASC",
    "Skip": 0,
    "Take": 100
}
                            

Response

{
    "Total": 0,
    "Sent": 0,
    "Skip": 0,
    "Take": 100,
    "QueryTime": 0,
    "Pings": [
        {
            "Id": "63c8b0a03314ce0624637a41",
            "Accepted": true,
            "OrderID": "ea8fa160-f51f-4086-ad2c-45eb2081d552",
            "CreatedOn": "2023-01-19T02:53:19.993Z",
            "ExpiresOn": "2023-01-19T02:58:19.962Z",
            "LeadSourceUID": 0,
            "LeadSource": "",
            "CampaignUID": 0,
            "Campaign": "",
            "Received": true,
            "LeadUID": 0,
            "PotentialClients": 0,
            "PotentialRevenue": 0.0,
            "DeliveredClients": 0,
            "ActualRevenue": 0.0,
            "Result": "",
            "ScanLog": "",
            "MatchedClients": [
                "",
                ""
            ],
            "RequestID": "",
            "Response": null,
            "Request": null,
            "Fields": null
        },
        {
            "Id": "63c8b0a03314ce0624637a41",
            "Accepted": true,
            "OrderID": "ea8fa160-f51f-4086-ad2c-45eb2081d552",
            "CreatedOn": "2023-01-19T02:53:19.993Z",
            "ExpiresOn": "2023-01-19T02:58:19.962Z",
            "LeadSourceUID": 0,
            "LeadSource": "",
            "CampaignUID": 0,
            "Campaign": "",
            "Received": true,
            "LeadUID": 0,
            "PotentialClients": 0,
            "PotentialRevenue": 0.0,
            "DeliveredClients": 0,
            "ActualRevenue": 0.0,
            "Result": "",
            "ScanLog": "",
            "MatchedClients": [
                "",
                ""
            ],
            "RequestID": "",
            "Response": null,
            "Request": null,
            "Fields": null
        }
    ]
}


Query Leads

POST Query Outbound PING Records

This method allows you to query the outbound PINGs database.

Request Parameters

Parameter Type Position Required Description
access_token string header required Authentication token (See Authentication)
LeadTypeUID integer url_segment required The identifier of the lead type to query against.
StartDate date body required Start date of the search (UTC)
EndDate date body required End date of the search (UTC)
SortOrder string body optional The sort order of the date created

ASC
DESC
Skip integer body optional Number of records to skip before returning
Take integer body Number of records to take in the return

Request

POST /v1/pings/outbound/query/[LeadTypeUID] HTTP/1.1
host: apidata.leadexec.net
content-type: application/json
Authorization: Bearer [access_token]

{
    "StartDate": "2020-10-23T12:24:36Z",
    "EndDate": "2020-10-23T12:24:36Z",
    "SortOrder": "ASC",
    "Skip": 0,
    "Take": 100
}
                
                

Response

{
    "Total": 0,
    "Sent": 0,
    "Skip": 0,
    "Take": 100,
    "QueryTime": 0,
    "Pings": [
        {
            "Id": "650b4e6e66024a3c705b1403",
            "Accepted": true,
            "ClientUID": "",
            "Client": 0,
            "DeliveryMethodUID": 0,
            "DeliveryMethod": "",
            "DeliveryAccountUID": 0,
            "DeliveryAccount": "",
            "PostSent": true,
            "LeadUID": 0,
            "Price": 0.0,
            "Revenue": 0.0,
            "Response": null,
            "Request": null,
            "LeadSourceUID": 0,
            "CampaignName": "",
            "SentOn": "2023-09-20T19:56:30.018Z",
            "Fields": null
        },
        {
            "Id": "650b4e6e66024a3c705b1403",
            "Accepted": true,
            "ClientUID": "",
            "Client": 0,
            "DeliveryMethodUID": 0,
            "DeliveryMethod": "",
            "DeliveryAccountUID": 0,
            "DeliveryAccount": "",
            "PostSent": true,
            "LeadUID": 0,
            "Price": 0.0,
            "Revenue": 0.0,
            "Response": null,
            "Request": null,
            "LeadSourceUID": 0,
            "CampaignName": "",
            "SentOn": "2023-09-20T19:56:30.018Z",
            "Fields": null
        }
    ]
}