How to integrate with FreeAgent: From the sandbox to the first read and write
FreeAgent is integrated through a REST API that runs on a sandbox and a production host. You register your own app, send each customer through OAuth 2.0 and receive an access token and a refresh token for the user who authorised it. This guide follows that path in order: environments, authentication, token lifetimes, access levels, reading, writing, rate limits, change detection and production.


FreeAgent’s REST API in sandbox and production
FreeAgent’s API is a REST API over HTTPS. Requests and responses are JSON or XML, selected with the Accept and Content-Type headers, and FreeAgent requires a User-Agent header that identifies your app.
The API runs on two hosts. Production is api.freeagent.com and the sandbox is api.sandbox.freeagent.com. The sandbox has accounts of its own: you sign up for a free temporary account and complete its setup stages, because FreeAgent warns of unexpected error messages from the API otherwise.
The paths are the same on both hosts, so a request moves from the sandbox to production by changing the server. The later examples in this guide use the production host. The operation is the HTTP verb: GET requests a resource, POST creates one, PUT updates one and DELETE deletes one.
Sandbox https://api.sandbox.freeagent.comProduction https://api.freeagent.comGET /v2/company HTTP/1.1Host: api.sandbox.freeagent.comAuthorization: Bearer <access token>Accept: application/jsonUser-Agent: YourProduct/1.0
GET /v2/company returns the company the access token belongs to. FreeAgent uses this request as the first example in its quick start.
Hosts, formats, verbs and the user agent requirement from FreeAgent’s API introduction and its OAuth 2.0 guide, the sandbox account and the first request from its quick start, checked 13 November 2026.
FreeAgent offers API access for two products: online accounting for companies and a practice dashboard for accountants and bookkeepers whose clients use FreeAgent. According to its introduction you need different apps to access the two. This guide covers the API for companies.
Which objects can be read and written through maesn is listed on the FreeAgent API page.
FreeAgent has announced versioning for changes that are not backwards compatible. Every endpoint will accept a version in the X-Api-Version header, in date format, for example 2024-10-01. Without the header a request receives the behaviour from before versioning. According to FreeAgent this should mean that integrations without the header still work as normal.
The two products from FreeAgent’s API introduction, the version header from its page on versioning, checked 13 November 2026.
Authenticating with OAuth 2.0 and an app you register yourself
FreeAgent authenticates with OAuth 2.0 and an authorisation code. You register an app in the FreeAgent Developer Dashboard and receive an OAuth identifier and an OAuth secret. The two are the client ID and the client secret of the flow.
The flow has four steps. At the end your application holds an access token and a refresh token for the FreeAgent user who authorised it.
- 1
Your application redirects the customer to FreeAgent
client_idresponse_typeredirect_uristate
The redirect URI has to match one that is registered for your app.
- 2
The customer logs in and approves the app
Login and approval take place on FreeAgent’s side.
- 3
FreeAgent redirects to your redirect URI
codestate
The authorisation code expires after 15 minutes.
- 4
Your server exchanges the code for tokens
access_tokenrefresh_token
One request to the token endpoint returns both tokens.
Store both tokens for the user who authorised. The access token is part of every request, and the refresh token renews it.
GET https://api.freeagent.com/v2/approve_app?client_id=<OAuth identifier>&response_type=code&redirect_uri=https%3A%2F%2Fapp.example.com%2Fcallback&state=<state value>GET https://app.example.com/callback?code=<authorisation code>&state=<state value>
redirect_uri is URL-escaped and has to match a redirect URI registered for the app. state is optional, contains the state of your app and comes back on the redirect.
POST /v2/token_endpoint HTTP/1.1Host: api.freeagent.comAuthorization: Basic <base64(OAuth identifier:OAuth secret)>grant_type=authorization_code&code=<authorisation code>&redirect_uri=https%3A%2F%2Fapp.example.com%2Fcallback
The request uses HTTP Basic authentication with the OAuth identifier as the username and the OAuth secret as the password. FreeAgent’s example sends the parameters form-encoded in the POST body, and redirect_uri is required only if the authorisation request specified one.
The authorisation code expires after 15 minutes. After the exchange, every API request includes the access token as a bearer token in the Authorization header.
The authorisation request specifies no scope. Which resources a connection reaches depends on the permissions of the user who authorised the app, and the section on access levels describes them.
Endpoints, parameters, both requests and the 15 minutes from FreeAgent’s OAuth 2.0 guide, the OAuth identifier and secret from its quick start, checked 13 November 2026.
Token lifetimes and the refresh request
The token endpoint returns an access token and a refresh token. The access token is valid for one hour. FreeAgent’s guide adds that this “may change in future”, so read the lifetime from expires_in in the response.
{"access_token": "<access token>","token_type": "bearer","expires_in": 3600,"refresh_token": "<refresh token>","refresh_token_expires_in": 631151957}
expires_in is the lifetime of the access token, one hour. refresh_token_expires_in is the lifetime of the refresh token, and the value in FreeAgent’s example corresponds to about 20 years.
When the access token has expired, your application sends a refresh request to the same endpoint, again with HTTP Basic authentication.
POST /v2/token_endpoint HTTP/1.1Host: api.freeagent.comAuthorization: Basic <base64(OAuth identifier:OAuth secret)>grant_type=refresh_token&refresh_token=<latest refresh token>
The response has the same fields as the first token response, including a refresh token.
FreeAgent describes the content of that response as “the new access and refresh tokens”. Your application therefore stores the refresh token from each response and sends that one in the next refresh request.
A refresh can wait until the token has expired. The guide states: “It is not necessary to refresh the access token before the old access token expires”. It suggests refreshing on the next use after expiry.
FreeAgent allows 15 token refreshes per minute for each user of your integration. A refresh request above that limit returns HTTP 429, like any other throttled request.
Lifetimes, field names, the refresh request and both quotations from FreeAgent’s OAuth 2.0 guide, the limit on refreshes from its API introduction, checked 13 November 2026.
What the access level is and which attributes depend on it
The access level is the permission level of a FreeAgent user, a number from 0 to 8. FreeAgent issues one access token for each user who authorises your app, and access to resources is limited by the permissions of that user.
| Level | Name |
|---|---|
| 0 | No Access |
| 1 | Time |
| 2 | My Money |
| 3 | Contacts & Projects |
| 4 | Invoices, Estimates & Files |
| 5 | Bills |
| 6 | Banking |
| 7 | Tax, Accounting & Users |
| 8 | Full |
Your application reads the level of the current user with GET /v2/users/me, in the attribute permission_level. GET /v2/company returns the company of that user, with its id and its subdomain.
Every resource states a minimum access level, and within a resource the level can limit the attributes. The contacts resource requires Time, level 1. Its attribute table has a divider with the words “Additional attributes available to users with Contacts & Projects permission”, which is level 3.
- url
- first_name
- last_name
- organisation_name
- active_projects_count
- direct_debit_mandate_state
- created_at
- updated_at
A user at the minimum access level of the contacts resource receives the attributes above the divider.
- billing_email
- phone_number
- mobile
- address1
- address2
- address3
- town
- region
- postcode
- country
- uses_contact_invoice_sequence
- contact_name_on_invoices
- charge_sales_tax
- sales_tax_registration_number
- status
- default_payment_terms_in_days
- locale
- is_cis_subcontractor
- cis_deduction_rate
- unique_tax_reference
- subcontractor_verification_number
The attributes below the divider. The four with a dashed border are present only if CIS for Contractors is enabled for the company.
A contact read by a user below level 3 therefore contains the attributes above the divider, among them the name, the URL and the timestamps. The email address, the postal address, the payment terms and the sales tax registration number are among the attributes below the divider.
Four attributes below the divider have a second condition. The CIS attributes are present only if CIS for Contractors is enabled for the company.
Request GET /v2/users/me once after the connection is made and store permission_level with the tokens. The users reference states Time as the minimum access level of this request. If your product needs the email address or the payment terms of a contact, the connecting user needs at least level 3.
The scale and the rule from FreeAgent’s API introduction, the divider and the CIS condition from its contacts reference, permission_level from its users reference, the company attributes from its company reference, checked 13 November 2026.
Reading contacts with a view filter and pagination in the Link header
A list is read with GET on the resource and a single record with GET on its URL. The example reads contacts. FreeAgent keeps customers and suppliers in one resource, /v2/contacts, and the view parameter selects which of them a list contains.
GET /v2/contacts?view=clients&page=1&per_page=100 HTTP/1.1Host: api.freeagent.comAuthorization: Bearer <access token>Accept: application/jsonUser-Agent: YourProduct/1.0
The response is a JSON object with the array contacts. Each entry contains its identifier in url, for example https://api.freeagent.com/v2/contacts/2.
Without the view parameter a list contains active contacts only. view=all returns every contact, view=clients all clients, view=suppliers only active suppliers and view=hidden the hidden contacts.
FreeAgent sets the two roles itself. According to its support documentation a contact becomes a customer, in the API a client, when an invoice is recorded for it, and a supplier when a bill is added for it.
A list is paginated with 25 items by default. The parameter per_page sets that number up to a maximum of 100, and page=2 requests the second page. The response returns the URLs of the previous, next, first and last page in the Link header, and the total number of entries in X-Total-Count.
Link: <https://api.freeagent.com/v2/invoices?page=4&per_page=50>; rel="prev",<https://api.freeagent.com/v2/invoices?page=6&per_page=50>; rel="next",<https://api.freeagent.com/v2/invoices?page=1&per_page=50>; rel="first",<https://api.freeagent.com/v2/invoices?page=10&per_page=50>; rel="last"
The line breaks are for display only. The possible rel values are prev, next, first and last.
The default sort order of contacts is by name. sort=updated_at sorts by the time of the last modification, and a hyphen in front of the value reverses the order.
Each contact is identified by its url attribute, which the reference describes as “The unique identifier for the contact”. References between records contain the same URL: an invoice names its contact in an attribute of the kind URI. Store the URL as the key of a record.
Views, sort orders and the identifier from FreeAgent’s contacts reference, the reference to a contact from its invoices reference, the two roles from its support article on customers and suppliers, pagination and both headers from its API introduction, checked 13 November 2026.
Writing a contact with POST and PUT
A create is a POST to the resource, and an update is a PUT to the URL of the record. The body has a root element named after the resource, in this example contact.
POST /v2/contacts HTTP/1.1Host: api.freeagent.comAuthorization: Bearer <access token>Content-Type: application/jsonAccept: application/jsonUser-Agent: YourProduct/1.0{"contact": {"organisation_name": "Acme Ltd","email": "billing@example.com","default_payment_terms_in_days": 30}}HTTP/1.1 201 CreatedLocation: https://api.freeagent.com/v2/contacts/70
The Location header contains the URL of the new contact, and the response body returns the contact with the same value in url. email and default_payment_terms_in_days are among the attributes FreeAgent lists for users with Contacts & Projects permission.
A contact needs a name. organisation_name is required if first_name and last_name are not specified, and the two are required if organisation_name is not. A contact marked as a CIS subcontractor also requires cis_deduction_rate.
An update contains the attributes that change. The reference describes the body of the PUT as the root element with the attributes “that should be updated”, and the response is 200 OK.
PUT /v2/contacts/70 HTTP/1.1Host: api.freeagent.comAuthorization: Bearer <access token>Content-Type: application/jsonAccept: application/jsonUser-Agent: YourProduct/1.0{"contact": {"default_payment_terms_in_days": 14}}HTTP/1.1 200 OK
The path contains the ID from the URL of the contact. A DELETE to the same URL deletes the contact and also returns 200 OK.
Both requests, the root element, the required attributes and the status codes from FreeAgent’s contacts reference, checked 13 November 2026.
Rate limits per user, per minute and per hour
FreeAgent enforces three rate limits. Each is counted for one user of your integration, so every connected user has limits of their own. The counters are reset at the start of every minute and every hour.
| Counted | Limit |
|---|---|
| Requests | 120 per minute |
| Requests | 3.600 per hour |
| Token refreshes | 15 per minute |
A request above a limit returns HTTP 429 until the restriction has expired. The response contains a Retry-After header, and FreeAgent asks integrations to back off before retrying. It reviews apps that continue to send a high volume of requests while rate limited and may restrict them further.
HTTP/1.1 429 Too Many RequestsDate: Wed, 27 Mar 2019 20:47:40 GMTRetry-After: 60You must not exceed 15 requests per 60 seconds
The example is the response to a token refresh above the limit of 15 per minute.
A request to the sandbox with the header X-RateLimit-Test: true lowers the limit to 5 requests per minute, so the handling of a 429 can be tested without reaching the regular limits.
Every figure, the 429 example and the test header from FreeAgent’s API introduction, checked 13 November 2026.
Detecting changes with updated_since, directly and through maesn
An integration detects changes in FreeAgent with a scheduled request that uses the updated_since filter. The filter takes a date and time in ISO 8601 format and limits a list to the records updated since then. FreeAgent’s API documentation describes no webhooks.
GET /v2/contacts?updated_since=2026-11-01T09:00:00.000Z HTTP/1.1Host: api.freeagent.comAuthorization: Bearer <access token>Accept: application/jsonUser-Agent: YourProduct/1.0
Each contact in the response contains updated_at, the time of its last update in UTC.
FreeAgent added the filter endpoint by endpoint. Its changelog lists it for invoices, bills, timeslips, estimates, expenses, bank transactions and bank transaction explanations since 22 May 2017 and for contacts since 21 April 2025. Since 3 June 2025 it can be combined with the from_date and to_date filters on endpoints that offer them.
The filter and updated_at from FreeAgent’s contacts reference, the three dates from its changelog, the list of documented resources from its API introduction, checked 13 November 2026.
Through maesn this scheduled request uses one filter for the systems you connect. You pass the timestamp of your last fetch and receive the objects that are new or changed since then, so the request is written once and not once per target system.
Moving from the sandbox to production
A sandbox account is a temporary test account. For live data your customers authorise your app with their own FreeAgent accounts:
- The host. The two OAuth endpoints and every API request move from
api.sandbox.freeagent.comtoapi.freeagent.com. - The tokens. For every user who authorises the app, your application receives an access token and a refresh token and stores them for that user.
Access to the API is free according to FreeAgent’s API terms. The same terms reserve the right to introduce fees with at least 30 days’ notice.
A listing in FreeAgent’s Integrations Directory is a separate step, requested by email. To qualify, an integration needs at least three paying customers, and its provider commits to first-line support and ongoing maintenance. Integrations without paying customers are evaluated case by case.
The change of host and the tokens per user from FreeAgent’s quick start and its OAuth 2.0 guide, the fees from its API terms, the listing conditions from the start page of its API documentation, checked 13 November 2026.
FreeAgent through maesn: What the Unified API handles for you
The sections above describe what a direct integration implements for one system. Through maesn you reach FreeAgent with the same REST API and the same common data model as every other supported system, and these parts are handled on our side:
- The authorisation flow. The redirect URI of your app points to maesn, so the exchange of the authorisation code and the token requests run on our side. A FreeAgent account holds one company, so the redirect is the whole flow for your customer.
- The tokens. The access token is refreshed per connection, and the refresh token from the latest response is the one we keep.
- Change detection. One filter returns the objects that are new or changed since a timestamp, in the same form for the systems you connect.
What stays in your product is the app itself. You register it in the FreeAgent Developer Dashboard and submit its OAuth identifier and secret to maesn. Which user connects stays with your customer, and the access level of that user decides which attributes of a contact FreeAgent returns.
How fields outside the common data model are handled is described on the customisation handling page.
Frequently asked questions
Does FreeAgent return JSON or XML?
What is the FreeAgent Accountancy Practice API?
Do FreeAgent refresh tokens expire?
How do I rotate the OAuth secret of a FreeAgent app?
Where do I find the subdomain of a FreeAgent company?
Which access level does a FreeAgent resource require?

State of Accounting API Connectivity 2027: Data on 31 Systems
How 31 accounting and ERP systems handle API access: OAuth, credential lifetimes, revocation, webhooks and ledger data. Collected in October and November 2026.
Lennart Svensson · 24 Nov 2026
Lexware Office Partnership Guide: Public API or Partner Route
The Lexware Office Public API runs on an API key from the XL plan. Reaching every plan takes a technology partnership. How Lexware's qualification works.
Dr. Themo Voswinckel · 24 Nov 2026
Chart of Accounts Mapping: Cover Every ERP Customisation
Map each object in your platform to the right account, tax code, dimension and company code in your customer's ERP. Standard and custom configuration in one step.
Dr. Themo Voswinckel · 2 Nov 2026Build once on the Unified API.
An access level on every user, URLs as record identifiers and pagination in a response header: that is the contract of one system, and the next system you connect has a different one. Through maesn you build against one interface for all of them.