---
title: "Query groups"
method: GET
path: "/v1/projects/{project_id}/groups"
tags: ["Group"]
---

# Query groups

`GET /v1/projects/{project_id}/groups`

## Request

- Base URL: `https://api.telerivet.com`
- URL: `https://api.telerivet.com/v1/projects/{project_id}/groups`
- Auth: one of:
  - HTTP basic
  - OAuth 2 (authorization code, authorization URL `https://telerivet.com/oauth/authorize`, token URL `https://api.telerivet.com/oauth/token`)

Queries groups within the given project.

## Path parameters

- `project_id` string, required

## Query parameters

- `name` string
- `dynamic` boolean
- `solution_id` string: ID of Solution
- `sort` 'default' | 'name'
- `sort_dir` 'asc' | 'desc'
- `page_size` integer
- `offset` integer
- `marker` string
- `count` boolean

## Response `200`

Successful response. When count=1 parameter is provided, returns {"count": N} instead.

- object
  - `data` Group[]: Array of results (omitted when count=1)
    - `id` string: ID of the group
    - `name` string: Name of the group
    - `dynamic` boolean: Whether this is a dynamic or normal group
    - `filters` object, nullable: Key-value pairs of conditions that contacts must match to be members of a dynamic group. To filter by a custom variable, precede the variable name with 'vars.' (conditions on custom variables may also be provided as a nested object under a `vars` key, e.g. `{"vars": {"city": "Manila"}}`); other supported keys are `id`, `name`, `phone_number`, `time_created`, `time_updated`, `incoming_message_count`, `outgoing_message_count`, `last_incoming_message_time`, `last_outgoing_message_time`, `conversation_status`, `send_blocked`, `group` (ID of a normal group whose members should be included), `not_group` (ID of a normal group whose members should be excluded), and `q` (full-text search query matching contacts like the search box in the web app). Each value is either a value to match exactly, or an object with an operator such as `ne`, `prefix`, `gte`, `lt`, `exists`, or `not_exists` as the key (e.g. `{"gte": 10}`). Null if this is a normal group. Filter conditions can only be updated on dynamic groups.
    - `num_members` integer, nullable: Number of contacts in the group (null if the group is dynamic)
    - `time_created` integer: Time the group was created in Telerivet
    - `allow_sending` boolean: True if messages can be sent to this group, false otherwise.
    - `add_time_variable` string, nullable: Variable name of a custom contact field that will automatically be set to the current date/time on any contact that is added to the group. This variable will only be set if the contact does not already have a value for this variable. If the project does not have a contact field with this variable name, a new date/time field will be created. This is useful as the `date_variable` of a `relative` campaign that sends messages relative to when each contact joins the group.
    - `solution_id` string, nullable: ID of the solution that this group belongs to, if any
    - `vars` object: Custom variables stored for this group. Variable names may be up to 32 characters in length and can contain the characters a-z, A-Z, 0-9, and _. Values may be strings, numbers, or boolean (true/false). String values may be up to 4096 bytes in length when encoded as UTF-8. Up to 100 variables are supported per object. Setting a variable to null will delete the variable.
    - `url` string: URL to this group in the Telerivet web app
    - `project_id` string: ID of the project this group belongs to
  - `truncated` boolean: True if there are more results
  - `next_marker` string: Marker for pagination
  - `page_size` integer: Number of results per page
  - `sort_dir` 'asc' | 'desc': Sort direction
  - `count` integer: Total count of matching items (only when count=1 parameter is provided)

## Other responses

- `400`: Invalid request parameters
- `401`: Invalid or missing API key or Bearer token
- `404`: Resource not found

---

[API](https://skmtc.dev/telerivet/apis/telerivet-api.md) · [All operations](https://skmtc.dev/telerivet/apis/telerivet-api/llms.txt) · [OpenAPI document](https://skmtc.dev/telerivet/apis/telerivet-api/revisions/4e14b1c8d917?raw)
