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.
Create
Section titled “Create”POST /v1/queries
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" }
]
}'| Field | Required | Description |
|---|---|---|
name | Yes | Display name |
resourceType | Yes | Patient, Pathway, or Practitioner |
filters | No | Same with / without tag filters as Search, applied on the server |
Response 201
{
"queryId": "<uuid>",
"name": "<string>",
"resourceType": "Patient | Pathway | Practitioner",
"filters": [
{ "op": "with | without", "tag": "<string>" }
],
"createdAt": "<ISO 8601>",
"updatedAt": "<ISO 8601>"
}GET /v1/queries
| Query | Description |
|---|---|
q | Optional name search |
resourceType | Optional filter |
limit / cursor | Pagination |
GET /v1/queries/:queryId
Update
Section titled “Update”PATCH /v1/queries/:queryId
Partial update of name, resourceType, or filters.
Delete
Section titled “Delete”DELETE /v1/queries/:queryId
Response 204. The call fails with 409 if active triggers or metrics still reference the query.