Production-grade Go client for the Codat financial data platform.
- 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
go get github.com/iamkanishka/codat-gopackage 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))
}client, err := codat.New("your-api-key")cfg := &config.Config{
APIKey: "your-api-key",
}
client, err := codat.NewWithConfig(cfg)client := codat.MustNew("your-api-key")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.Webhooksclient.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.TrackingCategoriesclient.BankFeeds.SourceAccounts
client.BankFeeds.Transactionsclient.Lending.AccountsReceivable
client.Lending.AccountsPayable
client.Lending.Banking
client.Lending.Financials
client.Lending.DataIntegrity
client.Lending.ExcelReportsclient.Expenses.Sync
client.Expenses.Transactions
client.Expenses.Mappingsclient.BillPay.Bills
client.BillPay.Suppliers
client.BillPay.PaymentsThe 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)newClient, err := client.WithConfig(&config.Config{
MaxRetries: 10,
})client, err := codat.New(apiKey)
if err != nil {
return err
}All configuration validation errors are returned during client creation.
The SDK includes automatic retry handling with:
- Exponential backoff
- Configurable retry limits
- Rate-limit retry delays
- Network failure recovery
The SDK includes HMAC-SHA256 webhook signature verification helpers for validating incoming Codat webhooks.
MIT