Skip to main content
This page provides the official templates for all API reference documentation in the Lerian ecosystem: endpoint pages, request/response schemas, error handling, and OpenAPI specs. API reference documentation is technical, dry, and precise. No narrative, no context-setting, no “why” — state facts. Describe inputs, outputs, and behavior. For task-oriented or contextual documentation, see Guides templates. Apply voice and tone and capitalization rules to all API reference content.

Endpoint page


Each API endpoint gets its own page. The structure is strict — every page follows the same format so developers can scan predictably.
1

Title

Use a short, clear title that fits in one line on the table of contents. Follow the standard verb pattern based on the HTTP method:
MethodVerbExample
POSTCreateCreate an account
GETListList accounts
GET (by ID)RetrieveRetrieve an account
PATCHUpdateUpdate an account
DELETEDelete / DeactivateDelete an account
2

Description

One to two sentences. What the endpoint does and when to use it. No background, no motivation.
Creates a new account in the specified ledger. The account is linked to a single asset
and follows double-entry accounting rules.
3

Prerequisites

List what is required to use the endpoint:
  • Authentication method
  • Required permissions or roles
  • Entities that must exist first (e.g., “Requires an existing organization and ledger”)
4

Parameters

Group by location. Use a separate table for each group:Header parameters
ParameterTypeRequiredDescription
AuthorizationstringYesBearer token
Path parameters
ParameterTypeRequiredDescription
organization_idstringYesUUID of the organization
ledger_idstringYesUUID of the ledger
Query parameters (when applicable)
ParameterTypeRequiredDescriptionDefault
limitintegerNoMaximum number of results10
cursorstringNoPagination cursor
5

Request body

Document all fields in a single table with these columns:
FieldTypeRequiredDescriptionPossible valuesDefaultConstraintsExample
namestringYesName of the accountMaxLength: 100"Main Account"
typestringYesAccount typedeposit, savings, external"deposit"
assetCodestringYesCurrency or asset codeISO 4217 or custom"BRL"
aliasstringNoHuman-readable identifierMust start with @"@revenue"
For nested objects, use a subsection (H4) with its own table:

status object

FieldTypeRequiredDescriptionPossible values
codestringYesStatus codeACTIVE, INACTIVE, BLOCKED
descriptionstringNoReason for the status
6

Request example

A complete, realistic curl command. Use placeholders only for IDs ({organization_id}), never for field values.
curl -X POST http://localhost:3002/v1/organizations/{organization_id}/ledgers/{ledger_id}/accounts \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer {token}" \
  -d '{
    "name": "Revenue Account",
    "assetCode": "BRL",
    "type": "deposit",
    "status": {
      "code": "ACTIVE"
    },
    "alias": "@revenue"
  }'
7

Success response

Include the HTTP status code and a complete response body.201 Created
{
  "id": "01fbc1e4-5678-9abc-def0-123456789abc",
  "name": "Revenue Account",
  "assetCode": "BRL",
  "type": "deposit",
  "status": {
    "code": "ACTIVE"
  },
  "alias": "@revenue",
  "createdAt": "2026-03-27T12:00:00Z",
  "updatedAt": "2026-03-27T12:00:00Z"
}
For 204 No Content responses, state explicitly that no body is returned.
8

Error responses

List every possible error the endpoint can return. All errors follow Lerian’s standard error format.
StatusCodeDescription
400INVALID_REQUESTMissing or invalid required field
404LEDGER_NOT_FOUNDLedger does not exist
409ALIAS_ALREADY_EXISTSAn account with this alias already exists in the ledger
422ASSET_NOT_FOUNDThe specified asset code does not exist in this ledger
Include a sample error response body:
{
  "code": "ALIAS_ALREADY_EXISTS",
  "message": "An account with alias @revenue already exists in this ledger.",
  "details": {
    "field": "alias",
    "value": "@revenue"
  }
}
9

OpenAPI spec

Include the OpenAPI 3.1 spec for this endpoint whenever possible. Use a collapsible section:
<Accordion title="OpenAPI spec (YAML)">

  ```yaml
    /v1/organizations/{organization_id}/ledgers/{ledger_id}/accounts:
      post:
        summary: Create an account
        operationId: createAccount
        ...
  ```    
</Accordion>

Error model


All Lerian APIs follow a standard error format. Document it once and reference it from every endpoint page.

Standard error response

{
  "code": "ERROR_CODE",
  "message": "Human-readable description of what went wrong.",
  "details": {}
}
FieldTypeDescription
codestringMachine-readable error code (uppercase, snake_case)
messagestringHuman-readable description
detailsobjectAdditional context (field name, value, constraints). Optional.

HTTP status code conventions

StatusMeaningWhen to use
400Bad RequestMalformed request, missing required fields, invalid values
401UnauthorizedMissing or invalid authentication
403ForbiddenAuthenticated but insufficient permissions
404Not FoundResource does not exist
409ConflictDuplicate resource (alias, idempotency key)
422Unprocessable EntityValid syntax but failed business rules
429Too Many RequestsRate limit exceeded
500Internal Server ErrorUnexpected server failure

Writing rules for API reference


These rules apply to all API reference documentation. They complement the general voice and tone guidelines.

Do

  • Start descriptions with a verb: “Creates”, “Returns”, “Deletes”
  • Use code formatting for all field names, values, endpoints, and HTTP methods
  • Document every field, even optional ones
  • Include realistic example values — never "string" or "example"
  • Show the complete request and response, not fragments
  • List every possible error, not just common ones

Don’t

  • Don’t explain business context or motivation — that belongs in guides
  • Don’t use <Tip>, <Note>, or <Warning> in endpoint descriptions — save them for prerequisites or gotchas only
  • Don’t use narrative voice (“you might want to”, “consider using”)
  • Don’t describe fields with “This field is used to…” — state what it does directly
  • Don’t omit error cases because they’re “unlikely”

Component patterns


API reference pages use a smaller set of components than guides.
ComponentWhen to use
<Accordion>Collapsible OpenAPI specs, extended error lists
<CodeGroup>Multiple request/response formats (curl + SDK examples)
<Note>Prerequisites, version-specific behavior
<Warning>Breaking changes, deprecation notices
<Danger>Irreversible operations (hard delete, data loss)
TablesParameters, fields, errors — always in tables, never in prose
For more information, see Mintlify’s official documentation.