---
title: Account API
description: Set the account webhook and read remaining credits.
type: doc
icon: key-round
sidebar:
  label: Account API
  order: 6
  icon: key-round
search:
  tags: [api]
---
Configure a webhook to receive results by push instead of polling, and check remaining credits. API keys are created in the console (**API Keys** → **Provide Name for Key** → **Create Key**), not through this API.

Webhook delivery, request format, and signature verification: [Jobs, Polling, and Webhooks](/guides/jobs#webhooks). This page is the two endpoints.


## Set account webhook

`POST /v2/account/webhook`

Set the webhook URL and secret for the account. Once configured, Amplifier POSTs the job object when the job reaches a terminal status: `done`, `failed`, or `timed-out`. Check `status` before reading `result`.

A single webhook applies to every job on the account. To send one job's result elsewhere, pass `webhook_url` and `webhook_secret_key` on the analyze request instead — see [Model API](/reference/models#analyze-with-a-model) or [Sign API](/reference/signs#analyze-with-a-sign).

### Request Body

Requests use `Content-Type: application/json`.

| Field | Type | Required | Description |
|---|---|---|---|
| `url` | string | Yes | Webhook URI (`format: uri`, 1–2083 characters). Must be publicly reachable. Production receivers must use HTTPS (see [Production Checklist](/guides/production)). The published schema accepts any URI, not HTTPS only. |
| `secret_key` | string | Yes | Secret used to sign webhook payloads. Store securely and use only for signature verification on your server. |

### Response

| Field | Type | Description |
|---|---|---|
| `success` | boolean | Whether the webhook was configured. |
| `message` | string | Confirmation message. |

The delivered payload is the completed job object: `job_id`, `status`, `model_name` or `sign_name`, and `result`. Field definitions are in [Response Schema](/reference/response-schema); delivery behaviour, the `X-Webhook-Signature` header, and HMAC-SHA256 verification are in [Jobs, Polling, and Webhooks](/guides/jobs#webhooks).

### Example

<CodeGroup param="lang">

```bash cURL
curl -X POST "https://api.amplifierhealth.com/v2/account/webhook" \
  -H "X-Account-ID: your-account-id" \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://your-server.com/webhooks/amplifier","secret_key":"your-webhook-secret"}'
```

```javascript JavaScript
const response = await fetch("https://api.amplifierhealth.com/v2/account/webhook", {
  method: "POST",
  headers: {
    "X-Account-ID": process.env.AMPLIFIER_ACCOUNT_ID,
    "X-API-Key": process.env.AMPLIFIER_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "url": "https://your-server.com/webhooks/amplifier",
    "secret_key": "your-webhook-secret"
  }),
});

const data = await response.json();
```

```python Python
# Requires httpx: pip install httpx
import os
import httpx

response = httpx.post(
  "https://api.amplifierhealth.com/v2/account/webhook",
  headers={
      "X-Account-ID": os.environ["AMPLIFIER_ACCOUNT_ID"],
      "X-API-Key": os.environ["AMPLIFIER_API_KEY"],
  },
  json={
    "url": "https://your-server.com/webhooks/amplifier",
    "secret_key": "your-webhook-secret",
  },
)

data = response.json()
```

</CodeGroup>

### Errors

Validation errors return `422` with a detail array. For authentication (401), rate limiting (429), and other codes, see [Errors](/reference/errors#error-codes).

## Get remaining credits

`GET /v2/account/credits`

Check remaining credits for the account. The `credits` value is the remaining token balance (1 credit = 1 token). See [Billing and Cost](/guides/billing).

### Response

| Field | Type | Description |
|---|---|---|
| `credits` | integer | Remaining token balance. 1 credit = 1 token. |

If the account has no remaining credits, analyze endpoints return `402 Payment Required`. Check this endpoint before submitting jobs.

### Example

<CodeGroup param="lang">

```bash cURL
curl -X GET "https://api.amplifierhealth.com/v2/account/credits" \
  -H "X-Account-ID: your-account-id" \
  -H "X-API-Key: your-api-key"
```

```javascript JavaScript
const response = await fetch("https://api.amplifierhealth.com/v2/account/credits", {
  headers: {
    "X-Account-ID": process.env.AMPLIFIER_ACCOUNT_ID,
    "X-API-Key": process.env.AMPLIFIER_API_KEY,
  },
});

const data = await response.json();
```

```python Python
# Requires httpx: pip install httpx
import os
import httpx

response = httpx.get(
  "https://api.amplifierhealth.com/v2/account/credits",
  headers={
      "X-Account-ID": os.environ["AMPLIFIER_ACCOUNT_ID"],
      "X-API-Key": os.environ["AMPLIFIER_API_KEY"],
  },
)

data = response.json()
```

</CodeGroup>

### Errors

For 401 and other codes, see [Errors](/reference/errors#error-codes).

## Related pages

- [Jobs, Polling, and Webhooks](/guides/jobs#webhooks) — webhook delivery, retries, and signature verification.
- [Billing and Cost](/guides/billing#token-rates) — how credits are consumed per call.
- [Production Checklist](/guides/production) — pre-deployment checks for credentials and webhook receivers.
