Bank feeds setup
Overview
Creating a company
Within the bank feeds api, a company represents a business that wishes to export their transactions from your application to their accounting software, the first step of the process is to create a company in Codat:
- Request URL
- Response
You can create a company by using the Create company endpoint:
POST /companies
{
"name": "{CompanyName}"
}
The endpoint returns a JSON response containing the company id
which you should use to create the data connection and specify which integration the company wishes to establish a bankfeed.
{
"id": "77921ff9-2491-4dfe-b23b-ff28f3e31e4f",
"name": "Sawayn Group",
"platform": "",
"redirect": "https://link.codat.io/company/77921ff9-2491-4dfe-b23b-ff28f3e31e4f",
"dataConnections": [],
"created": "2023-09-06T09:13:35.8188152Z"
}
Creating a data connection
Using the Create a data connection endpoint, create a data connection to the chosen accounting package for the company.
In the request body specify one of the following as the platformKey
Accounting platform | platformKey |
---|---|
Quickbooks Online Bankfeeds | hcws |
Xero | gbol |
FreeAgent | fbrh |
Sage Bank Feeds | olpr |
- Request
- Response
Sample request to create a QuickBooks Online Data Connection for a company.
POST /companies/:companyId/connections
{
"platformKey": "hcws"
}
The endpoint returns a 200
response. The body contains a dataConnection
object in PendingAuth
status and a linkUrl
, you should cache the linkUrl
as it will be required later to enable the company to link their accounting package.
{
"id": "7baba7cc-4ae0-48fd-a617-98d55a6fc008",
"integrationId": "6b113e06-e818-45d7-977b-8e6bb3d01269",
"sourceId": "56e6575a-3f1f-4918-b009-f7535555f0d6",
"platformName": "QuickBooks Online Bank Feeds",
"linkUrl": "https://link-api.codat.io/companies/COMPANY_ID/connections/CONNECTION_ID/start?otp=742271",
"status": "PendingAuth",
"created": "2022-09-01T10:21:57.0807447Z",
"sourceType": "BankFeed"
}
QuickBooks Online Bank Feeds
For QuickBooks Online Bankfeeds, The linkUrl
contains a one time password (OTP) which expires after one hour. If the OTP has expired, your customer will receive a 401 error when loading the page and you should generate a new OTP by a GET request to:
GET /companies/:companyId/connections/:connectionId
Deauthorizing a dataConnection
If the company wishes to revoke the connection to their accounting package, you can do so using the unlink-connection endpoint.
PATCH /companies/:companyId/connections/:connectionId
{
"status": "Unlinked"
}