Groups Endpoint

This endpoint allows you to list, create, update and delete contact groups in your account.

Listing Groups

A GET returns the list of contact groups for your organization, in the order of last created.

  • uuid - the UUID of the group (string), filterable as uuid.
  • name - the name of the group (string), filterable as name.
  • query - the query if a smart group (string).
  • status - the status, one of initializing, evaluating or ready.
  • system - whether this is a system group that can't be edited (bool).
  • count - the number of contacts in the group (int).

Example:

GET /api/v2/groups.json

Response containing the groups for your organization:

{
    "next": null,
    "previous": null,
    "results": [
        {
            "uuid": "5f05311e-8f81-4a67-a5b5-1501b6d6496a",
            "name": "Reporters",
            "query": null,
            "status": "ready",
            "system": false,
            "count": 315
        },
        ...
    ]
}

Adding a Group

A POST can be used to create a new contact group. Don't specify a UUID as this will be generated for you.

  • name - the group name (string)

Example:

POST /api/v2/groups.json
{
    "name": "Reporters"
}

You will receive a group object as a response if successful:

{
    "uuid": "5f05311e-8f81-4a67-a5b5-1501b6d6496a",
    "name": "Reporters",
    "count": 0,
    "query": null
}

Updating a Group

A POST can also be used to update an existing contact group if you specify its UUID in the URL.

Example:

POST /api/v2/groups.json?uuid=5f05311e-8f81-4a67-a5b5-1501b6d6496a
{
    "name": "Checked"
}

You will receive the updated group object as a response if successful:

{
    "uuid": "5f05311e-8f81-4a67-a5b5-1501b6d6496a",
    "name": "Checked",
    "count": 0,
    "query": null
}

Deleting a Group

A DELETE can be used to delete a contact group if you specify its UUID in the URL.

Notes: - cannot delete groups with associated active campaigns or triggers. You first need to delete related objects through the web interface

Example:

DELETE /api/v2/groups.json?uuid=5f05311e-8f81-4a67-a5b5-1501b6d6496a

You will receive either a 204 response if a group was deleted, or a 404 response if no matching group was found.