Skip to main content

Anamnesis (v4)

The v4 Anamnesis API lets you fetch a questionnaire model, render it on your own surface, and submit the patient’s answers back to RxScale. Every submission is validated against the questionnaire model before it is stored, so an invalid payload never creates a record.
This is the v4 Anamnesis API. The legacy /api/v3-1/anamnesis endpoints are still available — see Anamnesis for that reference.

Base Path

Authentication

The read endpoints (questionnaire model, public files) and the standard POST /submissions endpoint are public and require no API key. They are intended to be called directly from storefronts and other client surfaces that render RxScale questionnaires. The external submission endpoint (POST /external/submissions) is authenticated and requires an API key passed in the X-API-Key header, with the anamnesis:external_submit permission. You may only submit on behalf of an external anamnesis provider that belongs to your organisation — the provider_identifier you pass is resolved to a provider owned by the API key’s organisation.
For the public endpoints, because no credentials are sent, only non-sensitive read operations (questionnaire model, public files) and write operations that are validated against the questionnaire model are exposed. Submitted answers are transmitted over HTTPS, and an encrypted copy of each submission is retained at rest.

Endpoint Summary

Get Questionnaire

Fetch the questionnaire model and the metadata you need to render it. This endpoint is public and requires no API key.
string
required
The UID of the questionnaire

Example Request

Response

error
Returned when no questionnaire exists for the given questionnaire_id.

Download Questionnaire File

Download a file referenced by the questionnaire (for example an image or an information PDF). The file is returned as an attachment with its original filename. This endpoint is public and requires no API key.
string
required
The UID of the questionnaire
string
required
The name of the file to download

Example Request

The response is the raw file bytes, served as an attachment (Content-Disposition: attachment; filename="info.pdf").
error
Returned when the questionnaire or the requested file does not exist.

List Questionnaire Products

List the products attached to a questionnaire. This endpoint is public and requires no API key, because a SurveyJS product dropdown fetches it directly from the browser while the questionnaire is being answered.
string
required
The UID of the questionnaire

Example Request

Response

The array is flat and free of duplicates, and is ordered by the product’s short name so the choices stay stable between requests. It is shaped for a SurveyJS choicesByUrl binding with valueName: "uid" and titleName: "display_name".
error
Returned when no questionnaire exists for the given questionnaire_id.

Submit Anamnesis

Submit the patient’s answers for a questionnaire. This endpoint is public and requires no API key. The data payload is validated against the questionnaire model before anything is stored. On success the submission is persisted (with an encrypted copy of the answers retained at rest) and its UID is returned.
string
required
The UID of the questionnaire being answered

Request Body

File and signature answers

Answers to file and signaturepad questions are sent as base64 data URLs, exactly as SurveyJS produces them:
The uploaded bytes are stored as-is. The media type recorded for the file is not taken from your type field verbatim — it is determined from the file’s actual content, and your type is only consulted as a fallback when the content cannot be identified. Either way the result must be one of: application/pdf, image/gif, image/heic, image/heif, image/jpeg, image/png, image/tiff, image/webp Anything else is recorded as application/octet-stream. Such a file is still stored and still reaches the doctor, but it is offered for download instead of being previewed inline. Send one of the supported types if you need the file to render in the RxScale doctor tools.

Example Request

Response

The endpoint responds with 201 Created on success.

Submit External Anamnesis

Submit a questionnaire response on behalf of an external anamnesis provider. The data payload is validated against the questionnaire model in exactly the same way as a regular submission. This endpoint is authenticated: send your API key in the X-API-Key header. The key must have the anamnesis:external_submit permission. Instead of a provider UID, you pass a provider_identifier, which is resolved to an external anamnesis provider owned by the API key’s organisation — you may only submit for a provider that belongs to your organisation.
string
required
The UID of the questionnaire being answered

Request Body

Example Request

Response

The endpoint responds with 201 Created on success.

Submission Validation

Both submission endpoints validate the data payload against the questionnaire model before writing anything to the database. If validation fails, the request is rejected with 400 Bad Request and no record is created. The error body contains the list of validation problems reported against the questionnaire model:
If the request body itself is malformed — for example a missing required field such as data or provider_identifier — the 400 response instead reports the offending field:
If the submission validator is temporarily unreachable, the request fails with 502 Bad Gateway and no record is created. This is a transient upstream failure, not a problem with your payload — retry the request:
Always fetch the latest questionnaire model with Get Questionnaire and render your form from it. Submitting answers that do not match the current model will fail validation and the submission will not be stored.

Error Responses

Typical Integration Flow

1

Fetch the questionnaire model

Call GET /questionnaires/{questionnaire_id} to retrieve the model and theme.
2

Render the questionnaire

Render the model with the SurveyJS renderer (or use the RxScale snippet, which does this for you).
3

Submit the answers

Post the collected data to /submissions (public), or to /external/submissions with your X-API-Key for external providers. RxScale validates the answers against the model.
4

Store the returned UID

Persist the returned uid and use it to link the submission to a Shopify order. See the Questionnaire Integration guide.