Skip to main content

Overview

The Credit Kit API is a RESTful API that enables partners to integrate Centuari’s fixed-rate lending infrastructure into their applications. Base URLs:
  • Production: https://api.centuari.io/v1
  • Sandbox: https://sandbox-api.centuari.io/v1

Authentication

All requests require API key authentication:
curl -X GET "https://api.centuari.io/v1/positions" \
  -H "Authorization: Bearer ck_live_abc123..."

API Keys

Key TypePrefixUse
Productionck_live_Live transactions
Sandboxck_test_Testing only
Never expose API keys in client-side code. All Credit Kit requests should originate from your server.

Core Endpoints

Lending

Create Lend Order

POST /lend
Create a new lending position for a user. Request Body:
FieldTypeRequiredDescription
userIdstringYesYour internal user identifier
assetstringYesAsset to lend (USDC, USDT, DAI)
amountstringYesAmount to lend (decimal string)
ratenumberNoDesired fixed rate (0.08 = 8%)
maturitystringNoISO date or duration (e.g., “90d”)
modestringNo”easy” or “advanced” (default: easy)
autoRolloverbooleanNoEnable auto-rollover (default: true in easy mode)
Example Request:
curl -X POST "https://api.centuari.io/v1/lend" \
  -H "Authorization: Bearer ck_live_abc123..." \
  -H "Content-Type: application/json" \
  -d '{
    "userId": "user_123",
    "asset": "USDC",
    "amount": "10000",
    "rate": 0.08,
    "maturity": "90d",
    "mode": "advanced",
    "autoRollover": false
  }'
Response:
{
  "positionId": "pos_abc123",
  "status": "pending",
  "userId": "user_123",
  "asset": "USDC",
  "amount": "10000",
  "rate": 0.08,
  "maturity": "2025-06-15T00:00:00Z",
  "autoRollover": false,
  "createdAt": "2025-03-15T14:32:00Z"
}

Get Position

GET /positions/{positionId}
Retrieve details of a specific position. Response:
{
  "positionId": "pos_abc123",
  "status": "active",
  "type": "lend",
  "userId": "user_123",
  "asset": "USDC",
  "amount": "10000",
  "rate": 0.078,
  "maturity": "2025-06-15T00:00:00Z",
  "cbt": {
    "amount": "9617.31",
    "tokenAddress": "0x..."
  },
  "projectedReturn": "10000",
  "accruedInterest": "127.50",
  "autoRollover": false,
  "createdAt": "2025-03-15T14:32:00Z",
  "matchedAt": "2025-03-15T14:35:00Z"
}

List User Positions

GET /users/{userId}/positions
List all positions for a user. Query Parameters:
ParameterTypeDescription
statusstringFilter by status (pending, active, matured, cancelled)
typestringFilter by type (lend, borrow)
limitnumberResults per page (default: 20, max: 100)
cursorstringPagination cursor
Response:
{
  "positions": [
    {
      "positionId": "pos_abc123",
      "status": "active",
      "type": "lend",
      "asset": "USDC",
      "amount": "10000",
      "rate": 0.078,
      "maturity": "2025-06-15T00:00:00Z"
    }
  ],
  "nextCursor": "cursor_xyz",
  "hasMore": true
}

Borrowing

Create Borrow Order

POST /borrow
Create a new borrowing position. Request Body:
FieldTypeRequiredDescription
userIdstringYesYour internal user identifier
collateralobjectYesCollateral details
collateral.assetstringYesCollateral asset (ETH, USDC, etc.)
collateral.amountstringYesCollateral amount
borrowAssetstringYesAsset to borrow
borrowAmountstringYesAmount to borrow
ratenumberNoMaximum acceptable rate
maturitystringNoISO date or duration
autoRefinancebooleanNoEnable auto-refinance
Example Request:
curl -X POST "https://api.centuari.io/v1/borrow" \
  -H "Authorization: Bearer ck_live_abc123..." \
  -H "Content-Type: application/json" \
  -d '{
    "userId": "user_456",
    "collateral": {
      "asset": "ETH",
      "amount": "5"
    },
    "borrowAsset": "USDC",
    "borrowAmount": "8000",
    "maturity": "90d",
    "autoRefinance": true
  }'

