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

# Python SDK

> Install the axra Python package and integrate in minutes

## Installation

```bash theme={null}
pip install axra
```

## Quick start

```python theme={null}
from axra import Axra

client = Axra(api_key="sk_test_...")

# Create a payment
payment = client.payments.create(
    amount=5000,
    currency="usd",
)
print(payment.id)
```

## Configuration

| Option                | Type    | Default                   | Description                   |
| --------------------- | ------- | ------------------------- | ----------------------------- |
| `api_key`             | `str`   | required                  | Your secret API key           |
| `base_url`            | `str`   | `https://api.useaxra.com` | API base URL                  |
| `api_version`         | `str`   | `2026-04-15`              | Sent as `Axra-Version` header |
| `max_network_retries` | `int`   | `2`                       | Automatic retries on 5xx      |
| `timeout_seconds`     | `float` | `60.0`                    | Request timeout               |

## Local-rail payouts

`client.payouts` and `client.recipients` send outbound local-rail payouts. Pay a saved recipient by `recipient_id`, or pass `recipient=` inline to create + screen + pay in a single call. See [Local-rail payouts](/payments/payouts/local-rails) for corridors and recipient fields.

```python theme={null}
quote = client.payouts.quote(
    rail="LOCAL_BANK",
    country="NG",
    currency="NGN",
    src_amount="100.00",
)

payout = client.payouts.create(
    rail="LOCAL_BANK",
    quote_token=quote.quote_token,
    recipient={
        "country": "NG",
        "account_number": "0123456789",
        "account_name": "Jane Doe",
        "bank_code": "058",
        "bank_name": "Example Bank",
    },
    idempotency_key="payout-ng-2026-06-02-0001",
)
print(payout.id, payout.status)
```

| Method                                                | Description                                                   |
| ----------------------------------------------------- | ------------------------------------------------------------- |
| `client.payouts.quote(...)`                           | Lock an FX quote (60s) for a local-rail payout                |
| `client.payouts.create(...)`                          | Confirm a payout — saved `recipient_id` or inline `recipient` |
| `client.payouts.get(id)` / `client.payouts.list(...)` | Retrieve / list payouts                                       |
| `client.recipients.create(...)`                       | Save a reusable payout recipient                              |

## Webhook signature verification

```python theme={null}
from axra.webhooks import construct_event

@app.route("/webhooks", methods=["POST"])
def handle_webhook():
    signature = request.headers.get("Axra-Signature")
    event = construct_event(
        payload=request.data,
        signature_header=signature,
        secret="whsec_your_signing_secret",
    )

    if event["type"] == "payment.completed":
        # handle payment
        pass

    return "ok", 200
```

## Full API access

The Python SDK includes a fully generated API client for all endpoints:

```python theme={null}
# Access the full generated client
response = client.http.get("/api/v1/treasury/whoami")
```
