Skip to main content
This guide walks you through the core path to offering accounting in your product with Layer: authenticate, onboard a business, pass in financial data, and surface it back to your users. For the concepts behind these steps, see Key concepts.

Prerequisites

Before getting started with Layer’s API, you will need:
  • A Layer account. Reach out to your Layer contact or contact our team.
  • Client credentials (client_id and client_secret) provided by Layer.

Environments

Layer provides two environments for development and production use:
EnvironmentBase URLOAuth Scope
Sandboxhttps://sandbox.layerfi.comhttps://sandbox.layerfi.com/sandbox
Productionhttps://api.layerfi.comhttps://api.layerfi.com/production
Use sandbox for development and testing. All examples in this guide use the sandbox environment.
1

Get a bearer token

Layer uses OAuth2’s client credentials flow to authenticate API clients. Calls to the Layer API require a bearer access token. To receive one, provide your client_id and client_secret in the body of a POST request to Layer’s authorization server.
curl -X POST https://auth.layerfi.com/oauth2/token  \
  -u <client_id>:<client_secret>  \
  -H "Content-Type: application/x-www-form-urlencoded" \
  --data-urlencode "grant_type=client_credentials" \
  --data-urlencode "scope=https://sandbox.layerfi.com/sandbox" \
  --data-urlencode "client_id=<client_id>"
The authorization server will respond with your granted access token:
{
  "access_token": "<access_token>",
  "expires_in": 3600,
  "token_type": "Bearer"
}
Extract the access_token value from the response. You’ll use this in the Authorization header for all API requests.
2

Make a test API call

Use the access token to make a request to the API by including it as a Bearer token in the authorization header.
curl https://sandbox.layerfi.com/whoami \
  -H "Authorization: Bearer <access_token>" 
The API will respond with your client name and client id:
{
  "data":{
    "type":"whoami",
    "clientName":"Layer Example",
    "clientId":"018f1657-dc66-7482-917b-c0c0e532f52b"
  }
}
Access tokens expire after 1 hour. To refresh your access token, make another call to Layer’s authorization endpoint with your client_id and client_secret. We recommend refreshing tokens for new sets of requests rather than persisting access tokens.
3

Onboard a business

Each of your SMB customers is represented in Layer as a Business. Creating one also provisions its General Ledger, where all accounting data is stored.See Onboarding a Business for the full flow, then create a business via the API.
4

Connect or import financial data

Pass your customers’ financial activity to Layer so it can be categorized, reconciled, and reported on.
5

Surface accounting in your product

Choose how to display accounting features. Either method can deliver any capability, and you can mix them.

Next steps

Key concepts

Understand platforms, businesses, and the general ledger.

Embedding UI components

Add Layer’s pre-built components to your frontend.

Onboard a business

Create your first business and connect its data.

MCP server

Give AI agents access to Layer via Model Context Protocol.