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

# Introduction

> What the Public API is, how to authenticate, the shared contracts, and an end-to-end Quickstart.

The Connexease Public API is a panel-independent layer that lets customers manage their WhatsApp Business operations programmatically from their own servers. It has three goals:

* **Proxy / always fresh:** read endpoints have no caching — data comes straight from the source (Meta Graph API / ClickHouse), so you don't deal with Meta's token/credential complexity.
* **Org-scoped & secure:** every request is isolated to the organization resolved from your secret key; you cannot reach another organization's data.
* **Simple contract:** all endpoints share the same response envelope, error model, pagination, and `Prefer` behavior.

<CardGroup cols={2}>
  <Card title="Authentication" icon="key" href="/essentials/authentication#secret-key">
    Secret key authentication for the Public API.
  </Card>

  <Card title="Templates" icon="file-lines" href="/public-api-reference/template/create-template">
    Create, list, inspect, and update message templates.
  </Card>

  <Card title="Business Profile" icon="address-card" href="/public-api-reference/application/get-business-profile">
    Read and update the WhatsApp business profile.
  </Card>

  <Card title="Analytics" icon="chart-line" href="/public-api-reference/analytics/get-messages">
    Message volume: summary cards + time series.
  </Card>
</CardGroup>

***

## Base URL

All Public API paths in this reference are relative to a single base URL:

```text theme={null}
https://public-api.gateway.connexease.com
```

Throughout the docs, a path like `/wa/{app_id}/templates` means `{base_url}/wa/{app_id}/templates`.

***

## Authentication

The seven core endpoints require a **secret key**:

```http theme={null}
Authorization: Bearer sk_xxxxxxxxxxxxxxxx
```

* Use it **server-to-server**; never embed the secret key in a browser/client.
* `organization_id` is resolved automatically from the key — you don't pass it.
* The `app_id` you operate on must belong to your organization, otherwise you get `404`.

