# Get account

Source: https://docs.foodshot.ai/reference/get-account

> Returns the credits, limits and usage of your key's environment.

`GET https://api.foodshot.ai/v1/account`

`credits` is `null` for test keys.

## Responses

### 200

The account.

```json
{
  "object": "account",
  "id": "acme-eats",
  "environment": "live",
  "credits": {
    "available": 712,
    "low_balance": false,
    "low_balance_threshold": 200,
    "lots": [
      {
        "id": "lot_9iF8VdFw6H377trtTdF4OH",
        "kind": "plan",
        "remaining": 712,
        "granted": 1000,
        "expires_at": "2026-11-01T00:00:00.000Z"
      }
    ]
  },
  "limits": {
    "parallel_jobs": 5,
    "queued_jobs": 500,
    "jobs_per_day": 300,
    "day_resets_at": "00:00Z",
    "new_jobs_per_minute": 60,
    "requests_per_minute": 300
  },
  "usage": {
    "today": {
      "accepted": 37,
      "succeeded": 30,
      "failed": 1
    },
    "month": {
      "accepted": 812,
      "succeeded": 790,
      "failed": 9
    }
  },
  "key": {
    "id": "key_Qbv9XAAWzwlrKrWrmOePgG",
    "prefix": "fs_live_AbC4"
  }
}
```

### 400

A query parameter is wrong or unknown.

```json
{
  "error": {
    "code": "invalid_request",
    "message": "The query parameter named in param is invalid.",
    "param": "limit",
    "request_id": "req_daJCWaeLcd6uXjfMaJeplG"
  }
}
```

### 401

The key is missing, wrong or revoked.

```json
{
  "error": {
    "code": "invalid_api_key",
    "message": "The API key is missing, malformed, unknown or revoked.",
    "param": null,
    "request_id": "req_NPfzXU77n1f2QYM559fGL8"
  }
}
```

### 403

This key may not make this request.

```json
{
  "error": {
    "code": "permission_denied",
    "message": "Live keys work only from your server.",
    "param": null,
    "request_id": "req_NPfzXU77n1f2QYM559fGL8"
  }
}
```

### 429

Over the request limit of this key. Retry after `Retry-After` seconds.

```json
{
  "error": {
    "code": "rate_limited",
    "message": "Too many requests. Retry after the number of seconds in Retry-After.",
    "param": null,
    "request_id": "req_BTBBPZA0oirxnw23MU0t7E"
  }
}
```

### 500

Something went wrong on our side. Retry; for a `POST`, with the same `Idempotency-Key` and body.

```json
{
  "error": {
    "code": "internal_error",
    "message": "Something went wrong on our side. Retry the request; for POST /v1/generations, use the same Idempotency-Key.",
    "param": null,
    "request_id": "req_8d4DxP5n53EgewaJFOqGyS"
  }
}
```

### 503

Temporarily unavailable. Retry after `Retry-After` seconds.

```json
{
  "error": {
    "code": "service_unavailable",
    "message": "The service is temporarily unavailable. Retry after the number of seconds in Retry-After.",
    "param": null,
    "request_id": "req_8d4DxP5n53EgewaJFOqGyS"
  }
}
```

## Code samples

### curl

```bash
curl -sS https://api.foodshot.ai/v1/account \
  --max-time 60 \
  -H "Authorization: Bearer $FOODSHOT_API_KEY"
```

### Node

```js
const res = await fetch('https://api.foodshot.ai/v1/account', {
  headers: { Authorization: `Bearer ${process.env.FOODSHOT_API_KEY}` },
  signal: AbortSignal.timeout(60_000),
});
if (!res.ok) throw new Error(`FoodShot ${res.status}: ${await res.text()}`);
const account = await res.json();
if (account.credits?.low_balance) {
  console.warn(`Low balance: ${account.credits.available} credits left`);
}
console.log(account.environment, account.limits.jobs_per_day, account.usage.today);
```

### Python

```python
import os

import requests

response = requests.get(
    "https://api.foodshot.ai/v1/account",
    headers={"Authorization": f"Bearer {os.environ['FOODSHOT_API_KEY']}"},
    timeout=60,
)
response.raise_for_status()
account = response.json()
credits = account["credits"]  # None for test keys
if credits and credits["low_balance"]:
    print(f"Low balance: {credits['available']} credits left")
print(account["environment"], account["limits"]["jobs_per_day"], account["usage"]["today"])
```
