We want to take you through a tutorial introduction to using our APIs using the well documented command line tool - Curl.
Adding prospects to account and listing those prospects using cURL:
We will do this in 2 steps. First we will add prospects to a team using our add prospects API. Then we will show you how to fetch the added prospects and paginate through the list of prospects using the listing API.
Step 1 a:
We have curated this cURL command to add 2 prospects and then we will add 200 more prospects using the same API - add prospects.
curl --request POST \
--url https://api.smartreach.io/api/v3/prospects\?team_id\=team_xxxxxx \
--header 'X-API-KEY: uk__xxxxxx' \
--header 'accept: application/json'
--data '
[
{
"email": "[email protected]",
"first_name": "John",
"last_name": "Doe1",
"phone_number": "+1(460)-500-1727",
"linkedin_url": "https://www.linkedin.com/in/qtpgAand",
"city": "Chicago",
"country": "United States",
"company": "Smartreach",
"custom_fields": {}
},
{
"email": "[email protected]",
"first_name": "John",
"last_name": "Doe2",
"phone_number": "+1(147)-598-1917",
"linkedin_url": "https://www.linkedin.com/in/2UmKo0Lk",
"city": "Chicago",
"country": "United States",
"company": "Smartreach",
"custom_fields": {}
}
]
'
Response. - 200 Ok:
[
{
"object": "prospect",
"id": "prs_aa_xxxxxx",
"emails": [
{
"email": "[email protected]",
"is_valid": true,
"is_primary": true
}
],
"account_id": "acc_xxxxxx",
"first_name": "John",
"last_name": "Doe2",
"phone_numbers": [],
"linkedin_url": "https://www.linkedin.com/in/2umko0lk",
"city": "Chicago",
"company": "Smartreach",
"state": "",
"country": "United States",
"timezone": null,
"list": null,
"tags": [],
"custom_fields": {},
"updated_at": "2024-05-04T04:00:17.269Z",
"created_at": "2024-05-03T11:20:41.357Z"
},
{
"object": "prospect",
"id": "prs_aa_xxxxxx",
"emails": [
{
"email": "[email protected]",
"is_valid": true,
"is_primary": true
}
],
"account_id": "acc_xxxxxx",
"first_name": "John",
"last_name": "Doe1",
"phone_numbers": [],
"linkedin_url": "https://www.linkedin.com/in/qtpgaand",
"city": "Chicago",
"company": "Smartreach",
"state": "",
"country": "United States",
"timezone": null,
"list": null,
"tags": [],
"custom_fields": {},
"updated_at": "2024-05-04T04:00:17.269Z",
"created_at": "2024-05-03T11:20:41.357Z"
}
]
Step 1 b. - Adding more prospects:
Using the add/update prospects API we can add prospects to our account. We can add up to 100 prospects with a single API call.
In this example we will add 200 prospects, so we need to make 2 API calls.
Here are the 2 files which contain the dummy data of prospects we will add to our account. Please replace the "prospects_upload_1.txt" with the actual path of file.
cURL command:
curl --request POST \
--url https://api.smartreach.io/api/v3/prospects?team_id=team_xxxxxx \
--header 'X-API-KEY: uk__xxxxxx' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '@prospects_upload_1.txt'
Note: We have used a feature of cURL to pass the data as part of a file.
--data '@prospects_upload_1.txt'
Replace the "prospects_upload_1.txt" with the second file path and run the command on your terminal.
Both these calls should return with 200 Ok response status code.
The prospects are added successfully.
Now we will see how the prospects listing API works:
Here is the example cURL command for listing the prospects.
curl --request GET \
--url https://api.smartreach.io/api/v3/prospects?team_id=team_xxxxxx \
--header 'X-API-KEY: uk__xxxxxx' \
--header 'accept: application/json'
{
"prospects": [
{
"object": "prospect",
"id": "prs_aa_xxxxxx",
"emails": [
{
"email": "[email protected]",
"is_valid": true,
"is_primary": true
}
],
"account_id": "acc_xxxxxx",
"first_name": "John",
"last_name": "Doe197",
"phone_numbers": [],
"linkedin_url": "https://www.linkedin.com/in/kqxohrkb",
"city": "Manchester",
"company": "Smartreach",
"state": "",
"country": "United States",
"timezone": null,
"list": null,
"tags": [],
"custom_fields": {},
"updated_at": "2024-05-03T11:21:19.892Z",
"created_at": "2024-05-03T11:21:19.888Z"
},
{
"object": "prospect",
"id": "prs_aa_2fxGO3SjI1uQPwHsvDL0I1tLLAw",
"emails": [
{
"email": "[email protected]",
"is_valid": true,
"is_primary": true
}
],
"account_id": "acc_xxxxxx",
"first_name": "John",
"last_name": "Doe198",
"phone_numbers": [],
"linkedin_url": "https://www.linkedin.com/in/qjhgseyo",
"city": "New York",
"company": "Smartreach",
"state": "",
"country": "United States",
"timezone": null,
"list": null,
"tags": [],
"custom_fields": {},
"updated_at": "2024-05-03T11:21:19.892Z",
"created_at": "2024-05-03T11:21:19.888Z"
},
…
],
"links": {
"next": "/api/v3/prospects?team_id=team_xxxxxx&older_than=1714735279886"
}
}
We can navigate to the next page using the next page URL provided in ‘links’ -> ‘next’ field.
Next page URL:
"/api/v3/prospects?team_id=team_2flXWhol1NxGZvs5EW9q5Ld3BfW&older_than=1714735279886"
cURL command:
curl --request GET \
--url https://api.smartreach.io/api/v3/prospects?team_id=team_2flXWhol1NxGZvs5EW9q5Ld3BfW&older_than=1714735279886 \
--header 'X-API-KEY: uk__bNzoWOiW4pHE0wTzQz99lAsbQfTvEddI' \
--header 'accept: application/json'
response:
{
"prospects": [
{
"object": "prospect",
"id": "prs_aa_xxxxxx",
"emails": [
{
"email": "[email protected]",
"is_valid": true,
"is_primary": true
}
],
"account_id": "acc_xxxxxx",
"first_name": "John",
"last_name": "Doe99",
"phone_numbers": [],
"linkedin_url": "https://www.linkedin.com/in/qhrqrzxv",
"city": "Manchester",
"company": "Smartreach",
"state": "",
"country": "United States",
"timezone": null,
"list": null,
"tags": [],
"custom_fields": {},
"updated_at": "2024-05-03T11:20:41.362Z",
"created_at": "2024-05-03T11:20:41.359Z"
},
{
"object": "prospect",
"id": "prs_aa_xxxxxx",
"emails": [
{
"email": "[email protected]",
"is_valid": true,
"is_primary": true
}
],
"account_id": "acc_xxxxxx",
"first_name": "John",
"last_name": "Doe98",
"phone_numbers": [],
"linkedin_url": "https://www.linkedin.com/in/pvhaurt0",
"city": "Sao Paulo",
"company": "Smartreach",
"state": "",
"country": "United States",
"timezone": null,
"list": null,
"tags": [],
"custom_fields": {},
"updated_at": "2024-05-03T11:20:41.362Z",
"created_at": "2024-05-03T11:20:41.359Z"
}
…
],
"links": {}
}
Since there are only 2 pages in prospects listing we get the empty value for 'links' field.
Congratulations! You're now equipped to seamlessly integrate our APIs into your system. Happy coding!