See [Secret Key authentication](/essentials/authentication#secret-key) for details.

***

## Shared conventions

These apply to every endpoint:

* **Response envelope** — success: `{ "data": ..., "isSuccess": true }`; error: `{ "errors": { "code", "group", "description" }, "isSuccess": false }`.
* **`Prefer` header (on updates)** — `return=representation` (default, returns the current record) or `return=minimal` (no body). The response reports it via `Preference-Applied`.
* **Cursor pagination (on lists)** — `pagingMetadata.nextCursor` / `previousCursor` + `hasNext` / `hasPrevious` / `pageSize`.
* **Dates** — ISO-8601 (`2026-06-08T00:00:00`).
* **Null fields are dropped** from responses (e.g. an unset profile field, or `components` without `expand`).

***

## Endpoint quick reference

Path parameters are shown in `{braces}`; query parameters are listed separately so the route stays readable.

| # | Method  | Path                                 | Path params           | Query params                                                                     | Purpose                               |
| - | ------- | ------------------------------------ | --------------------- | -------------------------------------------------------------------------------- | ------------------------------------- |
| 1 | `GET`   | `/wa/analytics/messages`             | —                     | `appId`, `startDate`, `endDate`, `granularity`                                   | Message analytics (summary + series). |
| 2 | `GET`   | `/wa/{app_id}/profile`               | `app_id`              | —                                                                                | Read business profile.                |
| 3 | `PATCH` | `/wa/{app_id}/profile`               | `app_id`              | —                                                                                | Update business profile (partial).    |
| 4 | `POST`  | `/wa/{app_id}/templates`             | `app_id`              | —                                                                                | Create template.                      |
| 5 | `GET`   | `/wa/{app_id}/templates`             | `app_id`              | `limit`, `after`, `before`, `status`, `category`, `language`, `search`, `expand` | List templates (cursor + filters).    |
| 6 | `GET`   | `/wa/{app_id}/templates/{source_id}` | `app_id`, `source_id` | `expand`                                                                         | Template detail.                      |
| 7 | `POST`  | `/wa/{app_id}/templates/{source_id}` | `app_id`, `source_id` | —                                                                                | Update template (full-replace).       |

***

## Quickstart

An end-to-end walkthrough. Every request below uses the header `Authorization: Bearer sk_...` and a path relative to the [Base URL](#base-url).

### Step 1 — See the current state (analytics)

```http theme={null}
GET /wa/analytics/messages?granularity=daily
```

Returns a `summary` (total / sent / received / template messages) plus a daily `series`. Omit `appId` for the whole organization, or repeat it (`?appId=a&appId=b`) for specific apps. See [Get Messages](/public-api-reference/analytics/get-messages).

### Step 2 — Create a template

```http theme={null}
POST /wa/{app_id}/templates
Content-Type: application/json
```

```json theme={null}
{
  "name": "order_confirmation",
  "language": "en",
  "category": "UTILITY",
  "body": { "text": "Hi {{1}}, your order {{2}} is confirmed.", "examples": ["John", "#12345"] },
  "footer": { "text": "Connexease" }
}
```

Response:

```json theme={null}
{ "data": { "sourceId": "...", "status": "PENDING", "name": "order_confirmation", "language": "en", "category": "UTILITY" }, "isSuccess": true }
```

New templates usually start as `PENDING` (under review). See [Create Template](/public-api-reference/template/create-template).

### Step 3 — List templates / track status

```http theme={null}
GET /wa/{app_id}/templates?status=APPROVED
```

Filter by `status` / `category` / `language`, search with `search`, and page with the returned cursors. See [Get Templates](/public-api-reference/template/get-templates).

### Step 4 — Inspect a template (with components)

```http theme={null}
GET /wa/{app_id}/templates/{source_id}?expand=components
```

`expand=components` adds the header/body/footer/buttons detail. See [Get Template Detail](/public-api-reference/template/get-template-detail).

### Step 5 — Update an APPROVED template (send the full set!)

```http theme={null}
POST /wa/{app_id}/templates/{source_id}
Prefer: return=representation
Content-Type: application/json
```

```json theme={null}
{
  "body": { "text": "Hi {{1}}, your order {{2}} has shipped. Thanks!", "examples": ["John", "#12345"] },
  "footer": { "text": "Connexease" }
}
```

Editing is **full-replace** — send every component you want to keep (at minimum `body`), or the missing ones are removed. After a successful edit the status returns to `PENDING`. See [Update Template](/public-api-reference/template/update-template).

### Step 6 — Update the business profile

```http theme={null}
PATCH /wa/{app_id}/profile
Content-Type: application/json
```

```json theme={null}
{ "about": "Open 09:00-18:00", "email": "hello@acme.com", "websites": ["https://acme.com"] }
```

Profile updates are **partial** — only the fields you send change; the rest are preserved. See [Update Business Profile](/public-api-reference/application/update-business-profile).

***

## Common errors & tips

| HTTP | Meaning                                                                                            |
| ---- | -------------------------------------------------------------------------------------------------- |
| 401  | Secret key missing/invalid (`ORGANIZATION_SECRET_010` / `011`).                                    |
| 404  | `app_id` not in the organization (`APPLICATION_004`) or template not found (`META_075`).           |
| 409  | Conflict: template not in an editable status / same name+language exists (`META_096`, `META_017`). |
| 422  | Request validation (field limits, body starts/ends with a variable, example count, date range…).   |
| 429  | Rate limit / edit limit (`META_094`, `META_097`, …).                                               |
| 502  | General Meta-side error (`META_00x`).                                                              |

***

## Next steps

<CardGroup cols={2}>
  <Card title="Templates" icon="file-lines" href="/public-api-reference/template/create-template">
    The full template lifecycle.
  </Card>

  <Card title="Business Profile" icon="address-card" href="/public-api-reference/application/get-business-profile">
    Read and update the business profile.
  </Card>

  <Card title="Analytics" icon="chart-line" href="/public-api-reference/analytics/get-messages">
    Message volume analytics.
  </Card>
</CardGroup>
