# Quickstart

From sandbox credentials to a policy booked in your system, in five calls.

## 1. Get sandbox credentials

Ask your Wathiqaty account manager for a sandbox API client. You receive a `client_id` and a `client_secret` (delivered once, through a secure channel) with the scopes you asked for. Keep the secret in a secret manager, never in source code.

## 2. Get an access token

**Request**

```
curl -X POST https://sandbox-api.wathiqaty.com/api/v1/auth/partner/token \
  -u "$CLIENT_ID:$CLIENT_SECRET" \
  -d grant_type=client_credentials
```

**Response**

```
{
  "status": "success",
  "data": {
    "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…",
    "tokenType": "Bearer",
    "expiresIn": 900,
    "scope": "policies:read policies:write"
  },
  "error": null,
  "metadata": { "requestId": "8d7e2c1a-41f0-4a4e-9a55-6f0b3c2d1e77", "…": "…" }
}
```

The token is valid for 15 minutes. Cache it and reuse it for every call; get a new one shortly before it expires. Details: [Authentication](/guides/authentication.md).

## 3. Check who you are

**Request**

```
curl https://sandbox-api.wathiqaty.com/api/v1/partner/company \
  -H "Authorization: Bearer $ACCESS_TOKEN"
```

You get your company profile. A `401` means the token is wrong or expired.

## 4. Simulate a sale

In the sandbox you play the customer. Find an active package with [`GET /partner/packages?status=active`](/reference/packages.md#list-packages), then:

**Request**

```
curl -X POST https://sandbox-api.wathiqaty.com/api/v1/partner/sandbox/simulate/policy-sale \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"packageId":"<an active package id>"}'
```

You get the issued policy. If you registered a webhook endpoint, it also receives `policy.issued`.

## 5. Book it

Create the policy in your core system, then store your number:

**Request**

```
curl -X PUT https://sandbox-api.wathiqaty.com/api/v1/partner/policies/$POLICY_ID/external-reference \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"externalReference":"MI/2026/MED/004213"}'
```

## Next steps

- [Set up webhooks](/guides/webhooks.md) instead of polling, and verify their signatures.
- Read [Conventions](/guides/conventions.md) (money, dates, pagination, idempotency) before writing production code.
- Work through the [go-live checklist](/guides/go-live.md).
