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

# Credits API

> API documentation for retrieving the number of available credits

# Credits API

This API allows you to retrieve the total number of credits available on your account, including credits linked to your subscription and additional credits.

## Authentication (required)

Since the migration to the App Router, authentication is **required** for this endpoint:

* **Header `x-api-key`**: Your API key (generated in the Developer Space)
* **Request body `user_id`**: The user identifier associated with this API key

The API key must match the user in your Home Staging subscription. If the key is missing or invalid, a **401 Unauthorized** error will be returned.

## Retrieve your credits

<ParamField path="POST /api/account/credit" />

This endpoint allows you to obtain detailed information about your available credits.

### Request Parameters

<ParamField body="user_id" type="string" required>
  The unique user identifier (UUID) that you can retrieve from your Developer Space
</ParamField>

### Response

<ResponseField name="total" type="number">
  The total number of credits available on your account
</ResponseField>

<ResponseField name="subscription" type="number">
  The number of credits from your subscription
</ResponseField>

<ResponseField name="extra" type="number">
  The number of additional credits purchased separately
</ResponseField>

### Request Example

```bash theme={null}
curl --request POST \
--url 'https://iacrea.com/api/account/credit' \
--header x-api-key:API_KEY \
--header 'Content-Type: application/json' \
--data '{
  "user_id": "uuid"
}'
```

### Response Example

```json theme={null}
{
  "total": 100,
  "subscription": 90,
  "extra": 10
}
```

### Error Codes

| Code | Description                                              |
| ---- | -------------------------------------------------------- |
| 400  | Invalid parameters (e.g. missing or invalid `user_id`)   |
| 401  | Missing or invalid API key (header `x-api-key` required) |
| 503  | Service temporarily unavailable                          |
