> ## 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.

# Send a lead event

> Anonymous attribution endpoint called by the landing funnel. Accepts a lead event for the current page category and returns `202`; no bearer token is required, though an authenticated caller is matched by id. The event is only forwarded when `consent.marketing` is `true` — without marketing consent the request is still accepted (`202`) but nothing is sent.

`category_code` is a neutral single-letter code (`p`, `c` or `s`); `event_id` is a caller-supplied identifier used for de-duplication downstream (the endpoint itself does not enforce uniqueness). `consent.marketing` is required. Missing or invalid fields are a `400`. The endpoint is throttled.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/users/meta/lead/
openapi: 3.0.3
info:
  title: Hi-Doctor API
  version: 1.0.0
  description: >-
    Patient-facing REST API for Hi-Doctor.


    Authenticate with email and password to get an `access` token, then send it
    as `Authorization: Bearer <token>` on every request that needs one.
    Registering, verifying the code, signing in and refreshing the token all
    work without a bearer token.


    Every account-scoped endpoint returns only the authenticated patient's own
    records. A resource you cannot see is indistinguishable from one that does
    not exist.
  contact:
    name: Hi-Doctor
    email: hello@hi-doctor.ai
    url: https://hi-doctor.ai
servers:
  - url: https://api.hi-doctor.ai
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Account
    description: Registration, email verification, sign-in and profile.
  - name: Questionnaires
    description: Complete a consultation questionnaire and submit it for medical review.
  - name: Consultations
    description: Consultations a doctor has reviewed or is reviewing.
  - name: Prescriptions
    description: Prescriptions and reissue requests.
  - name: Billing
    description: Checkout, subscription management and the Stripe billing portal.
  - name: Records
    description: Orders, invoices and side-effect reports.
  - name: Messages
    description: The patient's private thread with their medical team.
  - name: Progress
    description: Weight, injection and note tracking. Requires an active treatment plan.
  - name: Referrals
    description: Referral summary and transactions.
  - name: Attribution
    description: Lead and attribution events from the landing funnel.
paths:
  /v1/users/meta/lead/:
    post:
      tags:
        - Attribution
      summary: Send a lead event
      description: >-
        Anonymous attribution endpoint called by the landing funnel. Accepts a
        lead event for the current page category and returns `202`; no bearer
        token is required, though an authenticated caller is matched by id. The
        event is only forwarded when `consent.marketing` is `true` — without
        marketing consent the request is still accepted (`202`) but nothing is
        sent.


        `category_code` is a neutral single-letter code (`p`, `c` or `s`);
        `event_id` is a caller-supplied identifier used for de-duplication
        downstream (the endpoint itself does not enforce uniqueness).
        `consent.marketing` is required. Missing or invalid fields are a `400`.
        The endpoint is throttled.
      operationId: users_meta_lead_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MetaLead'
            example:
              event_id: lead.browser-123
              category_code: p
              consent:
                marketing: true
              fbp: fb.1.1558571054389
              fbc: fb.1.1558571054389iwp121Bof
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MetaLead'
          description: ''
        '202':
          description: Success
          content:
            application/json:
              example:
                accepted: true
        '401':
          description: >-
            No bearer token, or a token that is expired or malformed.
            Re-authenticate; do not retry the same token.
          content:
            application/json:
              example:
                detail: Given token not valid for any token type
                code: token_not_valid
                messages:
                  - token_class: AccessToken
                    token_type: access
                    message: Token is invalid
      security:
        - jwtAuth: []
        - {}
components:
  schemas:
    MetaLead:
      type: object
      properties:
        event_id:
          type: string
          maxLength: 255
          minLength: 1
        category_code:
          $ref: '#/components/schemas/CategoryCodeEnum'
        consent:
          $ref: '#/components/schemas/MetaConsent'
        fbp:
          type: string
          maxLength: 500
        fbc:
          type: string
          maxLength: 500
      required:
        - category_code
        - consent
        - event_id
    CategoryCodeEnum:
      enum:
        - p
        - c
        - s
      type: string
    MetaConsent:
      type: object
      properties:
        marketing:
          type: boolean
      required:
        - marketing
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Access token from POST /v1/users/token/
    jwtAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````