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

# Send a Text

> Renders an SMS template with the supplied variables and sends it to one phone number. A 200 means the message was accepted and queued, not yet delivered — use the returned `messageId` with the status endpoint. Sandbox API keys are rejected.



## OpenAPI

````yaml POST /text/send
openapi: 3.0.1
info:
  title: CollectWise API
  description: >-
    An API for managing debtors, tracking statuses, and automating debt
    collection processes
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://collectwiseapi.com
security:
  - apiKey: []
paths:
  /text/send:
    post:
      summary: Send a one-time text
      description: >-
        Renders an SMS template with the supplied variables and sends it to one
        phone number. A 200 means the message was accepted and queued, not yet
        delivered — use the returned `messageId` with the status endpoint.
        Sandbox API keys are rejected.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - destination
                - templateId
                - variables
                - debtorId
              properties:
                destination:
                  type: string
                  description: >-
                    US phone number. `3313048434`, `13313048434`, and `+1 (331)
                    304-8434` are all accepted.
                templateId:
                  type: integer
                  description: >-
                    The template to send. Must belong to your organization's
                    account.
                variables:
                  type: object
                  additionalProperties:
                    type: string
                  description: >-
                    Values substituted into the template's `{placeholder}`
                    tokens. Use `{}` if the template has none. If any
                    placeholder is left unresolved, the request fails with 400
                    rather than texting a literal `{token}`.
                debtorId:
                  type: string
                  description: >-
                    Your reference for this recipient (e.g. your account or
                    reference number). Forwarded as-is; replies and the message
                    record are tracked against it.
            example:
              destination: '3313048434'
              templateId: 100
              variables:
                Consumer Name: Jane Doe
                Company Name: Acme Recovery Group
                Website Payment: https://pay.collectwise.com/acme
                Account Number: ACME-0001
                Phone#: 800-555-0100
              debtorId: your-reference-number
      responses:
        '200':
          description: Message accepted and queued.
          content:
            application/json:
              schema:
                type: object
                required:
                  - success
                  - messageId
                properties:
                  success:
                    type: boolean
                  messageId:
                    type: string
                    description: Delivery-tracking ID. Use it with the status endpoint.
                  segments:
                    $ref: '#/components/schemas/SegmentResult'
              example:
                success: true
                messageId: 1b1f0a9e-6f4e-4f4b-9a2e-1f2d3c4b5a69
                segments:
                  encoding: GSM-7
                  segmentCount: 1
                  characterCount: 142
                  maxCharsPerSegment: 160
        '400':
          description: >-
            Invalid body: bad phone number, missing or non-integer `templateId`,
            missing `debtorId`, bad `variables`, or unresolved template
            placeholders.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TextError'
              example:
                error: 'Missing variables for placeholders: Consumer Name'
        '403':
          description: >-
            Texting not enabled for your organization, the template is not in
            your account, or a sandbox key was used.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TextError'
              example:
                error: Template is not available for your account
        '404':
          description: Template not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TextError'
              example:
                error: Template not found
        '429':
          description: Rate limit exceeded (10 sends/min per organization).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TextError'
              example:
                error: Too many requests
        '500':
          description: Unexpected server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TextError'
              example:
                error: Internal server error
        '502':
          description: The SMS service rejected or failed the send.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TextError'
              example:
                error: Failed to send message
components:
  schemas:
    SegmentResult:
      type: object
      required:
        - encoding
        - characterCount
        - segmentCount
        - maxCharsPerSegment
      properties:
        encoding:
          type: string
          enum:
            - GSM-7
            - UCS-2
          description: >-
            Encoding the message is sent with. Any non-GSM-7 character (emoji,
            smart quotes, most CJK) forces the whole message to UCS-2.
        characterCount:
          type: integer
          description: Number of characters in the message.
        gsm7Length:
          type: integer
          description: >-
            Length in GSM-7 units (extended characters such as { } [ ] ~ \ | ^ €
            cost 2).
        segmentCount:
          type: integer
          description: Number of SMS segments the message will use.
        maxCharsPerSegment:
          type: integer
          description: >-
            Max characters per segment for the chosen encoding (160 GSM-7, 70
            UCS-2).
        messageSizeBits:
          type: integer
          description: Total message size in bits.
    TextError:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable error message.
      example:
        error: Texting is not enabled for this organization
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: collectwise_key

````