# Account, history and keys

> Docs index: https://wahasend.com/llms.txt · Everything in one file: https://wahasend.com/docs.md · API base URL: https://app.wahasend.com/api/v1

Who you are, what was sent, and your keys. Every product can read these and create API keys (see [Which products can use the API](https://wahasend.com/docs/authentication.md)).

<a id="me"></a>

### Your account

`GET /api/v1/me`

The organization, its active products and features, and whether a key is set. A quick way to test a key.

- Unlocked by: every product
- Account key only

**Example**

curl:

```bash
curl https://app.wahasend.com/api/v1/me \
  -H "X-API-Key: $WAHASEND_API_KEY"
```

JavaScript:

```js
const res = await fetch('https://app.wahasend.com/api/v1/me', {
  headers: { 'X-API-Key': process.env.WAHASEND_API_KEY },
});
const data = await res.json();
```

Python:

```python
import os
import requests

r = requests.get(
    "https://app.wahasend.com/api/v1/me",
    headers={"X-API-Key": os.environ["WAHASEND_API_KEY"]},
)
print(r.json())
```

**Response 200**

```json
{
  "success": true,
  "id": "2c7d0e19-4b8a-4f63-9e21-7a5c3d9b1f08",
  "name": "Aminetou Sall",
  "email": "aminetou@example.com",
  "memberRole": "admin",
  "organization": {
    "id": "2c7d0e19-4b8a-4f63-9e21-7a5c3d9b1f08",
    "name": "Kaba Shop",
    "requireTwoFactor": false
  },
  "products": [
    "developer"
  ],
  "features": [
    "send",
    "batch",
    "api",
    "otp",
    "media",
    "webhooks"
  ],
  "maxNumbers": null,
  "webhookUrl": "https://example.com/hooks/wahasend",
  "hasApiKey": true,
  "apiKeyPreview": "3f9c1a7b2e4d***",
  "…": "…"
}
```

<a id="messages"></a>

### Message history

`GET /api/v1/messages`

Messages sent by text sends, batches, campaigns, OTP, reminders and assistants, newest first.

- Unlocked by: every product
- Account key only

> OTP messages show `[OTP MESSAGE]` instead of the code. Media sends appear with their caption or a label such as `[image] https://…`.

> `wahaMessageId` is WhatsApp's id once the message is sent (null before); `containerId` is the number it went from (null on older rows).

**Query parameters**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | "alert" \| "bulk" \| "otp" | no | Filter by kind. |
| `status` | string | no | `queued`, `sending`, `sent`, `delivered`, `read` or `failed`. |
| `search` | string | no | Part of the recipient or text. |
| `page` | number | no | Default 1. |
| `limit` | number | no | Default 50, at most 100. |

**Example**

curl:

```bash
curl "https://app.wahasend.com/api/v1/messages?status=failed&limit=20" \
  -H "X-API-Key: $WAHASEND_API_KEY"
```

JavaScript:

```js
const res = await fetch('https://app.wahasend.com/api/v1/messages?status=failed&limit=20', {
  headers: { 'X-API-Key': process.env.WAHASEND_API_KEY },
});
const data = await res.json();
```

Python:

```python
import os
import requests

r = requests.get(
    "https://app.wahasend.com/api/v1/messages?status=failed&limit=20",
    headers={"X-API-Key": os.environ["WAHASEND_API_KEY"]},
)
print(r.json())
```

**Response 200**

```json
{
  "success": true,
  "total": 1,
  "page": 1,
  "limit": 20,
  "messages": [
    {
      "id": "4f0c6a1e-2b7d-4c1a-9e35-7d8f2a6b1c90",
      "type": "alert",
      "recipient": "22212345678",
      "content": "Your order #1042 is ready for pickup.",
      "status": "failed",
      "priority": "normal",
      "error": "Message delivery failed (ACK 0)",
      "sentAt": null,
      "deliveredAt": null,
      "createdAt": "2026-09-30T10:30:10.000Z",
      "wahaMessageId": "true_22212345678@c.us_3EB0C767D26A1D2E5A8F",
      "containerId": "6d2b9c1e-8f4a-4e37-a5c2-1b9e7d3f0a64"
    }
  ]
}
```

<a id="stats"></a>

### Counts

`GET /api/v1/stats`

Totals of all messages, by status and kind, plus the last 24 hours and 7 days.

- Unlocked by: every product
- Account key only

**Example**

curl:

```bash
curl https://app.wahasend.com/api/v1/stats \
  -H "X-API-Key: $WAHASEND_API_KEY"
```

JavaScript:

```js
const res = await fetch('https://app.wahasend.com/api/v1/stats', {
  headers: { 'X-API-Key': process.env.WAHASEND_API_KEY },
});
const data = await res.json();
```

Python:

```python
import os
import requests

r = requests.get(
    "https://app.wahasend.com/api/v1/stats",
    headers={"X-API-Key": os.environ["WAHASEND_API_KEY"]},
)
print(r.json())
```

**Response 200**

```json
{
  "success": true,
  "totalMessages": 1247,
  "sent": 30,
  "delivered": 1150,
  "failed": 47,
  "alerts": 900,
  "bulk": 320,
  "otp": 27,
  "last24h": 58,
  "last7d": 412
}
```

<a id="regenerate-key"></a>

### Replace the account key

`POST /api/v1/me/regenerate-key`

Issues a new account key; the old one stops working at once. `POST /me/generate-key` does the same the first time (409 `CONFLICT` once a key exists).

- Unlocked by: every product (`api`)
- Account key only

**Example**

curl:

```bash
curl -X POST https://app.wahasend.com/api/v1/me/regenerate-key \
  -H "X-API-Key: $WAHASEND_API_KEY"
```

JavaScript:

```js
const res = await fetch('https://app.wahasend.com/api/v1/me/regenerate-key', {
  method: 'POST',
  headers: { 'X-API-Key': process.env.WAHASEND_API_KEY },
});
const data = await res.json();
```

Python:

```python
import os
import requests

r = requests.post(
    "https://app.wahasend.com/api/v1/me/regenerate-key",
    headers={"X-API-Key": os.environ["WAHASEND_API_KEY"]},
)
print(r.json())
```

**Response 200**

```json
{
  "success": true,
  "apiKey": "wn_8c1f…64 hex characters…",
  "warning": "Save this new API key now. Your old key has been invalidated."
}
```

**Errors to expect**

- [`PRODUCT_REQUIRED`](https://wahasend.com/docs/errors.md#product_required) (403): This feature is not included in your products.

<a id="regenerate-number-key"></a>

### Replace a per-number key

`POST /api/v1/session/:containerId/regenerate-key`

New key for one number; the old one stops working. `POST /session/:containerId/generate-key` creates the first one.

- Unlocked by: every product (`api`)
- Account key only

**Path parameters**

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `containerId` | uuid | yes | The number, from `GET /session/list`. |

**Example**

curl:

```bash
curl -X POST https://app.wahasend.com/api/v1/session/6d2b9c1e-8f4a-4e37-a5c2-1b9e7d3f0a64/regenerate-key \
  -H "X-API-Key: $WAHASEND_API_KEY"
```

JavaScript:

```js
const res = await fetch('https://app.wahasend.com/api/v1/session/6d2b9c1e-8f4a-4e37-a5c2-1b9e7d3f0a64/regenerate-key', {
  method: 'POST',
  headers: { 'X-API-Key': process.env.WAHASEND_API_KEY },
});
const data = await res.json();
```

Python:

```python
import os
import requests

r = requests.post(
    "https://app.wahasend.com/api/v1/session/6d2b9c1e-8f4a-4e37-a5c2-1b9e7d3f0a64/regenerate-key",
    headers={"X-API-Key": os.environ["WAHASEND_API_KEY"]},
)
print(r.json())
```

**Response 200**

```json
{
  "success": true,
  "apiKey": "waha_V1StGXR8_Z5jdHi6B-myT…",
  "containerId": "6d2b9c1e-8f4a-4e37-a5c2-1b9e7d3f0a64",
  "label": "Shop",
  "warning": "Store this key securely. It cannot be retrieved again."
}
```

**Errors to expect**

- [`CONTAINER_NOT_FOUND`](https://wahasend.com/docs/errors.md#container_not_found) (404): WhatsApp number not found.
- [`PRODUCT_REQUIRED`](https://wahasend.com/docs/errors.md#product_required) (403): This feature is not included in your products.
