Skip to main content
REST client

Commerce Memory

The 12 operations under commerce-memory, as typed calls on the generated REST client.

2 min read
View MarkdownEdit on GitHub

Commerce Memory

Available from @codespar/sdk 0.12.0; the version on npm is 0.12.0. Every example on this page is compiled against the installed package when these docs build: a call that does not type-check 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/commerce-memory/counterparties

GET/v1/commerce-memory/counterparties
Deprecated

List this project's counterparties (deprecated path)

const  = await ..("/v1/commerce-memory/counterparties");

Parameters, body and every documented response: GET /v1/commerce-memory/counterparties in the HTTP reference.

POST /v1/commerce-memory/counterparties

POST/v1/commerce-memory/counterparties
Deprecated

Register a counterparty, or merge into the one already there (deprecated path)

const  = await ..("/v1/commerce-memory/counterparties", {
  : {
    : "supplier",
    : "Example",
    : "string",
    : "cnpj",
    : {}
  }
});

Parameters, body and every documented response: POST /v1/commerce-memory/counterparties in the HTTP reference.

GET /v1/commerce-memory/counterparties/{id}

GET/v1/commerce-memory/counterparties/{id}
Deprecated

Read one counterparty (deprecated path)

const  = await ..("/v1/commerce-memory/counterparties/{id}", {
  : {
    : "counterpartie_0000000000000000"
  }
});

Parameters, body and every documented response: GET /v1/commerce-memory/counterparties/{id} in the HTTP reference.

GET /v1/commerce-memory/insights/counterparty-summary

GET/v1/commerce-memory/insights/counterparty-summary

Per counterparty rollup over a window

const  = await ..("/v1/commerce-memory/insights/counterparty-summary");

Parameters, body and every documented response: GET /v1/commerce-memory/insights/counterparty-summary in the HTTP reference.

GET /v1/commerce-memory/insights/negotiation-stats

GET/v1/commerce-memory/insights/negotiation-stats

Negotiation outcomes and average discount, grouped by item

const  = await ..("/v1/commerce-memory/insights/negotiation-stats");

Parameters, body and every documented response: GET /v1/commerce-memory/insights/negotiation-stats in the HTTP reference.

GET /v1/commerce-memory/insights/top-counterparties

GET/v1/commerce-memory/insights/top-counterparties

Counterparties ranked by payment volume in a window

const  = await ..("/v1/commerce-memory/insights/top-counterparties");

Parameters, body and every documented response: GET /v1/commerce-memory/insights/top-counterparties in the HTTP reference.

GET /v1/commerce-memory/interactions

GET/v1/commerce-memory/interactions

List recorded interactions

const  = await ..("/v1/commerce-memory/interactions");

Parameters, body and every documented response: GET /v1/commerce-memory/interactions in the HTTP reference.

POST /v1/commerce-memory/interactions

POST/v1/commerce-memory/interactions

Record a commercial event against a counterparty

const  = await ..("/v1/commerce-memory/interactions", {
  : {
    : "counterparty_0000000000000000",
    : "quote",
    : 1000,
    : "BRL",
    : "2026-01-15T12:00:00.000Z",
    : "agent_execute",
    : "string",
    : "agt_0000000000000000",
    : {}
  }
});

Parameters, body and every documented response: POST /v1/commerce-memory/interactions in the HTTP reference.

GET /v1/commerce-memory/negotiations

GET/v1/commerce-memory/negotiations

List negotiations

const  = await ..("/v1/commerce-memory/negotiations");

Parameters, body and every documented response: GET /v1/commerce-memory/negotiations in the HTTP reference.

POST /v1/commerce-memory/negotiations

POST/v1/commerce-memory/negotiations

Record a price negotiation and its outcome

const  = await ..("/v1/commerce-memory/negotiations", {
  : {
    : "counterparty_0000000000000000",
    : "string",
    : "string",
    : 1,
    : 1,
    : "BRL",
    : 0,
    : "agreed",
    : "agt_0000000000000000",
    : "2026-01-15T12:00:00.000Z",
    : "2026-01-15T12:00:00.000Z",
    : {}
  }
});

Parameters, body and every documented response: POST /v1/commerce-memory/negotiations in the HTTP reference.

GET /v1/commerce-memory/preferences

GET/v1/commerce-memory/preferences

List preferences

const  = await ..("/v1/commerce-memory/preferences");

Parameters, body and every documented response: GET /v1/commerce-memory/preferences in the HTTP reference.

POST /v1/commerce-memory/preferences

POST/v1/commerce-memory/preferences

Set or update one preference on a counterparty

const  = await ..("/v1/commerce-memory/preferences", {
  : {
    : "counterparty_0000000000000000",
    : "string",
    : 0,
    : "explicit",
    : {}
  }
});

Parameters, body and every documented response: POST /v1/commerce-memory/preferences in the HTTP reference.

Commerce Memory | CodeSpar