# API Service Options

Each API service will have different options that you can pass in.&#x20;

Each service allows you to pass in options mapped to [`RequestInit`](https://developer.mozilla.org/en-US/docs/Web/API/fetch#options) which are passed to the underlying `fetch` function. You can use this option to control `cache` behavior, add `headers`, and more.

## **Runtime Environment and Allow Unsafe Client API Call**

Some API calls are intended to only be executed on the server.

Of these API calls that are only intended to be executed on the server, some of them allow you to pass an option to `allowUnsafeClientApiCall`. This option is a boolean that allows you to bypass the server check and execute the API call on the client.

{% hint style="warning" %}
Any service that requires a private key and generates a signed request does not allow you to pass this option.
{% endhint %}

### Example

```typescript
import { createAccessToken, QuadrataEnvironment } from '@quadrata/sdk/api';

const { data: { accessToken } } = await createAccessToken(
    // params
    {
        apiKey: process.env.QUADRATA_API_KEY,
        options: {
            // not recommended as it exposes your API key
            allowUnsafeClientApiCall: true,

            // optional fetch options
            cache: 'no-cache'
        }
    },
    // sdk config
    { environment: QuadrataEnvironment.PRODUCTION }
);
```

## API Signed Requests

When using a service that generates a request signature, you must pass in your private key.

You have options as to how you can pass in your private key:

* **`privateKeyPem`**: A string that contains the private key in PEM format.
* **`privateKeyDerBase64`**: A base64 encoded string that contains the private key in DER format.
* **`privateKeyDer`**: A binary string that contains the private key in DER format.
* **`privateKey`**: A [`CryptoKey`](https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey) object that contains the private key. (Uses [`SubtleCrypto`](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto))

### Example

```typescript
import { fetchWalletScreening, QuadrataEnvironment } from '@quadrata/sdk/api';

const { data } = await fetchWalletScreening(
    // params
    {
        apiKey: process.env.QUADRATA_API_KEY,
        privateKeyDerBase64: process.env.QUADRATA_PRIVATE_KEY_DER_BASE64,
        walletAddress: '0x123',
        
        // optional fetch options
        options: {
            cache: 'no-cache'
        }
    },
    // sdk config
    { environment: QuadrataEnvironment.PRODUCTION }
);
```
