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

# Get an SMS

> Returns an SMS sent by your project and its current status.



## OpenAPI

````yaml api-reference/openapi.yaml GET /messages/sms/{sid}
openapi: 3.1.0
info:
  title: OTPBay API
  version: 1.0.0
  description: >-
    Send one-time passwords over Telegram and SMS, verify the codes your users
    enter, and send transactional SMS from your own sender ID.
  contact:
    name: OTPBay support
    email: hello@otpbay.com
servers:
  - url: https://api.otpbay.com/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Project
    description: The project that owns the API key.
  - name: Verify
    description: >-
      Send a code and check it. OTPBay generates the code and falls back from
      Telegram to SMS.
  - name: SMS
    description: Send any text message from one of your approved sender IDs.
  - name: Telegram
    description: Send a one-time code to a Telegram account through the Telegram Gateway.
paths:
  /messages/sms/{sid}:
    get:
      tags:
        - SMS
      summary: Get an SMS
      description: Returns an SMS sent by your project and its current status.
      operationId: getSms
      parameters:
        - name: sid
          in: path
          required: true
          description: The SMS `sid` returned when you sent it.
          schema:
            type: string
            pattern: ^SM[a-fA-F0-9]{24}$
            example: SM6650c4b7c2d3e4f5a6b7c8d9
      responses:
        '200':
          description: The SMS.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SmsMessage'
              example:
                sid: SM6650c4b7c2d3e4f5a6b7c8d9
                status: sent
                to: '+447700900123'
                from: Acme
                body: Your Acme order 1042 has shipped.
                sms_segments: 1
                cost: '0.04'
                metadata:
                  order_id: '1042'
                date_created: '2026-09-26T10:20:11.302Z'
                processed_at: '2026-09-26T10:20:12.019Z'
        '400':
          $ref: '#/components/responses/InvalidSid'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/IpNotAllowed'
        '404':
          description: '`SMS_MESSAGE_NOT_FOUND` — no SMS with this `sid` in your project.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: SMS_MESSAGE_NOT_FOUND
                  message: SMS message was not found for this account.
components:
  schemas:
    SmsMessage:
      type: object
      required:
        - sid
        - status
        - to
        - from
        - body
        - sms_segments
        - cost
        - metadata
        - date_created
        - processed_at
      properties:
        sid:
          type: string
          pattern: ^SM[a-f0-9]{24}$
          description: Unique SMS ID.
          example: SM6650c4b7c2d3e4f5a6b7c8d9
        status:
          type: string
          enum:
            - queued
            - processing
            - sent
            - failed
            - enqueue_failed
          description: >-
            `queued` → `processing` → `sent` when the carrier accepts the
            message, or `failed` after retries. `enqueue_failed` means the
            message was saved but never queued.
        to:
          $ref: '#/components/schemas/PhoneNumber'
        from:
          type:
            - string
            - 'null'
          description: Sender ID the message was sent from.
          example: Acme
        body:
          type: string
          example: Your Acme order 1042 has shipped.
        sms_segments:
          type: integer
          description: Number of billed segments.
          example: 1
        cost:
          allOf:
            - $ref: '#/components/schemas/Money'
          description: Price of the message (per-segment price × segments).
          example: '0.04'
        metadata:
          $ref: '#/components/schemas/Metadata'
        date_created:
          type: string
          format: date-time
        processed_at:
          type:
            - string
            - 'null'
          format: date-time
          description: When the carrier accepted the message.
        last_error:
          type: string
          description: Latest delivery error. Only present when there is one.
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: >-
                Stable, machine-readable error code. Branch on this, not on
                `message`.
              example: INSUFFICIENT_BALANCE
            message:
              type: string
              description: Human-readable explanation. The wording can change.
              example: Insufficient balance for this verification.
    PhoneNumber:
      type: string
      description: >-
        Destination phone number in international format. OTPBay normalizes it
        to E.164, so `+1 (415) 555-2671` becomes `+14155552671`.
      example: '+14155552671'
    Money:
      type: string
      pattern: ^\d+\.\d{2}$
      description: Amount in US dollars as a decimal string.
      example: '0.02'
    Metadata:
      type: object
      description: >-
        Your own key-value data, returned in responses and webhooks. At most 32
        keys of 1–64 characters. Values are strings (up to 512 characters),
        numbers or booleans.
      maxProperties: 32
      additionalProperties:
        oneOf:
          - type: string
            maxLength: 512
          - type: number
          - type: boolean
      example:
        user_id: usr_1042
  responses:
    InvalidSid:
      description: >-
        `INVALID_MESSAGE_SID` — the `sid` doesn't have the right prefix and 24
        hex characters.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: INVALID_MESSAGE_SID
              message: '`sid` must match VExxxxxxxxxxxxxxxxxxxxxxxx (ObjectId hex).'
    Unauthorized:
      description: '`MISSING_API_KEY` or `INVALID_API_KEY`.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: INVALID_API_KEY
              message: Invalid API key.
    IpNotAllowed:
      description: >-
        `IP_NOT_ALLOWED` — the project's IP allowlist is on and your address
        isn't in it.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: IP_NOT_ALLOWED
              message: This IP address is not allowed for this project.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your project API key, sent as `Authorization: Bearer otp_live_...`.
        Create keys on the **API Keys** page of the dashboard.

````