Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History

README.md

Outline

Lending

Lending helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from the operating systems they are already using. You can use that data for automating decisioning and surfacing new insights on the customer, all via one API.

Summary

Lending API: Our Lending API helps you make smarter credit decisions on small businesses by enabling you to pull your customers' latest data from accounting, banking, and commerce software they are already using. It also includes features to help providers verify the accuracy of data and process it more efficiently.

The Lending API is built on top of the latest accounting, commerce, and banking data, providing you with the most important data points you need to get a full picture of SMB creditworthiness and make a comprehensive assessment of your customers.

Explore product | See OpenAPI spec

Endpoints

Endpoints Description
Companies Create and manage your SMB users' companies.
Connections Create new and manage existing data connections for a company.
Bank statements Retrieve banking data from linked bank accounts.
Sales Retrieve standardized sales data from a linked commerce software.
Financial statements Financial data and reports from a linked accounting software.
Liabilities Debt and other liabilities.
Accounts payable Data from a linked accounting software representing money the business owes money to its suppliers.
Accounts receivable Data from a linked accounting software representing money owed to the business for sold goods or services.
Transactions Data from a linked accounting software representing transactions.
Company info View company information fetched from the source platform.
Data integrity Match mutable accounting data with immutable banking data to increase confidence in financial data.
Excel reports Download reports in Excel format.
Manage data Control how data is retrieved from an integration.
File upload Endpoints to manage uploaded files.
Loan writeback Implement the loan writeback procedure in your lending process to maintain an accurate position of a loan during the entire lending cycle.

Table of Contents

SDK Installation

Getting started

JDK 11 or later is required.

The samples below show how a published SDK artifact is used:

Gradle:

implementation 'io.codat:lending:3.1.0'

Maven:

<dependency>
    <groupId>io.codat</groupId>
    <artifactId>lending</artifactId>
    <version>3.1.0</version>
</dependency>

How to build

After cloning the git repository to your file system you can build the SDK artifact from source to the build directory by running ./gradlew build on *nix systems or gradlew.bat on Windows systems.

If you wish to build from source and publish the SDK artifact to your local Maven repository (on your filesystem) then use the following command (after cloning the git repo locally):

On *nix:

./gradlew publishToMavenLocal -Pskip.signing

On Windows:

gradlew.bat publishToMavenLocal -Pskip.signing

Example Usage

SDK Example Usage

Example

package hello.world;

import io.codat.lending.CodatLending;
import io.codat.lending.models.shared.AccountCategoriesUpdatedWebhook;
import io.codat.lending.models.shared.AccountCategoriesUpdatedWebhookData;
import io.codat.lending.models.webhooks.AccountCategoriesUpdatedResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        CodatLending sdk = CodatLending.builder()
            .build();

        AccountCategoriesUpdatedWebhook req = AccountCategoriesUpdatedWebhook.builder()
                .alertId("a9367074-b5c3-42c4-9be4-be129f43577e")
                .clientId("bae71d36-ff47-420a-b4a6-f8c9ddf41140")
                .clientName("Bank of Dave")
                .companyId("8a210b68-6988-11ed-a1eb-0242ac120002")
                .data(AccountCategoriesUpdatedWebhookData.builder()
                    .modifiedDate("2022-10-23")
                    .build())
                .dataConnectionId("2e9d2c44-f675-40ba-8049-353bfcb5e171")
                .message("Account categories updated for company f1c35bdc-1546-41b9-baf4-3f31135af968.")
                .ruleId("70af3071-65d9-4ec3-b3cb-5283e8d55dac")
                .ruleType("Account Categories Updated")
                .build();

        AccountCategoriesUpdatedResponse res = sdk.accountCategoriesUpdated()
                .request(req)
                .call();

        // handle response
    }
}

Available Resources and Operations

