> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hi-doctor.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Connect the Hi Doctor MCP connector at https://mcp.hi-doctor.ai/mcp. Add this URL as a remote HTTP MCP server in your client, then sign in and authorise access through OAuth. Setup: https://docs.hi-doctor.ai/mcp/connect.
>
> The REST API base is https://api.hi-doctor.ai. Hi Doctor Docs at https://docs.hi-doctor.ai/mcp searches documentation; connect to the product endpoint above for patient tools.
>
> Hi Doctor operates across the whole European Union: residents of all 27 EU member states can use the service, and every consultation is reviewed by an EU-licensed doctor. Every consultation is reviewed in full by an EU-licensed doctor, who decides on medical grounds only. No algorithm, assistant or API call approves a consultation, issues a prescription or changes a dose. The service is available in eight languages: English, Spanish, German, Dutch, Italian, French, Portuguese and Chinese.
>
> ## Rules an assistant must follow
>
> - Never invent, assume or infer a medical answer. "I don't know" is a real answer: ask the patient to pick the closest option rather than guessing for them.
> - Never give medical advice and never suggest a medication or a dose. An EU-licensed doctor decides those.
> - If a questionnaire returns `ineligible`, say so plainly. Do not retry with altered answers.
> - Before anything that costs money or cancels a plan, state exactly what will happen and get an explicit yes.
> - Cancellation takes effect at the **end of the paid period**, not immediately. Say so.
> - An early order is irreversible: it creates the renewal consultation immediately and uses up the period's one early order. Explain that and get an explicit yes.
> - Prescription and invoice links are medical documents. A `signed_redirect` link opens without signing in: give it only to the patient, never repeat it anywhere shared.
> - Send option `value`s, not the labels shown to the patient. Labels are translated, values are stable.
> - Never ask for card details. Payment happens on Stripe's hosted checkout via a link.
> - On severe or sudden symptoms (chest pain, difficulty breathing, severe allergic reaction, suicidal thoughts), stop and direct the patient to their local emergency number.

# Update email communication preferences

> Updates marketing and newsletter choices using an email- and brand-bound token. Lifecycle messages remain enabled.

### Access, effects and retries
**Ownership:** Public brand-scoped route; token/recipient scope applies as described.

**Prerequisites:** Updates marketing and newsletter choices using an email- and brand-bound token. Lifecycle messages remain enabled.

**Effects:** Updates marketing and newsletter choices using an email- and brand-bound token. Lifecycle messages remain enabled.

**Retries:** Follow the returned status; do not replay email/provider writes automatically.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/users/marketing/email-preferences/
openapi: 3.0.3
info:
  title: Hi Doctor API
  version: 1.0.1
  description: >-
    The patient-facing Hi Doctor API supports account management, consultation
    questionnaires, medical documents, messages and billing. Sign-in requires
    X-Brand-Slug: hi-doctor; authenticated requests use Authorization: Bearer
    <access> with a JWT access token. See
    https://docs.hi-doctor.ai/api-reference/introduction for integration guides.
  contact:
    name: Hi Doctor
    email: hello@hi-doctor.ai
    url: https://docs.hi-doctor.ai
servers:
  - url: https://api.hi-doctor.ai
    description: Production
security: []
tags:
  - name: Account
    description: Register, verify, authenticate and manage the signed-in account.
  - name: Questionnaires
    description: Discover, save and submit consultation questionnaires.
  - name: Consultations
    description: Read consultation state and manage consultation photographs.
  - name: Prescriptions
    description: Retrieve issued prescription documents and request reissue.
  - name: Messages
    description: Read and send messages to the medical team, and download attachments.
  - name: Billing
    description: >-
      Create checkout, manage subscriptions and retrieve
      payments/invoices/credit notes.
  - name: Records
    description: Read orders and manage patient health documents.
  - name: Safety reports
    description: Submit and read suspected side-effect reports; no automated diagnosis.
  - name: Progress
    description: Record and review eligible weight-loss progress.
  - name: Referrals
    description: Read the signed-in account's referral summary and referral activity.
