Skip to main content
REST client

Account

The 12 operations under account, as typed calls on the generated REST client.

2 min read
View MarkdownEdit on GitHub

Available from @codespar/sdk 0.12.0; the version on npm is 0.16.23. When these docs build, the examples on this page are compiled against @codespar/sdk 0.16.23, the version this site installs: a call that does not type-check against it fails the build.

Every call below is cs.api reaching one operation of the OpenAPI document this page was generated from; the REST client overview explains request, response, the option bag and the errors. The values are placeholders shaped by the document.

import {  } from "@codespar/sdk";

const  = new ({ : .. });

GET /v1/account/agent-activity

BRL spent and received per agent, over a window

const  = await ..("/v1/account/agent-activity");

Parameters, body and every documented response: GET /v1/account/agent-activity in the HTTP reference.

GET /v1/account/balances

Account balances, per currency

const  = await ..("/v1/account/balances");

Parameters, body and every documented response: GET /v1/account/balances in the HTTP reference.

POST /v1/account/fund/sandbox

POST/v1/account/fund/sandbox
Moves money

Credits test balance, in BRL, in a TEST project.

Add test balance (test projects only)

const  = await ..("post", "/v1/account/fund/sandbox", {
  : {
    : 1000,
    : "string",
    : "pix",
    : "account",
    : "mandate_0000000000000000",
    : "csm_0000000000000000"
  }
});
// r.status is one of the documented statuses (200, 403, 422),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

The gates that refuse this call, the meaning of each refusal, parameters and every documented response: POST /v1/account/fund/sandbox in the HTTP reference.

POST /v1/account/fund/sandbox/initial

POST/v1/account/fund/sandbox/initial
Moves money

Credits 10000 centavos of test money to the project's account wallet

Grant the initial test balance (test projects only, once)

const  = await ..("post", "/v1/account/fund/sandbox/initial");
// r.status is one of the documented statuses (200, 403, 422),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

The gates that refuse this call, the meaning of each refusal, parameters and every documented response: POST /v1/account/fund/sandbox/initial in the HTTP reference.

POST /v1/account/fund/sandbox/refill

POST/v1/account/fund/sandbox/refill
Moves money

crediting only the difference to the account wallet

Refill the test balance (test projects only, confirmed)

const  = await ..("post", "/v1/account/fund/sandbox/refill", {
  : {
    : true
  }
});
// r.status is one of the documented statuses (200, 403, 422),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

The gates that refuse this call, the meaning of each refusal, parameters and every documented response: POST /v1/account/fund/sandbox/refill in the HTTP reference.

GET /v1/account/ledger

The project's ledger, every wallet merged

const  = await ..("/v1/account/ledger");

Parameters, body and every documented response: GET /v1/account/ledger in the HTTP reference.

GET /v1/account/payments

The project's payments, newest first

const  = await ..("/v1/account/payments");

Parameters, body and every documented response: GET /v1/account/payments in the HTTP reference.

GET /v1/account/sessions

The project's sessions, as the activity list draws them

const  = await ..("/v1/account/sessions");

Parameters, body and every documented response: GET /v1/account/sessions in the HTTP reference.

GET /v1/account/spenders

The mandates that can spend from this project

const  = await ..("/v1/account/spenders");

Parameters, body and every documented response: GET /v1/account/spenders in the HTTP reference.

GET /v1/account/statement

The account statement (extrato) of a period, as PDF

const  = await ..("/v1/account/statement", {
  : {
    : "2026-01-15",
    : "2026-01-15"
  }
});

Parameters, body and every documented response: GET /v1/account/statement in the HTTP reference.

GET /v1/account/summary

BRL money in, agent spend, tool calls and sessions over a window

const  = await ..("/v1/account/summary");

Parameters, body and every documented response: GET /v1/account/summary in the HTTP reference.

GET /v1/account/test-balance

The test balance, the refill quota and the Adicionar fundos cap

const  = await ..("/v1/account/test-balance");

Parameters, body and every documented response: GET /v1/account/test-balance in the HTTP reference.

Account | CodeSpar