**Source URL:** https://limited.veevavault.dev/custom-pages/vault-web-sdk/26.1.0/interfaces/vaultapiclient

# VaultApiClient

Provides functions to use Vault API from client code.

## Properties

### fetch

> **fetch**: (`input`, `init?`) => `Promise`<`Response`\>

Makes authorized requests to Vault API and prepends the `/api` prefix to the path. This is a wrapped version of JavaScript's `fetch` function.

#### Parameters

##### input

`string`

The URL string to make a request to

##### init?

`RequestInit`

A [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request) object containing custom settings to apply to the request

#### Returns

`Promise`<`Response`\>

A [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) which is fulfilled with a [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) object representing the server's response

#### See

*   [https://developer.veevavault.com/api/](https://developer.veevavault.com/api/)
*   [https://developer.mozilla.org/en-US/docs/Web/API/Fetch\_API/Using\_Fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch)

#### Remarks

Only accepts strings as input. Does not accept URL or Request objects.

Naively prepends `/api` to the provided URL. For example, calling this with `"http://example.com`" would make a request to `"/api/http://example.com`".

#### Example

```js
import { vaultApiClient } from '@veeva/vault'

const response = await vaultApiClient.fetch(
      '/v25.1/objects/documents/301',
      {
        headers: {
          Accept: 'application/json',
        },
      }
    );
const json = response.json();
```

---

**Previous:** [PageParameters](/custom-pages/vault-web-sdk/26.1.0/interfaces/pageparameters)  
**Next:** [Type Aliases](/custom-pages/vault-web-sdk/26.1.0/type-aliases)