Read Organization and Payroll Data
In this guide, you’ll learn how to read data from Finch’s company, directory, individual, employment, payment, and pay statement API endpoints.
You can now make API requests to Finch’s various endpoints, such as /company
, /directory
, /individual
, /employment
, /payment
, and /pay-statement
. These endpoints only allow the reading of data from employment providers; they do not permit the writing of data back to the system. Writing deductions and contributions back to the provider is covered in Write Data step.
In this step, you will learn how to make API requests, handle responses, and manage request rate limits.
-
Choose the appropriate Finch API endpoints: Depending on the data you need for your application, choose the appropriate Finch API endpoints.
- Here’s a brief overview of Finch’s endpoints again:
/company
: Retrieve company information, such as name, address, and Federal Employer Identification Number (EIN)./directory
: List all the employees at the company, both active and inactive./individual
: Obtain individual information, such as name, date of birth, and contact details./employment
: Access employment-related data, like job title, department, and start and end dates, and income./payment
: Get payroll information, including pay frequency and last payment date./pay-statement
: Fetch detailed individual paycheck data, including earnings, taxes, employee deductions, and employer contributions./benefits
: Create and enroll employees in various types of benefits directly in the employer’s provider. The “benefits” are applied directly to the employee’s next paycheck in the deductions or contributions section. This endpoint is covered more in Write Data.
- Here’s a brief overview of Finch’s endpoints again:
-
Set up the HTTP request: Use an HTTP library such as Fetch or Axios (or another suitable package) to create an HTTP request. Include the access token in the
Authorization
header using the formatBearer <your_access_token>
. Make sure the HTTP request uses the appropriate method (GET, POST, etc.) and includes any required parameters. -
Handle API responses: When Finch returns a response, parse the JSON data and extract the relevant information needed for your application. All API responses include a header that includes date the data was retrieved. See our Development Guide on Headers for more details
Store or display the data as needed for your application.
-
Handle errors and edge cases: Be prepared to mitigate errors and edge cases in the API response. For example, Finch may return
4XX
or5XX
error types due to unsupported responses from the underlying employment system. Retrying immediately may not resolve the issue, so consider implementing a retry strategy with a delay. If the error persists, submit a support ticket with theFinch-Request-ID
present in the headers of the response.Error handling example -
Handle 401 re-authentication errors: If Finch returns a
401
HTTP status code and afinch_code
ofreauthenticate_user
, it indicates Finch has lost access to the employer’s provider. If this happens, display a prompt on your frontend to have the end-user go through Finch Connect again to reconnect the provider. Upon successful re-authentication, obtain a new access token and continue making API requests with the new token. The old token can be discarded. -
Manage rate limits: Finch enforces rate limits on a per-product basis for both applications and access tokens. Rate limits are counted on a per-minute basis for each product. Each product has its own “bucket” with a 60-second Time-To-Live (TTL). The first request for a product starts the 60-second TTL for that product’s bucket, and rate limits reset after the 60-second period. If Finch returns a
429
HTTP status code, your application has exceeded the rate limit for a product. To reduce rate limit errors, you can implement a backoff strategy to retry requests when encountering rate limit errors.
Checkpoint + Next Step
After completing this step, your application will be able to interact with the Finch API endpoints, read the necessary data, and handle various error scenarios. This will enable you to provide a seamless experience to your users while leveraging Finch’s powerful API infrastructure. If all you need is to read data, the next step is to batch requests. If you need the ability to write data back to the provider, follow the Write Data step. Otherwise, you you can Prepare the Employer Experience.
Learn more
Was this page helpful?