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

# Python SDK Reference

> Complete reference for the Devdraft Python SDK with all available methods and examples

## Overview

The Devdraft Python SDK provides a complete client library for integrating payment processing, customer management, and webhook functionality into your Python applications.

<CardGroup cols={2}>
  <Card title="Pythonic API" icon="python">
    Follows Python conventions with snake\_case naming and type hints
  </Card>

  <Card title="Context Manager Support" icon="code">
    Clean resource management with Python's `with` statement
  </Card>

  <Card title="Comprehensive" icon="boxes-stacked">
    Access to all Devdraft API endpoints and features
  </Card>

  <Card title="Easy Integration" icon="plug">
    Simple configuration and intuitive method names
  </Card>
</CardGroup>

## Installation

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

## Requirements

* Python 3.9 or higher

## Quick Start

```python theme={null}
import devdraft
import os

# Configure the SDK
configuration = devdraft.Configuration(
    host="https://api.devdraft.ai"
)

configuration.api_key['x-client-key'] = os.environ.get('DEVDRAFT_CLIENT_KEY')
configuration.api_key['x-client-secret'] = os.environ.get('DEVDRAFT_CLIENT_SECRET')

# Use context manager for automatic resource cleanup
with devdraft.ApiClient(configuration) as api_client:
    # Initialize API instances
    transfers_api = devdraft.TransfersApi(api_client)
    webhooks_api = devdraft.WebhooksApi(api_client)
    
    # Use the APIs
    transfer = transfers_api.transfer_controller_create_direct_wallet_transfer(
        devdraft.CreateDirectWalletTransferDto(
            wallet_id='your-wallet-id',
            network='solana',
            stable_coin_currency='usdc',
            amount=100.00
        )
    )
```

## API Classes

The SDK is organized into API classes, each handling a specific domain:

