# @helia/delegated-routing-v1-http-api-client

> A Delegated Routing V1 HTTP API client

Latest version **9.0.2** (published 2026-08-16) · Apache-2.0 OR MIT license · 0 weekly downloads

## Install

```sh
npm install @helia/delegated-routing-v1-http-api-client
pnpm add @helia/delegated-routing-v1-http-api-client
yarn add @helia/delegated-routing-v1-http-api-client
bun add @helia/delegated-routing-v1-http-api-client
```

## Health

**Score 75/100 (B)** — status: active.

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 9.0.2 |
| Published | 2026-08-16 |
| First published | 2023-10-24 |
| Weekly downloads | 0 |
| License | Apache-2.0 OR MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 12 |
| Unpacked size | 1.1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 6 |
| Maintainers | npm-service-account-ipfs, achingbrain |
| Keywords | IPFS |

## Links

- npm: https://www.npmjs.com/package/@helia/delegated-routing-v1-http-api-client
- Repository: https://github.com/ipfs/helia-delegated-routing-v1-http-api
- Homepage: https://github.com/ipfs/helia-delegated-routing-v1-http-api/tree/main/packages/client#readme
- Issues: https://github.com/ipfs/helia-delegated-routing-v1-http-api/issues
- npm.io page: https://npm.io/package/@helia/delegated-routing-v1-http-api-client

## Dependencies (12)

