Fetch the schema
GET /v1/partner/questionnaires/{slug}?product_id=<product_id>&locale=<locale>
The slug is the product’s questionnaire_slug from GET /v1/partner/products. The optional product_id query parameter picks the product the schema is served for, when several of your products share a slug. The endpoint does not read country.
Labels and locale
- Without
locale, labels carry message keys only, andlocalein the response isnull. - With
locale=en,locale=esorlocale=zh, labels and help text are written in that language. Any other value falls back to English (en), and so does any single message missing in the requested language. The response’slocalesays which language was used. - Every localisable field keeps its message key in a
<field>Keysibling (for examplelabelKey) either way, so you can use your own translations. schema_hashis the hash of exactly the schema in the response, so it differs per locale. Submitschema_versionwith the hash you received: the current version’s hash is accepted with or without a locale and in any supported locale.
Versions and schema_outdated
Hi Doctor’s medical team updates questionnaires from time to time. Cache the schema by schema_version, and send both schema_version and schema_hash with every submission. If they no longer match the published version, the submission fails with 409 schema_outdated and nothing is created:
Steps
Every step has akey (the question_key you answer with), a kind, a title or label, and an optional required flag (steps are required unless required is false). Kind-specific properties are listed below.
Options
Option steps carryoptions: [{ value, label, ... }]; some group them under sections[].options. An option can be marked as excluding: when the patient picks it, the questionnaire stops because treatment is not possible through this route. Show the step’s exclusion message and do not submit. If you do, the submission fails with 422 clinical_ineligibility. An option that needs extra detail asks for it through option_inputs, keyed by option value.
Fields and validation
input steps carry fields: [{ name, label, validation }]. validation can include required (default true), type (for example number), and bounds such as min and max. Values outside plain bounds fail with 422 out_of_range. Bounds that also carry a reasonKey or blockedReasonKey are eligibility rules, not typing guards: a value outside them fails with 422 clinical_ineligibility, so treat it as an exclusion. Some steps carry step-level validation, such as a body-mass-index threshold computed from height and weight; when it fails, treat it as an exclusion.
Conditional display
A step withconditionalDisplay is shown only when an earlier answer matches:
A step can also carry
bmiConditionalDisplay with minBMI and/or maxBMI: it is shown only when the body-mass index computed from the height and weight step is at least minBMI and below maxBMI. If the step it depends on was skipped or has no answer, the dependent step is not shown either.
Hi Doctor decides which steps apply from the answers you send. Steps that apply and are required must be answered. Answer only the steps that apply: an answer to a step that the other answers hide is refused with 422 unexpected_question_key, with one error item per hidden question_key. This follows dependency chains, so a step hidden because the step it depends on is hidden is refused too. Apply the display rules yourself before you submit.
Conditional fields
conditionalFields adds follow-up fields inside a multiple-choice step. The follow-up fields apply when any selected value is outside dismissValues (for example, anything other than “none of these”). Send each follow-up value in the same entry under option_inputs, with the key __cf_<field name>:
values, or under option_inputs without the __cf_ prefix, are not found, and a required follow-up field then fails validation.
The entries-v1 answer format
answers is an array with one entry per answered step. Each entry has question_key and exactly one of value, values or skip. At submission question_key is required and must be a non-empty string: an entry without one fails with 422 invalid_answers. Answers to an information request also accept the alias key and use their own error codes; see Information requests.
- Upload answers are a scalar
valueholding theupload_idreturned byPOST /v1/partner/files. See Photos and files. skip: trueis only accepted for steps whoserequiredisfalse. A skipped entry carries justquestion_key,skipand, optionally, the step’s ownstep_id. Any other member alongside it, such asvalue,valuesoroption_inputs, fails with422 invalid_answers.- Do not send answers for steps that are not shown. An answer to a hidden step is refused with
422 unexpected_question_key, one error item per hiddenquestion_key(see Conditional display). - A key that is neither a step in the schema nor an envelope key fails validation. See Envelope keys.
Envelope keys
Envelope keys are answer entries that sit outside the schema’s steps. Each has its own fixed shape:How are answer errors reported?
Answer problems return422. When the API can tie a problem to a step, errors names its question_key, so you can point the patient back to the right step. Not every answer error carries errors or a question_key: when it is missing, show a general error and let the patient review their answers. Range errors name the field and its bounds:
Frequently asked questions
Is the partner questionnaire different from Hi Doctor’s own?
No. The Partner API serves the same questionnaire the doctor’s review is based on, so you render it instead of designing your own questions.Which languages can the schema be served in?
Labels and help text are served in English (en), Spanish (es) or Chinese (zh) when you pass the locale parameter; any other value falls back to English. Every label also keeps its message key, so you can use your own translations.How do I know the questionnaire has changed?
Send schema_version and schema_hash with every submission. If they are no longer the published ones, the submission fails with 409 schema_outdated and nothing is created, so fetch the schema again and ask the patient any new questions.Do I have to apply the conditional display rules myself?
Yes. Hi Doctor works out which steps apply from the answers you send and refuses answers to hidden steps, so apply the conditionalDisplay and bmiConditionalDisplay rules before you submit.What should I do when the patient picks an excluding option?
Stop the questionnaire and show the step’s exclusion message. Treatment is not possible through this route, and submitting anyway fails with 422 clinical_ineligibility.Can the patient skip a question?
Only a step marked as not required. Send it as an entry with its question_key and skip set to true, and nothing else.How do I answer a photo step?
Upload the file with POST /v1/partner/files first, then answer the step with the returned upload_id as a single value. See Photos and files.Next steps
Submit a consultation
Send the answers with the product, patient and consent in one request.
Photos and files
Upload photos and documents before you answer upload steps.
Partner API errors
Every error code, including answer validation errors.
Partnership FAQ
Commercial questions about partnering with Hi Doctor.