> ## Documentation Index
> Fetch the complete documentation index at: https://torpedo.co.mz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Check a code

> Checks the code the user entered. Returns `200` while the verification is pending, with
`valid: true` when the code is correct. A wrong code uses up one attempt.




## OpenAPI

````yaml /openapi.yaml post /api/v1/verify/{id}/check
openapi: 3.0.3
info:
  title: Torpedo API
  version: '1.0'
  description: |
    Torpedo is a transactional messaging API built for developers.
    Send emails from your own verified domain, SMS to Mozambican numbers, and
    WhatsApp verification codes with a single HTTP call.
  contact:
    email: hello@torpedo.co.mz
  license:
    name: Torpedo API Terms of Service
    url: https://torpedo.co.mz/terms
  termsOfService: https://torpedo.co.mz/terms
servers:
  - url: https://api.torpedo.co.mz
    description: Production
security:
  - ApiKeyAuth: []
paths:
  /api/v1/verify/{id}/check:
    post:
      tags:
        - Verify
      summary: Check a code
      description: >
        Checks the code the user entered. Returns `200` while the verification
        is pending, with

        `valid: true` when the code is correct. A wrong code uses up one
        attempt.
      operationId: checkVerification
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - code
              properties:
                code:
                  type: string
                  maxLength: 15
                  example: '482910'
      responses:
        '200':
          description: Check result
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                      status:
                        type: string
                        enum:
                          - approved
                          - pending
                          - max_attempts_reached
                      valid:
                        type: boolean
                      attemptsRemaining:
                        type: integer
                        example: 4
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: Verification not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '410':
          description: >-
            The verification already ended (VERIFICATION_ALREADY_APPROVED,
            VERIFICATION_EXPIRED, VERIFICATION_CANCELED or MAX_ATTEMPTS_REACHED)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too many wrong codes for this number. See the Retry-After header
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  responses:
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      required:
        - errors
      properties:
        errors:
          type: array
          items:
            type: object
            required:
              - code
              - message
            properties:
              code:
                type: string
                example: VALIDATION_ERROR
              message:
                type: string
                example: Domain not verified
              field:
                type: string
                example: from
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: |
        Prefix `tor_` followed by a base64url-encoded random key.
        Create and manage API keys from the authenticated Torpedo dashboard.

````

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