> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://mmg-sdk.wetechnologygroup.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://mmg-sdk.wetechnologygroup.com/_mcp/server.

# Client Configuration

> Advanced options for configuring requests and the underlying client

## Request Options

You can pass an optional configuration object to any API call to override default behaviors on a per-request basis.

### Additional Headers & Query Parameters

Append custom headers or query parameters to specific requests:

```typescript
const response = await client.authentication.loginResourceTokenApi(..., {
    headers: {
        'X-Custom-Header': 'custom value'
    },
    queryParams: {
        'customQueryParamKey': 'custom query param value'
    }
});
```

### Retries

The SDK is instrumented with automatic retries using exponential backoff. A request will be retried as long as it is deemed retryable (e.g., 408 Timeout, 429 Too Many Requests, or 5XX Server Errors) and the attempt count has not exceeded the limit (default: 2).

```typescript
const response = await client.authentication.loginResourceTokenApi(..., {
    maxRetries: 0 // Disable retries for this request
});
```

### Timeouts

The SDK defaults to a 60-second timeout. Override this using the `timeoutInSeconds` option:

```typescript
const response = await client.authentication.loginResourceTokenApi(..., {
    timeoutInSeconds: 30 
});
```

### Aborting Requests

You can abort requests at any point by passing in an `AbortSignal`.

```typescript
const controller = new AbortController();
const response = await client.authentication.loginResourceTokenApi(..., {
    abortSignal: controller.signal
});

controller.abort(); // aborts the request
```

## Accessing Raw Response Data

To access the raw response data (including headers), chain the `.withRawResponse()` method. This returns a promise that resolves to an object containing both the parsed `data` and the `rawResponse`.

```typescript
const { data, rawResponse } = await client.authentication.loginResourceTokenApi(...).withRawResponse();

console.log(data);
console.log(rawResponse.headers['X-My-Header']);
```

## Customizing the Fetch Client

If you are running in an unsupported environment or need to intercept network traffic, you can provide a custom `fetch` implementation when instantiating the client.

```typescript
import { MMGClient } from "mobile-money-sdk";

const client = new MMGClient({
    // ... credentials
    fetcher: // provide your custom fetch function here
});
```