Export data
Start an export, follow the run and download its CSV file.
Export downloads records from one campaign as a CSV file.
Before you start
- Complete the HTTP quickstart. Set
LINKT_API_URLandLINKT_API_KEY. - Create a campaign. Set
CAMPAIGN_IDto the returnedid. - Use an API key with effective permissions for the reads and changes in this guide. See Permissions.
- This procedure starts no research and uses no credits.
- Fill the campaign through discovery or import.
Steps
Start the export
curl --fail-with-body --request POST "$LINKT_API_URL/v2/runs/export" \
--header "x-api-key: $LINKT_API_KEY" \
--header "Content-Type: application/json" \
--data "$(jq -cn --arg CAMPAIGN_ID "$CAMPAIGN_ID" '{"campaign_id":"0190a4e2-0000-7000-8000-000000000001","entity_type":"account","review_state":"reviewed"} | walk(if . == "0190a4e2-0000-7000-8000-000000000001" then $CAMPAIGN_ID else . end)')"The response has status 202. Set RUN_ID to its id. Rules: Export fields and filters.
Follow the run
curl --fail-with-body --request GET "$LINKT_API_URL/v2/runs/$RUN_ID" \
--header "x-api-key: $LINKT_API_KEY"Use Polling.
Download the file
On success, use result.download_url to download the CSV. The URL expires. See Download.
Set DOWNLOAD_URL from the run response. Download before result.download_expires_at.