Ledger

List credit facility repayment events

Get on-chain repayment events for an organization. Each row represents a RepayPrincipal or RepayInterest event emitted by a SecuredLine credit facility. Filter by repaymentType to restrict to one subtype.

Results are sorted by occurredAt (descending — newest first). Ordering is not configurable from the query string.

Supports three response formats via the format query parameter:

  • json (default) — paginated JSON (default limit 100, max 1000).
  • csv — streamed CSV file download (up to 1,000,000 rows). Columns: inflow, transaction, type, timestamp, amount, usdValue, tokenAddress, tokenIcon, tokenSymbol.
  • event-stream — Server-Sent Events stream (up to 1,000,000 rows). Each entry is emitted as a named entry event with JSON data. A final done event carries {"total": N}. Connect with EventSource or fetch:
const es = new EventSource('/v3/ledger/repays?organizationId={id}&format=event-stream', {
  headers: { 'x-api-key': 'cc_...' },
});
es.addEventListener('entry', (e) => console.log(JSON.parse(e.data)));
es.addEventListener('done', (e) => { console.log('total:', JSON.parse(e.data).total); es.close(); });

Requires org membership or vault curator role (public orgs only).

get/v3/ledger/repays

Request

  • Base URL: https://api.creditcoop.xyz
  • URL: https://api.creditcoop.xyz/v3/ledger/repays
  • Auth: one of:
    • API key in header x-api-key
    • HTTP bearer
    • OAuth 2 (authorization code, authorization URL https://clerk.creditcoop.xyz/oauth/authorize, token URL https://clerk.creditcoop.xyz/oauth/token)

Query parameters

organizationIdstring uuid required
Example:550e8400-e29b-41d4-a716-446655440000

Organization ID (must be an org the caller is a member of, or a public org if caller is a vault curator).

startDatestring date
Example:2025-01-15

Optional filter. Inclusive start date (YYYY-MM-DD); restricts results to occurredAt >= startDate (or snapshotDate for collateral-snapshots). Omit to leave the start unbounded.

endDatestring date
Example:2025-01-31

Optional filter. Inclusive end date (YYYY-MM-DD). Omit to leave the end unbounded.

limitinteger

Maximum records returned. Format-dependent: format=json capped at 1000 (default 100); format=csv|event-stream capped at 1,000,000 (default 1,000,000). Values outside these caps are silently clamped server-side.

offsetinteger

Number of records to skip from the start (JSON pagination only — ignored for csv/event-stream).

format'json' | 'csv' | 'event-stream'

Response format. json returns paginated JSON. csv streams a CSV file download. event-stream returns Server-Sent Events: each row is a named entry event; a final done event carries {"total": N}.

repaymentType'principal' | 'interest'

Optional filter. Restricts results to a single repayment subtype: principal (reduces outstanding principal) or interest (paid to depositors). Omit to return both.

networkIdstring
Example:eip155:1

Optional filter. CAIP-2 network identifier; restricts results to a single chain. Omit to return all networks.

facilityAddressstring
Example:0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045

Optional filter. Credit facility (SecuredLine) contract address; restricts results to a single facility. Omit to return all facilities for the organization.

protocolVersionstring[]

Filter by protocol version(s). Comma-separated or repeated (e.g. ?protocolVersion=v1,v2 or ?protocolVersion=v1&protocolVersion=v2). Omit to return all versions.

Response

Credit facility repayment events.

Example response

{
  "entries": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "organizationId": "550e8400-e29b-41d4-a716-446655440000",
      "evmLogId": "550e8400-e29b-41d4-a716-446655440000",
      "facilityAddress": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
      "amountUsd": "1234567.890000",
      "tokenNetworkId": "eip155:1",
      "occurredAt": "2025-01-15T10:30:00Z",
      "networkId": "eip155:1",
      "createdAt": "2025-01-15T10:30:00Z"
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.