Documentation

Quickstart

Create an account, authenticate with Textree, send your first SMS, inspect the message log, and configure a webhook.

Copy-paste API examples
curl JavaScript Python Elixir
curl
curl https://api.texttree.ai/api/v1/messages \
  -H "Authorization: Bearer $TEXTREE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"phone_number":"+15551234567","body":"Hello"}'

1. Create an account

Start in the Textree app. Email, Google OAuth, wallet auth, and agent tokens all normalize into the same Textree identity model.

https://app.texttree.ai/signup

2. Get an access token

Use a Textree bearer token from the authenticated app or provision an agent token.

TEXTREE_ACCESS_TOKEN=txa...

3. Add or rent a phone number

Use a test sender first. Move to a live sender only after billing and compliance are ready.

4. Send your first SMS

Set TEXTREE_ACCESS_TOKEN in your shell, then send a test message. In test mode, use a verified recipient number.

curl

curl https://api.texttree.ai/api/v1/messages \
  -H "Authorization: Bearer $TEXTREE_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "phone_number": "+15551234567",
    "body": "Hello from Textree"
  }'

JavaScript

const response = await fetch("https://api.texttree.ai/api/v1/messages", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TEXTREE_ACCESS_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    phone_number: "+15551234567",
    body: "Hello from Textree",
  }),
});

const result = await response.json();
console.log(result.message.id, result.message.status);

Python

import os
import requests

response = requests.post(
    "https://api.texttree.ai/api/v1/messages",
    headers={
        "Authorization": f"Bearer {os.environ['TEXTREE_ACCESS_TOKEN']}",
        "Content-Type": "application/json",
    },
    json={
        "phone_number": "+15551234567",
        "body": "Hello from Textree",
    },
    timeout=10,
)

response.raise_for_status()
message = response.json()["message"]
print(message["id"], message["status"])

Elixir

Mix.install([:req])

response =
  Req.post!(
    "https://api.texttree.ai/api/v1/messages",
    auth: {:bearer, System.fetch_env!("TEXTREE_ACCESS_TOKEN")},
    json: %{
      phone_number: "+15551234567",
      body: "Hello from Textree"
    }
  )

IO.inspect({response.body["message"]["id"], response.body["message"]["status"]})

Expected response:

{
  "message": {
    "id": "msg_123",
    "status": "queued"
  }
}

Form posts are accepted as long as they use the V1 phone_number field:

curl https://api.texttree.ai/api/v1/messages \
  -H "Authorization: Bearer $TEXTREE_ACCESS_TOKEN" \
  -d "phone_number=+15551234567" \
  -d "body=Hello from Textree"

5. View the message log

Open Messages in the console to inspect status, cost, failure reason, and timeline.

6. Configure a webhook

Create an endpoint and send a test event before going live.

7. Go live

Add billing, complete compliance, register or connect a sender, and switch the environment to Live.