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

# API Reference

> Integrate your systems with Command using the ClearGrid APIs

The Command API provides a RESTful interface for lenders to push account and borrower data into the Command platform, manage account statuses, and keep portfolios in sync.

## Base URLs

<Tabs>
  <Tab title="Production">
    | Purpose            | URL                                    |
    | ------------------ | -------------------------------------- |
    | Authentication     | `https://v3-api.cleargrid.ai/`         |
    | Account Management | `https://v3-api.cleargrid.ai/admin/v3` |
    | CRM Dashboard      | `https://command.cleargrid.ai/`        |
  </Tab>

  <Tab title="Staging">
    | Purpose            | URL                                          |
    | ------------------ | -------------------------------------------- |
    | Authentication     | `https://stage-v3-api.cleargrid.ai/`         |
    | Account Management | `https://stage-v3-api.cleargrid.ai/admin/v3` |
    | CRM Dashboard      | `https://staging.cleargrid.ai/`              |
  </Tab>
</Tabs>

<Warning>
  Always use the **Staging** environment for development and testing. Only switch to **Production** when you are ready to go live with real data.
</Warning>

## Authentication

All API requests (except login) require a valid Bearer token in the `Authorization` header. Tokens are obtained through the [Lender Login](/api-reference/authentication/lender-login) endpoint and can be refreshed using the [Refresh Token](/api-reference/authentication/refresh-token) endpoint.

```bash theme={null}
curl -X POST https://v3-api.cleargrid.ai/admin/v3/lenders/{lenderPublicId}/accounts \
  -H "Authorization: Bearer <access_token>" \
  -H "Content-Type: application/json" \
  -d '{ "accounts": [...] }'
```

<Tip>
  Your lender credentials (email, password, and lender identifier) will be provided by ClearGrid during onboarding. Store them securely and never expose them in client-side code.
</Tip>

## HTTP Status Codes

| Status Code | Description                                                                                          |
| ----------- | ---------------------------------------------------------------------------------------------------- |
| `200`       | **OK** — Request succeeded. Data accepted and processing has started in the background.              |
| `400`       | **Bad Request** — The request body contains validation errors. Check the `errors` array for details. |
| `401`       | **Unauthorized** — Missing, invalid, or expired authentication token.                                |
| `500`       | **Internal Server Error** — Something went wrong on our end. Contact support if this persists.       |

## API Endpoints

<CardGroup cols={2}>
  <Card title="Authentication" icon="lock" href="/api-reference/authentication/lender-login">
    Authenticate with lender credentials to obtain access tokens for API requests.
  </Card>

  <Card title="Accounts" icon="file-invoice" href="/api-reference/accounts/create-update">
    Create, update, and withdraw accounts and sub-accounts. Manage your portfolio programmatically.
  </Card>
</CardGroup>

***

<Snippet file="snippets/support-info.mdx" />
