Legal endpoints

This section covers how the legal endpoints respond and how to use them

Getting the terms

After logging in, a JWT token was issued. That token can only be used to access the legal endpoints. First of all, the legal terms must be retrieved.

Example response:

{
  "content_version": "fc150b6fe1034e458a75376b126b52b2d0832f15",
  "messages": [
    {
      "value": "Before you begin",
      "type": "HEADER",
      "format": "PLAIN_TEXT"
    },
    {
      "value": "By continuing, you agree to Healthily [Terms of Service](https://www.healthily.ai/legal-pages/healthily-assessment-tool-terms-and-conditions) and confirm that you have read [How to use Healthily safely](https://www.healthily.ai/legal-pages/how-to-use-the-healthily-self-assessment-tool-safely).",
      "type": "PARAGRAPH",
      "format": "MARKDOWN"
    }
  ],
  "checkbox_policies": [
    {
      "value": "I’d like Healthily to process my health and activity data to show me possible next steps for my reported symptoms as described in the [Summary](https://www.healthily.ai/legal-pages/summary) and [Privacy Policy](https://www.healthily.ai/legal-pages/healthily-assessment-tool-privacy-policy). ",
      "type": "INPUT_HINT",
      "format": "MARKDOWN"
    }
  ],
  "footer_policies": [
    {
      "value": "[Terms](https://www.healthily.ai/legal-pages/healthily-assessment-tool-terms-and-conditions)",
      "type": "OTHER",
      "format": "MARKDOWN"
    },
    {
      "value": "[Privacy Policy](https://www.healthily.ai/legal-pages/healthily-assessment-tool-privacy-policy)",
      "type": "OTHER",
      "format": "MARKDOWN"
    },
    {
      "value": "[Safe Use](https://www.healthily.ai/legal-pages/how-to-use-the-healthily-self-assessment-tool-safely)",
      "type": "OTHER",
      "format": "MARKDOWN"
    },
    {
      "value": "[About](https://www.healthily.ai/legal-pages/certificates)",
      "type": "OTHER",
      "format": "MARKDOWN"
    }
  ]
}

Content version

content_version is an internal hash of the delivered terms. Upon accepting them, you must provide this version to prove you have retrieved them first.

Messages

Messages to display to the user. Check this section to learn more about the message type.

Checkbox policies

This section contains another list of messages which should be rendered as checkboxes.

Footer policies

This section contains another list of messages which should be preserved in your application state and rendered as a footer with clickable links.

Accepting the terms

Upon accepting the terms, the API will respond with an upgraded JWT token and the first questions to initiate the assessment.

{
  "login_response": {
    "access_token": "...redacted...",
    "token_type": "bearer",
    "expires_in": 1860
  },
  "onboarding_response": {
    "age_question": {
      "type": "numeric",
      "messages": [
        {
          "value": "How old are you?",
          "type": "HEADER",
          "format": "PLAIN_TEXT"
        },
        {
          "value": "This information can affect the assessment results and improve its accuracy.",
          "type": "PARAGRAPH",
          "format": "PLAIN_TEXT"
        },
        {
          "value": "Type your age...",
          "type": "INPUT_HINT",
          "format": "PLAIN_TEXT"
        }
      ],
      "constraints": {
        "min_selections": 18,
        "max_selections": 125
      }
    },
    "gender_question": { ...redacted ... },
    "symptoms_question": { ...redacted ... }
  }
}

As opposed to the rest of the assessment where the API asks one question at the time, at the start it needs 3 pieces of information, age, gender and initial_symptoms.

Check here how the question type works.

Collect the information using the 3 provided questions and proceed to the initial endpoint.