> ## Documentation Index
> Fetch the complete documentation index at: https://docs.avraapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Node.js SDK Universal API call

> Use the AvraAPI Node.js SDK Universal Function for a released provider route that does not yet have a typed SDK method.

`ApixClient.call()` is the Node.js SDK Universal Function. Use it only when a
released provider route is not yet available through a typed service method.
For Currency, Security, Location, SMS, or Utilities operations that already
have a typed method, use that method instead.

<Info>
  The Universal Function is for released **provider** routes. It is not a
  shortcut around the Universal Payment Gateway, payment completion, provider
  configuration, or browser-safety requirements.
</Info>

## SDK function

```ts title="Copy the Universal Function signature" theme={null}
const response = await avraapi.call(
  'GET_OR_POST',
  'RELEASED_PROVIDER_ROUTE',
  {},
);
```

| Argument | Use |
| - | - |
| `method` | `GET` or `POST`, case-insensitive. |
| `path` | A released provider route in any supported path format. |
| `payload` | Optional query parameters for `GET`, or a JSON request body for `POST`. |

The method returns `Promise<ApiResponse | BinaryResponse>`. JSON responses
contain their operation result in `data`; image and media responses use
`BinaryResponse`, just as typed Utility methods do.

## Use a typed service whenever it exists

These calls reach the same released Currency route. The typed method expresses
intent more clearly and should be your default.

```ts title="Preferred: typed SDK method" theme={null}
// AvraAPI SDK call.
const response = await avraapi.currency().getCodes();

// Your application code.
const codes = response.get('data.codes');
```

```ts title="Universal Function: supported fallback" theme={null}
// AvraAPI SDK call. GET payload values become query parameters.
const response = await avraapi.call('GET', 'utility/currency/codes');

// Your application code.
const codes = response.get('data.codes');
```

## Send a released POST operation

Use an exact released route and its documented body fields. This example uses
the public Security endpoint; normally prefer `security().checkVpn()` for the
same operation.

```ts title="POST through the Universal Function" theme={null}
import { ApiResponse } from '@avraapi/node-sdk';

// AvraAPI SDK call.
const response = await avraapi.call('POST', 'security/vpn-shield', {
  ip: '194.195.93.1',
});

// Your application code.
if (response instanceof ApiResponse) {
  const isVpn = response.get('data.is_vpn');
  const requestId = response.requestId;
}
```

Read the [REST API Reference](/api-reference/overview) for request fields,
response shape, billing rules, and errors before calling a new provider route.

## Path formats

The client normalises each path before sending it. Choose one consistent form;
a short relative route is usually clearest.

```ts title="Equivalent route paths" theme={null}
// Each call resolves to the configured base URL plus utility/currency/codes.
await avraapi.call('GET', 'utility/currency/codes');
await avraapi.call('GET', '/utility/currency/codes');
await avraapi.call('GET', '/api/v1/utility/currency/codes');
await avraapi.call('GET', 'https://avraapi.com/api/v1/utility/currency/codes');
```

The client removes a leading API version path and the host portion of a full
URL, then uses the configured `APIX_BASE_URL`.

## Response handling

Check the returned type before consuming output. Most provider routes return
`ApiResponse`; media routes can return `BinaryResponse`.

```ts title="Handle a JSON or media result" theme={null}
import { ApiResponse, BinaryResponse } from '@avraapi/node-sdk';

// AvraAPI SDK call. Use a released route and documented payload.
const response = await avraapi.call('POST', 'utilities/qr/generate', {
  data: 'https://example.com/receipt/ORDER-001',
  format: 'png',
});

// Your application code.
if (response instanceof BinaryResponse) {
  await response.saveAs('./generated/receipt-qr.png');
} else if (response instanceof ApiResponse) {
  const data = response.data;
}
```

## Boundaries and safety

<Warning>
  Do not use `call()` for payment initiation, payment completion, callbacks,
  gateway credentials, or a route not released in the public API Reference.
  Payment work uses the dedicated server-side
  [`payment()` service](/sdk/nodejs/advanced-services).
</Warning>

`call()` sends normal Project Client ID, Client Secret, and environment headers.
It does not expose the fluent `withProvider()` or `withPrivacyMode()` controls,
so use a typed provider service when you need either one-request option.

## Next steps

<CardGroup cols={2}>
  <Card title="Provider service guides" icon="layer-group" href="/sdk/nodejs/currency-services">
    Start with typed provider methods before using the Universal Function.
  </Card>

  <Card title="REST API Reference" icon="server" href="/api-reference/overview">
    Verify a released route, its request fields, response, and error contract.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.