> ## Documentation Index
> Fetch the complete documentation index at: https://api.vitarelay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Submit referral intake answers (partner-collected, self-hosted)

> Submit intake answers your patient completed on YOUR OWN site. Creates a submitted intake and automatically routes the referral to the Internal Doctor Network — no hosted intake link needed. Use this instead of `Send an intake` when you collect the questionnaire yourself. The IDN prescriber still reviews and writes or declines the script. Requires `rx:write`. Test keys run in a full sandbox (no real records created).



## OpenAPI

````yaml /openapi.yaml post /rx/patients/{patientId}/intake/submit
openapi: 3.1.0
info:
  title: VitaRelay API
  version: 2.0.0
  description: |
    The VitaRelay REST API.

    **Base URL:** `https://vitarelay.com/api/public/v1`

    ## Authentication
    All requests require a Bearer API key:

    ```text
    Authorization: Bearer vr_live_xxxxxxxxxxxxxxxx
    ```

    Keys are issued per organization. `vr_live_` keys act on production data.
    `vr_test_` keys operate a fully-isolated **sandbox** (see below).

    ## Pagination
    List endpoints are cursor-based. Pass `limit` (default 50, max 100) and
    `cursor` (the `next_cursor` from the previous page). When `next_cursor`
    is `null` there are no further pages. All resource ids are UUIDs.

    ## Idempotency
    Write endpoints accept your own external identifiers —
    `external_patient_id`, `external_intake_id`, `external_order_id`. These act
    as idempotency keys: replaying a request with the same external id returns
    the original resource (HTTP `200` instead of `201`) rather than creating a
    duplicate.

    ## Rate limiting
    Write endpoints are rate limited per API key — default **60 requests per
    minute** (fixed window). Exceeding the limit returns `429 rate_limited`
    with `Retry-After`, `X-RateLimit-Limit`, `X-RateLimit-Remaining` and
    `X-RateLimit-Reset` headers. Read endpoints are not rate limited in v1.

    ## Sandbox
    With a `vr_test_` key, writes never create real patients, intakes or orders
    and never charge a card. They return synthetic ids (`sandbox_pat_…`,
    `sandbox_int_…`, `sandbox_ord_…`) and include `"sandbox": true` in the
    response. Sandbox objects advance through a simulated lifecycle that fires
    real webhook deliveries to your endpoint (`intake.reviewed`, `order.paid` →
    `order.shipped` → `order.delivered`) with `"sandbox": true` in the payload.
    In sandbox, reference a patient by `external_patient_id` or by the returned
    `sandbox_pat_…` id.

    ## Webhooks
    Outbound webhooks are configured in the VitaRelay admin UI (there is no
    webhook management API). Events: `order.paid`, `order.shipped`,
    `order.delivered`, `order.exception`, `intake.reviewed`. Each delivery is
    signed with HMAC-SHA256 over the raw body and carries the headers
    `X-VitaRelay-Signature: sha256=<hex>`, `X-VitaRelay-Event`,
    `X-VitaRelay-Delivery` (event id) and `X-VitaRelay-Timestamp`. Failed
    deliveries are retried with exponential backoff and dead-lettered after the
    maximum attempts.
  contact:
    name: VitaRelay Support
    email: info@vitarelay.com
servers:
  - url: https://vitarelay.com/api/public/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Patients
    description: Patient records scoped to your organization.
  - name: Intakes
    description: Intake form submissions. Write access is Vita Clinic only.
  - name: Orders
    description: >-
      Orders and fulfillment status. Two billing modes: `card_on_file` (default)
      charges the clinic's stored card synchronously, and `patient_checkout`
      creates the order unpaid and returns a checkout block so the patient can
      pay on your own page via Authorize.Net Accept.js (see POST
      /orders/{id}/pay).
  - name: Products
    description: Catalog products available to your organization.
  - name: Prescriptions
    description: >-
      Prescriptions written by your organization (read only). Refer patients
      into the Internal Doctor Network (IDN). You refer; an IDN doctor evaluates
      and prescribes. Requires IDN activation and rx scopes.
  - name: Storefront
    description: >-
      Build and manage your clinic's patient storefront — settings, curated
      product listings and bundles. Requires the `shop:read` / `shop:write`
      scopes.
  - name: Subscriptions
    description: >-
      Patient-shop subscription lifecycle. Requires `subscriptions:read` or
      `subscriptions:write`.
paths:
  /rx/patients/{patientId}/intake/submit:
    post:
      tags:
        - Intakes
      summary: Submit referral intake answers (partner-collected, self-hosted)
      description: >-
        Submit intake answers your patient completed on YOUR OWN site. Creates a
        submitted intake and automatically routes the referral to the Internal
        Doctor Network — no hosted intake link needed. Use this instead of `Send
        an intake` when you collect the questionnaire yourself. The IDN
        prescriber still reviews and writes or declines the script. Requires
        `rx:write`. Test keys run in a full sandbox (no real records created).
      parameters:
        - name: patientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - responses
              properties:
                responses:
                  type: object
                  description: >-
                    The medical questionnaire answers. Must include these six
                    required fields or the request is rejected 422:
                    treatment_need (array or non-empty string), treatment_reason
                    (non-empty string), current_meds (present; "" or "none" are
                    valid), has_allergies (present), attest_accurate (boolean
                    true), attest_telehealth (boolean true).
                pharmacy_product_id:
                  type: string
                  description: >-
                    Optional. The requested 503A product id (from /rx/catalog).
                    The prescriber still decides.
                external_intake_id:
                  type: string
                  description: Optional idempotency key.
            example:
              responses:
                treatment_need:
                  - weight loss
                treatment_reason: Patient seeking GLP-1 therapy for weight management
                current_meds: none
                has_allergies: 'no'
                attest_accurate: true
                attest_telehealth: true
              pharmacy_product_id: 063b65ad-d92a-4120-9784-869f21f9c3ea
      responses:
        '201':
          description: Intake submitted and routed to the IDN.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      intake_id:
                        type: string
                      status:
                        type: string
                      pushed_to_idn:
                        type: boolean
        '403':
          $ref: '#/components/responses/IdnNotJoined'
        '404':
          $ref: '#/components/responses/RxNotFound'
        '422':
          description: Intake incomplete (lists missing required fields).
components:
  responses:
    IdnNotJoined:
      description: Org not IDN-activated, or rx scope missing.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: idn_not_joined
              message: Your organization hasn't joined the Internal Doctor Network yet.
    RxNotFound:
      description: Patient/request not found for your org.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RxError'
  schemas:
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: |
                One of `invalid_body`, `validation_failed`, `unauthorized`,
                `insufficient_scope`, `not_vita_clinic`, `patient_not_found`,
                `product_not_found`, `product_not_allowed`, `duplicate_request`,
                `rate_limited`, `card_required`, `payment_declined`,
                `internal_error`, `not_found`.
            message:
              type: string
      example:
        error:
          code: validation_failed
          message: One or more fields are invalid
    RxError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |
        API key issued by VitaRelay. Send as `Authorization: Bearer vr_live_…`
        (production) or `Authorization: Bearer vr_test_…` (sandbox).

````