lib-js: the JavaScript client
lib-js is the official Pryv.io client library for JavaScript / TypeScript, published
on npm as pryv. It works both in Node.js and
in the browser, and wraps the HTTP API with a small, promise-based
surface (connections, batched API calls, authentication helpers, high-frequency series,
and event/attachment helpers).
When to use it
Section titled “When to use it”Reach for lib-js when you build a JavaScript or TypeScript app or service that talks to
a Pryv.io account, instead of calling the REST API by hand. For other
languages, use the OpenAPI definitions to generate a client, or call the
API directly.
Install
Section titled “Install”npm install pryvMinimal example
Section titled “Minimal example”const Pryv = require('pryv');
// An API endpoint is `https://{token}@{username}.{domain}/`const connection = new Pryv.Connection('https://TOKEN@USERNAME.pryv.me');
// Batched API calls use the same method ids as the referenceconst [result] = await connection.api([ { method: 'events.get', params: { limit: 20 } },]);
console.log(result.events);In the browser, the same library is available as a bundle; see the repository for the script-tag and authentication (auth request) flows.
Full documentation
Section titled “Full documentation”The authoritative documentation, browser usage, authentication flows, high-frequency series and the complete API live in the repository:
- Repository: github.com/pryv/lib-js
- npm:
pryv
See also Get started and the API reference.

