(sourceAccounts)
Source accounts act as a bridge to bank accounts in accounting software.
- create - Create source account
- delete - Delete source account
- deleteCredentials - Delete all source account credentials
- generateCredentials - Generate source account credentials
- list - List source accounts
- update - Update source account
The Create Source Account endpoint allows you to create a representation of a bank account within Codat's domain. The company can then map the source account to an existing or new target account in their accounting software.
The method of mapping the source account to the target account varies depending on the accounting package your company uses.
- API Mapping: Integrate the mapping journey directly into your application for a seamless user experience.
- Codat UI Mapping: If you prefer a quicker setup, you can utilize Codat's provided user interface for mapping.
- Accounting Platform Mapping: For some accounting software, the mapping process must be conducted within the software itself.
Bank Feed Integration | API Mapping | Codat UI Mapping | Accounting Platform Mapping |
---|---|---|---|
Xero | ✅ | ✅ | |
FreeAgent | ✅ | ✅ | |
Oracle NetSuite | ✅ | ✅ | |
Exact Online (NL) | ✅ | ✅ | |
QuickBooks Online | ✅ | ||
Sage | ✅ |
import { CodatBankFeeds } from "@codat/bank-feeds";
async function run() {
const sdk = new CodatBankFeeds({
security: {
authHeader: "Basic BASE_64_ENCODED(API_KEY)",
},
});
const res = await sdk.sourceAccounts.create({
sourceAccount: {
accountName: "account-081",
accountNumber: "12345670",
accountType: "Credit",
balance: 99.99,
currency: "GBP",
feedStartDate: "2022-10-23T00:00:00Z",
id: "acc-002",
modifiedDate: "2023-01-09T14:14:14.1057478Z",
sortCode: "123456",
status: "pending",
},
companyId: "8a210b68-6988-11ed-a1eb-0242ac120002",
connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.CreateSourceAccountRequest | ✔️ | The request object to use for the request. |
retries |
utils.RetryConfig | ➖ | Configuration to override the default retry behavior of the client. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.CreateSourceAccountResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
The Delete source account endpoint enables you to remove a source account.
Removing a source account will also remove any mapping between the source bank feed bank accounts and the target bankfeed bank account.
import { CodatBankFeeds } from "@codat/bank-feeds";
async function run() {
const sdk = new CodatBankFeeds({
security: {
authHeader: "Basic BASE_64_ENCODED(API_KEY)",
},
});
const res = await sdk.sourceAccounts.delete({
accountId: "7110701885",
companyId: "8a210b68-6988-11ed-a1eb-0242ac120002",
connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.DeleteSourceAccountRequest | ✔️ | The request object to use for the request. |
retries |
utils.RetryConfig | ➖ | Configuration to override the default retry behavior of the client. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.DeleteSourceAccountResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
The Delete Bank Account Credentials endpoint serves as a comprehensive mechanism for revoking all existing authorization credentials that a company employs to establish its Bank Feed connection.
In cases where multiple credential sets have been generated, a single API call to this endpoint revokes all of them.
import { CodatBankFeeds } from "@codat/bank-feeds";
async function run() {
const sdk = new CodatBankFeeds({
security: {
authHeader: "Basic BASE_64_ENCODED(API_KEY)",
},
});
const res = await sdk.sourceAccounts.deleteCredentials({
companyId: "8a210b68-6988-11ed-a1eb-0242ac120002",
connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.DeleteBankFeedCredentialsRequest | ✔️ | The request object to use for the request. |
retries |
utils.RetryConfig | ➖ | Configuration to override the default retry behavior of the client. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.DeleteBankFeedCredentialsResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
The Generate Bank Account Credentials endpoint can be used to generate credentials for QuickBooks Online to use for authentication of the Bank Feed in their portal, each time this is used a new set of credentials will be generated.
The old credentials will still be valid until the revoke credentials endpoint is used, which will revoke all credentials associated to the data connection.
import { CodatBankFeeds } from "@codat/bank-feeds";
async function run() {
const sdk = new CodatBankFeeds({
security: {
authHeader: "Basic BASE_64_ENCODED(API_KEY)",
},
});
const res = await sdk.sourceAccounts.generateCredentials({
requestBody: new TextEncoder().encode("0xeDCfFBde9E"),
companyId: "8a210b68-6988-11ed-a1eb-0242ac120002",
connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GenerateCredentialsRequest | ✔️ | The request object to use for the request. |
retries |
utils.RetryConfig | ➖ | Configuration to override the default retry behavior of the client. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.GenerateCredentialsResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
The List source accounts endpoint returns a list of source accounts for a given company's connection.
source accounts are the bank's bank account within Codat's domain from which transactions are synced into the accounting platform.
import { CodatBankFeeds } from "@codat/bank-feeds";
async function run() {
const sdk = new CodatBankFeeds({
security: {
authHeader: "Basic BASE_64_ENCODED(API_KEY)",
},
});
const res = await sdk.sourceAccounts.list({
companyId: "8a210b68-6988-11ed-a1eb-0242ac120002",
connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.ListSourceAccountsRequest | ✔️ | The request object to use for the request. |
retries |
utils.RetryConfig | ➖ | Configuration to override the default retry behavior of the client. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.ListSourceAccountsResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |
The Update source account endpoint updates a single source account for a single data connection connected to a single company.
import { CodatBankFeeds } from "@codat/bank-feeds";
async function run() {
const sdk = new CodatBankFeeds({
security: {
authHeader: "Basic BASE_64_ENCODED(API_KEY)",
},
});
const res = await sdk.sourceAccounts.update({
sourceAccount: {
accountName: "account-095",
accountNumber: "12345671",
accountType: "Credit",
balance: 0,
currency: "USD",
feedStartDate: "2022-10-23T00:00:00Z",
id: "acc-003",
modifiedDate: "2023-01-09T14:14:14.1057478Z",
sortCode: "123456",
status: "pending",
},
accountId: "7110701885",
companyId: "8a210b68-6988-11ed-a1eb-0242ac120002",
connectionId: "2e9d2c44-f675-40ba-8049-353bfcb5e171",
});
if (res.statusCode == 200) {
// handle response
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.UpdateSourceAccountRequest | ✔️ | The request object to use for the request. |
retries |
utils.RetryConfig | ➖ | Configuration to override the default retry behavior of the client. |
config |
AxiosRequestConfig | ➖ | Available config options for making requests. |
Promise<operations.UpdateSourceAccountResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4xx-5xx | / |