Skip to main content
POST
/
admin
/
v3
/
lenders
/
{lenderPublicId}
/
accounts
Create or update accounts
curl --request POST \
  --url https://v3-api.cleargrid.ai/admin/v3/lenders/{lenderPublicId}/accounts \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "accounts": [
    {
      "status": 1,
      "debtorCompanyId": "customer_001",
      "firstName": "Ahmed",
      "lastName": "Al Maktoum",
      "language": "en",
      "idNumber": "784-1990-1234567-1",
      "birthDate": "15/06/1990",
      "gender": "male",
      "nationality": "Emirati",
      "phones": [
        {
          "number": "+971501234567",
          "type": "mobile"
        }
      ],
      "emails": [
        {
          "email": "ahmed@example.com",
          "type": "personal"
        }
      ],
      "addresses": [
        {
          "street": "Sheikh Zayed Road",
          "city": "Dubai",
          "area": "Downtown",
          "country": "ARE",
          "type": "home"
        }
      ],
      "accountId": "ORD-2025-001",
      "subAccountId": "PMT-2025-001-01",
      "merchant": "TechStore UAE",
      "dateDue": "01/03/2026",
      "principal": "5000",
      "interest": "250",
      "fees": "50",
      "paidAmount": "0",
      "loanType": 4,
      "additionalData": {
        "productType": "Electronics"
      }
    }
  ]
}
'
{
  "code": 200,
  "message": "success",
  "body": "Processing started successfully",
  "errors": []
}
This is the primary endpoint for managing accounts in Command. It supports creating new accounts, updating existing accounts (e.g., reflecting payments), and withdrawing accounts — all through a single unified request. Accounts are processed asynchronously in the background after the request is accepted.

Request

Endpoint

POST {{base_url}}/lenders/{{lenderPublicId}}/accounts
EnvironmentBase URL
Productionhttps://v3-api.cleargrid.ai/admin/v3
Staginghttps://stage-v3-api.cleargrid.ai/admin/v3

Headers

Authorization
string
required
Bearer token obtained from the Lender Login endpoint. Format: Bearer <access_token>

Body Parameters

The request body contains an accounts array. Each item represents an account or sub-account to create, update, or withdraw.
accounts
array
required
An array of account objects. You can include multiple accounts and sub-accounts in a single request.

Example Request

{
  "accounts": [
    {
      "status": 1,
      "debtorCompanyId": "customer_001",
      "firstName": "Ahmed",
      "lastName": "Al Maktoum",
      "language": "en",
      "idNumber": "784-1990-1234567-1",
      "passportNumber": "P1234567",
      "birthDate": "15/06/1990",
      "gender": "male",
      "nationality": "Emirati",
      "phones": [
        {
          "number": "+971501234567",
          "type": "mobile"
        }
      ],
      "emails": [
        {
          "email": "ahmed@example.com",
          "type": "personal"
        }
      ],
      "addresses": [
        {
          "externalId": "addr-uuid-001",
          "street": "Sheikh Zayed Road",
          "city": "Dubai",
          "area": "Downtown",
          "zip": "00000",
          "country": "ARE",
          "type": "home"
        }
      ],
      "accountId": "ORD-2025-001",
      "subAccountId": "PMT-2025-001-01",
      "merchant": "TechStore UAE",
      "dateDue": "01/03/2026",
      "principal": "5000",
      "interest": "250",
      "fees": "50",
      "paidAmount": "0",
      "paidDate": "",
      "additionalData": {
        "productType": "Electronics",
        "purpose": "Mobile phone purchase"
      },
      "loanType": 4
    },
    {
      "status": 1,
      "debtorCompanyId": "customer_001",
      "firstName": "Ahmed",
      "lastName": "Al Maktoum",
      "language": "en",
      "idNumber": "784-1990-1234567-1",
      "phones": [
        {
          "number": "+971501234567",
          "type": "mobile"
        }
      ],
      "emails": [
        {
          "email": "ahmed@example.com",
          "type": "personal"
        }
      ],
      "accountId": "ORD-2025-001",
      "subAccountId": "PMT-2025-001-02",
      "merchant": "TechStore UAE",
      "dateDue": "01/04/2026",
      "principal": "5000",
      "interest": "250",
      "fees": "50",
      "paidAmount": "0",
      "additionalData": {
        "productType": "Electronics"
      },
      "loanType": 4
    }
  ]
}

Understanding Accounts & Sub-Accounts

The accountId represents the main account or primary contract with a debtor. For example, a mobile phone purchase from an online store would be a single accountId. All related financial obligations (installments, fees) are grouped under this identifier.
The subAccountId represents an individual obligation or installment under the main account. Each installment or fee is tracked as a unique subAccountId, enabling itemized tracking of payments and dues. For example, a 4-installment BNPL plan would have 4 sub-accounts under one accountId.
The status field controls the operation:
StatusOperationUse Case
1CreateOnboarding a new account or sub-account
2UpdateReflecting a payment, fee adjustment, or data correction
3WithdrawRemoving or cancelling an account/sub-account
Example lifecycle:
  1. Status 1: Create account with principal of 100, paidAmount of 0
  2. Status 2: Update with paidAmount of 30 (balance becomes 70)
  3. Status 2: Update with paidAmount of 50 (balance becomes 50)
Sub-accounts are uniquely identified via subAccountId, which enables flexible real-time updates:
  • Add anytime — New sub-accounts (e.g., a new installment or charge) can be added independently at any time
  • Update anytime — Existing sub-accounts can be updated (e.g., fees change, payments received)
  • Withdraw anytime — A sub-account can be withdrawn (e.g., removed or marked as cancelled)
  • Automatic aggregation — Any operation on a sub-account automatically updates the main accountId aggregate (outstanding balance, status, etc.)
There is no requirement to submit all sub-accounts at once. The system is designed for incremental updates over time.

Important Notes

Date format: All dates must be in dd/MM/yyyy format (e.g., 15/03/2026).
Country codes: Use ISO 3166-1 alpha-3 three-character codes (e.g., ARE for UAE, SAU for Saudi Arabia, BHR for Bahrain).
Additional data: Any additional information about the debt or borrower that doesn’t fit into the standard fields should be placed in the additionalData object.

Response

Data has been accepted and processing has started in the background.
{
  "code": 200,
  "message": "success",
  "body": "Processing started successfully",
  "errors": []
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

lenderPublicId
string
required

Lender public ID (UUID) returned by the Lender Login endpoint.

Body

application/json
accounts
object[]
required

Array of account objects to create, update, or withdraw.

Response

Processing started successfully

code
integer
message
string | null
body
string
errors
object[]