---
title: "REST API for developers | TheBusinessApp"
description: "TheBusinessApp REST API: scoped API keys, cursor pagination, idempotent writes and an OpenAPI 3.1 spec for customers, jobs, quotes, invoices and more."
url: https://thebusinessapp.co.uk/developers
---

# Build on TheBusinessApp.

A plain REST API over HTTPS with JSON in and out. Read and add customers, enquiries, jobs, quotes, invoices and more, download accounting export files, and get told the moment things change with signed webhooks.

Authentication Resources Exports Errors [Webhooks](https://thebusinessapp.co.uk/developers/webhooks)

- Base URL
  https://api.thebusinessapp.co.uk/v1
- Format
  JSON over HTTPS
- Rate limit
  120 a minute
  per key
- Spec
  [OpenAPI 3.1](https://api.thebusinessapp.co.uk/v1/openapi.json)

## Authentication

An owner or admin creates keys in **Settings → Developers**. Each key belongs to one company, is shown once, and is stored only as a hash. Give each integration its own key so you can revoke one without breaking the others.

Send the key as a bearer token on every request:

curl

```
curl https://api.thebusinessapp.co.uk/v1/me \
  -H "Authorization: Bearer tba_live_XXXXXXXX_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
```

**Scopes** limit what a key can do. They come in pairs per resource, such as `customers:read` and `customers:write`; write includes read. Accounting exports use `exports:read`. A full-access key holds `*`. Calls outside a key’s scopes return `403 insufficient_scope`.

The API can create *draft* quotes and invoices. It never sends documents to customers or takes payments; those stay in the app where someone can check them first. Staff records never include pay rates.

Keep keys on your server. Don’t put them in a web page or mobile app, where anyone can read them.

## Resources

Every list endpoint takes `limit` (1–100, default 25), `cursor`, `created_since` and, where records have one, `updated_since`. Get a single record with `GET /{resource}/{id}`. Resources follow the modules you have switched on; a switched-off module returns `403 module_disabled`.

| Path | Scope | Operations | Notes |
| --- | --- | --- | --- |
| /customers | customers:read /:write | list · get · create · update | Filters: email, status |
| /customers/{id}/contacts | customers:read /:write | list · create | Also GET /contacts?customer_id= |
| /customers/{id}/sites | customers:read /:write | list · create | Sites and properties. Also GET /sites |
| /enquiries | enquiries:read /:write | list · get · create | Leads land in your pipeline with source “api” |
| /quotes | quotes:read /:write | list · get · create draft | Totals are worked out for you. Sending stays in the app |
| /jobs | jobs:read /:write | list · get · create · update | PATCH status to move a job on, e.g. done |
| /jobs/{id}/visits | jobs:read /:write | list · create | PATCH /visits/{id} to change a visit’s status or time |
| /invoices | invoices:read /:write | list · get · create draft | Never sends, never takes payment |
| /payments | payments:read | list · get | Read only |
| /products | products:read /:write | list · get · create · update | Your price list |
| /staff | staff:read | list · get | Read only. Pay rates are never included |
| /timesheets | timesheets:read | list · get | Read only |
| /stock-items | stock:read | list · get | Stock per product and location. Read only |

Field names and types for every endpoint are in the [OpenAPI spec](https://api.thebusinessapp.co.uk/v1/openapi.json). Import it into Postman, Insomnia or a code generator.

## Accounting exports

The same export files the accountant hub produces, for scripts that send the books on a schedule. These endpoints are read-only and need the `exports:read` scope (a `*` key holds it too).

- `GET /exports` lists each package, its datasets and import notes.
- `GET /exports/{target}/{dataset}` returns the CSV as a file download. Optional `from` and `to` (YYYY-MM-DD) set the period. `since_last_export=true` leaves out records an earlier API export already returned. `format=json` wraps the file with row counts and totals; exports that produce more than one file always come back as JSON.

| target | Package | dataset |
| --- | --- | --- |
| xero | Xero | sales, bills, contacts, bank, payments |
| quickbooks | QuickBooks Online | sales, contacts, products, credits |
| sage50 | Sage 50 (UK) | sales, bills, payments, contacts |
| sage_bc | Sage Business Cloud | contacts, products, sales, bills |
| freeagent | FreeAgent | contacts, bank, sales |

curl

```
curl "https://api.thebusinessapp.co.uk/v1/exports/xero/sales?from=2026-07-01&to=2026-09-30&since_last_export=true" \
  -H "Authorization: Bearer $TBA_KEY" -o xero-sales.csv
```

Files are laid out for each package’s own import screen. Check the first import with your accountant before relying on it.

## Lists and pagination

Lists are newest first. When `has_more` is true, pass `next_cursor` back as `cursor` to get the next page. Cursors are stable while records are added, so you won’t skip or repeat rows.

request

```
curl "https://api.thebusinessapp.co.uk/v1/customers?limit=50&updated_since=2026-10-01T00:00:00Z" \
  -H "Authorization: Bearer $TBA_KEY"
```

response

```
{
  "object": "list",
  "data": [
    { "id": "6e48692e-69f2-4d1c-86f9-8047000df7e2", "object": "customer",
      "name": "Jane Smith", "email": "jane@example.com", "postcode": "BS1 4DJ",
      "status": "active", "tags": ["landlord"],
      "created_at": "2026-10-17T09:00:00Z", "updated_at": "2026-10-17T09:30:00Z" }
  ],
  "has_more": true,
  "next_cursor": "eyJjIjoiMjAyNi0xMC0xN1QwOTowMDowMFoiLCJpIjoiNmU0OC4uLiJ9"
}
```

For a nightly sync, store the time you started and pass it as `updated_since` next time:

javascript

```
// Node 18+: fetch every customer changed since the last sync
let cursor = null, all = []
do {
  const url = new URL('https://api.thebusinessapp.co.uk/v1/customers')
  url.searchParams.set('limit', '100')
  url.searchParams.set('updated_since', lastSync)
  if (cursor) url.searchParams.set('cursor', cursor)
  const res = await fetch(url, { headers: { Authorization: `Bearer ${process.env.TBA_KEY}` } })
  if (res.status === 429) { await new Promise((r) => setTimeout(r, Number(res.headers.get('Retry-After')) * 1000)); continue }
  const page = await res.json()
  all.push(...page.data)
  cursor = page.next_cursor
} while (cursor)
```

## Creating and updating

Send JSON with `Content-Type: application/json`. Create returns `201` with the new record; update (`PATCH`) changes only the fields you send. Unknown fields are rejected so typos show up straight away. Ids you link to, such as `customer_id`, must belong to your company.

create an enquiry

```
curl https://api.thebusinessapp.co.uk/v1/enquiries \
  -H "Authorization: Bearer $TBA_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: website-form-81723" \
  -d '{
    "name": "Sam Patel",
    "email": "sam@example.com",
    "phone": "07700 900123",
    "service": "Boiler service",
    "message": "Combi losing pressure, can you take a look this week?"
  }'
```

create a draft quote

```
curl https://api.thebusinessapp.co.uk/v1/quotes \
  -H "Authorization: Bearer $TBA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "customer_id": "6e48692e-69f2-4d1c-86f9-8047000df7e2",
    "title": "Bathroom refit",
    "items": [
      { "description": "Labour", "quantity": 8, "unit_price": 45, "vat_rate": 20 },
      { "description": "Thermostatic shower valve", "quantity": 1, "unit_price": 185, "vat_rate": 20 }
    ]
  }'
```

complete a job

```
curl -X PATCH https://api.thebusinessapp.co.uk/v1/jobs/2ce27819-cc51-48c5-ad61-14161d5f2dd6 \
  -H "Authorization: Bearer $TBA_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "status": "done" }'
```

### Idempotency

Add an `Idempotency-Key` header (any unique string up to 255 characters) to a POST or PATCH and you can retry it safely after a timeout. For 24 hours, repeating the same request with the same key returns the first response with `Idempotent-Replayed: true` instead of creating a duplicate. Reusing a key with a different body returns `422 idempotency_conflict`.

## Errors

Every error has the same shape. Branch on `error.code`, never on the message, which may change. Each response carries an `X-Request-Id` header.

example

```
HTTP/2 403
X-Request-Id: req_6938fce94a9a4a29becc

{
  "error": {
    "type": "permission_error",
    "code": "insufficient_scope",
    "message": "This API key lacks the `invoices:read` scope",
    "request_id": "req_6938fce94a9a4a29becc",
    "details": { "required_scope": "invoices:read" }
  }
}
```

| Status | Code | Meaning |
| --- | --- | --- |
| 400 | validation_failed / invalid_cursor | Body isn’t a JSON object, or the cursor was changed |
| 401 | unauthenticated / invalid_api_key | No key, a malformed key, or a revoked key |
| 403 | insufficient_scope | The key doesn’t hold the scope the endpoint needs (details.required_scope) |
| 403 | module_disabled | That area of the app is switched off in Settings → Modules |
| 404 | not_found | No record with that id in your organisation |
| 405 | method_not_allowed | The resource doesn’t support that method |
| 409 | idempotency_in_progress | The first request with this Idempotency-Key is still running |
| 422 | validation_failed | details.fields lists each bad field |
| 422 | idempotency_conflict | You reused an Idempotency-Key with a different body |
| 429 | rate_limited | Over the per-key limit; wait for Retry-After seconds |
| 500 | internal_error | Our fault. Quote the request_id if you contact us |

### Rate limits

Each key gets 120 requests a minute. Responses include `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset` (Unix seconds). Over the limit you get `429` with `Retry-After`. Need more? Get in touch.

### Versioning

The version is in the path (`/v1`). Within v1 we only add things: new endpoints, new optional fields, new event types. Breaking changes would come as `/v2`, with notice.

## Connect your other tools to one business app.

14 days free, no card. Bring your customers and price list across from a CSV, switch on what you need, and invite the team when you’re ready.

[Start free trial](https://app.thebusinessapp.co.uk/signup?utm_source=marketing&utm_medium=web&utm_campaign=start-free&utm_content=developers-foot) [See pricing](https://thebusinessapp.co.uk/pricing)

No card. Monthly, no contract. Cancel any time and take your data with you.
