Push payroll to accounting platforms.
Sync for Payroll: The API for Sync for Payroll.
Sync for Payroll is an API and a set of supporting tools built to help integrate your customers' payroll data from their HR and payroll platforms into their accounting software and to support its reconciliation.
Explore product | See OpenAPI spec
| Endpoints | Description |
|---|---|
| Companies | Create and manage your SMB users' companies. |
| Connections | Create new and manage existing data connections for a company. |
| Accounts | Get, create, and update Accounts. |
| Journal entries | Get, create, and update Journal entries. |
| Journals | Get, create, and update Journals. |
| Tracking categories | Get, create, and update Tracking Categories for additional categorization of payroll components. |
| Company info | View company profile from the source platform. |
| Manage data | Control how data is retrieved from an integration. |
- SDK Installation
- SDK Example Usage
- Available Resources and Operations
- Retries
- Error Handling
- Server Selection
- Authentication
To add the NuGet package to a .NET project:
dotnet add package Codat.Sync.PayrollTo add a reference to a local instance of the SDK in a .NET project:
dotnet add reference Codat/Sync/Payroll/Codat.Sync.Payroll.csprojusing Codat.Sync.Payroll;
using Codat.Sync.Payroll.Models.Requests;
using Codat.Sync.Payroll.Models.Components;
var sdk = new CodatSyncPayroll(authHeader: "Basic BASE_64_ENCODED(API_KEY)");
ListCompaniesRequest req = new ListCompaniesRequest() {
Page = 1,
PageSize = 100,
Query = "id=e3334455-1aed-4e71-ab43-6bccf12092ee",
OrderBy = "-modifiedDate",
};
var res = await sdk.Companies.ListAsync(req);
// handle responseAvailable methods
- List - List accounts
- Get - Get account
- GetCreateModel - Get create account model
- Create - Create account
- List - List companies
- Create - Create company
- Update - Update company
- Delete - Delete a company
- Get - Get company
- GetAccountingProfile - Get company accounting profile
- List - List connections
- Create - Create connection
- Get - Get connection
- Delete - Delete connection
- Unlink - Unlink connection
- List - List journal entries
- Get - Get journal entry
- Delete - Delete journal entry
- GetCreateModel - Get create journal entry model
- Create - Create journal entry
- List - List journals
- Get - Get journal
- GetCreateModel - Get create journal model
- Create - Create journal
- RefreshAllDataTypes - Refresh all data
- GetDataStatus - Get data status
- RefreshDataType - Refresh data type
- ListPullOperations - List pull operations
- List - List push operations
- GetPullOperation - Get pull operation
- GetPushOperation - Get push operation
You can override the default server globally by passing a server index to the serverIndex: number optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
| # | Server | Variables |
|---|---|---|
| 0 | https://api.codat.io |
None |
The default server can also be overridden globally by passing a URL to the serverUrl: str optional parameter when initializing the SDK client instance. For example:
This SDK supports the following security scheme globally:
| Name | Type | Scheme |
|---|---|---|
AuthHeader |
apiKey | API key |
To authenticate with the API the AuthHeader parameter must be set when initializing the SDK client instance. For example:
using Codat.Sync.Payroll;
using Codat.Sync.Payroll.Models.Requests;
using Codat.Sync.Payroll.Models.Components;
var sdk = new CodatSyncPayroll(authHeader: "Basic BASE_64_ENCODED(API_KEY)");
ListCompaniesRequest req = new ListCompaniesRequest() {
Page = 1,
PageSize = 100,
Query = "id=e3334455-1aed-4e71-ab43-6bccf12092ee",
OrderBy = "-modifiedDate",
};
var res = await sdk.Companies.ListAsync(req);
// handle responseSome 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, simply pass a RetryConfig to the call:
using Codat.Sync.Payroll;
using Codat.Sync.Payroll.Models.Requests;
using Codat.Sync.Payroll.Models.Components;
var sdk = new CodatSyncPayroll(authHeader: "Basic BASE_64_ENCODED(API_KEY)");
ListCompaniesRequest req = new ListCompaniesRequest() {
Page = 1,
PageSize = 100,
Query = "id=e3334455-1aed-4e71-ab43-6bccf12092ee",
OrderBy = "-modifiedDate",
};
var res = await sdk.Companies.ListAsync(
retryConfig: new RetryConfig(
strategy: RetryConfig.RetryStrategy.BACKOFF,
backoff: new BackoffStrategy(
initialIntervalMs: 1L,
maxIntervalMs: 50L,
maxElapsedTimeMs: 100L,
exponent: 1.1
),
retryConnectionErrors: false
),req);
// handle responseIf you'd like to override the default retry strategy for all operations that support retries, you can use the RetryConfig optional parameter when intitializing the SDK:
using Codat.Sync.Payroll;
using Codat.Sync.Payroll.Models.Requests;
using Codat.Sync.Payroll.Models.Components;
var sdk = new CodatSyncPayroll(
retryConfig: new RetryConfig(
strategy: RetryConfig.RetryStrategy.BACKOFF,
backoff: new BackoffStrategy(
initialIntervalMs: 1L,
maxIntervalMs: 50L,
maxElapsedTimeMs: 100L,
exponent: 1.1
),
retryConnectionErrors: false
),
authHeader: "Basic BASE_64_ENCODED(API_KEY)"
);
ListCompaniesRequest req = new ListCompaniesRequest() {
Page = 1,
PageSize = 100,
Query = "id=e3334455-1aed-4e71-ab43-6bccf12092ee",
OrderBy = "-modifiedDate",
};
var res = await sdk.Companies.ListAsync(req);
// handle responseHandling errors in this SDK should largely match your expectations. All operations return a response object or thow an exception. If Error objects are specified in your OpenAPI Spec, the SDK will raise the appropriate type.
| Error Object | Status Code | Content Type |
|---|---|---|
| Codat.Sync.Payroll.Models.Errors.ErrorMessage | 400,401,402,403,404,429,500,503 | application/json |
| Codat.Sync.Payroll.Models.Errors.SDKException | 4xx-5xx | / |
using Codat.Sync.Payroll;
using Codat.Sync.Payroll.Models.Requests;
using Codat.Sync.Payroll.Models.Components;
using System;
using Codat.Sync.Payroll.Models.Errors;
var sdk = new CodatSyncPayroll(authHeader: "Basic BASE_64_ENCODED(API_KEY)");
try
{
ListCompaniesRequest req = new ListCompaniesRequest() {
Page = 1,
PageSize = 100,
Query = "id=e3334455-1aed-4e71-ab43-6bccf12092ee",
OrderBy = "-modifiedDate",
};
var res = await sdk.Companies.ListAsync(req);
// handle response
}
catch (Exception ex)
{
if (ex is ErrorMessage)
{
// handle exception
}
else if (ex is Codat.Sync.Payroll.Models.Errors.SDKException)
{
// handle exception
}
}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.