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

# Customers

> Create, manage, and close customer records.

A **customer** is a borrower record. Every loan in the system is tied
to exactly one customer. New customers created via this API are
**Active immediately** — there's no pending state for partners to
manage. The remaining lifecycle transition is just Active → Closed.

## The customer object

<ResponseField name="id" type="string">
  Unique customer identifier. Treat as opaque.
</ResponseField>

<ResponseField name="accountNo" type="string">
  Human-readable account number assigned at creation.
</ResponseField>

<ResponseField name="externalId" type="string">
  Optional client-assigned external ID. Useful for correlating to your
  own systems.
</ResponseField>

<ResponseField name="status" type="string">
  Status label (e.g. `Pending`, `Active`, `Closed`).
</ResponseField>

<ResponseField name="active" type="boolean">
  Whether the customer is currently active and can hold loans.
</ResponseField>

<ResponseField name="officeId" type="string">
  ID of the office (branch) the customer belongs to.
</ResponseField>

<ResponseField name="officeName" type="string">
  Display name of the office.
</ResponseField>

<ResponseField name="firstname" type="string" />

<ResponseField name="middlename" type="string" />

<ResponseField name="lastname" type="string" />

<ResponseField name="displayName" type="string">
  Computed full name.
</ResponseField>

<ResponseField name="mobileNo" type="string" />

<ResponseField name="emailAddress" type="string" />

<ResponseField name="dateOfBirth" type="string">
  ISO-8601 `YYYY-MM-DD`.
</ResponseField>

<ResponseField name="activationDate" type="string">
  ISO-8601 `YYYY-MM-DD`. Present only after activation.
</ResponseField>

<ResponseField name="submittedDate" type="string">
  ISO-8601 `YYYY-MM-DD`.
</ResponseField>

## Addressing a customer

Every resource-level customer endpoint accepts two equivalent path
prefixes. **Prefer the externalId form** — it lets you drive
integrations off the identifier you already store, with no client-side
mapping back to a numeric LMS id.

| Form                        | Path prefix                                         | When to use                                                |
| --------------------------- | --------------------------------------------------- | ---------------------------------------------------------- |
| By externalId (recommended) | `/v1/customers/external/{customer_external_id}/...` | Use the `externalId` you supplied on `POST /v1/customers`. |
| By LMS id                   | `/v1/customers/{customer_id}/...`                   | Use the numeric `id` returned from `POST /v1/customers`.   |

Both forms hit the same handlers and return identical responses. An
unknown externalId returns `404 not_found`.

```bash theme={null}
# By externalId (recommended)
curl "$BASE/v1/customers/external/ext-ada-001" -H "Authorization: Bearer $TOKEN"

# Same customer, by LMS id
curl "$BASE/v1/customers/42" -H "Authorization: Bearer $TOKEN"
```

## Endpoints

Each row below has an equivalent form under
`/v1/customers/external/{customer_external_id}/...` — substitute the
prefix when addressing the customer by externalId.

| Method | Path                                | Purpose                                                                        |
| ------ | ----------------------------------- | ------------------------------------------------------------------------------ |
| POST   | `/v1/customers`                     | [Create](/customers/create) a customer                                         |
| GET    | `/v1/customers`                     | [List](/customers/list) customers (paginated; `?externalId=` for point lookup) |
| GET    | `/v1/customers/{customer_id}`       | [Get](/customers/get) one                                                      |
| PUT    | `/v1/customers/{customer_id}`       | [Update](/customers/update) the `externalId`                                   |
| DELETE | `/v1/customers/{customer_id}`       | [Delete](/customers/delete) (only in pending state)                            |
| POST   | `/v1/customers/{customer_id}/close` | [Close](/customers/close) an active customer                                   |