Available methods
  • get - Get bank account
  • list - List bank accounts
  • get - Get bill credit note
  • list - List bill credit notes
  • get - Get bill payment
  • list - List bill payments
  • get - Get credit note
  • list - List credit notes
  • get - Get payment
  • list - List payments
  • list - List account balances
  • get - Get account
  • list - List accounts
  • get - Get categorized bank statement
  • get - Get transaction category
  • list - List transaction categories
  • get - Get bank transaction
  • list - List transactions
  • create - Create connection
  • delete - Delete connection
  • get - Get connection
  • list - List connections
  • unlink - Unlink connection
  • details - List data integrity details
  • status - Get data integrity status
  • summaries - Get data integrity summaries
  • download - Download all files for a company
  • listUploaded - List all files uploaded by a company
  • upload - Upload files for a company
  • get - Get account
  • list - List accounts
  • get - Get cash flow statement
  • create - Create bank account transactions
  • getCreateModel - Get create bank account transactions model
  • get - Get create operation
  • list - List create operations
  • get - Get pull operation
  • list - List pull operations
  • get - Get customer
  • list - List customers
  • get - Get dispute
  • list - List disputes
  • get - Get location
  • list - List locations
  • get - Get order
  • list - List orders
  • get - Get payment method
  • list - List payment methods
  • get - Get payment
  • list - List payments
  • get - Get product category
  • list - List product categories
  • get - Get product
  • list - List products
  • get - Get transaction
  • list - List transactions
  • get - Get account transaction
  • list - List account transactions
  • get - Get journal entry
  • list - List journal entries
  • get - Get journal
  • list - List journals
  • get - Get transfer
  • list - List transfers

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, you can provide a RetryConfig object through the retryConfig builder method:

package hello.world;

import io.codat.lending.CodatLending;
import io.codat.lending.models.errors.ErrorMessage;
import io.codat.lending.models.operations.CreateCompanyResponse;
import io.codat.lending.models.shared.CompanyRequestBody;
import io.codat.lending.models.shared.Security;
import io.codat.lending.utils.BackoffStrategy;
import io.codat.lending.utils.RetryConfig;
import java.lang.Exception;
import java.util.concurrent.TimeUnit;

public class Application {

    public static void main(String[] args) throws ErrorMessage, Exception {

        CodatLending sdk = CodatLending.builder()
                .security(Security.builder()
                    .authHeader("Basic BASE_64_ENCODED(API_KEY)")
                    .build())
            .build();

        CompanyRequestBody req = CompanyRequestBody.builder()
                .name("Technicalium")
                .description("Requested early access to the new financing scheme.")
                .build();

        CreateCompanyResponse res = sdk.companies().create()
                .request(req)
                .retryConfig(RetryConfig.builder()
                    .backoff(BackoffStrategy.builder()
                        .initialInterval(1L, TimeUnit.MILLISECONDS)
                        .maxInterval(50L, TimeUnit.MILLISECONDS)
                        .maxElapsedTime(1000L, TimeUnit.MILLISECONDS)
                        .baseFactor(1.1)
                        .jitterFactor(0.15)
                        .retryConnectError(false)
                        .build())
                    .build())
                .call();

        if (res.company().isPresent()) {
            // handle response
        }
    }
}

If you'd like to override the default retry strategy for all operations that support retries, you can provide a configuration at SDK initialization:

package hello.world;

import io.codat.lending.CodatLending;
import io.codat.lending.models.errors.ErrorMessage;
import io.codat.lending.models.operations.CreateCompanyResponse;
import io.codat.lending.models.shared.CompanyRequestBody;
import io.codat.lending.models.shared.Security;
import io.codat.lending.utils.BackoffStrategy;
import io.codat.lending.utils.RetryConfig;
import java.lang.Exception;
import java.util.concurrent.TimeUnit;

public class Application {

    public static void main(String[] args) throws ErrorMessage, Exception {

        CodatLending sdk = CodatLending.builder()
                .retryConfig(RetryConfig.builder()
                    .backoff(BackoffStrategy.builder()
                        .initialInterval(1L, TimeUnit.MILLISECONDS)
                        .maxInterval(50L, TimeUnit.MILLISECONDS)
                        .maxElapsedTime(1000L, TimeUnit.MILLISECONDS)
                        .baseFactor(1.1)
                        .jitterFactor(0.15)
                        .retryConnectError(false)
                        .build())
                    .build())
                .security(Security.builder()
                    .authHeader("Basic BASE_64_ENCODED(API_KEY)")
                    .build())
            .build();

        CompanyRequestBody req = CompanyRequestBody.builder()
                .name("Technicalium")
                .description("Requested early access to the new financing scheme.")
                .build();

        CreateCompanyResponse res = sdk.companies().create()
                .request(req)
                .call();

        if (res.company().isPresent()) {
            // handle response
        }
    }
}

