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

# Send a one-time code

> Send a one-time login or verification code to a registering user's email or phone.

Part of the [User Registration](https://openloop.mintlify.site/api-reference/user-registration-guide.md) flow — sent after [Register a user](https://openloop.mintlify.site/auth/register.md), redeemed by [Verify a one-time code](https://openloop.mintlify.site/auth/verify-otp.md).


## OpenAPI

````yaml post /auth/send-otp
openapi: 3.1.0
info:
  title: OpenLoop API
  version: 0.1.0
  description: >-
    Unified reference for the OpenLoop Patient (clinical) and Payments & Revenue
    APIs.
servers:
  - url: https://api.openloophealth.com/v0.1
    description: Production partner edge
  - url: https://api-staging.openloophealth.com/v0.1
    description: Staging partner edge (sandbox credentials)
security: []
paths:
  /auth/send-otp:
    post:
      tags:
        - Auth
      summary: Send a one-time login/verification code
      description: >-
        Shared entry point for login and post-registration verification, keyed
        by `email` only. Returns the same `200` response whether or not the
        email belongs to a registered user.


        Requires a **service token** — the caller's token `sub` must be a
        client_credentials (M2M) subject; a user token is rejected with 401.


        **Permissions:** `otps:send`
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AuthSendOtpRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthSendOtpResponse'
        '400':
          description: Validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid bearer token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Bearer token is missing the otps:send permission.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - serviceToken:
            - otps:send
components:
  schemas:
    AuthSendOtpRequest:
      type: object
      required:
        - email
        - channel
      properties:
        email:
          type: string
          format: email
          maxLength: 254
        channel:
          type: string
          enum:
            - email
          description: >-
            Delivery channel for the one-time code. Only `email` is currently
            supported.
    AuthSendOtpResponse:
      type: object
      required:
        - data
        - request_id
      properties:
        data:
          type: object
          required:
            - expires_in
          properties:
            expires_in:
              type: integer
              description: Seconds until the one-time code expires.
        request_id:
          type: string
          format: uuid
          description: Correlation id echoed on every response.
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            error_code:
              type: string
          required:
            - message
            - error_code
        request_id:
          type: string
      required:
        - error
        - request_id
  securitySchemes:
    serviceToken:
      type: oauth2
      description: >-
        Service (M2M) access token issued by POST /auth/token using the
        client_credentials grant. Required scopes, where known, are listed on
        each operation below.
      flows:
        clientCredentials:
          tokenUrl: https://api.openloophealth.com/v0.1/auth/token
          scopes: {}

````

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