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

# Verify a one-time code

> Redeem the one-time code a user received and get the verification code you exchange for tokens.

Part of the [User Registration](https://openloop.mintlify.site/api-reference/user-registration-guide.md) flow — its `verification_code` is redeemed next at [Exchange a verification code](https://openloop.mintlify.site/auth/exchange-verification-code.md).


## OpenAPI

````yaml post /auth/verify-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/verify-otp:
    post:
      tags:
        - Auth
      summary: Verify a one-time code
      description: >-
        Redeems the code sent by `POST /auth/send-otp` for a short-lived (~60s)
        single-use verification code, which can then be exchanged for tokens at
        `POST /auth/token` using the verification-code grant. On success, a
        `pending_verification` identity is flipped to `active`.


        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:verify`
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AuthVerifyOtpRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthVerifyOtpResponse'
        '400':
          description: Validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid bearer token, or the code is invalid or expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: >-
            Code is invalid, expired, or too many attempts have been made, or
            the bearer token is missing the otps:verify permission.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - serviceToken:
            - otps:verify
components:
  schemas:
    AuthVerifyOtpRequest:
      type: object
      required:
        - email
        - code
      properties:
        email:
          type: string
          format: email
          maxLength: 254
        code:
          type: string
          pattern: ^[0-9]{6}$
          description: 6-digit one-time code sent to the email.
    AuthVerifyOtpResponse:
      type: object
      required:
        - data
        - request_id
      properties:
        data:
          type: object
          required:
            - verification_code
            - expires_in
          properties:
            verification_code:
              type: string
              description: >-
                Single-use code to redeem for tokens at `POST /auth/token` using
                the `verification-code` grant type.
            expires_in:
              type: integer
              description: Seconds until the verification 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.