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

# Available Credits (Pre-paid)

> Use GET /credits/balance to check the credit balance still available on Judit pre-paid accounts, before firing new queries.

export const EndpointBadges = ({auth = true, billing = "billable", flow = "sync", attachments = false, requiresVault = false}) => <div style={{
  marginTop: "-8px",
  marginBottom: "16px",
  display: "flex",
  flexWrap: "wrap",
  alignItems: "center",
  gap: "8px"
}}>
    {auth && <Badge color="gray">🔒 Requer api-key</Badge>}{" "}
    {billing === "billable" && <Badge color="yellow">💰 Cobrança por requisição</Badge>}{" "}
    {billing === "free" && <Badge color="green">✅ Grátis</Badge>}{" "}
    {billing === "on-demand" && <Badge color="purple">⚡ On-demand (preço diferenciado)</Badge>}{" "}
    {flow === "async" && <Badge color="blue">⏳ Assíncrono · webhook ou polling</Badge>}{" "}
    {flow === "sync" && <Badge color="green">⚡ Síncrono</Badge>}{" "}
    {attachments && <Badge color="purple">📎 Suporta with_attachments</Badge>}{" "}
    {requiresVault && <Badge color="red">🔑 Cofre de Credenciais</Badge>}
  </div>;

Accounts on the **pre-paid** model work with a credit balance loaded upfront. `GET /credits/balance` returns **how much of that balance is still available**, so you can check it before firing new queries.

> 🤖 Endpoint: `GET https://users.production.judit.io/credits/balance`. The response is synchronous (HTTP 200) and carries the remaining credit balance of the account authenticated by the `api-key`.

<EndpointBadges auth billing={null} flow="sync" />

<Note>
  This route serves the **pre-paid** model. If your account runs on a cycle cap (post-paid), the number you are looking for is `remaining` in [Cycle Consumption](/en/resource/consumption/current).
</Note>

## When to use it

<CardGroup cols={2}>
  <Card title="Check before consuming" icon="list-check">
    Confirm there is balance before queueing a batch of queries, avoiding failures mid-processing.
  </Card>

  <Card title="Top-up alert" icon="bell">
    Notify your team when the balance drops below your integration's operational floor.
  </Card>
</CardGroup>

## Check the Balance (GET)

`GET https://users.production.judit.io/credits/balance`

### Authentication

Required `api-key` header, with the key of the account whose balance will be checked. The route takes no parameters — the balance returned is always the one of the authenticated account.

### Request Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl --request GET \
    --url 'https://users.production.judit.io/credits/balance' \
    --header 'api-key: '"$JUDIT_API_KEY"
  ```

  ```js JavaScript theme={null}
  const response = await fetch('https://users.production.judit.io/credits/balance', {
    method: 'GET',
    headers: { 'api-key': process.env.JUDIT_API_KEY }
  });

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

  ```python Python theme={null}
  import os
  import requests

  response = requests.get(
      "https://users.production.judit.io/credits/balance",
      headers={"api-key": os.environ["JUDIT_API_KEY"]},
  )

  print(response.json())
  ```
</CodeGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Cycle Consumption" icon="gauge" href="/en/resource/consumption/current">
    Consolidated consumption and effective cap for the current billing cycle.
  </Card>

  <Card title="Consumption History" icon="clock-rotate-left" href="/en/resource/consumption/history">
    List the period's requests and infer the cost of each operation.
  </Card>
</CardGroup>
