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

# API quickstart

> Create an API key, check it with GET /me and send your first message with the Shortext API v2.0.

This quickstart takes you from an empty integration to a first WhatsApp message sent through the API. You need a Shortext company with at least one [connected WhatsApp number](https://docs.shortext.ny-corp.io/channels/whatsapp.md).

**1. Create an API key**

In the dashboard, open **Developer > API Keys** and create a key. Give it a name (for example "CRM integration") and choose its permissions. To follow this quickstart, keep **Send messages** checked; add **Manage integrations** if your integration also manages agents, channels or webhooks.

The key is shown **once**. Store it in a secret manager or an environment variable, for example `SHORTEXT_API_KEY`.

> [!WARNING]
>
> An API key gives access to your company's data. Never put it in a mobile app, a web page or a public repository.

**2. Check the key with GET /me**

Every request sends the key as a bearer token. `GET /me` tells you which company and which key you are using.

```bash cURL theme={null}
curl https://shortext.ny-corp.io/api/v2.0/me \
  -H "Authorization: Bearer $SHORTEXT_API_KEY" \
  -H "Accept: application/json"
```

```php PHP theme={null}
<?php
$response = (new GuzzleHttp\Client())->get('https://shortext.ny-corp.io/api/v2.0/me', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('SHORTEXT_API_KEY'),
        'Accept'        => 'application/json',
    ],
]);

$result = json_decode((string) $response->getBody(), true);
if (!$result['success']) {
    throw new RuntimeException("Shortext error {$result['code']}: {$result['message']}");
}
echo $result['body']['company']['name'];
```

```javascript Node.js theme={null}
const response = await fetch("https://shortext.ny-corp.io/api/v2.0/me", {
  headers: {
    Authorization: `Bearer ${process.env.SHORTEXT_API_KEY}`,
    Accept: "application/json",
  },
});

const result = await response.json();
if (!result.success) {
  throw new Error(`Shortext error ${result.code}: ${result.message}`);
}
console.log(result.body.company.name);
```

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

response = requests.get(
    "https://shortext.ny-corp.io/api/v2.0/me",
    headers={
        "Authorization": f"Bearer {os.environ['SHORTEXT_API_KEY']}",
        "Accept": "application/json",
    },
)

result = response.json()
if not result["success"]:
    raise RuntimeError(f"Shortext error {result['code']}: {result['message']}")
print(result["body"]["company"]["name"])
```

```json Response theme={null}
{
  "success": true,
  "message": "Request success.",
  "code": 1000,
  "body": {
    "company": { "id": "CMP-XXXXX", "name": "Acme" },
    "user": null,
    "token": {
      "name": "CRM integration",
      "abilities": ["permissions.send_messages", "permissions.view_messages"],
      "last_used_at": "2026-10-24T09:12:44.000000Z",
      "expires_at": null
    },
    "api_version": "v2.0"
  }
}
```

The HTTP status is always `200`: read `success` and `code` to know the outcome. See [API introduction](https://docs.shortext.ny-corp.io/api-reference/introduction.md).

**3. Find your channel and a template**

`GET /channels?type=whatsapp` lists your WhatsApp numbers. The `id` of a channel is the `channel_id` you send messages from.

WhatsApp only lets a business write first with an **approved template**. `GET /templates?channel_id={id}&status=APPROVED` lists the templates this number can send, with their variables.

**4. Send your first message**

`POST /conversations` sends a first message to a contact and opens (or continues) the conversation.

```bash cURL theme={null}
curl -X POST https://shortext.ny-corp.io/api/v2.0/conversations \
  -H "Authorization: Bearer $SHORTEXT_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "channel": "whatsapp",
    "channel_id": "532867649916076",
    "contact": {
      "identifier": "237699999999",
      "profile": { "firstname": "Brice", "lastname": "Mbarga", "preferred_language": "fr" }
    },
    "message": {
      "type": "template",
      "content": {
        "template_name": "order_update",
        "language": "fr",
        "body": { "name": "Brice", "order": "A-1042" }
      }
    }
  }'
