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

# API overview

> Connect your real estate data to other systems with the Spacebase Enterprise API — authentication, permissions, and available resources.

The Spacebase API lets you connect your real estate data with other products and services. Read your lease portfolio programmatically, keep headcount and capacity up to date, manage invoices and payments, and configure [webhooks](/api/webhooks) — all over a standard JSON REST API.

## Who can use the API

<Info>
  The API is available on the **Enterprise** plan and requires an API token. Every request must be authenticated by a user on an Enterprise plan who holds a token.
</Info>

To get started, open the **Account** menu in the top right corner and select **Enterprise API**. If you're an Enterprise customer, ask your account manager for instructions on getting set up with an API token. If you're not on an Enterprise plan yet, contact [support@spacebaseapp.com](mailto:support@spacebaseapp.com) to learn about upgrading.

A few things to know about access:

* **Data is scoped to your company.** Every endpoint returns only your own company's data — there's no way to see or modify another company's records.
* **Your in-app permissions apply.** Some resources require the same permissions you'd need in the Spacebase UI. For example, managing users through the API requires the manage company users permission, and custom fields and webhooks require the manage company settings permission.
* **Module availability applies.** Invoice and payment endpoints require the payments module, and journal entry exports require the accounting module.
* **Leases must be published.** Draft leases aren't accessible through the API.

## Authentication

The API uses token authentication. Include your token in the `Authorization` header of every request, prefixed by `Token`:

```bash theme={null}
curl https://spacebaseapp.com/api/leases/ \
  -H "Authorization: Token your-token-key"
```

If you're signed in to Spacebase in your browser, you can retrieve your token from the `/api/token/` endpoint:

```bash theme={null}
GET /api/token/
```

```json theme={null}
[
  {
    "key": "your-token-key"
  }
]
```

<Warning>
  Treat your API token like a password. It grants the same access as your Spacebase account — store it in a secrets manager and never commit it to source control.
</Warning>

## Requests and responses

* **Base path** — all endpoints live under `/api/` on your Spacebase domain.
* **Format** — JSON for all requests and responses. Send `Content-Type: application/json` on writes.
* **Dates** — timestamps use ISO 8601 (`2026-07-01T00:00:00Z`); plain dates use `YYYY-MM-DD`.
* **Pagination** — list endpoints return 10 results per page. Use `?page=2` to move through pages; each response includes `count`, `next`, and `previous` alongside `results`:

```json theme={null}
{
  "count": 42,
  "next": "https://spacebaseapp.com/api/leases/?page=2",
  "previous": null,
  "results": []
}
```

## Available resources

| Resource              | Base path                                   | What you can do                                                                      |
| --------------------- | ------------------------------------------- | ------------------------------------------------------------------------------------ |
| Token                 | `/api/token/`                               | Retrieve your API token                                                              |
| Users                 | `/api/users/`                               | List and update users in your company (looked up by email)                           |
| Leases                | `/api/leases/`                              | List leases and retrieve full lease data (read-only)                                 |
| Lease custom fields   | `/api/leases/{uid}/custom-fields/`          | Read and update custom field values on a lease                                       |
| Custom fields         | `/api/custom-fields/`                       | Create, update, and delete your company's custom field definitions                   |
| Custom field options  | `/api/custom-fields/{slug}/options/`        | Manage the options of a dropdown custom field                                        |
| Headcount             | `/api/leases/{uid}/headcount/`              | Read headcount history; create and update monthly headcount by type                  |
| Capacity              | `/api/leases/{uid}/capacity/`               | Read capacity history; create and update monthly capacity                            |
| Invoices              | `/api/invoices/`                            | List, retrieve, and update invoices; create via `/api/leases/{uid}/invoices/create/` |
| Invoice expenses      | `/api/invoices/{uid}/expenses/`             | List the expenses on an invoice                                                      |
| Invoice payments      | `/api/invoices/{uid}/payments/`             | List and record payments (single or bulk)                                            |
| Journal entry exports | `/api/integration-exports/journal-entries/` | List and update journal entry export records                                         |
| Webhooks              | `/api/webhooks/`                            | Create and manage [webhook endpoints](/api/webhooks)                                 |

Notes on specific resources:

* **Leases** support a `?modified_after=` filter with an ISO 8601 timestamp, so you can fetch only leases that changed since your last sync — for example `/api/leases/?modified_after=2026-07-01T00:00:00Z`.
* **Invoices** support filtering by `?status=`, `?integration_status=`, `?lease_id=`, and `?payable_to=`.
* **Headcount and capacity** records are monthly: dates must fall on the first of a month within the lease's commencement and expiration dates, and the lease's property type must have headcount tracking enabled.

## Common examples

<CodeGroup>
  ```bash List recently changed leases theme={null}
  curl "https://spacebaseapp.com/api/leases/?modified_after=2026-07-01T00:00:00Z" \
    -H "Authorization: Token your-token-key"
  ```

  ```bash Retrieve a lease theme={null}
  curl https://spacebaseapp.com/api/leases/{lease_uid}/ \
    -H "Authorization: Token your-token-key"
  ```

  ```bash Update headcount for a month theme={null}
  curl -X PUT https://spacebaseapp.com/api/leases/{lease_uid}/headcount/2026-07-01/employees/ \
    -H "Authorization: Token your-token-key" \
    -H "Content-Type: application/json" \
    -d '{"date": "2026-07-01", "amount": 150}'
  ```

  ```bash Update a custom field value theme={null}
  curl -X PATCH https://spacebaseapp.com/api/leases/{lease_uid}/custom-fields/ \
    -H "Authorization: Token your-token-key" \
    -H "Content-Type: application/json" \
    -d '{"gl-code": "6400-100"}'
  ```
</CodeGroup>

## Interactive API reference

Full request and response schemas for every endpoint live in the interactive reference built into Spacebase:

* **API reference** — `https://spacebaseapp.com/api/documentation/` documents each endpoint, its parameters, and its response format.
* **Browsable API** — while signed in, visit `/api/` in your browser to explore the live API root and click through your own data.

Both require the same Enterprise plan and API token access as the API itself.

## FAQ

<AccordionGroup>
  <Accordion title="I'm getting a 401 or 403 response">
    Work through these checks:

    1. Your `Authorization` header uses the exact format `Token your-token-key` — the word `Token`, a space, then the key.
    2. Your company is on an Enterprise plan and your user has been issued an API token.
    3. The endpoint doesn't require an extra permission you're missing — for example, invoice endpoints require payments permissions and the payments module, and user management requires the manage company users permission.
  </Accordion>

  <Accordion title="Why doesn't a lease appear in the API?">
    Only **published** leases are available through the API. Draft leases and leases outside your user's access (if your account is limited to a subset of leases) won't appear.
  </Accordion>

  <Accordion title="Is there a rate limit?">
    There's no published rate limit today. For efficient syncing, use the `?modified_after=` filter on leases rather than repeatedly fetching your full portfolio, and consider [webhooks](/api/webhooks) to be notified of changes instead of polling.
  </Accordion>

  <Accordion title="How do I get notified when data changes?">
    Set up [webhooks](/api/webhooks). Spacebase sends a signed POST request to your endpoint whenever a subscribed resource is created, updated, or deleted — no polling required.
  </Accordion>

  <Accordion title="Can I create leases through the API?">
    No — leases are read-only through the API. Leases are created and abstracted in the Spacebase app. You can, however, update a lease's custom field values, headcount, and capacity through the API.
  </Accordion>
</AccordionGroup>
