Skip to content

Search

Auth: API key. Scope: search:read

Base path: /v1/search

Search finds patients, pathways, and practitioners with the same filters as the product search bar: a resource type plus tag filters (with / without). All filtering happens on the server, and results are limited to the API key’s workspace.


POST /v1/search

bash
curl -X POST "https://api-staging.medflow.care/v1/search" \
  -H "Authorization: Bearer $MEDFLOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "resourceType": "Patient",
    "filters": [
      { "op": "with", "tag": "active-patient" },
      { "op": "without", "tag": "cognitive-screen-completed" }
    ],
    "limit": 100,
    "offset": 0,
    "order": "name",
    "orderDirection": "asc"
  }'
FieldRequiredDescription
resourceTypeYesPatient, Pathway, or Practitioner
filtersNoTag filters. op is with or without. tag is a slug from the Tags library
limitNoMax hits (default 100, max 500)
offsetNoOffset for paging
orderNoSort field (default name)
orderDirectionNoasc or desc

Pathway filters may also target automation status tags (for example completed, running) when those tags are defined on pathways.

Response 200

json
{
  "total": <integer>,
  "limit": <integer>,
  "offset": <integer>,
  "results": [
    {
      "id": "<uuid>",
      "extId": "<string>",
      "name": "<string>",
      "resourceType": "Patient | Pathway | Practitioner",
      "tags": ["<string>"]
    }
  ]
}

Hits return id, extId, name, resourceType, and tags for use in run payloads.

The call is audited as search.execute whenever results can include PHI.


POST /v1/search/count

This takes the same body as search, though you do not need a large limit, and returns a JSON object with a total count (for example 128). It is a quick way to size a match set before you attach a query to a trigger.