Repay Loan

POST /positions/{positionId}/repay
Repay a borrowing position. Request Body:
FieldTypeRequiredDescription
amountstringNoAmount to repay (full if omitted)

Position Management

Cancel Order

POST /positions/{positionId}/cancel
Cancel an unmatched order.

Update Auto Features

PATCH /positions/{positionId}
Update position settings. Request Body:
{
  "autoRollover": false,
  "autoRefinance": true
}

Withdrawals

Initiate Withdrawal

POST /users/{userId}/withdraw
Withdraw available funds. Request Body:
FieldTypeRequiredDescription
assetstringYesAsset to withdraw
amountstringYesAmount to withdraw
destinationstringYesDestination address

Market Data

Get Rates

GET /markets/rates
Get current market rates. Response:
{
  "rates": [
    {
      "asset": "USDC",
      "maturity": "30d",
      "lendRate": 0.072,
      "borrowRate": 0.085,
      "spread": 0.013
    },
    {
      "asset": "USDC",
      "maturity": "90d",
      "lendRate": 0.078,
      "borrowRate": 0.092,
      "spread": 0.014
    }
  ],
  "timestamp": "2025-03-15T14:32:00Z"
}

Get Order Book

GET /markets/{asset}/orderbook
Get order book for an asset. Query Parameters:
ParameterTypeDescription
maturitystringFilter by maturity
depthnumberOrder book depth (default: 10)

Webhooks

Configuring Webhooks

Set up webhooks in your partner dashboard or via API:
POST /webhooks
{
  "url": "https://your-app.com/webhooks/centuari",
  "events": ["position.matched", "position.matured", "position.liquidated"],
  "secret": "whsec_..."
}

Event Types

EventDescription
position.createdNew position created
position.matchedOrder matched with counterparty
position.maturedPosition reached maturity
position.liquidatedBorrowing position liquidated
position.rolledPosition auto-rolled
withdrawal.completedWithdrawal processed

Webhook Payload

{
  "id": "evt_123",
  "type": "position.matched",
  "timestamp": "2025-03-15T14:32:00Z",
  "data": {
    "positionId": "pos_abc123",
    "userId": "user_123",
    "type": "lend",
    "amount": "10000",
    "rate": 0.078,
    "maturity": "2025-06-15T00:00:00Z"
  }
}

Verifying Webhooks

Verify webhook signatures to ensure authenticity:
import { CreditKit } from '@centuari/credit-kit';

const isValid = CreditKit.verifyWebhook(
  payload,
  signature,
  webhookSecret
);

Error Handling

Error Response Format

{
  "error": {
    "code": "insufficient_funds",
    "message": "User has insufficient USDC balance",
    "details": {
      "required": "10000",
      "available": "5000"
    }
  }
}

Error Codes

CodeHTTP StatusDescription
invalid_request400Malformed request
authentication_failed401Invalid API key
insufficient_funds400Not enough balance
position_not_found404Position doesn’t exist
rate_limit_exceeded429Too many requests
internal_error500Server error

Rate Limits

TierRequests/minBurst
Starter60100
Growth300500
Scale10002000
EnterpriseCustomCustom
Rate limit headers:
X-RateLimit-Limit: 300
X-RateLimit-Remaining: 298
X-RateLimit-Reset: 1710514380

SDKs

Official SDKs available:
LanguagePackage
TypeScript/JavaScript@centuari/credit-kit
Pythoncentuari-credit-kit
Gogithub.com/centuari-labs/credit-kit-go

SDK Guide

View SDK documentation and examples