{"id":8051,"library":"cybrid-api-bank-python","title":"Cybrid Bank API Python Client","description":"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.","status":"active","version":"0.128.106","language":"en","source_language":"en","source_url":"https://github.com/Cybrid-app/cybrid-api-bank-python/","tags":["crypto","bank","fintech","api-client","openapi-generated"],"install":[{"cmd":"pip install cybrid-api-bank-python","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"note":"Used for configuring the API client, especially authentication.","symbol":"Configuration","correct":"from cybrid_api_bank.configuration import Configuration"},{"note":"The core client for making API requests.","symbol":"ApiClient","correct":"from cybrid_api_bank.api_client import ApiClient"},{"note":"One of the generated API classes for interacting with bank-related endpoints. Other API classes (e.g., AccountsApi, CustomersApi) follow a similar pattern.","symbol":"BanksApi","correct":"from cybrid_api_bank.api.banks_api import BanksApi"},{"note":"One of the generated API classes for interacting with account-related endpoints.","symbol":"AccountsApi","correct":"from cybrid_api_bank.api.accounts_api import AccountsApi"},{"note":"Access to specific API exceptions for error handling.","symbol":"exceptions","correct":"from cybrid_api_bank import exceptions"}],"quickstart":{"code":"import os\nimport cybrid_api_bank\nfrom cybrid_api_bank.configuration import Configuration\nfrom cybrid_api_bank.api_client import ApiClient\nfrom cybrid_api_bank.api.accounts_api import AccountsApi\n\n# --- Configuration and Authentication ---\n# It is strongly recommended to store Client ID and Secret in environment variables.\n# Generate these credentials from the Cybrid Sandbox or dashboard.\n# The access token can be generated using the Client ID and Client Secret via an OAuth 2.0 Client Credentials Grant flow.\n# For a quick start, you might manually obtain a Bearer Token and use it directly.\n\n# Replace with your actual Bearer Token or logic to fetch it.\n# In a real application, you'd make an OAuth request to Cybrid's Identity Provider\n# to exchange CLIENT_ID and CLIENT_SECRET for an ACCESS_TOKEN.\n# 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\"}'\nACCESS_TOKEN = os.environ.get('CYBRID_BANK_ACCESS_TOKEN', 'YOUR_CYBRID_BANK_ACCESS_TOKEN')\n\n# Configure API key authorization: BearerAuth\nconfiguration = Configuration(\n    access_token = ACCESS_TOKEN,\n    host = \"https://bank.sandbox.cybrid.app\" # Or https://bank.production.cybrid.app for production\n)\n\n# Create an instance of the API client\nwith ApiClient(configuration) as api_client:\n    # Create an instance of the AccountsApi\n    accounts_api_instance = AccountsApi(api_client)\n\n    try:\n        # List accounts\n        # Optional parameters can be passed as keyword arguments\n        api_response = accounts_api_instance.list_accounts(limit=10)\n        print(\"Successfully listed accounts:\")\n        for account in api_response.data:\n            print(f\"  Account GUID: {account.guid}, Asset: {account.asset}, Balance: {account.platform_balance}\")\n\n    except cybrid_api_bank.exceptions.ApiException as e:\n        print(f\"Exception when calling AccountsApi->list_accounts: {e}\")\n    except Exception as e:\n        print(f\"An unexpected error occurred: {e}\")","lang":"python","description":"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."},"warnings":[{"fix":"Monitor Cybrid's official API documentation and changelog for announcements. Regenerate the client if using custom generation, or update the library and adapt code as necessary.","message":"The Cybrid API, and by extension its generated clients, may undergo breaking changes. While Cybrid aims for a safe evolution of its API, changes in OpenAPI definitions can lead to breaking changes in downstream clients. Developers should subscribe to Cybrid's changelog for advance notice.","severity":"breaking","affected_versions":"All versions, due to upstream API evolution"},{"fix":"Store `CLIENT_ID` and `CLIENT_SECRET` as environment variables (e.g., `CYBRID_CLIENT_ID`, `CYBRID_CLIENT_SECRET`) and retrieve them using `os.environ.get()` at runtime. Implement an OAuth client credentials flow to obtain time-limited Bearer Tokens.","message":"API credentials (Client ID and Secret) should never be embedded directly in code or committed to a source code repository. They should be stored securely, preferably in environment variables or a secrets management tool.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Generate customer-scoped access tokens via the Identity API's `POST /api/customer_tokens` endpoint for all customer-based API requests. This adheres to the principle of least privilege.","message":"Using a broadly scoped 'Bank token' for customer-specific operations can lead to security vulnerabilities. API requests for a specific customer should use a customer-scoped access token.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Implement robust token expiration handling. This includes detecting `401 Unauthorized` responses, refreshing the access token (using your Client ID/Secret or refresh token if applicable), and retrying the failed API request with the new token.","message":"Access tokens have a limited lifetime (e.g., 30 minutes in production, 8 hours in sandbox). API calls with expired tokens will result in 401 Unauthorized errors.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Ensure `CYBRID_BANK_ACCESS_TOKEN` environment variable is correctly set with a valid, non-expired Bearer Token. Implement token refresh logic in production applications to automatically renew tokens before or upon expiration.","cause":"The provided access token is missing, invalid, or expired.","error":"cybrid_api_bank.exceptions.ApiException: (401)\nReason: Unauthorized\nHTTP response body: {'message': 'Unauthorized', 'message_code': 'unauthorized'}"},{"fix":"Adjust import statements to correctly reference the `api` submodule. For example, use `from cybrid_api_bank.api.accounts_api import AccountsApi` instead of `from cybrid_api_bank import AccountsApi`.","cause":"Incorrect import path for API classes. The API classes are nested within the `api` submodule.","error":"AttributeError: module 'cybrid_api_bank' has no attribute 'api'"},{"fix":"Review the required scopes for the API endpoint you are calling (refer to Cybrid API documentation). Ensure that when you generate your access token, you request all the necessary scopes (e.g., `accounts:read` for listing accounts, `accounts:execute` for creating accounts).","cause":"The access token used does not have the necessary scopes to perform the requested operation.","error":"cybrid_api_bank.exceptions.ApiException: (403)\nReason: Forbidden\nHTTP response body: {'message': 'Forbidden', 'message_code': 'invalid_scope'}"}]}