Filtering, sorting & pagination


When making requests to some of Capable Health's API endpoints, you may add filtering criteria. Please refer to the API reference for more information regarding which filters are applicable to which endpoints.

Filters are applied as a query string.

Query parameter: filters[]
Multiple filters may be applied to a single endpoint. For this reason, when applying filters, you must use the query parameter filters[] no matter if you're applying a single filter or multiple filters.
By default, when multiple filters are passed, the resource will be filtered using the logical operator AND. Filtering using the logical operator OR is possible by passing an additional query parameter, filters_operator. filters_operator can receive either value: and or or.

Query value:
Filters are stringified and encoded json objects containing information regarding the field, the operator and the value by which to filter by.

FieldOperatorValue (data types)
Please refer to the API referenceeq (equals)boolean, datetime, integer, string
not_eq (does not equal)boolean, datetime, integer, string
matches (contains)string
does_not_match (does not contain)string
gt (greater than)datetime, integer
gteq (greater than or equal to)datetime, integer
lt (less than)datetime, integer
lteq (less than or equal to)datetime, integer
in (included in array)integer, string (note that the values must be passed in an array, i.e., [1,2,3])
not_in (not included in array)integer, string (note that the values must be passed in an array, i.e., [1,2,3])

Query value example:
JSON object:

"field": "id",
"operator": "eq",
"value": "123",

Stringified and encoded JSON object:


Query string example:

The above query string will find a patient with an ID equal to "123".


When making requests to some of Capable Health's API endpoints, you may request the data to be sorted. You can sort the data by created_at and updated_at using sort_by. A - will sort the data in desc order.


We currently support sorting on the following endpoints:

Care Plan Templates/care_plans/templates
Care Plans/care_plans
Goal Templates/goals/templates
Medication Orders/medication_orders
Observation Types/observation_types
Patient Medications/patient_medications
Patient Related Persons/patient_related_persons
Target Templates/targets/templates
Task Templates/tasks/templates


When an index endpoint is queried, such as /goals, pagination headers will be returned. The headers will look like the following:

Link <>; rel="first", <>; rel="next", <>; rel="last"
Current-Page 1
Page-Items 20
Total-Pages 10
Total-Count 200

You may query specific pages by appending a ?page=[PAGE_NUMBER] query string parameter on requests to index endpoints. For example, /goals?page=2 will return the second page of goals results.

linkThe link header is compatible with RFC8288.
The first, previous, next, and last pages will be present in the link header.
current-pagecurrent-page indicates the page currently being queried.
page-itemspage-items indicates the number of items per page.
total-pagestotal-page indicates how many pages there are total.
total-counttotal-count provides the total amount of results in the query.