Awell Health Developer Hub
Dev Hub

Request

Endpoint

POST/v2/calculations

Body

This endpoint expects the below fields to be present in the request body.

FieldTypeRequired
calculation_idstringyes
calculation_inputobject (key-value pair)yes

The calculation_input field expects a key-value pair object where the key represents the calculation input id and the value is the corresponding value for that calculation input.

To know what inputs a calculation expects, you can call the "get calculation" endpoint. In the response you'll find the calculation_blueprint.input_definition field that describes what calculation input ids the calculation expects. Additionally, you can use our Playground to simulate a calculation and see a simulated calculation input.

Below you can find an example for the PHQ-9 calculation.

01

Response

HTTP 200

When successful, the API will return a HTTP status code of 200. An array of results is returned because some calculations return multiple "subresults" instead of a single score.

Below you can find an example response of the PHQ-9 calculation:

01

HTTP 404

When you try to perform a calculation that doesn't exist (based on the calculation_id), the API will return a 404 HTTP status code and the following response:

01

HTTP 500

When unsuccessful, the API will return a 500 HTTP status.

InvalidInputsError

This error is thrown when you're passing at least 1 invalid value for a given calculation input id.

Request:

01

Response:

01

UnexpectedInputsError

This error is thrown when you're passing at least 1 unexpected calculation input id for a given calculation.

Request:

01

Response:

01

Previous versions

v1

The documentation for the v1 endpoint can be found here. The only change between v1 and v2 is the response format.