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

# Send SMS

> Send an SMS message from one of your phone numbers.

Sends an SMS message via Twilio using a phone number on your account. The cost is automatically deducted from your balance.

## Endpoint

`POST /user/sms`

## Request

<ParamField body="from" type="integer" required>
  ID of your phone number to send from. The number must be SMS-capable.
</ParamField>

<ParamField body="to" type="string" required>
  Recipient phone number in international format (e.g., `+1234567890`).
</ParamField>

<ParamField body="body" type="string" required>
  SMS message content. Maximum 300 characters.
</ParamField>

## Response

<ResponseField name="message" type="string">Confirmation message.</ResponseField>

<ResponseField name="data" type="object">
  SMS record details.

  <Expandable title="properties">
    <ResponseField name="id" type="integer">Unique identifier of the SMS record.</ResponseField>
    <ResponseField name="phone_number_id" type="integer">ID of the sending phone number.</ResponseField>
    <ResponseField name="to" type="string">Recipient's phone number in E.164 format.</ResponseField>
    <ResponseField name="body" type="string">SMS message content.</ResponseField>
    <ResponseField name="user_id" type="integer">ID of the user who sent the SMS.</ResponseField>
    <ResponseField name="segments" type="integer">Number of SMS segments (used for billing).</ResponseField>
    <ResponseField name="segment_price" type="number">Cost per segment in USD.</ResponseField>
    <ResponseField name="total_cost" type="number">Total cost of the SMS in USD.</ResponseField>
    <ResponseField name="status" type="string">Delivery status.</ResponseField>
    <ResponseField name="sms_sid" type="string">Twilio SID for tracking delivery.</ResponseField>
    <ResponseField name="created_at" type="string">Timestamp when the SMS was created.</ResponseField>
    <ResponseField name="updated_at" type="string">Timestamp when the SMS was last updated.</ResponseField>
  </Expandable>
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://portal.intellixent.ai/api/user/sms" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "from": 78,
      "to": "+1234567890",
      "body": "Hello! This is a message from Your Company. How can we help you today?"
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://portal.intellixent.ai/api/user/sms', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      from: 78,
      to: '+1234567890',
      body: 'Hello! This is a message from Your Company. How can we help you today?'
    })
  });

  const data = await response.json();
  console.log(data.data.sms_sid);
  ```
</CodeGroup>

```json 201 Success theme={null}
{
  "message": "SMS sent successfully",
  "data": {
    "id": 456,
    "phone_number_id": 78,
    "to": "+1234567890",
    "body": "Hello! This is a message from Your Company. How can we help you today?",
    "user_id": 1,
    "segments": 1,
    "segment_price": 0.0075,
    "total_cost": 0.0075,
    "status": "sent",
    "sms_sid": "SM1234567890abcdef1234567890abcdef",
    "created_at": "2025-08-04 15:30:00",
    "updated_at": "2025-08-04 15:30:02"
  }
}
```

```json 400 Not SMS-capable theme={null}
{
  "message": "From number is not SMS capable"
}
```

```json 400 Insufficient balance theme={null}
{
  "message": "Insufficient balance"
}
```

<Note>
  Long messages are split into multiple segments, each billed separately. Keep messages under 160 characters to stay within a single segment.
</Note>