```

```php PHP theme={null}
<?php
$response = (new GuzzleHttp\Client())->post('https://shortext.ny-corp.io/api/v2.0/conversations', [
    'headers' => [
        'Authorization' => 'Bearer ' . getenv('SHORTEXT_API_KEY'),
        'Accept'        => 'application/json',
    ],
    'json' => [
        'channel'    => 'whatsapp',
        'channel_id' => '532867649916076',
        'contact'    => [
            'identifier' => '237699999999',
            'profile'    => ['firstname' => 'Brice', 'lastname' => 'Mbarga', 'preferred_language' => 'fr'],
        ],
        'message'    => [
            'type'    => 'template',
            'content' => [
                'template_name' => 'order_update',
                'language'      => 'fr',
                'body'          => ['name' => 'Brice', 'order' => 'A-1042'],
            ],
        ],
    ],
]);

$result = json_decode((string) $response->getBody(), true);
if (!$result['success']) {
    throw new RuntimeException("Shortext error {$result['code']}: {$result['message']}");
}
$conversationId = $result['body']['conversation']['id'];
```

```javascript Node.js theme={null}
const response = await fetch("https://shortext.ny-corp.io/api/v2.0/conversations", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SHORTEXT_API_KEY}`,
    Accept: "application/json",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    channel: "whatsapp",
    channel_id: "532867649916076",
    contact: {
      identifier: "237699999999",
      profile: { firstname: "Brice", lastname: "Mbarga", preferred_language: "fr" },
    },
    message: {
      type: "template",
      content: {
        template_name: "order_update",
        language: "fr",
        body: { name: "Brice", order: "A-1042" },
      },
    },
  }),
});

const result = await response.json();
if (!result.success) {
  throw new Error(`Shortext error ${result.code}: ${result.message}`);
}
const conversationId = result.body.conversation.id;
```

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

response = requests.post(
    "https://shortext.ny-corp.io/api/v2.0/conversations",
    headers={
        "Authorization": f"Bearer {os.environ['SHORTEXT_API_KEY']}",
        "Accept": "application/json",
    },
    json={
        "channel": "whatsapp",
        "channel_id": "532867649916076",
        "contact": {
            "identifier": "237699999999",
            "profile": {"firstname": "Brice", "lastname": "Mbarga", "preferred_language": "fr"},
        },
        "message": {
            "type": "template",
            "content": {
                "template_name": "order_update",
                "language": "fr",
                "body": {"name": "Brice", "order": "A-1042"},
            },
        },
    },
)

result = response.json()
if not result["success"]:
    raise RuntimeError(f"Shortext error {result['code']}: {result['message']}")
conversation_id = result["body"]["conversation"]["id"]
```

The response holds the `conversation` and the sent `message`. Keep `conversation.id`: you use it to [reply](https://docs.shortext.ny-corp.io/api-reference/guides/start-a-conversation.md), [take the conversation over](https://docs.shortext.ny-corp.io/api-reference/guides/handover.md) or read its messages.

**5. Receive the replies**

When the contact answers, the agent attached to the channel replies automatically. To follow the conversation from your system, create a [webhook endpoint](https://docs.shortext.ny-corp.io/api-reference/webhooks.md) subscribed to `message.*`.

## Next steps

> **[Authentication](https://docs.shortext.ny-corp.io/api-reference/authentication.md)**
>
> API keys and their permissions.

> **[Message format](https://docs.shortext.ny-corp.io/api-reference/message-format.md)**
>
> Text, templates, interactive messages and media.

> **[Webhooks](https://docs.shortext.ny-corp.io/api-reference/webhooks.md)**
>
> Receive signed events in real time.

> **[The 24-hour rule](https://docs.shortext.ny-corp.io/api-reference/guides/start-a-conversation.md)**
>
> When WhatsApp accepts free text, and when it needs a template.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.