Error Handling

Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an exception.

By default, an API error will throw a models/errors/SDKError exception. When custom error responses are specified for an operation, the SDK may also throw their associated exception. You can refer to respective Errors tables in SDK docs for more details on possible exception types for each operation. For example, the create method throws the following exceptions:

Error Type Status Code Content Type
models/errors/ErrorMessage 400, 401, 402, 403, 429, 500, 503 application/json
models/errors/SDKError 4XX, 5XX */*

Example

package hello.world;

import io.codat.lending.CodatLending;
import io.codat.lending.models.errors.ErrorMessage;
import io.codat.lending.models.operations.CreateCompanyResponse;
import io.codat.lending.models.shared.CompanyRequestBody;
import io.codat.lending.models.shared.Security;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ErrorMessage, Exception {

        CodatLending sdk = CodatLending.builder()
                .security(Security.builder()
                    .authHeader("Basic BASE_64_ENCODED(API_KEY)")
                    .build())
            .build();

        CompanyRequestBody req = CompanyRequestBody.builder()
                .name("Technicalium")
                .description("Requested early access to the new financing scheme.")
                .build();

        CreateCompanyResponse res = sdk.companies().create()
                .request(req)
                .call();

        if (res.company().isPresent()) {
            // handle response
        }
    }
}

Server Selection

Override Server URL Per-Client

The default server can also be overridden globally using the .serverURL(String serverUrl) builder method when initializing the SDK client instance. For example:

package hello.world;

import io.codat.lending.CodatLending;
import io.codat.lending.models.errors.ErrorMessage;
import io.codat.lending.models.operations.CreateCompanyResponse;
import io.codat.lending.models.shared.CompanyRequestBody;
import io.codat.lending.models.shared.Security;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ErrorMessage, Exception {

        CodatLending sdk = CodatLending.builder()
                .serverURL("https://api.codat.io")
                .security(Security.builder()
                    .authHeader("Basic BASE_64_ENCODED(API_KEY)")
                    .build())
            .build();

        CompanyRequestBody req = CompanyRequestBody.builder()
                .name("Technicalium")
                .description("Requested early access to the new financing scheme.")
                .build();

        CreateCompanyResponse res = sdk.companies().create()
                .request(req)
                .call();

        if (res.company().isPresent()) {
            // handle response
        }
    }
}

Authentication

Per-Client Security Schemes

This SDK supports the following security scheme globally:

Name Type Scheme
authHeader apiKey API key

You can set the security parameters through the security builder method when initializing the SDK client instance. For example:

package hello.world;

import io.codat.lending.CodatLending;
import io.codat.lending.models.errors.ErrorMessage;
import io.codat.lending.models.operations.CreateCompanyResponse;
import io.codat.lending.models.shared.CompanyRequestBody;
import io.codat.lending.models.shared.Security;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws ErrorMessage, Exception {

        CodatLending sdk = CodatLending.builder()
                .security(Security.builder()
                    .authHeader("Basic BASE_64_ENCODED(API_KEY)")
                    .build())
            .build();

        CompanyRequestBody req = CompanyRequestBody.builder()
                .name("Technicalium")
                .description("Requested early access to the new financing scheme.")
                .build();

        CreateCompanyResponse res = sdk.companies().create()
                .request(req)
                .call();

        if (res.company().isPresent()) {
            // handle response
        }
    }
}

Support

If you encounter any challenges while utilizing our SDKs, please don't hesitate to reach out for assistance. You can raise any issues by contacting your dedicated Codat representative or reaching out to our support team. We're here to help ensure a smooth experience for you.

Library generated by Speakeasy

Morty Proxy This is a proxified and sanitized view of the page, visit original site.