paths:
  /v1/users/marketing/email-preferences/:
    post:
      tags:
        - Account
      summary: Update email communication preferences
      description: >-
        Updates marketing and newsletter choices using an email- and brand-bound
        token. Lifecycle messages remain enabled.


        ### Access, effects and retries

        **Ownership:** Public brand-scoped route; token/recipient scope applies
        as described.


        **Prerequisites:** Updates marketing and newsletter choices using an
        email- and brand-bound token. Lifecycle messages remain enabled.


        **Effects:** Updates marketing and newsletter choices using an email-
        and brand-bound token. Lifecycle messages remain enabled.


        **Retries:** Follow the returned status; do not replay email/provider
        writes automatically.
      operationId: users_marketing_email_preferences_create
      parameters:
        - in: header
          name: X-Brand-Slug
          required: false
          schema:
            type: string
          description: Brand for this request; use hi-doctor for these examples.
          example: hi-doctor
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  type: string
                  description: >-
                    Email address of the patient or recipient, normalized by the
                    endpoint.
                  format: email
                token:
                  type: string
                  description: >-
                    Signed, time-limited preference token bound to this email
                    and brand.
                locale:
                  type: string
                  description: >-
                    Preferred email language; unsupported values fall back to
                    English.
                preferences:
                  type: object
                  properties:
                    marketing:
                      type: boolean
                      description: Whether the recipient opts in to marketing messages.
                    newsletter:
                      type: boolean
                      description: Whether the recipient opts in to newsletter messages.
                  description: >-
                    Email topic choices. Transactional lifecycle messages remain
                    enabled.
              required:
                - email
                - token
                - preferences
            examples:
              example-1:
                summary: Illustrative request example
                value:
                  email: synthetic-patient@example.invalid
                  token: <TOKEN>
                  preferences: {}
      responses:
        '200':
          description: Successful response.
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    description: Whether the requested marketing action was accepted.
                  preferences:
                    type: object
                    properties:
                      lifecycle:
                        type: boolean
                        description: >-
                          Always true; essential account and care messages
                          cannot be disabled here.
                      marketing:
                        type: boolean
                        description: Whether the recipient opts in to marketing messages.
                      newsletter:
                        type: boolean
                        description: Whether the recipient opts in to newsletter messages.
                    description: >-
                      Email topic choices. Transactional lifecycle messages
                      remain enabled.
              examples:
                example-1:
                  summary: Illustrative response example
                  value: {}
        '400':
          description: Source-defined error; inspect the error envelope.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
              examples:
                example-1:
                  summary: Illustrative response example
                  value:
                    ok: false
                    error: invalid-preferences-payload
        '403':
          description: Source-defined error; inspect the error envelope.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
              examples:
                example-1:
                  summary: Illustrative response example
                  value:
                    ok: false
                    error: invalid-preferences-token
        '429':
          description: Source-defined error; inspect the error envelope.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
              examples:
                example-1:
                  summary: Illustrative response example
                  value:
                    detail: Request was throttled.
        '503':
          description: Source-defined error; inspect the error envelope.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
              examples:
                example-1:
                  summary: Illustrative response example
                  value:
                    ok: false
                    error: resend-not-configured
      security: []
      x-codeSamples:
        - lang: Shell
          label: curl
          source: >
            set -eu

            umask 077

            # Path values must be URL-encoded; query string excludes the leading
            question mark.

            url="${HD_BASE_URL:?Set API
            origin}/v1/users/marketing/email-preferences/${HD_QUERY_STRING:+?${HD_QUERY_STRING}}"

            printf 'X-Brand-Slug: hi-doctor\nAccept: application/json\n' >
            "${HD_REQUEST_HEADERS_FILE:?Private header file}"

            curl --silent --show-error --max-time 30 --request POST \
              --header "@$HD_REQUEST_HEADERS_FILE" \
              --dump-header "${HD_HEADERS_FILE:?Private response header file}" \
              --output "${HD_RESPONSE_FILE:?Private response file}" \
              --write-out '%{http_code}\n%{content_type}\n' \
              --header 'Content-Type: application/json' \
              --data-binary "@${HD_REQUEST_FILE:?JSON fixture file}" \
              "$url"
        - lang: Python
          label: requests
          source: >
            import os, json

            from pathlib import Path

            from urllib.parse import quote

            import requests

            os.umask(0o077)

            url = os.environ["HD_BASE_URL"].rstrip("/") +
            '/v1/users/marketing/email-preferences/'

            if os.environ.get("HD_QUERY_STRING"): url += "?" +
            os.environ["HD_QUERY_STRING"]

            headers = {"X-Brand-Slug": "hi-doctor", "Accept":
            'application/json'}

            kwargs = {}

            kwargs["json"] =
            json.loads(Path(os.environ["HD_REQUEST_FILE"]).read_text())

            response = requests.request('POST', url, headers=headers,
            timeout=30, allow_redirects=False, **kwargs)

            Path(os.environ["HD_RESPONSE_FILE"]).write_bytes(response.content)

            Path(os.environ["HD_HEADERS_FILE"]).write_text(json.dumps(dict(response.headers)))

            print(response.status_code)

            print(response.headers.get("Content-Type", ""))
        - lang: JavaScript
          label: fetch
          source: >
            import { readFileSync, writeFileSync } from "node:fs";

            const env = process.env;

            let url = env.HD_BASE_URL.replace(/\/$/, "") +
            "/v1/users/marketing/email-preferences/";

            if (env.HD_QUERY_STRING) url += "?" + env.HD_QUERY_STRING;

            const headers = { "X-Brand-Slug": "hi-doctor", "Accept":
            "application/json" };

            const options = { method: "POST", headers, redirect: "manual",
            signal: AbortSignal.timeout(30000) };

            headers["Content-Type"] = "application/json";

            options.body = readFileSync(env.HD_REQUEST_FILE, "utf8");

            const response = await fetch(url, options);

            writeFileSync(env.HD_RESPONSE_FILE, Buffer.from(await
            response.arrayBuffer()), {mode: 0o600});

            writeFileSync(env.HD_HEADERS_FILE,
            JSON.stringify(Object.fromEntries(response.headers)), {mode:
            0o600});

            console.log(response.status);

            console.log(response.headers.get("content-type") ?? "");

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.