Discover accounts
Start discovery, follow the run and read the campaign results.
Discovery researches new accounts and their people for the campaign.
Paid research
Starting discovery uses credits. Run cost depends on the research and the records created. Read Credits.
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 uses credits. Check
get_mebefore you start.
Steps
Start discovery
Use your campaign ID. This sample requests one account and one contact per account.
curl --fail-with-body --request POST "$LINKT_API_URL/v2/runs/discovery" \
--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","contacts_per_account":1,"count":1} | walk(if . == "0190a4e2-0000-7000-8000-000000000001" then $CAMPAIGN_ID else . end)')"The response has status 202. Set RUN_ID to its id. Rules: Discovery.
Follow the run
curl --fail-with-body --request GET "$LINKT_API_URL/v2/runs/$RUN_ID" \
--header "x-api-key: $LINKT_API_KEY"Poll until a final status. Use the interval and timeout in Polling. A failed run has an error_code.
Read the results
curl --fail-with-body --request GET "$LINKT_API_URL/v2/accounts?campaign_id=$CAMPAIGN_ID&limit=5" \
--header "x-api-key: $LINKT_API_KEY"curl --fail-with-body --request GET "$LINKT_API_URL/v2/people?campaign_id=$CAMPAIGN_ID&limit=5" \
--header "x-api-key: $LINKT_API_KEY"Each result includes its membership in this campaign. Follow next_cursor to read more records.
Schedule discovery
To start future discovery on a schedule, send this update. Read Schedule rules.
curl --fail-with-body --request PATCH "$LINKT_API_URL/v2/campaigns/$CAMPAIGN_ID" \
--header "x-api-key: $LINKT_API_KEY" \
--header "Content-Type: application/json" \
--data '{"discovery":{"count":3,"frequency":"weekly","status":"active"}}'Pause future discovery with this update. Pause does not cancel a running job.
curl --fail-with-body --request PATCH "$LINKT_API_URL/v2/campaigns/$CAMPAIGN_ID" \
--header "x-api-key: $LINKT_API_KEY" \
--header "Content-Type: application/json" \
--data '{"discovery":{"frequency":"weekly","status":"paused"}}'