Skip to content

fintech-sdk/codat-go

Repository files navigation

codat-go

Production-grade Go client for the Codat financial data platform.

Features

  • Supports all major Codat products:
    • Platform
    • Accounting
    • Bank Feeds
    • Lending
    • Expenses
    • Bill Pay
  • Fluent API design
  • Automatic retries with exponential backoff
  • HMAC-SHA256 webhook verification
  • Configurable HTTP client
  • Channel-based pagination support
  • Strongly typed resources

Installation

go get github.com/iamkanishka/codat-go

Quick Start

package main

import (
    "context"
    "log"

    "github.com/iamkanishka/codat-go"
)

func main() {
    client, err := codat.New("your-api-key")
    if err != nil {
        log.Fatal(err)
    }

    companies, err := client.Platform.Companies.List(
        context.Background(),
        domain.PageOpts{},
    )
    if err != nil {
        log.Fatal(err)
    }

    log.Printf("Found %d companies", len(companies.Results))
}

Creating a Client

Using API Key

client, err := codat.New("your-api-key")

Using Custom Configuration

cfg := &config.Config{
    APIKey: "your-api-key",
}

client, err := codat.NewWithConfig(cfg)

Panic on Failure

client := codat.MustNew("your-api-key")

Product Areas

Platform

client.Platform.Companies
client.Platform.Connections
client.Platform.PushOperations
client.Platform.DataStatus
client.Platform.Files
client.Platform.SyncSettings
client.Platform.SupplementalData
client.Platform.APIKeys
client.Platform.Webhooks

Accounting

client.Accounting.Accounts
client.Accounting.BankAccounts
client.Accounting.Bills
client.Accounting.CompanyInfo
client.Accounting.CreditNotes
client.Accounting.Customers
client.Accounting.FinancialStatements
client.Accounting.Invoices
client.Accounting.Items
client.Accounting.JournalEntries
client.Accounting.Payments
client.Accounting.PurchaseOrders
client.Accounting.Suppliers
client.Accounting.TaxRates
client.Accounting.TrackingCategories

Bank Feeds

client.BankFeeds.SourceAccounts
client.BankFeeds.Transactions

Lending

client.Lending.AccountsReceivable
client.Lending.AccountsPayable
client.Lending.Banking
client.Lending.Financials
client.Lending.DataIntegrity
client.Lending.ExcelReports

Expenses

client.Expenses.Sync
client.Expenses.Transactions
client.Expenses.Mappings

Bill Pay

client.BillPay.Bills
client.BillPay.Suppliers
client.BillPay.Payments

Configuration

The SDK supports:

  • Custom API endpoints
  • Custom HTTP clients
  • Retry configuration
  • Default headers
  • Request/response hooks
  • User-Agent customization

Example:

cfg := &config.Config{
    APIKey:     "your-api-key",
    BaseURL:    "https://api.codat.io",
    MaxRetries: 5,
}

client, err := codat.NewWithConfig(cfg)

Creating a Derived Client

newClient, err := client.WithConfig(&config.Config{
    MaxRetries: 10,
})

Error Handling

client, err := codat.New(apiKey)
if err != nil {
    return err
}

All configuration validation errors are returned during client creation.

Retry Support

The SDK includes automatic retry handling with:

  • Exponential backoff
  • Configurable retry limits
  • Rate-limit retry delays
  • Network failure recovery

Webhook Verification

The SDK includes HMAC-SHA256 webhook signature verification helpers for validating incoming Codat webhooks.

License

MIT

Packages

 
 
 

Contributors

Languages