Skip to content

Queries

Auth: API key. Scopes: queries:read / queries:write

Base path: /v1/queries

A query is a saved Find definition. Attach it to a trigger so MedFlow starts a pathway for each matching patient or work item. The same filters power Search and many metrics counts.


POST /v1/queries

bash
curl -X POST "https://api-staging.medflow.care/v1/queries" \
  -H "Authorization: Bearer $MEDFLOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Active patients needing screen",
    "resourceType": "Patient",
    "filters": [
      { "op": "with", "tag": "active-patient" },
      { "op": "without", "tag": "cognitive-screen-completed" }
    ]
  }'
FieldRequiredDescription
nameYesDisplay name
resourceTypeYesPatient, Pathway, or Practitioner
filtersNoSame with / without tag filters as Search, applied on the server

Response 201

json
{
  "queryId": "<uuid>",
  "name": "<string>",
  "resourceType": "Patient | Pathway | Practitioner",
  "filters": [
    { "op": "with | without", "tag": "<string>" }
  ],
  "createdAt": "<ISO 8601>",
  "updatedAt": "<ISO 8601>"
}

GET /v1/queries

QueryDescription
qOptional name search
resourceTypeOptional filter
limit / cursorPagination

GET /v1/queries/:queryId


PATCH /v1/queries/:queryId

Partial update of name, resourceType, or filters.


DELETE /v1/queries/:queryId

Response 204. The call fails with 409 if active triggers or metrics still reference the query.