Cybrid Bank API Python Client

0.128.106 · active · verified Thu Apr 16

The `cybrid-api-bank-python` library provides a Python client for interacting with the Cybrid Bank API. It enables developers to build and launch white-label crypto products and services, managing resources across banks, customers, accounts, and more. This package is automatically generated from the Cybrid OpenAPI specification. The current version is `0.128.106`, and it appears to be actively maintained with frequent releases, often on a daily basis.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to configure the Cybrid Bank API client using a Bearer Token and then make a simple call to list accounts. It emphasizes the importance of secure credential management via environment variables. In a production environment, you would first obtain an access token from the Cybrid Identity Provider using your Client ID and Client Secret.

import os
import cybrid_api_bank
from cybrid_api_bank.configuration import Configuration
from cybrid_api_bank.api_client import ApiClient
from cybrid_api_bank.api.accounts_api import AccountsApi

# --- Configuration and Authentication ---
# It is strongly recommended to store Client ID and Secret in environment variables.
# Generate these credentials from the Cybrid Sandbox or dashboard.
# The access token can be generated using the Client ID and Client Secret via an OAuth 2.0 Client Credentials Grant flow.
# For a quick start, you might manually obtain a Bearer Token and use it directly.

# Replace with your actual Bearer Token or logic to fetch it.
# In a real application, you'd make an OAuth request to Cybrid's Identity Provider
# to exchange CLIENT_ID and CLIENT_SECRET for an ACCESS_TOKEN.
# Example: curl -X POST https://id.sandbox.cybrid.app/oauth/token -d '{"grant_type": "client_credentials", "client_id": "<Your Client ID>", "client_secret": "<Your Secret>", "scope": "accounts:read"}'
ACCESS_TOKEN = os.environ.get('CYBRID_BANK_ACCESS_TOKEN', 'YOUR_CYBRID_BANK_ACCESS_TOKEN')

# Configure API key authorization: BearerAuth
configuration = Configuration(
    access_token = ACCESS_TOKEN,
    host = "https://bank.sandbox.cybrid.app" # Or https://bank.production.cybrid.app for production
)

# Create an instance of the API client
with ApiClient(configuration) as api_client:
    # Create an instance of the AccountsApi
    accounts_api_instance = AccountsApi(api_client)

    try:
        # List accounts
        # Optional parameters can be passed as keyword arguments
        api_response = accounts_api_instance.list_accounts(limit=10)
        print("Successfully listed accounts:")
        for account in api_response.data:
            print(f"  Account GUID: {account.guid}, Asset: {account.asset}, Balance: {account.platform_balance}")

    except cybrid_api_bank.exceptions.ApiException as e:
        print(f"Exception when calling AccountsApi->list_accounts: {e}")
    except Exception as e:
        print(f"An unexpected error occurred: {e}")

view raw JSON →