Categories

How To Auto-Download Leads Using an API

API Request

HTTP Method: GET

Endpoint: /api/leads

Query Parameters:

• take (optional): The number of leads to return. Default is 50. Example: take=1

• skip (optional): The number of leads to skip. Default is 0. Example: skip=5

• startDate and endDate (optional): The time period of lead data desired to be obtained. Default is 1 day. Maximum time period is 90 days.

Headers:

• x-token (personal data > API key)

• x-campaign-id

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

API Response

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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36",
      "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": "[email protected]",
        "IKQMY_text_input": "123asd"
      }
    ]
  }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

Curl:

curl --location 'https://app.popupsmart.com/api/leads?take=2&skip=10' \ --header 'x-token: V2-1ZTPYBU1IBY1FQNHP1M11CCRDQFSU1F1CQAF1MHGQGCQQWXH1KTB11B1XBLH1BPK' \ --header 'x-campaign-id: 1111'

1
2

Notes:

• The header should contain a valid x-token and x-campaign-id for authentication.

• The leads field in the response contains an array of leads.

• The take and skip query parameters can be used to control the pagination of the results.