How To Auto-Download Leads Using an API
Automate lead downloads via API. Follow our guide on Popupsmart to effortlessly set up auto-downloads and streamline your lead management.
API Request
.line-numbers-mode { position: relative; } .language-text { padding-left: 43px; } pre { display: block; padding: 10px; margin: 0 0 10.5px; font-size: 14px; line-height: 1.428571429; word-break: break-all; word-wrap: break-word; color: #333; background-color: #f5f5f5; border: 1px solid #ccc; border-radius: 4px; } pre code { padding: 0; font-size: inherit; color: inherit; white-space: pre-wrap; background-color: transparent; border-radius: 0; } .line-numbers-wrapper { position: absolute; top: 13px; left: 13px; font-size: 14px; color: inherit; font-family: Menlo, Monaco, Consolas, Courier New, monospace; }
Example Request:
GET /api/leads?take=100&skip=50&startDate=2024-02-01&endDate=2024-03-01 HTTP/1.1
Host: example.com
Headers:
x-token: {APIkey}
x-campaign-id: {Campaignld}1 2 3 4 5 6
HTTP Status Code: 200
Headers:
Content-Type: application/json
Example Response:
HTTP/1.1 200 OK
{
"leads": [
{
"date": "2023-02-28T09:48:36.362Z",
"sessionId": "111e1a1b-1ca1-1111-ad1b-11111ffa1",
"accountId": 1111,
"location": {
"ip": "111.11.11.11",
"countryCode": "UK",
"country": "United Kingdom",
"region": "London",
"regionCode": "1",
"city": "London",
"latitude": "11.11111",
"longitude": "11.11111",
"timezone": "Europe/London",
"asOrganization": "John Doe's Organization",
"postalCode": "1111"
},
"url": "https://johndoe.com/?ps-preview=4948",
"page": "/",
"host": "johndoe.com",
"userAgent": "Mozilla/5.0 ...",
"device": "Desktop",
"resolution": "1112x1112",
"os": "Mac OS",
"browser": "Chrome",
"language": "en-US",
"referrer": "",
"type": "lead",
"campaignId": 1111,
"triggerIntegrations": true,
"meta": {
"utm_campaign": null,
"utm_source": null,
"utm_medium": null,
"utm_content": null,
"utm_term": null,
"ps-preview": "1111"
},
"formData": {
"ULLE3_email_input": "janesmith@gmail.com",
"IKQMY_text_input": "123asd"
}
]
}curl --location 'https://app.popupsmart.com/api/leads?take=2&skip=10' \ --header 'x-token: V2-1ZTPYBU1IBY1FQNHP1M11CCRDQFSU1F1CQAF1MHGQGCQQWXH1KTB11B1XBLH1BPK' \ --header 'x-campaign-id: 1111'Important Notes
- The
headershould contain a valid x-token and x-campaign-id for authentication. - The
leadsfield in the response contains an array of leads. - The
takeandskipquery parameters can be used to control the pagination of the results.
How is this guide?