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

# Paymaster API

The Paymaster API signs or sponsors transactions and reads paymaster balance
state through API-key guarded runtime endpoints.

## Auth

Use an API key:

```text theme={null}
Authorization: Bearer sk_your_api_key
```

Developer-portal admin endpoints are intentionally omitted from this reference.

## Get balance

`GET /paymaster/balance`

Query parameters:

| Parameter | Type   | Description                                        |
| :-------- | :----- | :------------------------------------------------- |
| `network` | string | `devnet` or `mainnet`; empty defaults to `mainnet` |
| `kind`    | enum   | `PAYMASTER_KIND_API` or `PAYMASTER_KIND_IDP`       |

Response:

```json theme={null}
{
  "configured": true,
  "kind": "PAYMASTER_KIND_API",
  "id": "paymaster_123",
  "address": "PaymasterPublicKey",
  "label": "Production paymaster",
  "balanceLamports": "1000000000",
  "balanceSol": 1
}
```

## Sign a transaction

`POST /paymaster/sign`

```json theme={null}
{
  "base58EncodedTransaction": "BASE58_TRANSACTION",
  "network": "devnet"
}
```

Response:

```json theme={null}
{
  "requestId": "req_123",
  "signedTransaction": "BASE58_SIGNED_TRANSACTION"
}
```

## Sponsor a transaction

`POST /paymaster/sponsor`

```json theme={null}
{
  "base58EncodedTransaction": "BASE58_TRANSACTION",
  "network": "devnet"
}
```

Response:

```json theme={null}
{
  "requestId": "req_123",
  "signature": "TransactionSignature",
  "spentByPaymaster": "5000"
}
```

Paymaster limit configuration is handled through developer-portal admin
surfaces, not API-key runtime endpoints.
