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

# Get Budget Balance

> Retrieve the current budget balance for a grant.

## Endpoint

```
GET /v1/budget/balance/:grantId
```

## Authentication

Requires a developer API key in the `Authorization` header.

## Request Headers

| Header          | Value              |
| --------------- | ------------------ |
| `Authorization` | `Bearer <api_key>` |

## Path Parameters

| Parameter | Type     | Description             |
| --------- | -------- | ----------------------- |
| `grantId` | `string` | The grant ID to look up |

## Example Request

```bash theme={null}
curl https://grantex-auth-dd4mtrt2gq-uc.a.run.app/v1/budget/balance/grnt_01HXYZ... \
  -H "Authorization: Bearer gx_..."
```

## Response -- 200 OK

```json theme={null}
{
  "id": "ba_01HXYZ...",
  "grantId": "grnt_01HXYZ...",
  "initialBudget": 100.00,
  "remainingBudget": 94.50,
  "currency": "USD",
  "createdAt": "2026-04-05T12:00:00.000Z",
  "updatedAt": "2026-04-05T14:30:00.000Z"
}
```

## Response Fields

| Field             | Type     | Description                          |
| ----------------- | -------- | ------------------------------------ |
| `id`              | `string` | Budget allocation ID                 |
| `grantId`         | `string` | The grant this budget is attached to |
| `initialBudget`   | `number` | The original budget amount           |
| `remainingBudget` | `number` | Current remaining budget             |
| `currency`        | `string` | Currency code                        |
| `createdAt`       | `string` | ISO-8601 creation timestamp          |
| `updatedAt`       | `string` | ISO-8601 last update timestamp       |

## Error Responses

| Status | Code           | Description                               |
| ------ | -------------- | ----------------------------------------- |
| 401    | `UNAUTHORIZED` | Invalid or missing API key                |
| 404    | `NOT_FOUND`    | No budget allocation found for this grant |

## SDK Examples

<CodeGroup>
  ```typescript TypeScript theme={null}
  import Grantex from '@grantex/sdk';

  const grantex = new Grantex({ apiKey: 'gx_...' });

  const balance = await grantex.budgets.balance('grnt_01HXYZ...');
  console.log(balance.remainingBudget); // 94.50
  ```

  ```python Python theme={null}
  from grantex import Grantex

  grantex = Grantex(api_key="gx_...")

  balance = grantex.budgets.balance("grnt_01HXYZ...")
  print(balance.remaining_budget)  # 94.50
  ```
</CodeGroup>
