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

# Start a verification

> Sends a one-time code to a phone number over WhatsApp (default) or SMS and returns a
verification. Returns `202 Accepted`; the code is sent in the background.

A number can only have one pending verification at a time. Sends are charged from the
workspace's WhatsApp balance (or SMS credits for SMS).




## OpenAPI

````yaml /openapi.yaml post /api/v1/verify
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:
    post:
      tags:
        - Verify
      summary: Start a verification
      description: >
        Sends a one-time code to a phone number over WhatsApp (default) or SMS
        and returns a

        verification. Returns `202 Accepted`; the code is sent in the
        background.


        A number can only have one pending verification at a time. Sends are
        charged from the

        workspace's WhatsApp balance (or SMS credits for SMS).
      operationId: startVerification
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - to
              properties:
                to:
                  type: string
                  pattern: ^\+[1-9]\d{7,14}$
                  description: Recipient phone number in E.164 format
                  example: '+258841234567'
                channel:
                  type: string
                  enum:
                    - whatsapp
                    - sms
                  default: whatsapp
                  description: SMS only works for Mozambican mobile numbers.
                fallback:
                  type: string
                  enum:
                    - sms
                  nullable: true
                  description: >-
                    Send the code by SMS if WhatsApp fails. Defaults to the
                    workspace setting.
                locale:
                  type: string
                  enum:
                    - pt
                    - en
                  description: Template language. Defaults to the workspace setting.
                code:
                  type: string
                  pattern: ^(?=.*\d)[A-Za-z0-9]{4,10}$
                  description: >-
                    Your own code. Omit it to let Torpedo generate one. Can't be
                    combined with codeLength.
                codeLength:
                  type: integer
                  minimum: 6
                  maximum: 10
                  description: >-
                    Length of the generated code. Defaults to the workspace
                    setting.
                template:
                  type: string
                  maxLength: 512
                  description: Name of an approved WhatsApp authentication template.
                clientRef:
                  type: string
                  maxLength: 128
                  description: >-
                    Your own reference, returned on the verification and in
                    webhooks.
                ip:
                  type: string
                  maxLength: 64
                  description: The end user's IP address, used for per-IP rate limiting.
      responses:
        '202':
          description: Verification started
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VerificationResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          description: Not enough WhatsApp balance or SMS credits
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            A verification is already pending for this number
            (VERIFICATION_PENDING)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: >-
            Invalid request, suppressed recipient, country not allowed, channel
            unavailable or no approved template
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Verify rate limit reached. See the Retry-After header
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: WhatsApp sending is not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      description: >-
        Unique key for replaying the original accepted response without sending
        again. Leading and trailing whitespace is removed; only the first 255
        characters are retained.
      schema:
        type: string
  schemas:
    VerificationResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/Verification'
    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
    Verification:
      type: object
      properties:
        id:
          type: string
          format: uuid
        status:
          type: string
          enum:
            - pending
            - approved
            - expired
            - canceled
            - max_attempts_reached
        to:
          type: string
          example: '+258841234567'
        channel:
          type: string
          enum:
            - whatsapp
            - sms
        fallback:
          type: string
          enum:
            - sms
          nullable: true
        locale:
          type: string
          enum:
            - pt
            - en
        codeSource:
          type: string
          enum:
            - generated
            - custom
        isTest:
          type: boolean
        clientRef:
          type: string
          nullable: true
          example: signup-4821
        checkAttempts:
          type: integer
          example: 0
        maxCheckAttempts:
          type: integer
          example: 5
        sendCount:
          type: integer
          example: 1
        maxSends:
          type: integer
          example: 5
        expiresAt:
          type: string
          format: date-time
        resendAvailableAt:
          type: string
          format: date-time
          nullable: true
        approvedAt:
          type: string
          format: date-time
          nullable: true
        createdAt:
          type: string
          format: date-time
        attempts:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                format: uuid
              channel:
                type: string
                enum:
                  - whatsapp
                  - sms
              trigger:
                type: string
                enum:
                  - initial
                  - resend
                  - fallback
              status:
                type: string
                enum:
                  - queued
                  - sent
                  - delivered
                  - failed
              errorCode:
                type: string
                nullable: true
                example: '131026'
              errorCategory:
                type: string
                nullable: true
                example: recipient_unreachable
              createdAt:
                type: string
                format: date-time
  responses:
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  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.