API reference
Pass calculation inputs and get back the results of the calculation
This endpoint expects the below fields to be present in the request body.
Field | Type | Required |
---|---|---|
calculation_id | string | yes |
calculation_input | object (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
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
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
When unsuccessful, the API will return a 500 HTTP status.
This error is thrown when you're passing at least 1 invalid value for a given calculation input id.
Request:
01
Response:
01
This error is thrown when you're passing at least 1 unexpected calculation input id for a given calculation.
Request:
01
Response:
01
The documentation for the v1 endpoint can be found here. The only change between v1 and v2 is the response format.