# Query activities
URL: https://docs.awellhealth.com/api-reference/guides/query-activities

> For the complete documentation index, see [llms.txt](https://docs.awellhealth.com/llms.txt).



Activities are the unit of work in Awell. Read the
[domain model](/api-reference/guides/domain-model) first; these queries are hard to use
without it.

Field-level reference is in [Activities](/api-reference/reference/activities).

## Which query [#which-query]

| Query                            | Use when                                                          |
| -------------------------------- | ----------------------------------------------------------------- |
| `careflowActivities`             | You want everything in one care flow, including system activities |
| `activitiesByPatient`            | You want activities across all of one patient's care flows        |
| `activitiesByCareflowDefinition` | You want activities across all patients on one definition         |
| `activity`                       | You have an activity ID                                           |

`careflowActivities` requires a `pathway_id`. The by-patient and by-definition queries are the ones to
reach for when the question spans care flows, for example building a worklist.

## Filtering happens server-side [#filtering-happens-server-side]

Filters are **optional**, and with none supplied the response contains **every activity in the care
flow**, including calculations, track activations and other system activities.

Available filters cover activity status, activity type, action, stakeholders, care flow status, and
date range.

**Filter server-side rather than fetching everything and filtering in your client.** A long-running care
flow accumulates a lot of system activities, and the response grows with it.

## Paging and sorting [#paging-and-sorting]

Results support pagination and sorting. Page through rather than raising a limit: a care flow's activity
count grows for as long as the patient is enrolled.

## Pending activities for a user [#pending-activities-for-a-user]

There's a dedicated query for a user's pending activities, suited to a task list rather than a history.
It expects particular headers to identify the user.

## Expect repetition [#expect-repetition]

A [looping track](/docs/design-care-flows/track-looping) produces the same step's activities many times
for one patient. Code that assumes one activity per step shows the wrong one.

## Next steps [#next-steps]

**Next:** [Work with forms](/api-reference/guides/work-with-forms) to complete the activities you found.
