### Consume Cybrid API ID TypeScript Package Source: https://github.com/cybrid-app/cybrid-api-id-typescript/blob/main/README.md Steps to install the Cybrid API ID TypeScript client package in a project using npm. Supports both published and local installations. ```bash # For published package: npm install @cybrid/cybrid-api-id-typescript@0.124.82 --save # For local package (not recommended): npm install PATH_TO_GENERATED_PACKAGE --save ``` -------------------------------- ### Apply Middleware for Authentication Source: https://github.com/cybrid-app/cybrid-api-id-typescript/blob/main/README.md Example of creating a custom middleware class that extends the generated Configuration class to add an Authorization header with a Bearer token. This is useful for securing API requests. ```typescript import { Configuration, RequestArgs } from '@cybrid/cybrid-api-id-typescript'; // Assume getAuthToken() is defined elsewhere and retrieves the auth token // declare function getAuthToken(): string; export class AuthInterceptor extends Configuration { private static config: AuthInterceptor; private constructor() { const middleware: Middleware[] = [ { pre(request: RequestArgs): RequestArgs { const token = getAuthToken(); return { ...request, headers: { ...request.headers, Authorization: `Bearer ${token}`, }, }; }, }, ]; super({ middleware }); } public static get Instance() { return AuthInterceptor.config || (AuthInterceptor.config = new this()); } } // Usage: // const api = new StoreApi(AuthInterceptor.Instance); ``` -------------------------------- ### Build and Publish Cybrid API ID TypeScript Package Source: https://github.com/cybrid-app/cybrid-api-id-typescript/blob/main/README.md Instructions for building the TypeScript sources to JavaScript and publishing the package to npm. Requires Node.js environment. ```bash npm install npm run build # Then to publish: npm publish ``` -------------------------------- ### Cybrid API Overview Source: https://github.com/cybrid-app/cybrid-api-id-typescript/blob/main/README.md This section provides an overview of the Cybrid platform's APIs, categorizing them into Organization, Bank, and Identities APIs. It also links to external resources for API schema definitions and support. ```APIDOC Organization API: Description: APIs to manage organizations Swagger UI: https://organization.production.cybrid.app/api/schema/swagger-ui Bank API: Description: APIs to manage banks (and all downstream customer activity) Swagger UI: https://bank.production.cybrid.app/api/schema/swagger-ui Identities API: Description: APIs to manage organization and bank identities Swagger UI: https://id.production.cybrid.app/api/schema/swagger-ui ``` -------------------------------- ### Cybrid API Endpoints Overview Source: https://github.com/cybrid-app/cybrid-api-id-typescript/blob/main/README.md Provides a structured list of available API endpoints for Cybrid's Identity, Organization, and Bank services. Each entry includes the API service, model, endpoint path, and a description of its functionality. ```APIDOC API Service | Model | API Endpoint Path | Description --|--|--|-- Identity | Bank | /api/bank_applications | Create and list banks Identity | CustomerToken | /api/customer_tokens | Create customer JWT access tokens Identity | Organization | /api/organization_applications | Create and list organizations Identity | Organization | /api/users | Create and list organization users Organization | Organization | /api/organizations | APIs to retrieve and update organization name Bank | Account | /api/accounts | Create and list accounts, which hold a specific asset for a customers Bank | Asset | /api/assets | Get a list of assets supported by the platform (ex: BTC, ETH) Bank | Bank | /api/banks | Create, update and list banks, the parent to customers, accounts, etc Bank | Customer | /api/customers | Create and list customers Bank | Counterparty | /api/counterparties | Create and list counterparties Bank | DepositAddress | /api/deposit_addresses | Create, get and list deposit addresses Bank | ExternalBankAccount | /api/external_bank_accounts | Create, get and list external bank accounts, which connect customer bank accounts to the platform Bank | ExternalWallet | /api/external_wallets | Create, get, list and delete external wallets, which connect customer wallets to the platform Bank | IdentityVerification | /api/identity_verifications | Create and list identity verifications, which are performed on customers for KYC Bank | Invoice | /api/invoices | Create, get, cancel and list invoices Bank | PaymentInstruction | /api/payment_instructions | Create, get and list payment instructions for invoices Bank | Price | /api/prices | Get the current prices for assets on the platform Bank | Quote | /api/quotes | Create and list quotes, which are required to execute trades Bank | Symbol | /api/symbols | Get a list of symbols supported for trade (ex: BTC-USD) Bank | Trade | /api/trades | Create and list trades, which buy or sell cryptocurrency Bank | Transfer | /api/transfers | Create, get and list transfers (e.g., funding, book) Bank | Workflow | /api/workflows | Create, get and list workflows ``` -------------------------------- ### Cybrid API Authentication Scopes Overview Source: https://github.com/cybrid-app/cybrid-api-id-typescript/blob/main/README.md Provides a comprehensive list of available authentication scopes for the Cybrid platform. It details the read, write, and execute scopes for various resources and the token types (Organization, Bank, Customer) they apply to. ```APIDOC Resource: Account Read scope: accounts:read (Organization, Bank, Customer) Write scope: None Execute scope: accounts:execute (Bank, Customer) Resource: Bank Read scope: banks:read (Organization, Bank) Write scope: banks:write (Organization, Bank) Execute scope: banks:execute (Organization) Resource: Customer Read scope: customers:read (Organization, Bank, Customer) Write scope: customers:write (Bank, Customer) Execute scope: customers:execute (Bank) Resource: Counterparty Read scope: counterparties:read (Organization, Bank, Customer) Write scope: counterparties:write (Bank, Customer) Execute scope: counterparties:execute (Bank) Resource: Deposit Address Read scope: deposit_addresses:read (Organization, Bank, Customer) Write scope: deposit_addresses:write (Bank, Customer) Execute scope: deposit_addresses:execute (Bank, Customer) Resource: External Bank Account Read scope: external_bank_accounts:read (Organization, Bank, Customer) Write scope: external_bank_accounts:write (Bank, Customer) Execute scope: external_bank_accounts:execute (Bank, Customer) Resource: External Wallet Read scope: external_wallet:read (Organization, Bank, Customer) Write scope: None Execute scope: external_wallet:execute (Bank, Customer) Resource: Organization Read scope: organizations:read (Organization) Write scope: organizations:write (Organization) Execute scope: None Resource: User Read scope: users:read (Organization) Write scope: None Execute scope: users:execute (Organization) Resource: Price Read scope: prices:read (Bank, Customer) Write scope: None Execute scope: None Resource: Quote Read scope: quotes:read (Organization, Bank, Customer) Write scope: None Execute scope: quotes:execute (Organization, Bank, Customer) Resource: Trade Read scope: trades:read (Organization, Bank, Customer) Write scope: None Execute scope: trades:execute (Organization, Bank, Customer) Resource: Transfer Read scope: transfers:read (Organization, Bank, Customer) Write scope: None Execute scope: transfers:execute (Organization, Bank, Customer) Resource: Workflow Read scope: workflows:read (Organization, Bank, Customer) Write scope: None Execute scope: workflows:execute (Bank, Customer) Resource: Invoice Read scope: invoices:read (Organization, Bank, Customer) Write scope: invoices:write (Bank, Customer) Execute scope: invoices:execute (Bank, Customer) ``` -------------------------------- ### Generate Bearer Token using Curl Source: https://github.com/cybrid-app/cybrid-api-id-typescript/blob/main/README.md This snippet demonstrates how to obtain a time-limited Bearer Token for API authentication using curl. It shows requests for both Bank and Organization credentials, including the necessary parameters like grant type, client ID, client secret, and scope. ```shell # Example request when using Bank credentials curl -X POST https://id.production.cybrid.app/oauth/token -d '{ "grant_type": "client_credentials", "client_id": "", "client_secret": "", "scope": "banks:read banks:write bank_applications:execute accounts:read accounts:execute counterparties:read counterparties:pii:read counterparties:write counterparties:execute customers:read customers:pii:read customers:write customers:execute prices:read quotes:execute quotes:read trades:execute trades:read transfers:execute transfers:read transfers:write external_bank_accounts:read external_bank_accounts:pii:read external_bank_accounts:write external_bank_accounts:execute external_wallets:read external_wallets:execute workflows:read workflows:execute deposit_addresses:read deposit_addresses:execute deposit_bank_accounts:read deposit_bank_accounts:execute invoices:read invoices:write invoices:execute identity_verifications:read identity_verifications:pii:read identity_verifications:write identity_verifications:execute persona_sessions:execute files:read files:pii:read files:execute" }' -H "Content-Type: application/json" # When using Organization credentials set `scope` to 'organizations:read organizations:write organization_applications:execute banks:read banks:write banks:execute bank_applications:execute users:read users:write users:execute counterparties:read counterparties:pii:read customers:read customers:pii:read accounts:read prices:read quotes:execute quotes:read trades:execute trades:read transfers:read transfers:write transfers:execute external_bank_accounts:read external_bank_accounts:pii:read external_wallets:read workflows:read deposit_addresses:read deposit_bank_accounts:read invoices:read subscriptions:read subscriptions:write subscriptions:execute subscription_events:read subscription_events:execute identity_verifications:read identity_verifications:pii:read identity_verifications:execute persona_sessions:execute files:read files:pii:read files:execute' ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.