Skip to main content
This page states exactly how @parmana/sdk behaves. If a guide and this page disagree, this page is right, and please report the guide. Every value here was read from the SDK source, and the retry behavior was tested against a server that fails on purpose.

Create a client

From 1.1.6 the client builds a default HttpTransport from the configuration you pass, so timeout, retryPolicy, apiKey and userAgent all apply. Two notes:
  1. On 1.1.5 and earlier, always pass transport. Those versions throw ConfigurationError: Transport is required. when it is missing, even though the Configuration type marks it optional. Use 1.1.6 or later to omit it.
  2. If you supply your own transport, build it from the same configuration object. HttpTransport reads timeout and retryPolicy from the configuration it is constructed with, not from the client. If you write new HttpTransport({ endpoint, apiKey }) next to a retryPolicy on the client, the transport never sees the retry policy and nothing is retried, with no error. Omit transport and this cannot happen.

Configuration options

Every request also carries Content-Type: application/json.

Retries

Retries are off by default. They run only when both retryPolicy.enabled is true and maxAttempts is above zero. What is retried: Tested: a server that returns 503 twice and then 200, and a client with enabled: true and maxAttempts: 3, made 3 requests and returned success. With a supplied transport built from a partial configuration the same client made 1 request and threw InternalServerError.

Errors

Every non 2xx response, and every failure to get one, is thrown as a typed error. There is no path where a failure looks like success. Two InternalServerError cases need different handling, and from 1.1.3 you can tell them apart with error.serverCode: On 1.1.2 and earlier serverCode is not on InternalServerError, so read the code from the error message.

Methods

The full signature of every method is in the API reference.

Idempotency

businessTransactionId is the idempotency key. Sending the same one twice returns 409 (ConflictError). The helper createBusinessTransaction() generates the identifiers and keeps the linked ones consistent, so use it instead of writing them by hand. The SDK never generates a businessTransactionId for you when you build the object yourself, and it never retries a POST, so a single call is a single attempt.

Where to go next

For a client wrapper with logging and a deployment checklist read TypeScript SDK in production. For an agent that must fail closed read TypeScript SDK for AI agents. For the exact rules an agent follows read Integrate Parmana: specification for AI agents.