- [it-map](https://npm.io/package/it-map.md) ^3.1.6
- [it-first](https://npm.io/package/it-first.md) ^3.0.11
- [it-ndjson](https://npm.io/package/it-ndjson.md) ^2.0.0
- [any-signal](https://npm.io/package/any-signal.md) ^4.2.0
- [race-signal](https://npm.io/package/race-signal.md) ^2.0.2
- [uint8arrays](https://npm.io/package/uint8arrays.md) ^6.1.1
- [multiformats](https://npm.io/package/multiformats.md) ^14.0.0
- [@libp2p/utils](https://npm.io/package/@libp2p/utils.md) ^7.2.2
- [@libp2p/peer-id](https://npm.io/package/@libp2p/peer-id.md) ^6.0.9
- [@libp2p/interface](https://npm.io/package/@libp2p/interface.md) ^3.2.2
- [@multiformats/multiaddr](https://npm.io/package/@multiformats/multiaddr.md) ^13.0.3
- [browser-readablestream-to-it](https://npm.io/package/browser-readablestream-to-it.md) ^2.0.12

## Recent versions

- 9.0.2 (latest) — 2026-08-16
- 9.0.1 — 2026-08-16
- 9.0.0 — 2026-07-02
- 8.0.1 — 2026-06-12
- 8.0.0 — 2026-06-12
- 7.0.1 — 2026-05-22
- 7.0.0 — 2026-05-22
- 6.0.1 — 2026-01-16
- 6.0.0 — 2026-01-16
- 5.2.1 — 2026-01-15
- 5.2.0 — 2026-01-15
- 5.1.4 — 2025-12-03
- 5.1.3 — 2025-12-03
- 5.1.2 — 2025-11-13
- 5.1.1 — 2025-10-29
- … 28 more at https://npm.io/package/@helia/delegated-routing-v1-http-api-client/versions

## README

<p align="center">
  <a href="https://github.com/ipfs/helia" title="Helia">
    <img src="https://raw.githubusercontent.com/ipfs/helia/main/assets/helia.png" alt="Helia logo" width="300" />
  </a>
</p>

# @helia/delegated-routing-v1-http-api-client

[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech)
[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech)
[![codecov](https://img.shields.io/codecov/c/github/ipfs/helia-delegated-routing-v1-http-api.svg?style=flat-square)](https://codecov.io/gh/ipfs/helia-delegated-routing-v1-http-api)
[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/helia-delegated-routing-v1-http-api/js-test-and-release.yml?branch=main\&style=flat-square)](https://github.com/ipfs/helia-delegated-routing-v1-http-api/actions/workflows/js-test-and-release.yml?query=branch%3Amain)

> A Delegated Routing V1 HTTP API client

# About

<!--

!IMPORTANT!

Everything in this README between "# About" and "# Install" is automatically
generated and will be overwritten the next time the doc generator is run.

To make changes to this section, please update the @packageDocumentation section
of src/index.js or src/index.ts

To experiment with formatting, please run "npm run docs" from the root of this
repo and examine the changes made.

-->

A client implementation of the IPFS [Delegated Routing V1 HTTP API](https://specs.ipfs.tech/routing/http-routing-v1/) that can be used to interact with any compliant server implementation.

## Example

```typescript
import { delegatedRoutingV1HttpApiClient } from '@helia/delegated-routing-v1-http-api-client'
import { CID } from 'multiformats/cid'
import { defaultLogger } from '@libp2p/logger'

const client = delegatedRoutingV1HttpApiClient({
  url: 'https://example.org'
})({
  logger: defaultLogger()
})

for await (const prov of client.getProviders(CID.parse('QmFoo'))) {
  // ...
}
```

### How to use with libp2p

The client can be configured as a libp2p service, this will enable it as both a ContentRouting and a PeerRouting implementation

## Example

```typescript
import { delegatedRoutingV1HttpApiClient } from '@helia/delegated-routing-v1-http-api-client'
import { createLibp2p } from 'libp2p'
import { peerIdFromString } from '@libp2p/peer-id'

const libp2p = await createLibp2p({
  // other config here
  services: {
    delegatedRouting: delegatedRoutingV1HttpApiClient({
      url: 'https://example.org'
    })
  }
})

// later this will use the configured HTTP gateway
await libp2p.peerRouting.findPeer(peerIdFromString('QmFoo'))
```

### Caching

By default, the client caches successful (200) delegated routing responses in browser environments (that support the [Cache API](https://developer.mozilla.org/en-US/docs/Web/API/Cache)) for a duration of 5 minutes. The client does this by adding an `x-cache-expires` header to the response object.

If caching is enabled, the client will cache responses for the duration of `cacheTTL` milliseconds.
If `cacheTTL` is 0, caching is disabled:

## Example

```typescript
// disable caching
const client = delegatedRoutingV1HttpApiClient({
  url: 'https://example.org'
  cacheTTL: 0
})({
  logger: defaultLogger()
})
```

### Filtering with IPIP-484

The client can be configured to pass filter options to the delegated routing server as defined in IPIP-484.
The filter options be set globally, by passing them to the client constructor, or on a per-request basis.

## Example

```typescript
import { delegatedRoutingV1HttpApiClient } from '@helia/delegated-routing-v1-http-api-client'
import { createLibp2p } from 'libp2p'
import { peerIdFromString } from '@libp2p/peer-id'
import { defaultLogger } from '@libp2p/logger'

// globally set filter options
const client = delegatedRoutingV1HttpApiClient({
  url: 'https://delegated-ipfs.dev',
  filterProtocols: ['transport-bitswap', 'unknown', 'transport-ipfs-gateway-http'],
  filterAddrs: ['webtransport', 'webrtc-direct', 'wss']
})({
  logger: defaultLogger()
})

// per-request filter options
for await (const prov of client.getProviders(CID.parse('bafy'), {
  filterProtocols: ['transport-ipfs-gateway-http'],
  filterAddrs: ['!p2p-circuit']
})) {
  // ...
}
```

# Install

```console
$ npm i @helia/delegated-routing-v1-http-api-client
```

## Browser `<script>` tag

Loading this module through a script tag will make its exports available as `HeliaDelegatedRoutingV1HttpApiClient` in the global namespace.

```html
<script src="https://unpkg.com/@helia/delegated-routing-v1-http-api-client/dist/index.min.js"></script>
```

# API Docs

- <https://ipfs.github.io/helia-delegated-routing-v1-http-api/modules/_helia_delegated-routing-v1-http-api-client.html>

# License

Licensed under either of

- Apache 2.0, ([LICENSE-APACHE](https://github.com/ipfs/helia-delegated-routing-v1-http-api/blob/main/packages/client/LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](https://github.com/ipfs/helia-delegated-routing-v1-http-api/blob/main/packages/client/LICENSE-MIT) / <http://opensource.org/licenses/MIT>)

# Contribute

Contributions welcome! Please check out [the issues](https://github.com/ipfs/helia-delegated-routing-v1-http-api/issues).

Also see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.

Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)

---
_Source: https://npm.io/package/@helia/delegated-routing-v1-http-api-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
