JavaScript SDK — API reference

Generated from JSDoc in packages/batchpipe-sdk/index.js using documentation.js. Regenerate after changing the client: npm run docs:sdk from the repository root, then commit lib/generated/batchpipe_sdk_docs.json.

For how to load the module and examples, see the SDK guide. For HTTP status codes and payloads, see the HTTP API page. For management request/response contracts (OpenAPI, validation shape, Postgres destination_config), see Management API — contract & automation and OpenAPI YAML.

← SDK guide

Overview

Every async method resolves to { status, ok, data } with parsed JSON in data (or null for empty bodies). Management calls require a workspace API key in the client constructor (or per-request overrides where documented on the HTTP API page).

Generated 2026-04-23T03:58:04.458Z

create_batchpipe_client (module export)

Return `new BatchPipeClient(options)` — small factory for ergonomic imports.

Parameter Type Description
options BatchPipeClientOptions

Returns BatchPipeClient

BatchPipeClientOptions

Property Type Description
base_url string BatchPipe origin (no trailing slash), e.g. https://api.example.com
api_key string? Workspace API key (bp_v1_…). Required for management methods; optional for ingest if you pass per-call options.

BatchPipeClient constructor

Construct a client for BatchPipe’s `/v1` JSON API (health, ingest, management). Pass `base_url` (and usually `api_key` for management calls). Method names use `snake_case` and mirror the HTTP API.

Parameter Type Description
options BatchPipeClientOptions

Instance methods

Each block is a method on BatchPipeClient — call as await client.method_name(…) using the parameters in the table in order. The HTTP: line in each summary is the underlying request for cross-reference with the HTTP API page.

add_allowed_origin

Allowlist a browser origin for CORS ingest on a pipe. HTTP: POST /v1/pipes/:pipe_id/allowed-origins

Parameter Type Description
pipe_id string
body object

Returns Promise<{status: number, ok: boolean, data: *}>

create_api_key

Mint a new workspace API key. `body` matches the management API (see HTTP API). HTTP: POST /v1/api-keys

Parameter Type Description
body object

Returns Promise<{status: number, ok: boolean, data: *}>

create_destination

Add a destination to a pipe (`pipe_id`, configuration `body`). HTTP: POST /v1/pipes/:pipe_id/destinations

Parameter Type Description
pipe_id string
body object

Returns Promise<{status: number, ok: boolean, data: *}>

create_pipe

Create a pipe. `body` matches the management HTTP API (see HTTP API). HTTP: POST /v1/pipes

Parameter Type Description
body object Request body (see HTTP API docs)

Returns Promise<{status: number, ok: boolean, data: *}>

delete_destination

Remove a destination from a pipe. HTTP: DELETE /v1/pipes/:pipe_id/destinations/:destination_id

Parameter Type Description
pipe_id string
destination_id string

Returns Promise<{status: number, ok: boolean, data: *}>

delete_pipe

Delete a pipe (and dependent resources per server rules). HTTP: DELETE /v1/pipes/:pipe_id

Parameter Type Description
pipe_id string

Returns Promise<{status: number, ok: boolean, data: *}>

get_ingest_hint

Read the ingest “hint” JSON for a pipe (discovery only; does not enqueue records). HTTP: GET /v1/ingest/:pipe_id

Parameter Type Description
pipe_id string

Returns Promise<{status: number, ok: boolean, data: *}>

get_pipe

Fetch a single pipe by id. HTTP: GET /v1/pipes/:pipe_id

Parameter Type Description
pipe_id string

Returns Promise<{status: number, ok: boolean, data: *}>

health

Ping deployment health. No API key is sent. HTTP: GET /v1/health

Returns Promise<{status: number, ok: boolean, data: *}>

ingest

Send one record object or an array of objects to `pipe_id`. Optional per-call `api_key` / `origin` in `options`. HTTP: POST /v1/ingest/:pipe_id

Parameter Type Description
pipe_id string
records object | Array<object> Single record object or array of objects
options

Returns Promise<{status: number, ok: boolean, data: *}>

list_api_keys

List workspace API keys (metadata only; secrets are not returned). HTTP: GET /v1/api-keys

Returns Promise<{status: number, ok: boolean, data: *}>

list_pipes

List pipes and usage for the workspace tied to the client’s API key. HTTP: GET /v1/pipes

Returns Promise<{status: number, ok: boolean, data: *}>

remove_allowed_origin

Remove a previously allowlisted browser origin. HTTP: DELETE /v1/pipes/:pipe_id/allowed-origins/:origin_id

Parameter Type Description
pipe_id string
origin_id string

Returns Promise<{status: number, ok: boolean, data: *}>

revoke_api_key

Revoke an API key by id. HTTP: DELETE /v1/api-keys/:api_key_id

Parameter Type Description
api_key_id string

Returns Promise<{status: number, ok: boolean, data: *}>

set_destination_status

Pause or resume delivery for one destination (`body` matches the status endpoint). HTTP: PATCH /v1/pipes/:pipe_id/destinations/:destination_id/status

Parameter Type Description
pipe_id string
destination_id string
body object

Returns Promise<{status: number, ok: boolean, data: *}>

set_pipe_limits

Replace pipe limit row (`pipe_limit`): ingest caps (`pl_ingest_*`) and delivery flush (`pl_delivery_*`). HTTP: PUT /v1/pipes/:pipe_id/limits

Parameter Type Description
pipe_id string
body object

Returns Promise<{status: number, ok: boolean, data: *}>

update_destination

Update an existing destination’s configuration. HTTP: PATCH /v1/pipes/:pipe_id/destinations/:destination_id

Parameter Type Description
pipe_id string
destination_id string
body object

Returns Promise<{status: number, ok: boolean, data: *}>

update_pipe

Update fields on a pipe. HTTP: PATCH /v1/pipes/:pipe_id

Parameter Type Description
pipe_id string
body object

Returns Promise<{status: number, ok: boolean, data: *}>