0

I looked in the documentation but I can't seem to find a way to add a contact to a group using the API.

1 Answer 1

8

Open API Explorer - Support menu > Developer > API Explorer and use GroupContact API to add contacts to group. See an eg in the screenshot below -

enter image description here

API formed for PHP is -

$result = civicrm_api3('GroupContact', 'create', [
  'group_id' => <group_id>,
  'contact_id' => <contact id>,
]);

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.