# Quickstart

Canonical: https://docs.bluehola.com/docs/guides/quickstart
OpenAPI: https://docs.bluehola.com/openapi.yaml

From receiving your API Key to sending your first WhatsApp message, in 4 steps.

## Base URL

The base address for every `/v1/*` endpoint is:

```
https://api.bluehola.com
```

## 1\. Get an API Key

Email us at [senpeng.zheng1@bluefocus.com](mailto:senpeng.zheng1@bluefocus.com) to obtain an API Key. BlueMedia configures the Key's authorization scope; you do not need to choose or understand the internal permission hierarchy.

:::warning

**The secret is returned in plaintext exactly once, at creation.** Save it immediately — the platform stores only a hash, and a lost key can only be reissued.

:::

## 2\. Verify the token

Call `GET /whoami` with `Authorization: Bearer <API_KEY>` to confirm the token works and read `tenantId` and `customerEntityId`. The latter is set for customer Keys and is `null` for other Keys.

```bash
curl https://api.bluehola.com/whoami \
  -H "Authorization: Bearer <API_KEY>"
```

```json
{
  "tenantId": "tenant_01923abc...",
  "customerEntityId": "cust_01923abc...",
  "platformVersion": "1.0.302"
}
```

`platformVersion` is the version of the API process that handled this request — useful when checking whether a given fix has shipped. The response may carry other diagnostic fields; do **not** use them to make authorization decisions.

## 3\. List your available phone numbers

Before sending anything, check which registered numbers you have. For a customer Key, pass the `customerEntityId` returned by `/whoami`; a customer Key cannot list numbers without this filter:

```bash
curl "https://api.bluehola.com/v1/phone-numbers?customerEntityId=cust_01923abc..." \
  -H "Authorization: Bearer <API_KEY>"
```

Take an `id` (in `pn_...` form) from the returned list for the next step — do not reuse the placeholder from these docs, it is not a real phone number ID.

## 4\. Send your first message

```bash
curl -X POST https://api.bluehola.com/v1/messages \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-8821-notify" \
  -d '{
    "phoneNumberId": "pn_01923abc",
    "to": "8613800138000",
    "type": "text",
    "text": { "body": "Hi, your order has shipped." }
  }'
```

The response is `202 Accepted`, carrying the message id and an initial status of `accepted`. **That does not mean it was delivered** — track what happens next with `GET /v1/messages/{id}` or webhooks (see [Sending Messages & Tracking Status](messaging.md)).

:::note

**Idempotency:** send an `Idempotency-Key` (≤200 characters). Reusing the same key within the current authorization scope returns *the original* message rather than sending a second one — always include it when retrying a request that timed out.

:::

Next, read [Authentication & Scopes](authentication.md) to understand authorization scopes, and [Webhook Integration](webhook-integration.md) to learn how to receive status callbacks and user replies.

If your asset lists are empty, follow [Customer Onboarding](customer-onboarding.md): create a Portfolio with only `name`, then generate a hosted invitation or submit the authorization result from your own SDK page. A customer Key can complete these steps for its own customer; do not substitute a numeric Meta Business Portfolio ID for `portfolioId`.
