# @coveo/push-api-client

> Push API client

Latest version **4.0.24** (published 2025-12-09) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @coveo/push-api-client
pnpm add @coveo/push-api-client
yarn add @coveo/push-api-client
bun add @coveo/push-api-client
```

## Health

**Score 70/100 (B)** — status: stable.

Positive: has types; esm support; no vulnerabilities; has provenance; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.0.24 |
| Published | 2025-12-09 |
| First published | 2021-05-13 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | ^18.12.0 \|\| ^20.10.0 \|\| ^22.11.0 |
| Dependencies | 6 |
| Unpacked size | 406 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 6 |
| Maintainers | coveo-organization, coveoit, npmcoveo, pixhel, oa-npmcoveo |

## Links

- npm: https://www.npmjs.com/package/@coveo/push-api-client
- Repository: https://github.com/coveo/push-api-client.js
- Homepage: https://github.com/coveo/push-api-client.js#readme
- Issues: https://github.com/coveo/push-api-client.js/issues
- npm.io page: https://npm.io/package/@coveo/push-api-client

## Dependencies (6)

- [zod](https://npm.io/package/zod.md) ^3.20.2
- [dayjs](https://npm.io/package/dayjs.md) ^1.10.4
- [ts-dedent](https://npm.io/package/ts-dedent.md) ^2.2.0
- [@coveo/bueno](https://npm.io/package/@coveo/bueno.md) ^0.46.0
- [exponential-backoff](https://npm.io/package/exponential-backoff.md) ^3.1.0
- [@coveo/platform-client](https://npm.io/package/@coveo/platform-client.md) ^54.0.0

## Recent versions

- 4.0.24 (latest) — 2025-12-09
- 4.0.23 — 2025-11-28
- 4.0.22 — 2025-11-28
- 4.0.21 — 2025-10-16
- 4.0.19 — 2025-08-19
- 4.0.17 — 2025-08-04
- 4.0.16 — 2025-07-30
- 4.0.15 — 2025-07-28
- 4.0.14 — 2025-07-21
- 4.0.13 — 2025-07-14
- 4.0.12 — 2025-07-14
- 4.0.11 — 2025-07-11
- 4.0.10 — 2025-03-12
- 4.0.1 — 2024-02-05
- 4.0.0 — 2024-02-05
- … 335 more at https://npm.io/package/@coveo/push-api-client/versions

## README

# @coveo/push-api-client.js

Coveo Push API client

## Installation

`npm i @coveo/push-api-client`

## Features

- Upload data to both Push and Catalog sources
- Pre-push document validation
- Automatic custom field creation
- Full catalog upload and incremental document update
- Optimized for large payload uploads

## Usage

```js
import {PushSource, DocumentBuilder} from '@coveo/push-api-client';

async function main() {
  const source = new PushSource('my_api_key', 'my_coveo_organization_id');

  const myDocument = new DocumentBuilder(
    'https://my.document.uri',
    'My document title'
  ).withData('these words will be searchable');

  await source.addOrUpdateDocument('my_source_id', myDocument);
}

main();
```

You can also upload your data into a catalog source

```js
async function main() {
  const source = new CatalogSource('my_api_key', 'my_coveo_organization_id');
  await source
    .batchStreamDocumentsFromFiles('my_source_id', ['path/to/file_or_folder'])
    .batch();
}

main();
```

See more examples in the `./samples` folder.

### Proxy configuration

You can use the `HTTPS_PROXY` or `https_proxy` environment variable for proxy configuration.
Read more about it [here](https://about.gitlab.com/blog/2021/01/27/we-need-to-talk-no-proxy/).

### Exponential backoff retry configuration

By default, the SDK leverages an exponential backoff retry mechanism. Exponential backoff allows for the SDK to make multiple attempts to resolve throttled requests, increasing the amount of time to wait for each subsequent attempt. Outgoing requests will retry when a `429` status code is returned from the platform.

The exponential backoff parameters are as follows:

- `retryAfter` - The amount of time, in milliseconds, to wait between throttled request attempts.

  Optional, will default to 5,000.

- `maxRetries` - The maximum number of times to retry throttled requests.

  Optional, will default to 10.

- `timeMultiple` - The multiple by which to increase the wait time between each throttled request attempt.

  Optional, will default to 2.

You may configure the exponential backoff that will be applied to all outgoing requests. To do so, specify a `PlatformOptions` object when creating either a `CatalogSource` or `PushSource` object:

```js
const catalogSource = new CatalogSource(
  'my_api_key',
  'my_coveo_organization_id',
  {maxRetries: 10, retryAfter: 2000, timeMultiple: 3}
);
const pushSource = new PushSource(
  'my_other_api_key',
  'my_other_coveo_organization_id',
  {maxRetries: 3, retryAfter: 600000}
);
```

By default, requests will retry a maximum of 10 times, waiting 5 seconds after the first attempt, with a time multiple of 2 (which will equate to a maximum execution time of roughly 1.5 hours).

## Local development

- `npm i`
- Copy `env.sample` to `.env`, and replace the variables with proper values.
- `npm run dev` to compile and run `./src/localtest.ts`.
- `npm run test` for unit tests.

## Commit

Use `npm run commit` to get a properly formatted commit message which will help control the versioning and CHANGELOG generation.

## Release

Run Github action named `release`, which will bump version, tag and publish to npm.

---
_Source: https://npm.io/package/@coveo/push-api-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
