# Get Authenticator code

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v2/mailboxes/authenticator-code:
    get:
      summary: Get Authenticator code
      deprecated: false
      description: "This endpoint allows you to retrieve an authenticator code for a specific mailbox. The code can be used for authentication purposes and has a limited validity period.\n\n> **Note** \n>    -\tThe `expiresIn` field in the response indicates the number of seconds after which the current code will expire.\n>    -\tAfter expiration, you must re-hit the API to obtain a new code, as the old one will no longer be valid.\n>   -\t`domainId` is optional and can only be used with Microsoft domains to fetch the OTP for the admin account of the given domain."
      tags:
        - mailbox
      parameters:
        - name: mailboxId
          in: query
          description: ''
          required: false
          example: ''
          schema:
            type: string
        - name: domainId
          in: query
          description: ''
          required: false
          schema:
            type: string
        - name: x-auth-zapmail
          in: header
          description: ''
          required: true
          example: ''
          schema:
            type: string
        - name: x-workspace-key
          in: header
          description: ''
          required: false
          example: ''
          schema:
            type: string
        - name: ' x-service-provider'
          in: header
          description: ''
          required: false
          example: ''
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties: {}
              example:
                status: 200
                message: Unique exports fetched successfully
                data:
                  otp: '246043'
                  expiresIn: 4
          headers: {}
          x-apidog-name: Success
        '400':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                  message:
                    type: string
                  errorId:
                    type: string
                required:
                  - status
                  - message
                  - errorId
                x-apidog-orders:
                  - status
                  - message
                  - errorId
              example:
                status: 400
                message: Authenticator code by domain is only supported for Microsoft
                errorId: a8612d76-4d70-4971-b74f-ff50ef398cee
          headers: {}
          x-apidog-name: Domain id only for MS
        x-400:2FA Not set:
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                  message:
                    type: string
                  errorId:
                    type: string
                required:
                  - status
                  - message
                  - errorId
                x-apidog-orders:
                  - status
                  - message
                  - errorId
              example:
                status: 400
                message: No 2FA set for this mailbox
                errorId: cb5b72bb-a07d-461a-947f-8bbfe621aff5
          headers: {}
          x-apidog-name: 2FA Not set
      security: []
      x-apidog-folder: mailbox
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/797058/apis/api-13648760-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://api.zapmail.ai/api
    description: Prod Env
security: []

```
