If I do a api3 contact 'get' with no return fields specified, it obvs returns all the fields including address fields.

What I want to do is only retrieve certain fields for my needs, just to reduce overhead.

If I specify to return only 'state_province_name' or 'geofield1', they are not returned.

Is there a way to do this in a single call?

1 Answer 1


If include 'state_province' in return param it should return you state_province_id, state_province_name and state_province.

For geofield1 you need to use 'geo_code_1'.

If you search for primary address in return field drop down under api explorer you should see the exact name for fields to retrieve for address.

$result = civicrm_api3('Contact', 'get', [
  'sequential' => 1,
  'return' => ["address_id", "city", "postal_code", "state_province", "geo_code_1", "country"],
  'state_province_name' => ['IS NOT NULL' => 1],
  • I also realised is quicker to use the address entity and do a join to the contact data. Mar 31, 2021 at 21:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.