| API Class                                         | Description                                     |
| ------------------------------------------------- | ----------------------------------------------- |
| [APIHealthApi](#api-health)                       | Service health checks and status monitoring     |
| [AppBalancesApi](#app-balances)                   | Query application balances across stablecoins   |
| [CustomersApi](#customers)                        | Customer management and KYC operations          |
| [ExchangeRatesApi](#exchange-rates)               | Real-time currency exchange rates               |
| [InvoicesApi](#invoices)                          | Invoice creation and management                 |
| [LiquidationAddressesApi](#liquidation-addresses) | Cryptocurrency liquidation addresses            |
| [PaymentIntentsApi](#payment-intents)             | Payment intent creation for bank and stablecoin |
| [PaymentLinksApi](#payment-links)                 | Generate and manage payment links               |
| [ProductsApi](#products)                          | Product catalog management                      |
| [TaxesApi](#taxes)                                | Tax configuration and management                |
| [TestPaymentsApi](#test-payments)                 | Test payment processing in sandbox              |
| [TransfersApi](#transfers)                        | Initiate and manage fund transfers              |
| [WalletsApi](#wallets)                            | Wallet management and balances                  |
| [WebhooksApi](#webhooks)                          | Webhook configuration and management            |

***

## API Health

Monitor service health and availability.

### Methods

#### `health_controller_check_v0()`

Authenticated health check endpoint requiring API credentials.

```python theme={null}
import devdraft

with devdraft.ApiClient(configuration) as api_client:
    health_api = devdraft.APIHealthApi(api_client)
    
    try:
        health_api.health_controller_check_v0()
        print('Service is healthy and authenticated')
    except devdraft.ApiException as e:
        print(f'Health check failed: {e}')
```

**Returns:** `None`

#### `health_controller_public_health_check_v0()`

Public health check endpoint (no authentication required).

```python theme={null}
status = health_api.health_controller_public_health_check_v0()
print(f'Service status: {status}')
```

**Returns:** `PublicHealthResponseDto`

***

## App Balances

Query your application's stablecoin balances.

### Methods

#### `balance_controller_get_all_balances()`

Get all stablecoin balances for your application.

```python theme={null}
import devdraft

with devdraft.ApiClient(configuration) as api_client:
    balances_api = devdraft.AppBalancesApi(api_client)
    
    balances = balances_api.balance_controller_get_all_balances()
    print(f'USDC Balance: {balances.usdc}')
    print(f'EURC Balance: {balances.eurc}')
```

**Returns:** `AllBalancesResponse`

#### `balance_controller_get_usdc_balance()`

Get USDC balance only.

```python theme={null}
usdc_balance = balances_api.balance_controller_get_usdc_balance()
print(f'USDC: {usdc_balance.amount}')
```

**Returns:** `AggregatedBalanceResponse`

#### `balance_controller_get_eurc_balance()`

Get EURC balance only.

```python theme={null}
eurc_balance = balances_api.balance_controller_get_eurc_balance()
print(f'EURC: {eurc_balance.amount}')
```

**Returns:** `AggregatedBalanceResponse`

***

## Customers

Manage customer records and KYC information.

### Methods

#### `customer_controller_create(create_customer_dto)`

Create a new customer.

```python theme={null}
import devdraft
from devdraft.model.create_customer_dto import CreateCustomerDto

with devdraft.ApiClient(configuration) as api_client:
    customers_api = devdraft.CustomersApi(api_client)
    
    new_customer = customers_api.customer_controller_create(
        CreateCustomerDto(
            first_name='John',
            last_name='Doe',
            email='john.doe@example.com',
            type='INDIVIDUAL',
            country='US'
        )
    )
    
    print(f'Customer created: {new_customer.id}')
```

**Parameters:**

* `create_customer_dto: CreateCustomerDto` - Customer details

**Returns:** `Customer`

#### `customer_controller_find_all(**kwargs)`

Get all customers with optional filters.

```python theme={null}
customers = customers_api.customer_controller_find_all(
    page=1,
    limit=20,
    status='ACTIVE'
)

for customer in customers:
    print(f'{customer.first_name} {customer.last_name} - {customer.email}')
```

**Parameters:**

* `page: int` - Page number (optional, default: 1)
* `limit: int` - Items per page (optional, default: 20)
* `status: str` - Filter by status (optional)

**Returns:** `List[Customer]`

#### `customer_controller_find_one(id)`

Get a customer by ID.

```python theme={null}
customer = customers_api.customer_controller_find_one(id='customer-id-here')
print(f'Customer: {customer.first_name} {customer.last_name}')
```

**Parameters:**

* `id: str` - Customer ID

**Returns:** `Customer`

#### `customer_controller_update(id, update_customer_dto)`

Update a customer's information.

```python theme={null}
from devdraft.model.update_customer_dto import UpdateCustomerDto

updated = customers_api.customer_controller_update(
    id='customer-id-here',
    update_customer_dto=UpdateCustomerDto(
        phone='+1234567890',
        address='123 Main St'
    )
)

print(f'Customer updated: {updated.id}')
```

**Parameters:**

* `id: str` - Customer ID
* `update_customer_dto: UpdateCustomerDto` - Fields to update

**Returns:** `Customer`

***

## Exchange Rates

Get real-time currency exchange rates.

### Methods

#### `exchange_rate_controller_get_exchange_rate(**kwargs)`

Get exchange rate between any two supported currencies.

```python theme={null}
import devdraft

with devdraft.ApiClient(configuration) as api_client:
    rates_api = devdraft.ExchangeRatesApi(api_client)
    
    rate = rates_api.exchange_rate_controller_get_exchange_rate(
        var_from='USD',
        to='EUR'
    )
    
    print(f'1 USD = {rate.rate} EUR')
    print(f'Rate expires at: {rate.expires_at}')
```

**Parameters:**

* `var_from: str` - Source currency code
* `to: str` - Target currency code

**Returns:** `ExchangeRateResponseDto`

#### `exchange_rate_controller_get_usdto_eur_rate()`

Get USD to EUR exchange rate.

```python theme={null}
usd_to_eur = rates_api.exchange_rate_controller_get_usdto_eur_rate()
print(f'USD to EUR: {usd_to_eur.rate}')
```

**Returns:** `ExchangeRateResponseDto`

#### `exchange_rate_controller_get_eurto_usd_rate()`

Get EUR to USD exchange rate.

```python theme={null}
eur_to_usd = rates_api.exchange_rate_controller_get_eurto_usd_rate()
print(f'EUR to USD: {eur_to_usd.rate}')
```

**Returns:** `ExchangeRateResponseDto`

***

## Invoices

Create and manage invoices for your customers.

### Methods

#### `invoice_controller_create(create_invoice_dto)`

Create a new invoice.

```python theme={null}
import devdraft
from devdraft.model.create_invoice_dto import CreateInvoiceDto

with devdraft.ApiClient(configuration) as api_client:
    invoices_api = devdraft.InvoicesApi(api_client)
    
    invoice = invoices_api.invoice_controller_create(
        CreateInvoiceDto(
            customer_id='customer-id',
            items=[
                {
                    'description': 'Premium Subscription',
                    'quantity': 1,
                    'price': 99.99,
                    'currency': 'USD'
                }
            ],
            due_date='2024-12-31'
        )
    )
    
    print(f'Invoice created: {invoice.id}')
    print(f'Total: {invoice.total}')
```

**Parameters:**

* `create_invoice_dto: CreateInvoiceDto` - Invoice details

**Returns:** `Invoice`

#### `invoice_controller_find_all(**kwargs)`

Get all invoices.

```python theme={null}
invoices = invoices_api.invoice_controller_find_all(
    page=1,
    limit=50,
    status='UNPAID'
)
```

**Parameters:**

* `page: int` - Page number (optional)
* `limit: int` - Items per page (optional)
* `status: str` - Filter by status (optional)

**Returns:** `List[Invoice]`

#### `invoice_controller_find_one(id)`

Get an invoice by ID.

```python theme={null}
invoice = invoices_api.invoice_controller_find_one(id='invoice-id')
```

**Parameters:**

* `id: str` - Invoice ID

**Returns:** `Invoice`

#### `invoice_controller_update(id, update_invoice_dto)`

Update an invoice.

```python theme={null}
from datetime import datetime

updated = invoices_api.invoice_controller_update(
    id='invoice-id',
    update_invoice_dto={
        'status': 'PAID',
        'paid_at': datetime.now().isoformat()
    }
)
```

**Parameters:**

* `id: str` - Invoice ID
* `update_invoice_dto: dict` - Fields to update

**Returns:** `Invoice`

***

## Liquidation Addresses

Manage cryptocurrency liquidation addresses for customers.

### Methods

#### `liquidation_address_controller_create_liquidation_address(customer_id, create_liquidation_address_dto)`

Create a new liquidation address for a customer.

```python theme={null}
import devdraft
from devdraft.model.create_liquidation_address_dto import CreateLiquidationAddressDto

with devdraft.ApiClient(configuration) as api_client:
    liquidation_api = devdraft.LiquidationAddressesApi(api_client)
    
    address = liquidation_api.liquidation_address_controller_create_liquidation_address(
        customer_id='customer-id',
        create_liquidation_address_dto=CreateLiquidationAddressDto(
            network='solana',
            currency='usdc'
        )
    )
    
    print(f'Liquidation address: {address.address}')
    print(f'Network: {address.network}')
```

**Parameters:**

* `customer_id: str` - Customer ID
* `create_liquidation_address_dto: CreateLiquidationAddressDto` - Address details

**Returns:** `LiquidationAddressResponseDto`

#### `liquidation_address_controller_get_liquidation_addresses(customer_id)`

Get all liquidation addresses for a customer.

```python theme={null}
addresses = liquidation_api.liquidation_address_controller_get_liquidation_addresses(
    customer_id='customer-id'
)

for addr in addresses:
    print(f'{addr.network}: {addr.address}')
```

**Parameters:**

* `customer_id: str` - Customer ID

**Returns:** `List[LiquidationAddressResponseDto]`

#### `liquidation_address_controller_get_liquidation_address(customer_id, liquidation_address_id)`

Get a specific liquidation address.

```python theme={null}
address = liquidation_api.liquidation_address_controller_get_liquidation_address(
    customer_id='customer-id',
    liquidation_address_id='address-id'
)
```

**Parameters:**

* `customer_id: str` - Customer ID
* `liquidation_address_id: str` - Address ID

**Returns:** `LiquidationAddressResponseDto`

***

## Payment Intents

Create payment intents for bank and stablecoin payments.

### Methods

#### `payment_intent_controller_create_bank_payment_intent(create_bank_payment_intent_dto)`

Create a bank payment intent.

```python theme={null}
import devdraft
from devdraft.model.create_bank_payment_intent_dto import CreateBankPaymentIntentDto

with devdraft.ApiClient(configuration) as api_client:
    intent_api = devdraft.PaymentIntentsApi(api_client)
    
    intent = intent_api.payment_intent_controller_create_bank_payment_intent(
        CreateBankPaymentIntentDto(
            customer_id='customer-id',
            amount=1000.00,
            currency='USD',
            payment_rail='wire'
        )
    )
    
    print(f'Payment intent: {intent.id}')
    print(f'Status: {intent.status}')
```

**Parameters:**

* `create_bank_payment_intent_dto: CreateBankPaymentIntentDto` - Intent details

**Returns:** `PaymentIntent`

#### `payment_intent_controller_create_stable_payment_intent(create_stable_payment_intent_dto)`

Create a stablecoin payment intent.

```python theme={null}
from devdraft.model.create_stable_payment_intent_dto import CreateStablePaymentIntentDto

stable_intent = intent_api.payment_intent_controller_create_stable_payment_intent(
    CreateStablePaymentIntentDto(
        customer_id='customer-id',
        amount=500.00,
        currency='usdc',
        network='solana'
    )
)
```

**Parameters:**

* `create_stable_payment_intent_dto: CreateStablePaymentIntentDto` - Intent details

**Returns:** `PaymentIntent`

***

## Payment Links

Generate and manage payment links for easy customer payments.

### Methods

#### `payment_links_controller_create(create_payment_link_dto)`

Create a new payment link.

```python theme={null}
import devdraft
from devdraft.model.create_payment_link_dto import CreatePaymentLinkDto

with devdraft.ApiClient(configuration) as api_client:
    links_api = devdraft.PaymentLinksApi(api_client)
    
    link = links_api.payment_links_controller_create(
        CreatePaymentLinkDto(
            name='Product Purchase',
            amount=99.99,
            currency='USD',
            products=[
                {
                    'name': 'Premium Plan',
                    'quantity': 1,
                    'price': 99.99
                }
            ]
        )
    )
    
    print(f'Payment link: {link.url}')
    print(f'Share this link with customers: {link.short_url}')
```

**Parameters:**

* `create_payment_link_dto: CreatePaymentLinkDto` - Link details

**Returns:** `PaymentLink`

#### `payment_links_controller_find_all(**kwargs)`

Get all payment links.

```python theme={null}
links = links_api.payment_links_controller_find_all(
    page=1,
    limit=20,
    active=True
)
```

**Parameters:**

* `page: int` - Page number (optional)
* `limit: int` - Items per page (optional)
* `active: bool` - Filter by active status (optional)

**Returns:** `List[PaymentLink]`

#### `payment_links_controller_find_one(id)`

Get a payment link by ID.

```python theme={null}
link = links_api.payment_links_controller_find_one(id='link-id')
```

**Parameters:**

* `id: str` - Payment link ID

**Returns:** `PaymentLink`

#### `payment_links_controller_update(id, update_payment_link_dto)`

Update a payment link.

```python theme={null}
updated = links_api.payment_links_controller_update(
    id='link-id',
    update_payment_link_dto={
        'active': False,
        'expires_at': '2024-12-31T23:59:59Z'
    }
)
```

**Parameters:**

* `id: str` - Payment link ID
* `update_payment_link_dto: dict` - Fields to update

**Returns:** `PaymentLink`

***

## Products

Manage your product catalog.

### Methods

#### `product_controller_create(create_product_dto)`

Create a new product.

```python theme={null}
import devdraft

with devdraft.ApiClient(configuration) as api_client:
    products_api = devdraft.ProductsApi(api_client)
    
    product = products_api.product_controller_create(
        {
            'name': 'Premium Subscription',
            'description': 'Access to all premium features',
            'price': 99.99,
            'currency': 'USD',
            'category': 'subscriptions'
        }
    )
    
    print(f'Product created: {product.id}')
```

**Parameters:**

* `create_product_dto: dict` - Product details

**Returns:** `Product`

#### `product_controller_find_all(**kwargs)`

Get all products.

```python theme={null}
products = products_api.product_controller_find_all(
    category='subscriptions',
    active=True
)
```

**Parameters:**

* `category: str` - Filter by category (optional)
* `active: bool` - Filter by active status (optional)

**Returns:** `List[Product]`

#### `product_controller_find_one(id)`

Get a product by ID.

```python theme={null}
product = products_api.product_controller_find_one(id='product-id')
```

**Parameters:**

* `id: str` - Product ID

**Returns:** `Product`

#### `product_controller_update(id, update_product_dto)`

Update a product.

```python theme={null}
updated = products_api.product_controller_update(
    id='product-id',
    update_product_dto={
        'price': 89.99,
        'description': 'Updated description'
    }
)
```

**Parameters:**

* `id: str` - Product ID
* `update_product_dto: dict` - Fields to update

**Returns:** `Product`

#### `product_controller_remove(id)`

Delete a product.

```python theme={null}
products_api.product_controller_remove(id='product-id')
```

**Parameters:**

* `id: str` - Product ID

**Returns:** `None`

#### `product_controller_upload_image(id, images)`

Upload images for a product.

```python theme={null}
with open('product-image.jpg', 'rb') as image_file:
    products_api.product_controller_upload_image(
        id='product-id',
        images=[image_file]
    )
```

**Parameters:**

* `id: str` - Product ID
* `images: List[file]` - Image files

**Returns:** `Product`

***

## Taxes

Configure and manage tax settings.

### Methods

#### `tax_controller_create(create_tax_dto)`

Create a new tax configuration.

```python theme={null}
import devdraft
from devdraft.model.create_tax_dto import CreateTaxDto

with devdraft.ApiClient(configuration) as api_client:
    taxes_api = devdraft.TaxesApi(api_client)
    
    tax = taxes_api.tax_controller_create(
        CreateTaxDto(
            name='Sales Tax',
            percentage=8.5,
            country='US',
            state='CA'
        )
    )
    
    print(f'Tax created: {tax.id}')
```

**Parameters:**

* `create_tax_dto: CreateTaxDto` - Tax details

**Returns:** `Tax`

#### `tax_controller_find_all(**kwargs)`

Get all tax configurations.

```python theme={null}
taxes = taxes_api.tax_controller_find_all(country='US')
```

**Parameters:**

* `country: str` - Filter by country (optional)

**Returns:** `List[Tax]`

#### `tax_controller_find_one(id)`

Get a tax configuration by ID.

```python theme={null}
tax = taxes_api.tax_controller_find_one(id='tax-id')
```

**Parameters:**

* `id: str` - Tax ID

**Returns:** `Tax`

#### `tax_controller_update(id, update_tax_dto)`

Update a tax configuration.

```python theme={null}
from devdraft.model.update_tax_dto import UpdateTaxDto

updated = taxes_api.tax_controller_update(
    id='tax-id',
    update_tax_dto=UpdateTaxDto(percentage=9.0)
)
```

**Parameters:**

* `id: str` - Tax ID
* `update_tax_dto: UpdateTaxDto` - Fields to update

**Returns:** `Tax`

#### `tax_controller_remove(id)`

Delete a tax configuration.

```python theme={null}
taxes_api.tax_controller_remove(id='tax-id')
```

**Parameters:**

* `id: str` - Tax ID

**Returns:** `None`

***

## Test Payments

Process test payments in sandbox environment.

### Methods

#### `test_payment_controller_create_payment_v0(payment_request_dto)`

Create a test payment.

```python theme={null}
import devdraft
from devdraft.model.payment_request_dto import PaymentRequestDto

with devdraft.ApiClient(configuration) as api_client:
    test_api = devdraft.TestPaymentsApi(api_client)
    
    payment = test_api.test_payment_controller_create_payment_v0(
        PaymentRequestDto(
            amount=100.00,
            currency='USD',
            customer_id='test-customer-id',
            idempotency_key='unique-key-123'
        )
    )
    
    print(f'Test payment: {payment.id}')
    print(f'Status: {payment.status}')
```

**Parameters:**

* `payment_request_dto: PaymentRequestDto` - Payment details

**Returns:** `PaymentResponseDto`

#### `test_payment_controller_get_payment_v0(id)`

Get test payment details by ID.

```python theme={null}
payment = test_api.test_payment_controller_get_payment_v0(id='payment-id')
print(f'Payment status: {payment.status}')
```

**Parameters:**

* `id: str` - Payment ID

**Returns:** `PaymentResponseDto`

#### `test_payment_controller_refund_payment_v0(id, **kwargs)`

Refund a test payment.

```python theme={null}
refund = test_api.test_payment_controller_refund_payment_v0(
    id='payment-id',
    refund_amount=50.00
)

print(f'Refund processed: {refund.id}')
```

**Parameters:**

* `id: str` - Payment ID
* `refund_amount: float` - Amount to refund (optional, defaults to full amount)

**Returns:** `RefundResponseDto`

***

## Transfers

Initiate and manage fund transfers between different payment rails.

### Methods

#### `transfer_controller_create_direct_bank_transfer(create_direct_bank_transfer_dto)`

Create a direct bank transfer.

```python theme={null}
import devdraft
from devdraft.model.create_direct_bank_transfer_dto import CreateDirectBankTransferDto

with devdraft.ApiClient(configuration) as api_client:
    transfers_api = devdraft.TransfersApi(api_client)
    
    transfer = transfers_api.transfer_controller_create_direct_bank_transfer(
        CreateDirectBankTransferDto(
            wallet_id='wallet-id',
            payment_rail='wire',
            source_currency='usd',
            destination_currency='usdc',
            amount=1000.00
        )
    )
    
    print(f'Transfer created: {transfer.id}')
    print(f'Bank instructions: {transfer.source_deposit_instructions}')
```

**Parameters:**

* `create_direct_bank_transfer_dto: CreateDirectBankTransferDto` - Transfer details

**Returns:** `Transfer`

**See also:** [Direct Bank Transfer Guide](/docs/developers/transfers/direct-bank-transfer)

#### `transfer_controller_create_direct_wallet_transfer(create_direct_wallet_transfer_dto)`

Create a direct wallet transfer.

```python theme={null}
from devdraft.model.create_direct_wallet_transfer_dto import CreateDirectWalletTransferDto

transfer = transfers_api.transfer_controller_create_direct_wallet_transfer(
    CreateDirectWalletTransferDto(
        wallet_id='wallet-id',
        network='solana',
        stable_coin_currency='usdc',
        amount=500.00
    )
)

print(f'Transfer created: {transfer.id}')
print(f'Deposit address: {transfer.source_deposit_instructions.to_address}')
```

**Parameters:**

* `create_direct_wallet_transfer_dto: CreateDirectWalletTransferDto` - Transfer details

**Returns:** `Transfer`

**See also:** [Direct Wallet Transfer Guide](/docs/developers/transfers/direct-wallet-transfer)

#### `transfer_controller_create_external_bank_transfer(create_external_bank_transfer_dto)`

Create an external bank transfer (from your wallet to external bank).

```python theme={null}
from devdraft.model.create_external_bank_transfer_dto import CreateExternalBankTransferDto

transfer = transfers_api.transfer_controller_create_external_bank_transfer(
    CreateExternalBankTransferDto(
        source_wallet_id='wallet-id',
        destination_bank_account_id='bank-account-id',
        amount=1000.00,
        currency='USD'
    )
)
```

**Parameters:**

* `create_external_bank_transfer_dto: CreateExternalBankTransferDto` - Transfer details

**Returns:** `Transfer`

#### `transfer_controller_create_external_stablecoin_transfer(create_external_stablecoin_transfer_dto)`

Create an external stablecoin transfer (from your wallet to external wallet).

```python theme={null}
from devdraft.model.create_external_stablecoin_transfer_dto import CreateExternalStablecoinTransferDto

transfer = transfers_api.transfer_controller_create_external_stablecoin_transfer(
    CreateExternalStablecoinTransferDto(
        source_wallet_id='wallet-id',
        destination_address='0x742d35Cc6Ff82a8C2D8D1Da9da17c7eDfD5bE0a3',
        network='ethereum',
        currency='usdc',
        amount=250.00
    )
)
```

**Parameters:**

* `create_external_stablecoin_transfer_dto: CreateExternalStablecoinTransferDto` - Transfer details

**Returns:** `Transfer`

#### `transfer_controller_create_stablecoin_conversion(create_stablecoin_conversion_dto)`

Convert between different stablecoins or networks.

```python theme={null}
from devdraft.model.create_stablecoin_conversion_dto import CreateStablecoinConversionDto

conversion = transfers_api.transfer_controller_create_stablecoin_conversion(
    CreateStablecoinConversionDto(
        source_wallet_id='wallet-id',
        destination_wallet_id='wallet-id',
        source_network='ethereum',
        destination_network='solana',
        source_currency='usdc',
        destination_currency='usdc',
        amount=1000.00
    )
)

print(f'Conversion ID: {conversion.id}')
print(f'Exchange rate: {conversion.exchange_rate.rate}')
print(f'Estimated completion: {conversion.estimated_completion}')
```

**Parameters:**

* `create_stablecoin_conversion_dto: CreateStablecoinConversionDto` - Conversion details

**Returns:** `Conversion`

**See also:** [Stablecoin Conversion Guide](/docs/developers/transfers/stablecoin-conversion)

***

## Wallets

Manage wallets and query balances.

### Methods

#### `wallet_controller_get_wallets()`

Get all wallets for your application.

```python theme={null}
import devdraft

with devdraft.ApiClient(configuration) as api_client:
    wallets_api = devdraft.WalletsApi(api_client)
    
    wallets_api.wallet_controller_get_wallets()
    # Returns wallet information for your application
```

**Returns:** `None`

<Info>
  The response contains wallet IDs that you can use for transfers and other operations. In a future SDK version, this will return typed wallet objects.
</Info>

***

## Webhooks

Configure webhooks to receive real-time event notifications.

### Methods

#### `webhook_controller_create(create_webhook_dto)`

Create a new webhook.

```python theme={null}
import devdraft
from devdraft.model.create_webhook_dto import CreateWebhookDto

with devdraft.ApiClient(configuration) as api_client:
    webhooks_api = devdraft.WebhooksApi(api_client)
    
    webhook = webhooks_api.webhook_controller_create(
        CreateWebhookDto(
            url='https://your-app.com/webhooks/devdraft',
            name='Production Webhook',
            is_active=True,
            encrypted=False
        )
    )
    
    print(f'Webhook ID: {webhook.id}')
    print(f'Signing secret: {webhook.signing_secret}')
```

**Parameters:**

* `create_webhook_dto: CreateWebhookDto` - Webhook configuration

**Returns:** `WebhookResponseDto`

**See also:** [Webhooks Overview](/docs/developers/webhooks/overview)

#### `webhook_controller_find_all(**kwargs)`

Get all webhooks.

```python theme={null}
webhooks = webhooks_api.webhook_controller_find_all(
    page=1,
    limit=20,
    active=True
)

for webhook in webhooks:
    print(f'{webhook.name}: {webhook.url}')
    print(f'Active: {webhook.is_active}')
```

**Parameters:**

* `page: int` - Page number (optional)
* `limit: int` - Items per page (optional)
* `active: bool` - Filter by active status (optional)

**Returns:** `List[WebhookResponseDto]`

#### `webhook_controller_find_one(id)`

Get a webhook by ID.

```python theme={null}
webhook = webhooks_api.webhook_controller_find_one(id='webhook-id')

print(f'Webhook: {webhook.name}')
print(f'URL: {webhook.url}')
print(f'Delivery stats: {webhook.delivery_stats}')
```

**Parameters:**

* `id: str` - Webhook ID

**Returns:** `WebhookResponseDto`

#### `webhook_controller_update(id, update_webhook_dto)`

Update a webhook.

```python theme={null}
from devdraft.model.update_webhook_dto import UpdateWebhookDto

updated = webhooks_api.webhook_controller_update(
    id='webhook-id',
    update_webhook_dto=UpdateWebhookDto(
        url='https://your-app.com/webhooks/new-endpoint',
        is_active=True
    )
)
```

**Parameters:**

* `id: str` - Webhook ID
* `update_webhook_dto: UpdateWebhookDto` - Fields to update

**Returns:** `WebhookResponseDto`

#### `webhook_controller_remove(id)`

Delete a webhook.

```python theme={null}
webhooks_api.webhook_controller_remove(id='webhook-id')
print('Webhook deleted')
```

**Parameters:**

* `id: str` - Webhook ID

**Returns:** `None`

***

## Error Handling

All SDK methods may throw `ApiException`. Handle them appropriately:

```python theme={null}
from devdraft.rest import ApiException

try:
    transfer = transfers_api.transfer_controller_create_direct_wallet_transfer(transfer_data)
except ApiException as e:
    status_code = e.status
    response_body = e.body
    
    if status_code == 400:
        print(f'Invalid request: {response_body}')
    elif status_code == 401:
        print('Authentication failed - check your API credentials')
    elif status_code == 404:
        print(f'Resource not found: {response_body}')
    elif status_code == 422:
        print(f'Validation error: {response_body}')
    elif status_code == 429:
        retry_after = e.headers.get('Retry-After')
        print(f'Rate limited - retry after: {retry_after}')
    else:
        print(f'API error: {status_code} - {response_body}')
```

## Type Hints

The SDK includes type hints for better IDE support and type checking:

```python theme={null}
from devdraft.model.create_direct_wallet_transfer_dto import CreateDirectWalletTransferDto
from devdraft.model.webhook_response_dto import WebhookResponseDto
from devdraft.model.payment_response_dto import PaymentResponseDto

# Type hints help with IDE autocomplete and type checking
def create_transfer(wallet_id: str, amount: float) -> None:
    transfer_dto = CreateDirectWalletTransferDto(
        wallet_id=wallet_id,
        network='solana',
        stable_coin_currency='usdc',
        amount=amount
    )
    
    transfer = transfers_api.transfer_controller_create_direct_wallet_transfer(transfer_dto)
```

## Best Practices

<Steps>
  <Step title="Use Context Managers">
    Always use `with` statements to ensure proper resource cleanup.

    ```python theme={null}
    with devdraft.ApiClient(configuration) as api_client:
        transfers_api = devdraft.TransfersApi(api_client)
        # API calls here
    # Resources automatically cleaned up
    ```
  </Step>

  <Step title="Environment Variables for Credentials">
    Store API credentials in environment variables, never in source code.

    ```python theme={null}
    import os

    configuration.api_key['x-client-key'] = os.environ['DEVDRAFT_CLIENT_KEY']
    configuration.api_key['x-client-secret'] = os.environ['DEVDRAFT_CLIENT_SECRET']
    ```
  </Step>

  <Step title="Proper Exception Handling">
    Always wrap API calls in try-except blocks.

    ```python theme={null}
    from devdraft.rest import ApiException

    try:
        result = api.some_method()
    except ApiException as e:
        print(f'API error: {e.status} - {e.body}')
    except Exception as e:
        print(f'Unexpected error: {e}')
    ```
  </Step>

  <Step title="Use Type Hints">
    Leverage Python's type hints for better code quality.

    ```python theme={null}
    from typing import Optional
    from devdraft.model.customer import Customer

    def get_customer_by_email(email: str) -> Optional[Customer]:
        customers = customers_api.customer_controller_find_all()
        return next((c for c in customers if c.email == email), None)
    ```
  </Step>

  <Step title="Reuse ApiClient">
    Create a single configuration and ApiClient instance and reuse it.

    ```python theme={null}
    # Bad: Creating new client for each API
    with devdraft.ApiClient(config) as client1:
        transfers_api = devdraft.TransfersApi(client1)

    with devdraft.ApiClient(config) as client2:
        webhooks_api = devdraft.WebhooksApi(client2)

    # Good: Reuse the same client
    with devdraft.ApiClient(config) as api_client:
        transfers_api = devdraft.TransfersApi(api_client)
        webhooks_api = devdraft.WebhooksApi(api_client)
    ```
  </Step>

  <Step title="Use Logging for Debugging">
    Enable logging for debugging API calls.

    ```python theme={null}
    import logging

    # Enable debug logging
    logging.basicConfig(level=logging.DEBUG)

    configuration.debug = True  # Enable SDK debug mode
    ```
  </Step>
</Steps>

## Testing with Pytest

Example pytest test for SDK integration:

```python theme={null}
import pytest
import devdraft
from devdraft.rest import ApiException

@pytest.fixture
def api_client():
    configuration = devdraft.Configuration(
        host="https://api.devdraft.ai"
    )
    configuration.api_key['x-client-key'] = 'test-key'
    configuration.api_key['x-client-secret'] = 'test-secret'
    
    with devdraft.ApiClient(configuration) as client:
        yield client

def test_create_webhook(api_client):
    webhooks_api = devdraft.WebhooksApi(api_client)
    
    webhook = webhooks_api.webhook_controller_create(
        devdraft.CreateWebhookDto(
            url='https://test.example.com/webhook',
            name='Test Webhook',
            is_active=True
        )
    )
    
    assert webhook.id is not None
    assert webhook.name == 'Test Webhook'

def test_api_error_handling(api_client):
    transfers_api = devdraft.TransfersApi(api_client)
    
    with pytest.raises(ApiException) as exc_info:
        transfers_api.transfer_controller_create_direct_wallet_transfer(
            devdraft.CreateDirectWalletTransferDto(
                wallet_id='invalid-id',
                network='invalid-network',
                stable_coin_currency='invalid',
                amount=-100  # Invalid amount
            )
        )
    
    assert exc_info.value.status in [400, 422]
```

## Async Support

For async/await support, you can use `aiohttp` with the SDK:

```python theme={null}
import asyncio
import devdraft

async def async_example():
    configuration = devdraft.Configuration(
        host="https://api.devdraft.ai"
    )
    configuration.api_key['x-client-key'] = 'your-key'
    configuration.api_key['x-client-secret'] = 'your-secret'
    
    async with devdraft.ApiClient(configuration) as api_client:
        health_api = devdraft.APIHealthApi(api_client)
        
        # Use async methods
        response = await health_api.health_controller_public_health_check_v0()
        print(f'Status: {response.status}')

# Run async function
asyncio.run(async_example())
```

## Next Steps

<CardGroup cols={2}>
  <Card title="SDK Quickstart" href="/docs/developers/sdk-quickstart" icon="rocket">
    Complete integration guide with examples
  </Card>

  <Card title="Transfers" href="/docs/developers/transfers/direct-wallet-transfer" icon="arrow-right-arrow-left">
    Learn about initiating transfers
  </Card>

  <Card title="Webhooks" href="/docs/developers/webhooks/overview" icon="bell">
    Set up webhook notifications
  </Card>

  <Card title="API Reference" href="/docs/developers/api-reference" icon="book">
    Complete REST API documentation
  </Card>
</CardGroup>
