> ## Documentation Index
> Fetch the complete documentation index at: https://docs.campfire.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Getting started

> How the Campfire API works: base URL, authentication, pagination, incremental sync, rate limits, errors and formats

This page covers the conventions every Campfire endpoint shares. Read it once before you build an integration, then use the [API reference](https://docs.campfire.ai/api-reference) for each endpoint's fields.

## Base URL and authentication

All requests go to:

```
https://api.meetcampfire.com
```

Every request needs an `Authorization` header. Which one depends on how you connect:

| You are building | Header | How to get it |
| - | - | - |
| An integration for your own Campfire account | `Authorization: Token YOUR_API_KEY` | Create an API key. See the [Quickstart](https://docs.campfire.ai/quickstart.md). API keys don't expire. |
| An app other Campfire customers connect to | `Authorization: Bearer cfa_...` | Use an [OAuth app](https://docs.campfire.ai/guides/oauth-apps.md). Access tokens expire after the number of seconds in the token response's `expires_in`; refresh them with the refresh token. |

The API user's role decides which objects it can read and change. Give each integration its own API user, with the narrowest role that covers what it does. Only a Super Admin key can manage webhooks and API keys; a key with any other role gets a `403`.

### Your first request

List two vendors:

```bash theme={null}
curl "https://api.meetcampfire.com/coa/api/vendor?limit=2" \
  -H "Authorization: Token $CAMPFIRE_API_KEY"
```

The response is a page of results (each vendor is trimmed to a few fields here):

```json theme={null}
{
  "count": 148,
  "next": "https://api.meetcampfire.com/coa/api/vendor?limit=2&offset=2",
  "previous": null,
  "results": [
    {
      "id": 5012,
      "name": "Acme Supplies",
      "vendor_type": "vendor",
      "last_modified_at": "2026-11-20T16:42:09+00:00"
    },
    {
      "id": 5013,
      "name": "Northwind Logistics",
      "vendor_type": "vendor",
      "last_modified_at": "2026-11-21T09:03:51+00:00"
    }
  ],
  "is_truncated": true,
  "truncation_message": "Showing 2 of 148 results. Use filters or pagination to see more."
}
```

A `401` means the header is missing or the key is wrong. A `403` means the API user's role doesn't allow that call.

## Pagination

List endpoints return one page at a time. Most support two ways to page: offset and cursor.

### Page size

| Parameter | Default | Maximum |
| - | - | - |
| `limit` | 100 | 10,000 |

A `limit` above 10,000 is treated as 10,000. A few endpoints use a different page size; their reference page says so.

Every page includes:

| Key | Meaning |
| - | - |
| `count` | Total number of matching records. On some large lists the total is cached for a few minutes, so it can briefly lag behind new records. |
| `next` | URL of the next page, or `null` on the last page. |
| `previous` | URL of the previous page in offset mode. Always `null` in cursor mode. |
| `results` | The records on this page. |
| `is_truncated` | `true` when `count` is larger than the number of records on this page. It is also `true` on the last page of a multi-page list, so don't use it to decide whether to keep paging. Use `next`. |
| `truncation_message` | A readable version of the above, present when `is_truncated` is `true`. |
| `pagination_mode` | `"cursor"` when the page was served in cursor mode. `"offset"` when you sent `cursor` but the sort can't be paged by cursor, with the reason in `pagination_mode_reason`. Otherwise absent. |

Stop paging when `next` is `null`.

> [!TIP]
>
> On large pulls, add `skip_count=1` to skip computing the total. `count` then becomes a lower bound: it tells you whether another page exists, not the total.

### Offset paging

Pass `limit` and `offset`, or follow `next`:

```bash theme={null}
curl "https://api.meetcampfire.com/coa/api/transaction?limit=1000&offset=2000" \
  -H "Authorization: Token $CAMPFIRE_API_KEY"
```

Offset paging is simple, but if records are added or deleted while you page, rows can shift between pages, so you may skip or repeat some. Use cursor paging for long or large pulls.

### Cursor paging

Cursor paging keeps your place by the last record you received rather than by a row number, so pages stay stable while data changes.

**1. Start with an empty cursor**

Add `cursor=` with no value to the first request:

```bash theme={null}
curl "https://api.meetcampfire.com/coa/api/transaction?limit=1000&cursor=" \
  -H "Authorization: Token $CAMPFIRE_API_KEY"
```

**2. Check the mode**

The response includes `"pagination_mode": "cursor"`. If it's `"offset"` or missing, the endpoint served the page with offset paging instead (see below).

**3. Follow next until it is null**

Request the `next` URL exactly as returned. It carries the cursor and your `limit`. Stop when `next` is `null`.

The cursor value is opaque. Don't parse it or build one yourself, and don't change `sort` partway through a walk. A cursor that is malformed, edited, or from a different sort returns `404` with `{"detail": "Invalid cursor."}` (or `"Cursor fields do not match current ordering."`). If you get one, start again with `cursor=`.

Cursor paging works with the endpoint's other filters, including `last_modified_at__gte` for [incremental sync](#incremental-sync).

#### Endpoints that support cursor paging

These endpoints are tested with cursor paging. Other list endpoints may accept `cursor` too; check for `"pagination_mode": "cursor"` in the response.

| Object | Endpoint |
| - | - |
| Transactions (GL lines) | `GET /coa/api/transaction` |
| Journal entries | `GET /coa/api/journal_entry` |
| Invoices | `GET /coa/api/v1/invoice` |
| Credit memos | `GET /coa/api/v1/credit-memo` |
| Vendors | `GET /coa/api/vendor` |
| Budgets | `GET /coa/api/budgets` |
| Contracts | `GET /rr/api/v1/contracts` |
| Customers | `GET /rr/api/v1/customers` |
| Products | `GET /rr/api/v1/product` |
| Approvals (draft queue) | `GET /ca/api/draft_queue` |

> [!WARNING]
>
> If you send `cursor=` with a sort that can't be cursor-paged (for example, sorting by a related object's name, or a grouped or pivoted transaction report), the endpoint serves offset pages instead. The response then has `"pagination_mode": "offset"` and a `pagination_mode_reason`; on accounts where this is still rolling out, `pagination_mode` is left out. Always check for `"pagination_mode": "cursor"`, and if you don't get it, keep following `next` — it still works, with offset semantics.

### Lighter transaction rows

`GET /coa/api/transaction` accepts `fields`, a comma-separated list of the fields you want back. `id` and `consolidation_currency` are always included, and unknown names are ignored. Asking for only the fields you need makes each page much smaller:

```bash theme={null}
curl "https://api.meetcampfire.com/coa/api/transaction?cursor=&limit=1000&fields=posted_at,account,debit_amount,credit_amount,last_modified_at" \
  -H "Authorization: Token $CAMPFIRE_API_KEY"
```

## Incremental sync

To keep a copy of Campfire data up to date, fetch only what changed since your last run instead of re-pulling everything.

**1. Filter by last modified time**

Pass `last_modified_at__gte` set to the high-water mark from your last run, minus an overlap (see the format rules below). The bound is inclusive.

**2. Page with the cursor**

Start with `cursor=` and follow `next` until it is `null`, as described in [Cursor paging](#cursor-paging). Add `skip_count=1` if you don't need the total.

**3. Save a new high-water mark**

Store the largest `last_modified_at` you received in this run. Next time, start from that value minus a few minutes, so records saved while your previous run was in progress aren't missed.

**4. De-duplicate by id**

The overlap means you'll see some records twice. Upsert by `id`, so a record you already have is simply updated.

**5. Pick up deletes**

Deleted records don't appear in normal results. Fetch them with `include_deleted=true` and `last_modified_at__gte`, which then filters by when the record was deleted. The response contains only deleted records; rely on each record's `id`, `is_deleted: true` and `deleted_at`, not on its other fields. Keep a separate high-water mark for deletes based on `deleted_at`, because a deleted record's `last_modified_at` is its last edit before the delete. For near-real-time changes, including deletes, subscribe to [webhooks](https://docs.campfire.ai/guides/webhooks.md).

> [!NOTE]
>
> With `include_deleted=true`, `cursor` and `skip_count` are ignored: the response uses offset paging with an exact `count`. Keep following `next` until it is `null`. `deleted_at` includes fractional seconds (`2026-11-20T16:42:09.446280+00:00`).

### Supported endpoints and formats

`last_modified_at__gte` and `last_modified_at__lte` accept a date (`2026-11-20`) or a timestamp in whole seconds with a timezone (`2026-11-20T16:42:09Z` or `2026-11-20T16:42:09+00:00`). A date means midnight UTC on that day. A timestamp is compared in its own timezone, so it must include one. Fractional seconds and timestamps without a timezone are not accepted. Both bounds are inclusive.

| Object | Endpoint | Accepts | A value it can't read |
| - | - | - | - |
| Transactions | `GET /coa/api/transaction` | **Date only** (`2026-11-20`) | Returns `400` |
| Journal entries | `GET /coa/api/journal_entry` | Timestamp or date | Returns `400` |
| Invoices | `GET /coa/api/v1/invoice` | Timestamp or date | Returns `400` |
| Bills | `GET /coa/api/v1/bill` | Timestamp or date | Returns every record |
| Credit memos | `GET /coa/api/v1/credit-memo` | Timestamp or date | Returns every record |
| Vendors | `GET /coa/api/vendor` | Timestamp or date | Returns every record |
| Entities | `GET /coa/api/entity` | Timestamp or date. Returns all matches in one array, without paging. `include_deleted` isn't supported; use [webhooks](https://docs.campfire.ai/guides/webhooks.md) to catch entity deletes. | Returns every record |
| Contracts | `GET /rr/api/v1/contracts` | Timestamp or date | Returns every record |
| Customers | `GET /rr/api/v1/customers` | Timestamp or date | Returns every record |

A date in `__lte` includes the whole day, except on `GET /rr/api/v1/customers` and with `include_deleted=true`, where it means the start of that day. To be safe, pass the next day's date or a full timestamp as the upper bound.

> [!WARNING]
>
> * **Transactions filter by day.** `GET /coa/api/transaction` accepts only a date, so for transactions, start each run from the day of your high-water mark (the overlap is up to one day) and rely on de-duplication by `id`.
> * **Journal entries default to recent dates.** Without `all_time=true`, `start_date` or `end_date`, `GET /coa/api/journal_entry` returns only entries dated from about six months ago through the end of the current month, even with `last_modified_at__gte`. Add `all_time=true` so edits to older or future-dated entries aren't missed.
> * **Line edits don't update the journal entry.** Editing one of a journal entry's lines changes that line's `last_modified_at`, not the journal entry's, so a journal entry sync skips it. To mirror GL lines, sync `GET /coa/api/transaction`.
> * **Some endpoints return every record when they can't read the value**, which silently turns an incremental pull into a full one. Send values exactly in the formats above, and URL-encode the `+` in an offset such as `+00:00` (`%2B00:00`) or use `Z`.

> [!TIP]
>
> For a full copy of your books in a data warehouse, ask your Campfire team about a Snowflake share or S3 export instead of paging through the API.

## Rate limits

| Caller | Limit | Counted per |
| - | - | - |
| API key | 10 requests per second | API user |
| OAuth app | 10 requests per second | Connection (each customer that connected your app) |
| Unauthenticated | 5 requests per second | IP address |

The limit is shared across endpoints. Treat 10 per second as a ceiling to stay under, not a guaranteed rate: a burst of parallel requests can briefly get more through, and the same limit then applies to the requests that follow. The unauthenticated limit applies only to endpoints that don't need a key; on other endpoints a request without credentials gets `401` first.

A request over the limit returns `429 Too Many Requests` with a `Retry-After` header giving the number of seconds to wait:

```json theme={null}
{"detail": "Request was throttled. Expected available in 1 second."}
```

When you get a `429`, wait the `Retry-After` seconds, then retry. If you run requests in parallel, cap the number in flight, and back off exponentially if you keep getting `429`s. Responses don't include `X-RateLimit-*` headers.

The custom report endpoints (`/ca/api/custom-reports`) and invoice report endpoints (`/coa/api/v1/invoice/report/...`) also reject identical `GET` requests repeated within one second. From the fifth identical request in a second they return `429` with `{"error": "Duplicate request", "detail": "Too many identical requests"}` and no `Retry-After`. If the repeats continue, they return `{"error": "Too many requests", "detail": "Too many repeated requests"}` with a `Retry-After` of up to 10 minutes. Cache report results instead of re-requesting them.

## Errors

Errors return a JSON body with a message under `error` or `detail`, depending on where the request failed. Read whichever is present, and branch on the status code rather than on the message text, which can change.

| Status | When | Example body |
| - | - | - |
| `400` | The request is invalid, or the change isn't allowed (for example, posting into a closed period). Field errors are combined into one message: each is prefixed with its field name (`currency: ...`, or `transactions[0].account: ...` for a field inside a list), and they're joined with `, `. | `{"error": "currency: This field is required."}` |
| `401` | The `Authorization` header is missing, or the key or token is invalid. An OAuth access token that has expired or been revoked gets the last message; refresh it. | `{"detail": "Authentication credentials were not provided."}`, `{"detail": "Invalid token."}` or `{"detail": "OAuth app token is invalid or has expired."}` |
| `403` | The API user's role doesn't allow the call. OAuth apps missing a scope also get a `WWW-Authenticate` header naming it; see [OAuth apps](https://docs.campfire.ai/guides/oauth-apps.md). | `{"detail": "You do not have permission to perform this action."}` |
| `404` | The record doesn't exist or belongs to another workspace, or the pagination cursor is invalid. The message names the object. A path that doesn't exist returns an HTML page instead of JSON, so check the URL if you can't parse the body. | `{"detail": "No Vendor matches the given query."}` |
| `409` | The record can't be deleted because other records depend on it, or a request with the same `Idempotency-Key` is still running. | `{"error": "Cannot complete this operation because the record is referenced by other objects that must be removed first."}` |
| `429` | You hit a [rate limit](#rate-limits). | `{"detail": "Request was throttled. Expected available in 1 second."}` |
| `500` | Something went wrong on our side. Include the `trace_id` when you contact support. | `{"error": "An unexpected error occurred. If it persists, contact support with the trace_id.", "trace_id": "..."}` |
| `504` | The request took too long. Narrow it with filters or a smaller `limit`, then retry. | `{"error": "The request took too long to process. Please try again."}` |

Retry `429`, `500` and `504` with backoff. Don't retry `400`, `401`, `403` or `404` without changing the request.

## Formats

| Type | Format | Example |
| - | - | - |
| Date | `YYYY-MM-DD` | `"2026-11-20"` |
| Timestamp | ISO-8601 in UTC, whole seconds. Deleted records' `deleted_at` includes fractional seconds, so accept both when parsing. | `"2026-11-20T16:42:09+00:00"` |
| Amounts and other decimals | JSON numbers on most endpoints; some revenue and usage endpoints return them as strings (`"1250.75"`). Accept both, and parse them as decimals rather than floating point. Values with more than about 15 significant digits may be rounded. An amount that doesn't apply is `null`, not `0`: a credit line has `debit_amount: null`. | `1250.75` |
| Currency | ISO 4217 three-letter code | `"USD"` |
| IDs | Integers | `5012` |

## Idempotency

`POST /coa/api/journal_entry` accepts an `Idempotency-Key` header, so a retried request doesn't create a second journal entry. Send a unique value (up to 255 letters, digits, `_`, `-`, `:` or `.`) per journal entry:

* Repeating the same key and body within 24 hours returns the original response, with an `Idempotent-Replayed: true` header.
* Reusing a key with a different body returns `400`.
* Reusing a key while the first request is still running returns `409`; retry shortly.

Don't rely on `Idempotency-Key` for other create endpoints. Before retrying one of those after a timeout or a `504`, check whether the record was already created.

## Sandbox

There's no separate sandbox host. The Campfire team can set up a sandbox workspace for you; it uses the same base URL, with its own API key. Otherwise, build and test against your own workspace: start with `GET` requests, and use an API user whose role allows only what your integration needs.

## Versioning

There is no global API version. Some paths include a version (`/coa/api/v1/invoice`, `/coa/api/v2/reconciliation`) and some don't (`/coa/api/transaction`); the version is part of that endpoint's path, so call each endpoint at the path in the API reference.

We change endpoints in a backward-compatible way: we add fields, parameters and endpoints, but don't remove or rename them or change their types without notice. When we retire something, we mark it deprecated in the API reference and announce it in the [changelog](https://docs.campfire.ai/changelog.md) before it's removed. Build your integration to ignore response fields it doesn't recognize.

## Next steps

> [card] [Webhooks](https://docs.campfire.ai/guides/webhooks.md)
>
> Get notified when records are created, updated or deleted.

> [card] [OAuth apps](https://docs.campfire.ai/guides/oauth-apps.md)
>
> Let other Campfire customers connect your software.

> [card] [API reference](https://docs.campfire.ai/api-reference)
>
> Every endpoint, with its parameters and fields.

> [card] [Changelog](https://docs.campfire.ai/changelog.md)
>
> New features, changes and deprecations.
