Server-side APIEndpointsWorkspace

Replace patient form schema

Overwrite the clinic's intake questions with a new set.

PATCH /v2/workspaces/patient-form

Writes the schema that the read route returns. Despite the PATCH verb, fields is a replace: the array you send becomes the clinic's form.

This is a whole-form write

Read the current schema, change what you need, and send the complete fields array back. Sending only your new question deletes every other one.

Body

FieldTypeRequiredDescription
fieldsarrayYesThe complete set of custom questions.
standardFieldOverridesobjectNoBuilt-in field tweaks, keyed by native field id. Omit to leave the stored overrides alone; send {} to clear them.
standardSectionOverridesobjectNoBuilt-in sections to hide. Same omit-versus-empty rule.
standardFieldOrderobjectNoOrdering of built-in fields per section. Same rule.

A field

KeyTypeRequiredDescription
idstringYesStable key. It is what patientFormValues is keyed by, so changing it orphans every existing answer.
typestringYesOne of the supported types.
labelstringYesWhat the patient reads.
sortOrdernumberNoDisplay order.
requiredbooleanNoEnforced on write.
staffOnlybooleanNoHidden from patients.
sensitivebooleanNoStored encrypted.
placeholder, helperTextstringNoRendering hints.
optionsstring[]ConditionalRequired for DROPDOWN and CHECKBOX_GROUP.
maxRatingnumberConditionalFor RATING.
allowedMimeTypes, maxSizeBytesarray / numberConditionalFor FILE_UPLOAD.
precisionstringNoDAY, MONTH or YEAR for DATE.
bodystringConditionalThe text of a NOTICE.
showWhenobjectNoConditional display, keyed on another field's answer.
removedbooleanNoRetire a field without destroying the answers already recorded against it.

Overrides

standardFieldOverrides is keyed by native field id and takes hidden, label and required. Only the ids in hideableNativeFieldIds and requirableNativeFieldIds may be tweaked; the rest are fixed.

Try it

PATCH/v2/workspaces/patient-form

A whole-form replace, not a merge — send every field you want to keep.

Body

Request
PATCH /v2/workspaces/patient-form
{
  "fields": [
    {
      "key": "allergies",
      "label": "Allergies",
      "type": "TEXT",
      "required": false
    }
  ]
}
to https://api.medos.one
Use a dedicated test key, and put your browser's address on its allowlist

A Developer API key authenticates on its own, so it only works from the addresses registered against it — and this page calls from your browser, not your servers. Unless your own public address is on the list you get a 403 naming it, which is the allowlist doing its job. Your browser may also reach us over IPv6 even when your server does not, so the address in the error is often not the one you expected. The key here is kept in memory only and never written to storage, but create a test key for it and deactivate that key when you are done.

Request

curl -sX PATCH "https://api.medos.one/v2/workspaces/patient-form" \
  -H "x-api-key: $MEDOS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "fields": [
      {
        "id": "occupation",
        "type": "TEXT",
        "label": "Occupation",
        "sortOrder": 1
      },
      {
        "id": "referral_source",
        "type": "DROPDOWN",
        "label": "How did you hear about us?",
        "sortOrder": 2,
        "required": true,
        "options": ["Search", "Friend", "Doctor referral"]
      }
    ],
    "standardFieldOverrides": { "bloodGroup": { "hidden": true } }
  }'

Response

The saved schema, in the same shape the read route returns — read it back to confirm what was stored.

Common failures

StatusCause
400Duplicate ids, a type outside supportedFieldTypes, or a type missing its required extra (options on a DROPDOWN).
400An override on a native field the clinic is not allowed to hide or mandate.

Retire, do not delete

Dropping a field from fields removes it from the form. Existing answers keep their key but nothing describes it any more. Set removed: true instead when the history matters.

On this page