Use API in XML to get the contact ID

I am trying to get the contact ID of a contact by searching via phone number. We are trying to get Active Campaign to post call records to notes using a Yeastar PBX. The PBX uses an XML file for instructions.

My problem is I can’t seem to get records even using a curl command. I try the following, which I think is how it should, but it comes up blank,

curl -s -X GET ‘%api_url%/api/3/contacts?phone=%2B12125551212&search=phone&segmentid=null&status=-1&orders[id]=ASC&orders[email]=ASC&forceQuery=0’
-H ‘Api-Token: %api_key%’
-H ‘accept: application/json’

Hey! The issue is that ActiveCampaign’s API doesn’t support searching contacts directly by phone number using the search parameter.

I would use the field value search:

curl -X GET ‘https://youraccountname.api-us1.com/api/3/contacts?filters[fieldValue]=PHONE_FIELD_ID_%2B12125551212
-H ‘Api-Token: YOUR_API_KEY’
-H ‘accept: application/json’

  1. Find your phone field ID: GET /api/3/fields
  2. Use format: filters[fieldValue]=FIELDID_PHONEVALUE
  3. Phone must be in E.164 format (+12125551212)

Your issues: :x: search=phone — Not a valid parameter :x: Make sure %api_url% is actually replacing with your full API URL :x: Remove segmentid=null

Try searching by email first to verify your API setup works:

curl -X GET ‘https://ACCOUNT.api-us1.com/api/3/contacts?email=test@example.com
-H ‘Api-Token: YOUR_KEY’

Quick test: Try searching by email first to verify your API setup works: