npm package: @oatfi/oatfi-sdk-ts
Description: Developer-friendly & type-safe Typescript SDK specifically catered to leverage *oat-fi-sdk* API.
Author: OatFi
Latest version: 0.11.67

# oat-fi-sdk

Developer-friendly & type-safe Typescript SDK specifically catered to leverage *oat-fi-sdk* API.

<div align="left">
    <a href="./LICENSE">
        <img src="https://img.shields.io/badge/License-Proprietary-red.svg" style="width: 100px; height: 28px;" />
    </a>
</div>


<br /><br />

<!-- Start Summary [summary] -->
## Summary

Oatfi API: Working Capital Infrastructure for B2B Payments
<!-- End Summary [summary] -->

<!-- Start Table of Contents [toc] -->
## Table of Contents
<!-- $toc-max-depth=2 -->
* [oat-fi-sdk](#oat-fi-sdk)
  * [SDK Installation](#sdk-installation)
  * [Requirements](#requirements)
  * [SDK Example Usage](#sdk-example-usage)
  * [Authentication](#authentication)
  * [Available Resources and Operations](#available-resources-and-operations)
  * [Standalone functions](#standalone-functions)
  * [Pagination](#pagination)
  * [File uploads](#file-uploads)
  * [Retries](#retries)
  * [Error Handling](#error-handling)
  * [Server Selection](#server-selection)
  * [Custom HTTP Client](#custom-http-client)
  * [Debugging](#debugging)
* [Development](#development)
  * [Maturity](#maturity)
  * [License](#license)
  * [Contributions](#contributions)

<!-- End Table of Contents [toc] -->

<!-- Start SDK Installation [installation] -->
## SDK Installation

The SDK can be installed with either [npm](https://www.npmjs.com/), [pnpm](https://pnpm.io/), [bun](https://bun.sh/) or [yarn](https://classic.yarnpkg.com/en/) package managers.

### NPM

```bash
npm add @oatfi/oatfi-sdk-ts
```

### PNPM

```bash
pnpm add @oatfi/oatfi-sdk-ts
```

### Bun

```bash
bun add @oatfi/oatfi-sdk-ts
```

### Yarn

```bash
yarn add @oatfi/oatfi-sdk-ts
```

> [!NOTE]
> This package is published with CommonJS and ES Modules (ESM) support.
<!-- End SDK Installation [installation] -->

<!-- Start Requirements [requirements] -->
## Requirements

For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).
<!-- End Requirements [requirements] -->

## SDK Example Usage

### Example

```typescript
import { OatFiSDK } from "@oatfi/oatfi-sdk-ts";

const oatFiSDK = await OatFiSDK.initialize({
  apiKey: config.apiKey
});

async function run() {
  const result = await oatFiSDK.businesses.list({ limit: 20 });

  console.log(result);
}

run();

```
<!-- No SDK Example Usage [usage] -->

## Authentication

### Per-Client Security Schemes

This SDK supports the following security scheme globally:

| Name     | Type | Scheme      | Environment Variable |
| -------- | ---- | ----------- | -------------------- |
| `bearer` | http | HTTP Bearer | `OATFISDK_BEARER`    |

To authenticate with the API the `bearer` parameter must be set when initializing the SDK client instance. For example:
```typescript
import { OatFiSDK } from "@oatfi/oatfi-sdk-ts";

const oatFiSDK = await OatFiSDK.initialize({
  apiKey: config.apiKey
});

async function run() {
  const result = await oatFiSDK.applications.create({
    idempotencyKey: "<value>",
    createApplicationDto: {
      platform: "<value>",
      businessInformation: {
        name: "Acme Corp",
        externalId: "biz_123abc",
        dbaName: "Acme Innovations",
        taxId: "123456789",
        businessEntityType: "corporation",
        stateOfIncorporation: "CA",
        dateEstablished: "2020-01-15",
        physicalAddress: {
          line1: "123 Main St",
          line2: "Apt 4B",
          city: "San Francisco",
          state: "CA",
          postalCode: "94107",
        },
        contactPhone: "555-123-4567",
        contactEmail: "contact@acme.com",
        industryType: "541511",
        businessDescription: "Software development services",
        websiteUrl: "https://acme.com",
        mailingAddress: {
          line1: "123 Main St",
          line2: "Apt 4B",
          city: "San Francisco",
          state: "CA",
          postalCode: "94107",
        },
      },
      personsInformation: [
        {
          externalId: "person_ext_123",
          firstName: "John",
          lastName: "Doe",
          title: "CEO",
          email: "john.doe@example.com",
          phone: "555-0101",
          dateOfBirth: "1985-07-22",
          address: {
            line1: "123 Main St",
            line2: "Apt 4B",
            city: "San Francisco",
            state: "CA",
            postalCode: "94107",
          },
          relationshipToBusiness: "Owner",
          isControlPerson: false,
          ownershipPercentage: 25,
          kycStatus: "NOT_STARTED",
          ssn: "123-45-6789",
        },
      ],
      expectedUsage: {
        expectedMonthlyPaymentsVolumeRange: "100,001-500,000",
        operationalCountries: [
          "US",
          "CA",
        ],
        customerTypes: [
          "B2C",
          "B2B",
        ],
        fundsTransferCountries: [
          "US",
          "MX",
        ],
        restrictedActivities: {},
      },
    },
  });

  console.log(result);
}

run();

```
<!-- No Authentication [security] -->

<!-- Start Available Resources and Operations [operations] -->
## Available Resources and Operations

<details open>
<summary>Available methods</summary>

### [ApplicationFiles](docs/sdks/applicationfiles/README.md)

* [upload](docs/sdks/applicationfiles/README.md#upload) - Upload files for a specific application
* [list](docs/sdks/applicationfiles/README.md#list) - List files for a specific application
* [get](docs/sdks/applicationfiles/README.md#get) - Get a file by ID for a specific application
* [update](docs/sdks/applicationfiles/README.md#update) - Update a file for a specific application
* [delete](docs/sdks/applicationfiles/README.md#delete) - Delete a file for a specific application
* [download](docs/sdks/applicationfiles/README.md#download) - Download a file for a specific application

### [Applications](docs/sdks/applications/README.md)

* [create](docs/sdks/applications/README.md#create) - Create a new application
* [list](docs/sdks/applications/README.md#list) - List all applications
* [get](docs/sdks/applications/README.md#get) - Retrieve an application by ID
* [update](docs/sdks/applications/README.md#update) - Update an application by ID
* [submit](docs/sdks/applications/README.md#submit) - Submit application for processing
* [approve](docs/sdks/applications/README.md#approve) - Approve application directly
* [getTransactionsReportUrl](docs/sdks/applications/README.md#gettransactionsreporturl) - Get transactions report URL for an application

### [Authentication](docs/sdks/authentication/README.md)

* [token](docs/sdks/authentication/README.md#token) - Login with API Key
* [forgotPassword](docs/sdks/authentication/README.md#forgotpassword) - Request password reset email
* [resetPassword](docs/sdks/authentication/README.md#resetpassword) - Reset password using token
* [changePassword](docs/sdks/authentication/README.md#changepassword) - Change password (authenticated users only)
* [getProfile](docs/sdks/authentication/README.md#getprofile) - Get authenticated user profile
* [refresh](docs/sdks/authentication/README.md#refresh) - Refresh access token

### [BillingCycleConfigs](docs/sdks/billingcycleconfigs/README.md)

* [create](docs/sdks/billingcycleconfigs/README.md#create) - Create a billing cycle config
* [get](docs/sdks/billingcycleconfigs/README.md#get) - Get a billing cycle config by ID
* [update](docs/sdks/billingcycleconfigs/README.md#update) - Update a billing cycle config

### [BillingCycles](docs/sdks/billingcycles/README.md)

* [list](docs/sdks/billingcycles/README.md#list) - List billing cycles for a business
* [get](docs/sdks/billingcycles/README.md#get) - Get a specific billing cycle by ID

### [Businesses](docs/sdks/businesses/README.md)

* [create](docs/sdks/businesses/README.md#create) - Create a new business
* [list](docs/sdks/businesses/README.md#list) - List businesses
* [createBulk](docs/sdks/businesses/README.md#createbulk) - Create multiple businesses
* [search](docs/sdks/businesses/README.md#search) - Search businesses
* [get](docs/sdks/businesses/README.md#get) - Retrieve a business by ID
* [update](docs/sdks/businesses/README.md#update) - Update a business by ID
* [delete](docs/sdks/businesses/README.md#delete) - Delete a business by ID
* [startUnderwriting](docs/sdks/businesses/README.md#startunderwriting) - Start underwriting process for a business
* [getUnderwritingStatus](docs/sdks/businesses/README.md#getunderwritingstatus) - Get underwriting status for a business
* [getBalance](docs/sdks/businesses/README.md#getbalance) - Get business balance across all programs
* [businessesControllerGetBusinessBalance](docs/sdks/businesses/README.md#businessescontrollergetbusinessbalance) - Get business balance for a specific program
* [getAccountStatements](docs/sdks/businesses/README.md#getaccountstatements) - Get account statements for a business
* [getAccountStatement](docs/sdks/businesses/README.md#getaccountstatement) - Get account statement for a business
* [getVirtualAccountInformation](docs/sdks/businesses/README.md#getvirtualaccountinformation) - Retrieve virtual account information
* [getAccountHolderInformation](docs/sdks/businesses/README.md#getaccountholderinformation) - Retrieve account holder information
* [submitSupplementalData](docs/sdks/businesses/README.md#submitsupplementaldata) - Submit supplemental data for a business

### [BusinessFiles](docs/sdks/businessfiles/README.md)

* [upload](docs/sdks/businessfiles/README.md#upload) - Upload files for a specific business
* [list](docs/sdks/businessfiles/README.md#list) - List files for a specific business
* [get](docs/sdks/businessfiles/README.md#get) - Get a file by ID for a specific business
* [update](docs/sdks/businessfiles/README.md#update) - Update a file for a specific business
* [delete](docs/sdks/businessfiles/README.md#delete) - Delete a file for a specific business
* [download](docs/sdks/businessfiles/README.md#download) - Download a file for a specific business

### [BusinessFinancialAccounts](docs/sdks/businessfinancialaccounts/README.md)

* [create](docs/sdks/businessfinancialaccounts/README.md#create) - Create a new financial account for a business
* [list](docs/sdks/businessfinancialaccounts/README.md#list) - List all financial accounts for a business
* [get](docs/sdks/businessfinancialaccounts/README.md#get) - Get a financial account by ID for a business
* [update](docs/sdks/businessfinancialaccounts/README.md#update) - Update a financial account for a business
* [delete](docs/sdks/businessfinancialaccounts/README.md#delete) - Delete a financial account by ID for a business

### [BusinessHolds](docs/sdks/businessholds/README.md)

* [create](docs/sdks/businessholds/README.md#create) - Create a hold for a business
* [list](docs/sdks/businessholds/README.md#list) - List holds for a business
* [get](docs/sdks/businessholds/README.md#get) - Get a hold by ID for a business
* [update](docs/sdks/businessholds/README.md#update) - Update a hold for a business
* [release](docs/sdks/businessholds/README.md#release) - Release a hold by ID for a business

### [BusinessPersons](docs/sdks/businesspersons/README.md)

* [create](docs/sdks/businesspersons/README.md#create) - Create a new person for a business
* [list](docs/sdks/businesspersons/README.md#list) - List all persons for a business
* [get](docs/sdks/businesspersons/README.md#get) - Get a person by ID for a business
* [update](docs/sdks/businesspersons/README.md#update) - Update a person for a business
* [delete](docs/sdks/businesspersons/README.md#delete) - Delete a person by ID for a business

### [BusinessPlaidTokens](docs/sdks/businessplaidtokens/README.md)

* [create](docs/sdks/businessplaidtokens/README.md#create) - Create a new Plaid token for a business
* [list](docs/sdks/businessplaidtokens/README.md#list) - List all Plaid tokens for a business
* [getLinkToken](docs/sdks/businessplaidtokens/README.md#getlinktoken) - Get Plaid link token for a business
* [exchangeToken](docs/sdks/businessplaidtokens/README.md#exchangetoken) - Exchange Plaid public token for access token
* [get](docs/sdks/businessplaidtokens/README.md#get) - Get a Plaid token by ID for a business
* [update](docs/sdks/businessplaidtokens/README.md#update) - Update a Plaid token for a business
* [delete](docs/sdks/businessplaidtokens/README.md#delete) - Delete a Plaid token by ID for a business

### [DailyReports](docs/sdks/dailyreports/README.md)

* [create](docs/sdks/dailyreports/README.md#create) - Create a daily report
* [list](docs/sdks/dailyreports/README.md#list) - List daily reports
* [get](docs/sdks/dailyreports/README.md#get) - Retrieve a daily report by ID
* [update](docs/sdks/dailyreports/README.md#update) - Update a daily report

### [Embed](docs/sdks/embed/README.md)

* [exchangeToken](docs/sdks/embed/README.md#exchangetoken) - Exchange a standard partner token for a short-lived embed token
* [refreshToken](docs/sdks/embed/README.md#refreshtoken) - Refresh an embed token

### [Files](docs/sdks/files/README.md)

* [upload](docs/sdks/files/README.md#upload) - Upload files for any resource
* [list](docs/sdks/files/README.md#list) - List files with filtering
* [get](docs/sdks/files/README.md#get) - Get a file by ID
* [update](docs/sdks/files/README.md#update) - Update a file
* [delete](docs/sdks/files/README.md#delete) - Delete a file
* [download](docs/sdks/files/README.md#download) - Download a file

### [FinancialAccounts](docs/sdks/financialaccounts/README.md)

* [list](docs/sdks/financialaccounts/README.md#list) - List all financial accounts
* [get](docs/sdks/financialaccounts/README.md#get) - Get a financial account by ID
* [update](docs/sdks/financialaccounts/README.md#update) - Update a financial account
* [delete](docs/sdks/financialaccounts/README.md#delete) - Delete a financial account by ID

### [Holds](docs/sdks/holds/README.md)

* [get](docs/sdks/holds/README.md#get) - Get a hold by ID
* [update](docs/sdks/holds/README.md#update) - Update a hold
* [release](docs/sdks/holds/README.md#release) - Release a hold by ID

### [IncreaseTransactions](docs/sdks/increasetransactions/README.md)

* [list](docs/sdks/increasetransactions/README.md#list) - List increase transactions

### [InternalProgramSettings](docs/sdks/internalprogramsettings/README.md)

* [get](docs/sdks/internalprogramsettings/README.md#get) - Get program settings

### [OnboardingTerms](docs/sdks/onboardingterms/README.md)

* [create](docs/sdks/onboardingterms/README.md#create) - Create a new onboarding terms acceptance record
* [getAll](docs/sdks/onboardingterms/README.md#getall) - Get onboarding terms acceptance records

### [Originations](docs/sdks/originations/README.md)

* [createOffer](docs/sdks/originations/README.md#createoffer) - Request an origination offer
* [accept](docs/sdks/originations/README.md#accept) - Accept an origination offer
* [list](docs/sdks/originations/README.md#list) - List originations
* [search](docs/sdks/originations/README.md#search) - Search originations
* [getBalance](docs/sdks/originations/README.md#getbalance) - Get origination balance
* [cancelOrigination](docs/sdks/originations/README.md#cancelorigination) - Cancel an origination
* [updateOrigination](docs/sdks/originations/README.md#updateorigination) - Update an origination
* [getById](docs/sdks/originations/README.md#getbyid) - Retrieve an origination by ID
* [simulateOrigination](docs/sdks/originations/README.md#simulateorigination) - Simulate origination on a specific date
* [getInstallments](docs/sdks/originations/README.md#getinstallments) - Get origination with installments

### [PaymentIntents](docs/sdks/paymentintents/README.md)

* [create](docs/sdks/paymentintents/README.md#create) - Create a new Payment Intent
* [getAll](docs/sdks/paymentintents/README.md#getall) - List all Payment Intents
* [createBulk](docs/sdks/paymentintents/README.md#createbulk) - Create multiple Payment Intents in bulk
* [search](docs/sdks/paymentintents/README.md#search) - Search for Payment Intents
* [get](docs/sdks/paymentintents/README.md#get) - Retrieve a Payment Intent by ID
* [update](docs/sdks/paymentintents/README.md#update) - Update a Payment Intent by ID
* [delete](docs/sdks/paymentintents/README.md#delete) - Delete a Payment Intent by ID
* [getBalance](docs/sdks/paymentintents/README.md#getbalance) - Get Payment Intent Balance
* [getBalanceByProgram](docs/sdks/paymentintents/README.md#getbalancebyprogram) - Get Payment Intent Balance by Program

### [Payments](docs/sdks/payments/README.md)

* [create](docs/sdks/payments/README.md#create) - Create a new payment
* [get](docs/sdks/payments/README.md#get) - Get a payment by ID
* [update](docs/sdks/payments/README.md#update) - Update a payment by ID

### [Persons](docs/sdks/persons/README.md)

* [create](docs/sdks/persons/README.md#create) - Create a new person
* [list](docs/sdks/persons/README.md#list) - List all persons
* [search](docs/sdks/persons/README.md#search) - Search persons
* [get](docs/sdks/persons/README.md#get) - Get a person by ID
* [update](docs/sdks/persons/README.md#update) - Update a person
* [delete](docs/sdks/persons/README.md#delete) - Delete a person by ID

### [PlaidTokens](docs/sdks/plaidtokens/README.md)

* [getById](docs/sdks/plaidtokens/README.md#getbyid) - Get a Plaid token by ID
* [update](docs/sdks/plaidtokens/README.md#update) - Update a Plaid token
* [delete](docs/sdks/plaidtokens/README.md#delete) - Delete a Plaid token by ID

### [PlatformApiKeys](docs/sdks/platformapikeys/README.md)

* [create](docs/sdks/platformapikeys/README.md#create) - Create API keys for a platform
* [list](docs/sdks/platformapikeys/README.md#list) - Get API keys by platform ID
* [get](docs/sdks/platformapikeys/README.md#get) - Get API key by ID for a platform
* [delete](docs/sdks/platformapikeys/README.md#delete) - Delete API key
* [getByEnvironment](docs/sdks/platformapikeys/README.md#getbyenvironment) - Get API keys for specific environment
* [rotate](docs/sdks/platformapikeys/README.md#rotate) - Rotate API keys for specific environment
* [regenerate](docs/sdks/platformapikeys/README.md#regenerate) - Regenerate API keys for specific environment
* [updateViewDate](docs/sdks/platformapikeys/README.md#updateviewdate) - Update API key view date for specific environment

### [PlatformComponents](docs/sdks/platformcomponents/README.md)

* [get](docs/sdks/platformcomponents/README.md#get) - Get platform components

### [PlatformFinancialAccounts](docs/sdks/platformfinancialaccounts/README.md)

* [create](docs/sdks/platformfinancialaccounts/README.md#create) - Create a new financial account for a platform
* [list](docs/sdks/platformfinancialaccounts/README.md#list) - List all financial accounts for a platform
* [get](docs/sdks/platformfinancialaccounts/README.md#get) - Get a financial account by ID for a platform
* [update](docs/sdks/platformfinancialaccounts/README.md#update) - Update a financial account for a platform
* [delete](docs/sdks/platformfinancialaccounts/README.md#delete) - Delete a financial account by ID for a platform

### [Platforms](docs/sdks/platforms/README.md)

* [create](docs/sdks/platforms/README.md#create) - Create a new platform
* [list](docs/sdks/platforms/README.md#list) - List all platforms
* [search](docs/sdks/platforms/README.md#search) - Search platforms
* [get](docs/sdks/platforms/README.md#get) - Get a platform by ID
* [getScopes](docs/sdks/platforms/README.md#getscopes) - Get a platform's assigned scopes
* [updateScopes](docs/sdks/platforms/README.md#updatescopes) - Update a platform's assigned scopes

### [PlatformSettings](docs/sdks/platformsettings/README.md)

* [create](docs/sdks/platformsettings/README.md#create) - Create platform settings
* [getOne](docs/sdks/platformsettings/README.md#getone) - Get platform settings
* [update](docs/sdks/platformsettings/README.md#update) - Update platform settings

### [Programs](docs/sdks/programs/README.md)

* [create](docs/sdks/programs/README.md#create) - Create a new program
* [list](docs/sdks/programs/README.md#list) - List all programs
* [get](docs/sdks/programs/README.md#get) - Get a program by ID
* [update](docs/sdks/programs/README.md#update) - Update a program
* [delete](docs/sdks/programs/README.md#delete) - Delete a program

### [ProgramSettings](docs/sdks/programsettings/README.md)

* [create](docs/sdks/programsettings/README.md#create) - Create a new program setting
* [list](docs/sdks/programsettings/README.md#list) - List all settings for a program
* [get](docs/sdks/programsettings/README.md#get) - Get a specific program setting
* [update](docs/sdks/programsettings/README.md#update) - Update a program setting
* [delete](docs/sdks/programsettings/README.md#delete) - Delete a program setting
* [activate](docs/sdks/programsettings/README.md#activate) - Activate a program setting
* [deactivate](docs/sdks/programsettings/README.md#deactivate) - Deactivate a program setting

### [UnderwritingTerms](docs/sdks/underwritingterms/README.md)

* [getHtml](docs/sdks/underwritingterms/README.md#gethtml) - Get underwriting terms HTML

### [Users](docs/sdks/users/README.md)

* [upsertBulk](docs/sdks/users/README.md#upsertbulk) - Bulk upsert users
* [list](docs/sdks/users/README.md#list) - List all users
* [get](docs/sdks/users/README.md#get) - Get a user by ID

</details>
<!-- End Available Resources and Operations [operations] -->

<!-- Start Standalone functions [standalone-funcs] -->
## Standalone functions

All the methods listed above are available as standalone functions. These
functions are ideal for use in applications running in the browser, serverless
runtimes or other environments where application bundle size is a primary
concern. When using a bundler to build your application, all unused
functionality will be either excluded from the final bundle or tree-shaken away.

To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).

<details>

<summary>Available standalone functions</summary>

- [`applicationFilesDelete`](docs/sdks/applicationfiles/README.md#delete) - Delete a file for a specific application
- [`applicationFilesDownload`](docs/sdks/applicationfiles/README.md#download) - Download a file for a specific application
- [`applicationFilesGet`](docs/sdks/applicationfiles/README.md#get) - Get a file by ID for a specific application
- [`applicationFilesList`](docs/sdks/applicationfiles/README.md#list) - List files for a specific application
- [`applicationFilesUpdate`](docs/sdks/applicationfiles/README.md#update) - Update a file for a specific application
- [`applicationFilesUpload`](docs/sdks/applicationfiles/README.md#upload) - Upload files for a specific application
- [`applicationsApprove`](docs/sdks/applications/README.md#approve) - Approve application directly
- [`applicationsCreate`](docs/sdks/applications/README.md#create) - Create a new application
- [`applicationsGet`](docs/sdks/applications/README.md#get) - Retrieve an application by ID
- [`applicationsGetTransactionsReportUrl`](docs/sdks/applications/README.md#gettransactionsreporturl) - Get transactions report URL for an application
- [`applicationsList`](docs/sdks/applications/README.md#list) - List all applications
- [`applicationsSubmit`](docs/sdks/applications/README.md#submit) - Submit application for processing
- [`applicationsUpdate`](docs/sdks/applications/README.md#update) - Update an application by ID
- [`authenticationChangePassword`](docs/sdks/authentication/README.md#changepassword) - Change password (authenticated users only)
- [`authenticationForgotPassword`](docs/sdks/authentication/README.md#forgotpassword) - Request password reset email
- [`authenticationGetProfile`](docs/sdks/authentication/README.md#getprofile) - Get authenticated user profile
- [`authenticationRefresh`](docs/sdks/authentication/README.md#refresh) - Refresh access token
- [`authenticationResetPassword`](docs/sdks/authentication/README.md#resetpassword) - Reset password using token
- [`authenticationToken`](docs/sdks/authentication/README.md#token) - Login with API Key
- [`billingCycleConfigsCreate`](docs/sdks/billingcycleconfigs/README.md#create) - Create a billing cycle config
- [`billingCycleConfigsGet`](docs/sdks/billingcycleconfigs/README.md#get) - Get a billing cycle config by ID
- [`billingCycleConfigsUpdate`](docs/sdks/billingcycleconfigs/README.md#update) - Update a billing cycle config
- [`billingCyclesGet`](docs/sdks/billingcycles/README.md#get) - Get a specific billing cycle by ID
- [`billingCyclesList`](docs/sdks/billingcycles/README.md#list) - List billing cycles for a business
- [`businessesBusinessesControllerGetBusinessBalance`](docs/sdks/businesses/README.md#businessescontrollergetbusinessbalance) - Get business balance for a specific program
- [`businessesCreate`](docs/sdks/businesses/README.md#create) - Create a new business
- [`businessesCreateBulk`](docs/sdks/businesses/README.md#createbulk) - Create multiple businesses
- [`businessesDelete`](docs/sdks/businesses/README.md#delete) - Delete a business by ID
- [`businessesGet`](docs/sdks/businesses/README.md#get) - Retrieve a business by ID
- [`businessesGetAccountHolderInformation`](docs/sdks/businesses/README.md#getaccountholderinformation) - Retrieve account holder information
- [`businessesGetAccountStatement`](docs/sdks/businesses/README.md#getaccountstatement) - Get account statement for a business
- [`businessesGetAccountStatements`](docs/sdks/businesses/README.md#getaccountstatements) - Get account statements for a business
- [`businessesGetBalance`](docs/sdks/businesses/README.md#getbalance) - Get business balance across all programs
- [`businessesGetUnderwritingStatus`](docs/sdks/businesses/README.md#getunderwritingstatus) - Get underwriting status for a business
- [`businessesGetVirtualAccountInformation`](docs/sdks/businesses/README.md#getvirtualaccountinformation) - Retrieve virtual account information
- [`businessesList`](docs/sdks/businesses/README.md#list) - List businesses
- [`businessesSearch`](docs/sdks/businesses/README.md#search) - Search businesses
- [`businessesStartUnderwriting`](docs/sdks/businesses/README.md#startunderwriting) - Start underwriting process for a business
- [`businessesSubmitSupplementalData`](docs/sdks/businesses/README.md#submitsupplementaldata) - Submit supplemental data for a business
- [`businessesUpdate`](docs/sdks/businesses/README.md#update) - Update a business by ID
- [`businessFilesDelete`](docs/sdks/businessfiles/README.md#delete) - Delete a file for a specific business
- [`businessFilesDownload`](docs/sdks/businessfiles/README.md#download) - Download a file for a specific business
- [`businessFilesGet`](docs/sdks/businessfiles/README.md#get) - Get a file by ID for a specific business
- [`businessFilesList`](docs/sdks/businessfiles/README.md#list) - List files for a specific business
- [`businessFilesUpdate`](docs/sdks/businessfiles/README.md#update) - Update a file for a specific business
- [`businessFilesUpload`](docs/sdks/businessfiles/README.md#upload) - Upload files for a specific business
- [`businessFinancialAccountsCreate`](docs/sdks/businessfinancialaccounts/README.md#create) - Create a new financial account for a business
- [`businessFinancialAccountsDelete`](docs/sdks/businessfinancialaccounts/README.md#delete) - Delete a financial account by ID for a business
- [`businessFinancialAccountsGet`](docs/sdks/businessfinancialaccounts/README.md#get) - Get a financial account by ID for a business
- [`businessFinancialAccountsList`](docs/sdks/businessfinancialaccounts/README.md#list) - List all financial accounts for a business
- [`businessFinancialAccountsUpdate`](docs/sdks/businessfinancialaccounts/README.md#update) - Update a financial account for a business
- [`businessHoldsCreate`](docs/sdks/businessholds/README.md#create) - Create a hold for a business
- [`businessHoldsGet`](docs/sdks/businessholds/README.md#get) - Get a hold by ID for a business
- [`businessHoldsList`](docs/sdks/businessholds/README.md#list) - List holds for a business
- [`businessHoldsRelease`](docs/sdks/businessholds/README.md#release) - Release a hold by ID for a business
- [`businessHoldsUpdate`](docs/sdks/businessholds/README.md#update) - Update a hold for a business
- [`businessPersonsCreate`](docs/sdks/businesspersons/README.md#create) - Create a new person for a business
- [`businessPersonsDelete`](docs/sdks/businesspersons/README.md#delete) - Delete a person by ID for a business
- [`businessPersonsGet`](docs/sdks/businesspersons/README.md#get) - Get a person by ID for a business
- [`businessPersonsList`](docs/sdks/businesspersons/README.md#list) - List all persons for a business
- [`businessPersonsUpdate`](docs/sdks/businesspersons/README.md#update) - Update a person for a business
- [`businessPlaidTokensCreate`](docs/sdks/businessplaidtokens/README.md#create) - Create a new Plaid token for a business
- [`businessPlaidTokensDelete`](docs/sdks/businessplaidtokens/README.md#delete) - Delete a Plaid token by ID for a business
- [`businessPlaidTokensExchangeToken`](docs/sdks/businessplaidtokens/README.md#exchangetoken) - Exchange Plaid public token for access token
- [`businessPlaidTokensGet`](docs/sdks/businessplaidtokens/README.md#get) - Get a Plaid token by ID for a business
- [`businessPlaidTokensGetLinkToken`](docs/sdks/businessplaidtokens/README.md#getlinktoken) - Get Plaid link token for a business
- [`businessPlaidTokensList`](docs/sdks/businessplaidtokens/README.md#list) - List all Plaid tokens for a business
- [`businessPlaidTokensUpdate`](docs/sdks/businessplaidtokens/README.md#update) - Update a Plaid token for a business
- [`dailyReportsCreate`](docs/sdks/dailyreports/README.md#create) - Create a daily report
- [`dailyReportsGet`](docs/sdks/dailyreports/README.md#get) - Retrieve a daily report by ID
- [`dailyReportsList`](docs/sdks/dailyreports/README.md#list) - List daily reports
- [`dailyReportsUpdate`](docs/sdks/dailyreports/README.md#update) - Update a daily report
- [`embedExchangeToken`](docs/sdks/embed/README.md#exchangetoken) - Exchange a standard partner token for a short-lived embed token
- [`embedRefreshToken`](docs/sdks/embed/README.md#refreshtoken) - Refresh an embed token
- [`filesDelete`](docs/sdks/files/README.md#delete) - Delete a file
- [`filesDownload`](docs/sdks/files/README.md#download) - Download a file
- [`filesGet`](docs/sdks/files/README.md#get) - Get a file by ID
- [`filesList`](docs/sdks/files/README.md#list) - List files with filtering
- [`filesUpdate`](docs/sdks/files/README.md#update) - Update a file
- [`filesUpload`](docs/sdks/files/README.md#upload) - Upload files for any resource
- [`financialAccountsDelete`](docs/sdks/financialaccounts/README.md#delete) - Delete a financial account by ID
- [`financialAccountsGet`](docs/sdks/financialaccounts/README.md#get) - Get a financial account by ID
- [`financialAccountsList`](docs/sdks/financialaccounts/README.md#list) - List all financial accounts
- [`financialAccountsUpdate`](docs/sdks/financialaccounts/README.md#update) - Update a financial account
- [`holdsGet`](docs/sdks/holds/README.md#get) - Get a hold by ID
- [`holdsRelease`](docs/sdks/holds/README.md#release) - Release a hold by ID
- [`holdsUpdate`](docs/sdks/holds/README.md#update) - Update a hold
- [`increaseTransactionsList`](docs/sdks/increasetransactions/README.md#list) - List increase transactions
- [`internalProgramSettingsGet`](docs/sdks/internalprogramsettings/README.md#get) - Get program settings
- [`onboardingTermsCreate`](docs/sdks/onboardingterms/README.md#create) - Create a new onboarding terms acceptance record
- [`onboardingTermsGetAll`](docs/sdks/onboardingterms/README.md#getall) - Get onboarding terms acceptance records
- [`originationsAccept`](docs/sdks/originations/README.md#accept) - Accept an origination offer
- [`originationsCancelOrigination`](docs/sdks/originations/README.md#cancelorigination) - Cancel an origination
- [`originationsCreateOffer`](docs/sdks/originations/README.md#createoffer) - Request an origination offer
- [`originationsGetBalance`](docs/sdks/originations/README.md#getbalance) - Get origination balance
- [`originationsGetById`](docs/sdks/originations/README.md#getbyid) - Retrieve an origination by ID
- [`originationsGetInstallments`](docs/sdks/originations/README.md#getinstallments) - Get origination with installments
- [`originationsList`](docs/sdks/originations/README.md#list) - List originations
- [`originationsSearch`](docs/sdks/originations/README.md#search) - Search originations
- [`originationsSimulateOrigination`](docs/sdks/originations/README.md#simulateorigination) - Simulate origination on a specific date
- [`originationsUpdateOrigination`](docs/sdks/originations/README.md#updateorigination) - Update an origination
- [`paymentIntentsCreate`](docs/sdks/paymentintents/README.md#create) - Create a new Payment Intent
- [`paymentIntentsCreateBulk`](docs/sdks/paymentintents/README.md#createbulk) - Create multiple Payment Intents in bulk
- [`paymentIntentsDelete`](docs/sdks/paymentintents/README.md#delete) - Delete a Payment Intent by ID
- [`paymentIntentsGet`](docs/sdks/paymentintents/README.md#get) - Retrieve a Payment Intent by ID
- [`paymentIntentsGetAll`](docs/sdks/paymentintents/README.md#getall) - List all Payment Intents
- [`paymentIntentsGetBalance`](docs/sdks/paymentintents/README.md#getbalance) - Get Payment Intent Balance
- [`paymentIntentsGetBalanceByProgram`](docs/sdks/paymentintents/README.md#getbalancebyprogram) - Get Payment Intent Balance by Program
- [`paymentIntentsSearch`](docs/sdks/paymentintents/README.md#search) - Search for Payment Intents
- [`paymentIntentsUpdate`](docs/sdks/paymentintents/README.md#update) - Update a Payment Intent by ID
- [`paymentsCreate`](docs/sdks/payments/README.md#create) - Create a new payment
- [`paymentsGet`](docs/sdks/payments/README.md#get) - Get a payment by ID
- [`paymentsUpdate`](docs/sdks/payments/README.md#update) - Update a payment by ID
- [`personsCreate`](docs/sdks/persons/README.md#create) - Create a new person
- [`personsDelete`](docs/sdks/persons/README.md#delete) - Delete a person by ID
- [`personsGet`](docs/sdks/persons/README.md#get) - Get a person by ID
- [`personsList`](docs/sdks/persons/README.md#list) - List all persons
- [`personsSearch`](docs/sdks/persons/README.md#search) - Search persons
- [`personsUpdate`](docs/sdks/persons/README.md#update) - Update a person
- [`plaidTokensDelete`](docs/sdks/plaidtokens/README.md#delete) - Delete a Plaid token by ID
- [`plaidTokensGetById`](docs/sdks/plaidtokens/README.md#getbyid) - Get a Plaid token by ID
- [`plaidTokensUpdate`](docs/sdks/plaidtokens/README.md#update) - Update a Plaid token
- [`platformApiKeysCreate`](docs/sdks/platformapikeys/README.md#create) - Create API keys for a platform
- [`platformApiKeysDelete`](docs/sdks/platformapikeys/README.md#delete) - Delete API key
- [`platformApiKeysGet`](docs/sdks/platformapikeys/README.md#get) - Get API key by ID for a platform
- [`platformApiKeysGetByEnvironment`](docs/sdks/platformapikeys/README.md#getbyenvironment) - Get API keys for specific environment
- [`platformApiKeysList`](docs/sdks/platformapikeys/README.md#list) - Get API keys by platform ID
- [`platformApiKeysRegenerate`](docs/sdks/platformapikeys/README.md#regenerate) - Regenerate API keys for specific environment
- [`platformApiKeysRotate`](docs/sdks/platformapikeys/README.md#rotate) - Rotate API keys for specific environment
- [`platformApiKeysUpdateViewDate`](docs/sdks/platformapikeys/README.md#updateviewdate) - Update API key view date for specific environment
- [`platformComponentsGet`](docs/sdks/platformcomponents/README.md#get) - Get platform components
- [`platformFinancialAccountsCreate`](docs/sdks/platformfinancialaccounts/README.md#create) - Create a new financial account for a platform
- [`platformFinancialAccountsDelete`](docs/sdks/platformfinancialaccounts/README.md#delete) - Delete a financial account by ID for a platform
- [`platformFinancialAccountsGet`](docs/sdks/platformfinancialaccounts/README.md#get) - Get a financial account by ID for a platform
- [`platformFinancialAccountsList`](docs/sdks/platformfinancialaccounts/README.md#list) - List all financial accounts for a platform
- [`platformFinancialAccountsUpdate`](docs/sdks/platformfinancialaccounts/README.md#update) - Update a financial account for a platform
- [`platformsCreate`](docs/sdks/platforms/README.md#create) - Create a new platform
- [`platformSettingsCreate`](docs/sdks/platformsettings/README.md#create) - Create platform settings
- [`platformSettingsGetOne`](docs/sdks/platformsettings/README.md#getone) - Get platform settings
- [`platformSettingsUpdate`](docs/sdks/platformsettings/README.md#update) - Update platform settings
- [`platformsGet`](docs/sdks/platforms/README.md#get) - Get a platform by ID
- [`platformsGetScopes`](docs/sdks/platforms/README.md#getscopes) - Get a platform's assigned scopes
- [`platformsList`](docs/sdks/platforms/README.md#list) - List all platforms
- [`platformsSearch`](docs/sdks/platforms/README.md#search) - Search platforms
- [`platformsUpdateScopes`](docs/sdks/platforms/README.md#updatescopes) - Update a platform's assigned scopes
- [`programsCreate`](docs/sdks/programs/README.md#create) - Create a new program
- [`programsDelete`](docs/sdks/programs/README.md#delete) - Delete a program
- [`programSettingsActivate`](docs/sdks/programsettings/README.md#activate) - Activate a program setting
- [`programSettingsCreate`](docs/sdks/programsettings/README.md#create) - Create a new program setting
- [`programSettingsDeactivate`](docs/sdks/programsettings/README.md#deactivate) - Deactivate a program setting
- [`programSettingsDelete`](docs/sdks/programsettings/README.md#delete) - Delete a program setting
- [`programSettingsGet`](docs/sdks/programsettings/README.md#get) - Get a specific program setting
- [`programSettingsList`](docs/sdks/programsettings/README.md#list) - List all settings for a program
- [`programSettingsUpdate`](docs/sdks/programsettings/README.md#update) - Update a program setting
- [`programsGet`](docs/sdks/programs/README.md#get) - Get a program by ID
- [`programsList`](docs/sdks/programs/README.md#list) - List all programs
- [`programsUpdate`](docs/sdks/programs/README.md#update) - Update a program
- [`underwritingTermsGetHtml`](docs/sdks/underwritingterms/README.md#gethtml) - Get underwriting terms HTML
- [`usersGet`](docs/sdks/users/README.md#get) - Get a user by ID
- [`usersList`](docs/sdks/users/README.md#list) - List all users
- [`usersUpsertBulk`](docs/sdks/users/README.md#upsertbulk) - Bulk upsert users

</details>
<!-- End Standalone functions [standalone-funcs] -->

<!-- Start Pagination [pagination] -->
## Pagination

Some of the endpoints in this SDK support pagination. To use pagination, you
make your SDK calls as usual, but the returned response object will also be an
async iterable that can be consumed using the [`for await...of`][for-await-of]
syntax.

[for-await-of]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of

Here's an example of one such pagination call:

```typescript
import { OatFiSDK } from "@oatfi/oatfi-sdk-ts";

const oatFiSDK = new OatFiSDK({
  bearer: process.env["OATFISDK_BEARER"] ?? "",
});

async function run() {
  const result = await oatFiSDK.businesses.list();

  for await (const page of result) {
    console.log(page);
  }
}

run();

```
<!-- End Pagination [pagination] -->

<!-- Start File uploads [file-upload] -->
## File uploads

Certain SDK methods accept files as part of a multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request.

> [!TIP]
>
> Depending on your JavaScript runtime, there are convenient utilities that return a handle to a file without reading the entire contents into memory:
>
> - **Node.js v20+:** Since v20, Node.js comes with a native `openAsBlob` function in [`node:fs`](https://nodejs.org/docs/latest-v20.x/api/fs.html#fsopenasblobpath-options).
> - **Bun:** The native [`Bun.file`](https://bun.sh/docs/api/file-io#reading-files-bun-file) function produces a file handle that can be used for streaming file uploads.
> - **Browsers:** All supported browsers return an instance to a [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) when reading the value from an `<input type="file">` element.
> - **Node.js v18:** A file stream can be created using the `fileFrom` helper from [`fetch-blob/from.js`](https://www.npmjs.com/package/fetch-blob).

```typescript
import { OatFiSDK } from "@oatfi/oatfi-sdk-ts";

const oatFiSDK = new OatFiSDK({
  bearer: process.env["OATFISDK_BEARER"] ?? "",
});

async function run() {
  const result = await oatFiSDK.files.upload({
    idempotencyKey: "<value>",
    uploadFilesDto: {
      files: [],
      resourceType: "business",
      resourceId: "507f1f77bcf86cd799439012",
      fileType: "bank_statement",
      description: "January 2024 bank statement for business account",
      metadata: {
        "uploaded_by": "user123",
        "verification_status": "pending",
      },
    },
  });

  console.log(result);
}

run();

```
<!-- End File uploads [file-upload] -->

<!-- Start Retries [retries] -->
## Retries

Some of the endpoints in this SDK support retries.  If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API.  However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.

To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
```typescript
import { OatFiSDK } from "@oatfi/oatfi-sdk-ts";

const oatFiSDK = new OatFiSDK({
  bearer: process.env["OATFISDK_BEARER"] ?? "",
});

async function run() {
  const result = await oatFiSDK.businesses.create({
    idempotencyKey: "<value>",
    createBusinessDto: {
      externalId: "ext_123456",
      name: "Acme Corporation",
      dbaName: "Acme",
      taxId: "123456789",
      address: {
        line1: "123 Main St",
        line2: "Suite 100",
        city: "San Francisco",
        state: "CA",
        postalCode: "94105",
      },
      contactFirstName: "John",
      contactLastName: "Doe",
      contactEmail: "john.doe@acme.com",
      contactPhone: "+14155552671",
      businessStartDateMonth: "January",
      businessStartDateYear: "2020",
      businessEntityType: "LLC",
      application: "507f1f77bcf86cd799439011",
      users: [
        "507f1f77bcf86cd799439011",
        "507f1f77bcf86cd799439012",
      ],
      primaryUser: "507f1f77bcf86cd799439011",
      achToken: "ACH20c64a3d71cb-4400-8225-6d19918aa183",
      webhookUrl: "https://my.webhook.com/post",
      plaidToken: "20c64a3d-71cb-4400-8225-6d19918aa183",
      plaidTokens: [
        {
          alias: "Default Token",
          token: "access-sandbox-43bb37eb-954c-45e8-b0be-391b1d2c06fc",
        },
      ],
      heronId: "heron_123456",
      paymentSettings: [
        {
          partner: "62eaf2133147bd1b70da07d2",
          business: "62eaf2133147bd1b70da07d2",
          data: {
            accountId: "acct_1J876rQjaww8b42s",
            customerId: "cus_sdfsdfsd1J876rQjawghghw8b42s",
            paymentMethodId: "pm_ssej45jawghghw8b42s",
            accountNumber: "21565234545",
            routingNumber: "1572515454",
            directDebitAuthorization:
              "{\"authorized\": true, \"type\": \"PLAID\", \"account_id\": \"000123456789\", \"owner\": \"Business Owner\", \"created_at\": \"2023-01-01T00:00:00.000Z\"}",
            fundingSourceId:
              "H6U1rvcYcDybNwKykiyM28of0mPdOnh9yCJPIa5MJEdSRD5846",
            moovPaymentMethodId: "0ff91950-3333-4444-5555-b071f5550795",
            unitAccountId: "21565234545",
            swiftCode: "1572515454",
            remittanceInformation: "Payment for {year}-{month}-{day}",
            lockboxAddress: "123 Main St",
            accountNumberId: "account_number_i6kffj1pvwhmhi7okasb",
            oatfiAccountNumber: "21565234545",
            oatfiRoutingNumber: "21565234545",
          },
          scheduledRepayment: false,
          isDefault: true,
          type: "UNIT",
        },
      ],
      codatCompanyId: "20c64a3d-71cb-4400-8225-6d19918aa183",
      consumerInvoices: false,
      onboardingSource: "API",
      requestedLimitSource: "Customer",
      requestedCreditLimit: 10000,
      metadata: {
        mcNumber: "20c64a3d-71cb-4400-8225-6d19918aa183",
        avgMonthlySpend: "10000",
        orderProductSelection: "20c64a3d-71cb-4400-8225-6d19918aa183",
        requestedCreditLimit: 10000,
        plaidData: "{\"accounts\":[...],\"institution\":{...}}",
      },
    },
  }, {
    retries: {
      strategy: "backoff",
      backoff: {
        initialInterval: 1,
        maxInterval: 50,
        exponent: 1.1,
        maxElapsedTime: 100,
      },
      retryConnectionErrors: false,
    },
  });

  console.log(result);
}

run();

```

If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
```typescript
import { OatFiSDK } from "@oatfi/oatfi-sdk-ts";

const oatFiSDK = new OatFiSDK({
  retryConfig: {
    strategy: "backoff",
    backoff: {
      initialInterval: 1,
      maxInterval: 50,
      exponent: 1.1,
      maxElapsedTime: 100,
    },
    retryConnectionErrors: false,
  },
  bearer: process.env["OATFISDK_BEARER"] ?? "",
});

async function run() {
  const result = await oatFiSDK.businesses.create({
    idempotencyKey: "<value>",
    createBusinessDto: {
      externalId: "ext_123456",
      name: "Acme Corporation",
      dbaName: "Acme",
      taxId: "123456789",
      address: {
        line1: "123 Main St",
        line2: "Suite 100",
        city: "San Francisco",
        state: "CA",
        postalCode: "94105",
      },
      contactFirstName: "John",
      contactLastName: "Doe",
      contactEmail: "john.doe@acme.com",
      contactPhone: "+14155552671",
      businessStartDateMonth: "January",
      businessStartDateYear: "2020",
      businessEntityType: "LLC",
      application: "507f1f77bcf86cd799439011",
      users: [
        "507f1f77bcf86cd799439011",
        "507f1f77bcf86cd799439012",
      ],
      primaryUser: "507f1f77bcf86cd799439011",
      achToken: "ACH20c64a3d71cb-4400-8225-6d19918aa183",
      webhookUrl: "https://my.webhook.com/post",
      plaidToken: "20c64a3d-71cb-4400-8225-6d19918aa183",
      plaidTokens: [
        {
          alias: "Default Token",
          token: "access-sandbox-43bb37eb-954c-45e8-b0be-391b1d2c06fc",
        },
      ],
      heronId: "heron_123456",
      paymentSettings: [
        {
          partner: "62eaf2133147bd1b70da07d2",
          business: "62eaf2133147bd1b70da07d2",
          data: {
            accountId: "acct_1J876rQjaww8b42s",
            customerId: "cus_sdfsdfsd1J876rQjawghghw8b42s",
            paymentMethodId: "pm_ssej45jawghghw8b42s",
            accountNumber: "21565234545",
            routingNumber: "1572515454",
            directDebitAuthorization:
              "{\"authorized\": true, \"type\": \"PLAID\", \"account_id\": \"000123456789\", \"owner\": \"Business Owner\", \"created_at\": \"2023-01-01T00:00:00.000Z\"}",
            fundingSourceId:
              "H6U1rvcYcDybNwKykiyM28of0mPdOnh9yCJPIa5MJEdSRD5846",
            moovPaymentMethodId: "0ff91950-3333-4444-5555-b071f5550795",
            unitAccountId: "21565234545",
            swiftCode: "1572515454",
            remittanceInformation: "Payment for {year}-{month}-{day}",
            lockboxAddress: "123 Main St",
            accountNumberId: "account_number_i6kffj1pvwhmhi7okasb",
            oatfiAccountNumber: "21565234545",
            oatfiRoutingNumber: "21565234545",
          },
          scheduledRepayment: false,
          isDefault: true,
          type: "UNIT",
        },
      ],
      codatCompanyId: "20c64a3d-71cb-4400-8225-6d19918aa183",
      consumerInvoices: false,
      onboardingSource: "API",
      requestedLimitSource: "Customer",
      requestedCreditLimit: 10000,
      metadata: {
        mcNumber: "20c64a3d-71cb-4400-8225-6d19918aa183",
        avgMonthlySpend: "10000",
        orderProductSelection: "20c64a3d-71cb-4400-8225-6d19918aa183",
        requestedCreditLimit: 10000,
        plaidData: "{\"accounts\":[...],\"institution\":{...}}",
      },
    },
  });

  console.log(result);
}

run();

```
<!-- End Retries [retries] -->

<!-- Start Error Handling [errors] -->
## Error Handling

[`OatFiSDKError`](./src/models/errors/oatfisdkerror.ts) is the base class for all HTTP error responses. It has the following properties:

| Property            | Type       | Description                                            |
| ------------------- | ---------- | ------------------------------------------------------ |
| `error.message`     | `string`   | Error message                                          |
| `error.statusCode`  | `number`   | HTTP response status code eg `404`                     |
| `error.headers`     | `Headers`  | HTTP response headers                                  |
| `error.body`        | `string`   | HTTP body. Can be empty string if no body is returned. |
| `error.rawResponse` | `Response` | Raw HTTP response                                      |

### Example
```typescript
import { OatFiSDK } from "@oatfi/oatfi-sdk-ts";
import * as errors from "@oatfi/oatfi-sdk-ts/models/errors";

const oatFiSDK = new OatFiSDK({
  bearer: process.env["OATFISDK_BEARER"] ?? "",
});

async function run() {
  try {
    const result = await oatFiSDK.businesses.create({
      idempotencyKey: "<value>",
      createBusinessDto: {
        externalId: "ext_123456",
        name: "Acme Corporation",
        dbaName: "Acme",
        taxId: "123456789",
        address: {
          line1: "123 Main St",
          line2: "Suite 100",
          city: "San Francisco",
          state: "CA",
          postalCode: "94105",
        },
        contactFirstName: "John",
        contactLastName: "Doe",
        contactEmail: "john.doe@acme.com",
        contactPhone: "+14155552671",
        businessStartDateMonth: "January",
        businessStartDateYear: "2020",
        businessEntityType: "LLC",
        application: "507f1f77bcf86cd799439011",
        users: [
          "507f1f77bcf86cd799439011",
          "507f1f77bcf86cd799439012",
        ],
        primaryUser: "507f1f77bcf86cd799439011",
        achToken: "ACH20c64a3d71cb-4400-8225-6d19918aa183",
        webhookUrl: "https://my.webhook.com/post",
        plaidToken: "20c64a3d-71cb-4400-8225-6d19918aa183",
        plaidTokens: [
          {
            alias: "Default Token",
            token: "access-sandbox-43bb37eb-954c-45e8-b0be-391b1d2c06fc",
          },
        ],
        heronId: "heron_123456",
        paymentSettings: [
          {
            partner: "62eaf2133147bd1b70da07d2",
            business: "62eaf2133147bd1b70da07d2",
            data: {
              accountId: "acct_1J876rQjaww8b42s",
              customerId: "cus_sdfsdfsd1J876rQjawghghw8b42s",
              paymentMethodId: "pm_ssej45jawghghw8b42s",
              accountNumber: "21565234545",
              routingNumber: "1572515454",
              directDebitAuthorization:
                "{\"authorized\": true, \"type\": \"PLAID\", \"account_id\": \"000123456789\", \"owner\": \"Business Owner\", \"created_at\": \"2023-01-01T00:00:00.000Z\"}",
              fundingSourceId:
                "H6U1rvcYcDybNwKykiyM28of0mPdOnh9yCJPIa5MJEdSRD5846",
              moovPaymentMethodId: "0ff91950-3333-4444-5555-b071f5550795",
              unitAccountId: "21565234545",
              swiftCode: "1572515454",
              remittanceInformation: "Payment for {year}-{month}-{day}",
              lockboxAddress: "123 Main St",
              accountNumberId: "account_number_i6kffj1pvwhmhi7okasb",
              oatfiAccountNumber: "21565234545",
              oatfiRoutingNumber: "21565234545",
            },
            scheduledRepayment: false,
            isDefault: true,
            type: "UNIT",
          },
        ],
        codatCompanyId: "20c64a3d-71cb-4400-8225-6d19918aa183",
        consumerInvoices: false,
        onboardingSource: "API",
        requestedLimitSource: "Customer",
        requestedCreditLimit: 10000,
        metadata: {
          mcNumber: "20c64a3d-71cb-4400-8225-6d19918aa183",
          avgMonthlySpend: "10000",
          orderProductSelection: "20c64a3d-71cb-4400-8225-6d19918aa183",
          requestedCreditLimit: 10000,
          plaidData: "{\"accounts\":[...],\"institution\":{...}}",
        },
      },
    });

    console.log(result);
  } catch (error) {
    if (error instanceof errors.OatFiSDKError) {
      console.log(error.message);
      console.log(error.statusCode);
      console.log(error.body);
      console.log(error.headers);
    }
  }
}

run();

```

### Error Classes
**Primary error:**
* [`OatFiSDKError`](./src/models/errors/oatfisdkerror.ts): The base class for HTTP error responses.

<details><summary>Less common errors (6)</summary>

<br />

**Network errors:**
* [`ConnectionError`](./src/models/errors/httpclienterrors.ts): HTTP client was unable to make a request to a server.
* [`RequestTimeoutError`](./src/models/errors/httpclienterrors.ts): HTTP request timed out due to an AbortSignal signal.
* [`RequestAbortedError`](./src/models/errors/httpclienterrors.ts): HTTP request was aborted by the client.
* [`InvalidRequestError`](./src/models/errors/httpclienterrors.ts): Any input used to create a request is invalid.
* [`UnexpectedClientError`](./src/models/errors/httpclienterrors.ts): Unrecognised or unexpected error.


**Inherit from [`OatFiSDKError`](./src/models/errors/oatfisdkerror.ts)**:
* [`ResponseValidationError`](./src/models/errors/responsevalidationerror.ts): Type mismatch between the data returned from the server and the structure expected by the SDK. See `error.rawValue` for the raw value and `error.pretty()` for a nicely formatted multi-line string.

</details>
<!-- End Error Handling [errors] -->

<!-- Start Server Selection [server] -->
## Server Selection

### Select Server by Index

You can override the default server globally by passing a server index to the `serverIdx: number` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:

| #   | Server                      | Description |
| --- | --------------------------- | ----------- |
| 0   | `https://dev.api.oatfi.com` | Development |
| 1   | `https://api.oatfi.com`     | Production  |
| 2   | `https://stg.api.oatfi.com` | Staging     |

#### Example

```typescript
import { OatFiSDK } from "@oatfi/oatfi-sdk-ts";

const oatFiSDK = new OatFiSDK({
  serverIdx: 0,
  bearer: process.env["OATFISDK_BEARER"] ?? "",
});

async function run() {
  const result = await oatFiSDK.businesses.create({
    idempotencyKey: "<value>",
    createBusinessDto: {
      externalId: "ext_123456",
      name: "Acme Corporation",
      dbaName: "Acme",
      taxId: "123456789",
      address: {
        line1: "123 Main St",
        line2: "Suite 100",
        city: "San Francisco",
        state: "CA",
        postalCode: "94105",
      },
      contactFirstName: "John",
      contactLastName: "Doe",
      contactEmail: "john.doe@acme.com",
      contactPhone: "+14155552671",
      businessStartDateMonth: "January",
      businessStartDateYear: "2020",
      businessEntityType: "LLC",
      application: "507f1f77bcf86cd799439011",
      users: [
        "507f1f77bcf86cd799439011",
        "507f1f77bcf86cd799439012",
      ],
      primaryUser: "507f1f77bcf86cd799439011",
      achToken: "ACH20c64a3d71cb-4400-8225-6d19918aa183",
      webhookUrl: "https://my.webhook.com/post",
      plaidToken: "20c64a3d-71cb-4400-8225-6d19918aa183",
      plaidTokens: [
        {
          alias: "Default Token",
          token: "access-sandbox-43bb37eb-954c-45e8-b0be-391b1d2c06fc",
        },
      ],
      heronId: "heron_123456",
      paymentSettings: [
        {
          partner: "62eaf2133147bd1b70da07d2",
          business: "62eaf2133147bd1b70da07d2",
          data: {
            accountId: "acct_1J876rQjaww8b42s",
            customerId: "cus_sdfsdfsd1J876rQjawghghw8b42s",
            paymentMethodId: "pm_ssej45jawghghw8b42s",
            accountNumber: "21565234545",
            routingNumber: "1572515454",
            directDebitAuthorization:
              "{\"authorized\": true, \"type\": \"PLAID\", \"account_id\": \"000123456789\", \"owner\": \"Business Owner\", \"created_at\": \"2023-01-01T00:00:00.000Z\"}",
            fundingSourceId:
              "H6U1rvcYcDybNwKykiyM28of0mPdOnh9yCJPIa5MJEdSRD5846",
            moovPaymentMethodId: "0ff91950-3333-4444-5555-b071f5550795",
            unitAccountId: "21565234545",
            swiftCode: "1572515454",
            remittanceInformation: "Payment for {year}-{month}-{day}",
            lockboxAddress: "123 Main St",
            accountNumberId: "account_number_i6kffj1pvwhmhi7okasb",
            oatfiAccountNumber: "21565234545",
            oatfiRoutingNumber: "21565234545",
          },
          scheduledRepayment: false,
          isDefault: true,
          type: "UNIT",
        },
      ],
      codatCompanyId: "20c64a3d-71cb-4400-8225-6d19918aa183",
      consumerInvoices: false,
      onboardingSource: "API",
      requestedLimitSource: "Customer",
      requestedCreditLimit: 10000,
      metadata: {
        mcNumber: "20c64a3d-71cb-4400-8225-6d19918aa183",
        avgMonthlySpend: "10000",
        orderProductSelection: "20c64a3d-71cb-4400-8225-6d19918aa183",
        requestedCreditLimit: 10000,
        plaidData: "{\"accounts\":[...],\"institution\":{...}}",
      },
    },
  });

  console.log(result);
}

run();

```

### Override Server URL Per-Client

The default server can also be overridden globally by passing a URL to the `serverURL: string` optional parameter when initializing the SDK client instance. For example:
```typescript
import { OatFiSDK } from "@oatfi/oatfi-sdk-ts";

const oatFiSDK = new OatFiSDK({
  serverURL: "https://stg.api.oatfi.com",
  bearer: process.env["OATFISDK_BEARER"] ?? "",
});

async function run() {
  const result = await oatFiSDK.businesses.create({
    idempotencyKey: "<value>",
    createBusinessDto: {
      externalId: "ext_123456",
      name: "Acme Corporation",
      dbaName: "Acme",
      taxId: "123456789",
      address: {
        line1: "123 Main St",
        line2: "Suite 100",
        city: "San Francisco",
        state: "CA",
        postalCode: "94105",
      },
      contactFirstName: "John",
      contactLastName: "Doe",
      contactEmail: "john.doe@acme.com",
      contactPhone: "+14155552671",
      businessStartDateMonth: "January",
      businessStartDateYear: "2020",
      businessEntityType: "LLC",
      application: "507f1f77bcf86cd799439011",
      users: [
        "507f1f77bcf86cd799439011",
        "507f1f77bcf86cd799439012",
      ],
      primaryUser: "507f1f77bcf86cd799439011",
      achToken: "ACH20c64a3d71cb-4400-8225-6d19918aa183",
      webhookUrl: "https://my.webhook.com/post",
      plaidToken: "20c64a3d-71cb-4400-8225-6d19918aa183",
      plaidTokens: [
        {
          alias: "Default Token",
          token: "access-sandbox-43bb37eb-954c-45e8-b0be-391b1d2c06fc",
        },
      ],
      heronId: "heron_123456",
      paymentSettings: [
        {
          partner: "62eaf2133147bd1b70da07d2",
          business: "62eaf2133147bd1b70da07d2",
          data: {
            accountId: "acct_1J876rQjaww8b42s",
            customerId: "cus_sdfsdfsd1J876rQjawghghw8b42s",
            paymentMethodId: "pm_ssej45jawghghw8b42s",
            accountNumber: "21565234545",
            routingNumber: "1572515454",
            directDebitAuthorization:
              "{\"authorized\": true, \"type\": \"PLAID\", \"account_id\": \"000123456789\", \"owner\": \"Business Owner\", \"created_at\": \"2023-01-01T00:00:00.000Z\"}",
            fundingSourceId:
              "H6U1rvcYcDybNwKykiyM28of0mPdOnh9yCJPIa5MJEdSRD5846",
            moovPaymentMethodId: "0ff91950-3333-4444-5555-b071f5550795",
            unitAccountId: "21565234545",
            swiftCode: "1572515454",
            remittanceInformation: "Payment for {year}-{month}-{day}",
            lockboxAddress: "123 Main St",
            accountNumberId: "account_number_i6kffj1pvwhmhi7okasb",
            oatfiAccountNumber: "21565234545",
            oatfiRoutingNumber: "21565234545",
          },
          scheduledRepayment: false,
          isDefault: true,
          type: "UNIT",
        },
      ],
      codatCompanyId: "20c64a3d-71cb-4400-8225-6d19918aa183",
      consumerInvoices: false,
      onboardingSource: "API",
      requestedLimitSource: "Customer",
      requestedCreditLimit: 10000,
      metadata: {
        mcNumber: "20c64a3d-71cb-4400-8225-6d19918aa183",
        avgMonthlySpend: "10000",
        orderProductSelection: "20c64a3d-71cb-4400-8225-6d19918aa183",
        requestedCreditLimit: 10000,
        plaidData: "{\"accounts\":[...],\"institution\":{...}}",
      },
    },
  });

  console.log(result);
}

run();

```
<!-- End Server Selection [server] -->

<!-- Start Custom HTTP Client [http-client] -->
## Custom HTTP Client

The TypeScript SDK makes API calls using an `HTTPClient` that wraps the native
[Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). This
client is a thin wrapper around `fetch` and provides the ability to attach hooks
around the request lifecycle that can be used to modify the request or handle
errors and response.

The `HTTPClient` constructor takes an optional `fetcher` argument that can be
used to integrate a third-party HTTP client or when writing tests to mock out
the HTTP client and feed in fixtures.

The following example shows how to:
- route requests through a proxy server using [undici](https://www.npmjs.com/package/undici)'s ProxyAgent
- use the `"beforeRequest"` hook to add a custom header and a timeout to requests
- use the `"requestError"` hook to log errors

```typescript
import { OatFiSDK } from "@oatfi/oatfi-sdk-ts";
import { ProxyAgent } from "undici";
import { HTTPClient } from "@oatfi/oatfi-sdk-ts/lib/http";

const dispatcher = new ProxyAgent("http://proxy.example.com:8080");

const httpClient = new HTTPClient({
  // 'fetcher' takes a function that has the same signature as native 'fetch'.
  fetcher: (input, init) =>
    // 'dispatcher' is specific to undici and not part of the standard Fetch API.
    fetch(input, { ...init, dispatcher } as RequestInit),
});

httpClient.addHook("beforeRequest", (request) => {
  const nextRequest = new Request(request, {
    signal: request.signal || AbortSignal.timeout(5000)
  });

  nextRequest.headers.set("x-custom-header", "custom value");

  return nextRequest;
});

httpClient.addHook("requestError", (error, request) => {
  console.group("Request Error");
  console.log("Reason:", `${error}`);
  console.log("Endpoint:", `${request.method} ${request.url}`);
  console.groupEnd();
});

const sdk = new OatFiSDK({ httpClient: httpClient });
```
<!-- End Custom HTTP Client [http-client] -->

<!-- Start Debugging [debug] -->
## Debugging

You can setup your SDK to emit debug logs for SDK requests and responses.

You can pass a logger that matches `console`'s interface as an SDK option.

> [!WARNING]
> Beware that debug logging will reveal secrets, like API tokens in headers, in log messages printed to a console or files. It's recommended to use this feature only during local development and not in production.

```typescript
import { OatFiSDK } from "@oatfi/oatfi-sdk-ts";

const sdk = new OatFiSDK({ debugLogger: console });
```

You can also enable a default debug logger by setting an environment variable `OATFISDK_DEBUG` to true.
<!-- End Debugging [debug] -->

<!-- Placeholder for Future Speakeasy SDK Sections -->

# Development

## Maturity

This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
looking for the latest version.

## License

This SDK is proprietary software owned by OatFi. Please see the [LICENSE](./LICENSE) file for complete terms and conditions.

## Contributions

While we value feedback and suggestions for this SDK, this library is auto-generated from our OpenAPI specification. Any manual changes added to internal files will be overwritten on the next generation cycle. 

For feature requests, bug reports, or licensing inquiries, please contact us at legal@oatfi.com or open an issue with your request. 

### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=oat-fi-sdk&utm_campaign=typescript)