Skip to main content
POST
/
balances
/
credit
JavaScript
import Limitry from '@limitry/sdk';

const client = new Limitry({
  apiKey: process.env['LIMITRY_API_KEY'], // This is the default and can be omitted
});

const response = await client.balances.credit({
  amount: 1,
  customerId: 'x',
  description: 'description',
  name: 'x',
});

console.log(response.balance);
{
  "success": true,
  "transaction": {
    "id": "<string>",
    "balanceId": "<string>",
    "type": "<string>",
    "amount": 123,
    "description": "<string>",
    "reference": "<string>",
    "createdAt": "2023-11-07T05:31:56Z"
  },
  "balance": {
    "id": "<string>",
    "projectId": "<string>",
    "customerId": "<string>",
    "name": "<string>",
    "unit": "<string>",
    "currentBalance": 123,
    "minimumBalance": 123,
    "dimensionFilters": {},
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z"
  }
}

Authorizations

Authorization
string
header
required

API Key or Personal Access Token (PAT). When using PAT, include X-Project header.

Body

application/json
customerId
string
required

Customer ID

Minimum string length: 1
name
string
required

Balance name

Minimum string length: 1
amount
number
required

Amount to credit

Required range: x > 0
description
string
required

Transaction description

reference
string

External reference ID

Response

Balance credited

success
boolean
required

Whether the transaction succeeded

transaction
object
required

Transaction details

balance
object
required

Updated balance