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

# Delete your account

> Permanently closes the authenticated patient's own account. Any active subscription is cancelled immediately — not at the end of the paid period.

If the account has retained medico-legal records (payments, refunds, prescriptions), personal data is anonymised in place and those records are kept as required by law; otherwise the account is deleted outright. Either way the `204` is final: credentials and refresh tokens stop working and the email address becomes free for a future registration.

Patient accounts only — internal roles are refused with a `403`.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/users/account/delete/
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/account/delete/:
    post:
      tags:
        - Account
      summary: Delete your account
      description: >-
        Permanently closes the authenticated patient's own account. Any active
        subscription is cancelled immediately — not at the end of the paid
        period.


        If the account has retained medico-legal records (payments, refunds,
        prescriptions), personal data is anonymised in place and those records
        are kept as required by law; otherwise the account is deleted outright.
        Either way the `204` is final: credentials and refresh tokens stop
        working and the email address becomes free for a future registration.


        Patient accounts only — internal roles are refused with a `403`.
      operationId: users_account_delete_create
      responses:
        '204':
          description: No response body
        '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
        '403':
          description: >-
            The token does not belong to a patient account — internal roles
            cannot use the self-service deletion endpoint.
          content:
            application/json:
              example:
                code: internal_account_deletion_forbidden
        '429':
          description: More than 5 deletion attempts within an hour. Honour Retry-After.
          content:
            application/json:
              example:
                detail: Request was throttled. Expected available in 3600 seconds.
        '502':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PatientAccountDeleteStripeFailureResponse'
              example:
                code: stripe_subscription_cancellation_failed
          description: >-
            A live subscription could not be confirmed cancelled at Stripe.
            Nothing was deleted or anonymised; the request is safe to retry.
      security:
        - jwtAuth: []
components:
  schemas:
    PatientAccountDeleteStripeFailureResponse:
      type: object
      properties:
        code:
          type: string
      required:
        - code
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Access token from POST /v1/users/token/
    jwtAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````