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

# Quickstart

> Send your first WhatsApp message in 5 minutes

# Quickstart

Get started with the TimelinesAI API in just a few steps.

## Prerequisites

<Check>
  A TimelinesAI account with at least one connected WhatsApp number
</Check>

<Check>
  Basic familiarity with REST APIs
</Check>

## Step 1: Get your API token

<Steps>
  <Step title="Log in to TimelinesAI">
    Go to [app.timelines.ai](https://app.timelines.ai) and sign in to your account.
  </Step>

  <Step title="Navigate to API settings">
    Click **Integrations** → **Public API** in the left sidebar.
  </Step>

  <Step title="Copy your token">
    Click **Copy** to copy your API token. Keep this secure—it provides full access to your workspace.
  </Step>
</Steps>

<Warning>
  Never share your API token publicly or commit it to version control. Use environment variables in production.
</Warning>

## Step 2: Test your connection

Verify your token works by listing your WhatsApp accounts:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://app.timelines.ai/integrations/api/whatsapp_accounts" \
    -H "Authorization: Bearer YOUR_API_TOKEN"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://app.timelines.ai/integrations/api/whatsapp_accounts', {
    headers: {
      'Authorization': 'Bearer YOUR_API_TOKEN'
    }
  });
  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://app.timelines.ai/integrations/api/whatsapp_accounts',
      headers={'Authorization': 'Bearer YOUR_API_TOKEN'}
  )
  print(response.json())
  ```
</CodeGroup>

You should see a response like:

```json theme={null}
{
  "status": "ok",
  "data": [
    {
      "id": "14155551234@s.whatsapp.net",
      "phone": "+14155551234",
      "name": "Business WhatsApp",
      "connected": true
    }
  ]
}
```

## Step 3: Send your first message

Now send a message to a phone number:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://app.timelines.ai/integrations/api/messages" \
    -H "Authorization: Bearer YOUR_API_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "phone": "+14155559999",
      "text": "Hello from TimelinesAI API! 🎉"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://app.timelines.ai/integrations/api/messages', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_TOKEN',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      phone: '+14155559999',
      text: 'Hello from TimelinesAI API! 🎉'
    })
  });
  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://app.timelines.ai/integrations/api/messages',
      headers={
          'Authorization': 'Bearer YOUR_API_TOKEN',
          'Content-Type': 'application/json'
      },
      json={
          'phone': '+14155559999',
          'text': 'Hello from TimelinesAI API! 🎉'
      }
  )
  print(response.json())
  ```
</CodeGroup>

<Note>
  Replace `+14155559999` with a real phone number. The recipient must have WhatsApp installed.
</Note>

Success response:

```json theme={null}
{
  "status": "ok",
  "data": {
    "message_uid": "a5bbb005-37f2-402c-96fa-e479a2e09b02"
  }
}
```

<Info>
  Messages are queued and sent asynchronously. Use the `message_uid` to track delivery status.
</Info>

## Step 4: Check message status

Track your message delivery:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://app.timelines.ai/integrations/api/messages/a5bbb005-37f2-402c-96fa-e479a2e09b02/status_history" \
    -H "Authorization: Bearer YOUR_API_TOKEN"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://app.timelines.ai/integrations/api/messages/a5bbb005-37f2-402c-96fa-e479a2e09b02/status_history',
    {
      headers: { 'Authorization': 'Bearer YOUR_API_TOKEN' }
    }
  );
  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://app.timelines.ai/integrations/api/messages/a5bbb005-37f2-402c-96fa-e479a2e09b02/status_history',
      headers={'Authorization': 'Bearer YOUR_API_TOKEN'}
  )
  print(response.json())
  ```
</CodeGroup>

## Next steps

<CardGroup cols={2}>
  <Card title="Send attachments" icon="paperclip" href="/guides/file-attachments">
    Learn to send images and documents
  </Card>

  <Card title="Set up webhooks" icon="webhook" href="/guides/webhooks">
    Receive real-time notifications
  </Card>

  <Card title="Manage chats" icon="comments" href="/guides/managing-chats">
    Organize and assign conversations
  </Card>

  <Card title="API Reference" icon="code" href="/public-api-reference/overview">
    Explore all endpoints
  </Card>
</CardGroup>
