> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.modex.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.modex.com/_mcp/server.

# Getting started

## Getting started

1. Get an API key (access token) by contacting [support@modex.com](mailto:support@modex.com) or your Modex Account Executive.
2. Send it as a bearer token on every request (see [Authentication](#authentication)).
3. Call `GET /v1/ping` to confirm the API is reachable, then call `GET /v1/resources/nmls/{nmls_id}` with any NMLS ID.
4. Browse every endpoint in the [API Reference](/api-reference), or download the [OpenAPI spec](https://docs.modex.com/openapi.json) to generate a client or import the API into your own tools.

## Base URL

`https://api.modex.com/v1`

All requests and responses are JSON. Every response is JSON, including errors, regardless of the `Accept` header you send.

## Authentication

Send your token as a bearer token on every request except **Ping**:

```
Authorization: Bearer <access_token>
```

Tokens are issued per user. The token's user must belong to an **active** Modex client.

| Situation                                     | Status                                               |
| --------------------------------------------- | ---------------------------------------------------- |
| Missing, malformed, revoked, or unknown token | 401 `authentication_error`                           |
| Token is valid but not enabled for the API    | 403 `permission_error` ("Invalid ability provided.") |
| Token's user has no active Modex client       | 403 `permission_error`                               |

## What your token can see

* **Active records only.** Inactive records return 404, as if they didn't exist.
* **State restrictions.** If your account is limited to certain states, loan officers, branches, real estate agents, and real estate offices outside those states return 404, and rosters leave them out. Companies and lender beneficiaries aren't state-restricted.
* **Feature access.** Lender beneficiary data, real estate data, and contact access are enabled per account. When one isn't enabled, its endpoints (and the `lender_beneficiaries` include) return 403.

## Rate limits

600 requests per minute per token. Every response carries:

| Header                  | Meaning                             |
| ----------------------- | ----------------------------------- |
| `X-RateLimit-Limit`     | Requests allowed per minute (600)   |
| `X-RateLimit-Remaining` | Requests left in the current minute |

Going over returns **429** `rate_limit_error` with `Retry-After` (seconds to wait) and `X-RateLimit-Reset` (Unix time the window resets).

## IDs

Every record is identified by a Modex UUID. Detail, workforce, and roster endpoints take the **UUID, not the NMLS ID**. To start from an NMLS ID, call **Resolve NMLS ID** and follow the returned `uri`.

## Includes

Detail and roster endpoints return a small base record. Add sections with `include`, comma-separated:

```
GET /v1/resources/loan-officers/{id}?include=mortgage,licenses,employment
```

| Include                 | Company | Branch |   Loan officer   | Lender beneficiary | RE agent | RE office |
| ----------------------- | :-----: | :----: | :--------------: | :----------------: | :------: | :-------: |
| `mortgage`              |    ✓    |    ✓   |         ✓        |          ✓         |   ✓ \*   |    ✓ \*   |
| `non_qm`                |    ✓    |    ✓   |         ✓        |                    |          |           |
| `lender_beneficiaries`  |    ✓    |    ✓   |         ✓        |                    |          |           |
| `census`                |    ✓    |    ✓   |         ✓        |          ✓         |     ✓    |     ✓     |
| `licenses`              |    ✓    |    ✓   |         ✓        |                    |          |           |
| `trade_names`           |    ✓    |    ✓   |                  |                    |          |           |
| `federal_registrations` |    ✓    |        | ✓ (with history) |                    |          |           |
| `employment`            |         |        |         ✓        |                    |          |           |
| `real_estate`           |         |        |                  |                    |     ✓    |     ✓     |
| `contacts`              |         |        |         ✓        |                    |     ✓    |           |

\* For agents and offices, `mortgage` has a different shape (see **Real estate `mortgage`** below).

Roster endpoints accept the same includes as the matching single-record endpoint. Asking for an include a record type doesn't support returns **400** `The include [name] is not supported.`

Field-by-field definitions for every include are on [Includes and field reference](/includes).

## Data windows

* **`mortgage`, `non_qm`, `lender_beneficiaries`, `census`, `real_estate`** cover a rolling **12 months**: from the first day of the month 11 months before Modex's latest data refresh, through the refresh date. They don't take a timeframe parameter.
* **Workforce** endpoints take a `timeframe` parameter: `3`, `6`, `9`, or `12` (months), `ytd`, or a calendar year from `2019` to `2025`. Default is `12`.
* Dollar amounts (`volume`, `sum`, `average`, `average_monthly`) are whole US dollars. `units` and `count` are numbers of transactions.
* A record with no activity in the window returns `null` totals and empty lists, not zeros. Treat that as "no production in the window."
* Dates are `YYYY-MM-DD`. Timestamps are ISO 8601 with an offset.

## Pagination

Roster and list endpoints are cursor-paginated:

| Parameter | Description                                                                              |
| --------- | ---------------------------------------------------------------------------------------- |
| `limit`   | Page size. Default 25, maximum 100 (larger values are capped at 100).                    |
| `cursor`  | The `next_cursor` (or `prev_cursor`) from the previous page. Omit it for the first page. |

```json
{
  "data": [ ... ],
  "pagination": {
    "per_page": 25,
    "next_cursor": "eyJsb2Fu...",
    "next_page_url": "https://api.modex.com/v1/...&cursor=eyJsb2Fu...",
    "prev_cursor": null,
    "prev_page_url": null
  }
}
```

Keep requesting `next_page_url` until `next_cursor` is `null`. Rosters are ordered by record ID, so pages are stable while you walk them.

## Errors

Every error uses the same envelope:

```json
{
  "error": {
    "type": "invalid_request",
    "code": "validation_error",
    "message": "The ids field is required.",
    "details": { "ids": ["The ids field is required."] }
  }
}
```

`details` appears only on validation errors and maps each field to its messages.

| Status | `type`                 | `code`                 | When                                                                                                             |
| ------ | ---------------------- | ---------------------- | ---------------------------------------------------------------------------------------------------------------- |
| 400    | `invalid_request`      | `invalid_request`      | Unsupported include, invalid `timeframe`, `limit` below 1, or a malformed `cursor`                               |
| 401    | `authentication_error` | `authentication_error` | Missing or invalid token                                                                                         |
| 403    | `permission_error`     | `permission_error`     | Token not enabled for the API, no active client, feature not enabled for your account, or a client you don't own |
| 404    | `not_found`            | `not_found`            | Record doesn't exist, is inactive, or is outside your state restrictions; unknown path; a non-UUID ID            |
| 422    | `invalid_request`      | `validation_error`     | Request body failed validation; see `details`                                                                    |
| 429    | `rate_limit_error`     | `rate_limit_error`     | Over 600 requests per minute                                                                                     |
| 500    | `api_error`            | `api_error`            | Unexpected server error. Retry with backoff, and contact support if it persists.                                 |

Questions or issues: [support@modex.com](mailto:support@modex.com).