linxio-js

Getting Started

Install linxio-js and make your first authenticated Linxio request. This guide will walk you through the process of installing the package, creating a client, and making your first authenticated request.

Install

The package ships ESM, CommonJS, and TypeScript declarations. No configuration needed — import and go.

pnpm add @ambulancewa/linxio-js

Create a client

createClient(options)

Clients are reusable once you've created one, so they can be instantiated once in a configuration file, service, or other location and imported as needed. You can optionally pass options to configure timeout, retry behaviour, and a custom fetch implementation. See the createClient Reference for more details.

Authenticate the client

POST
/loginlinxio.auth.login(payload)

Authenticating the client is required before you can make any requests to the Linxio API. Use your Linxio dashboard credentials to authenticate.

Persisting sessions (optional)

createClient(options)

Note

Persisting sessions is optional, but recommended for long-running processes or services.

login() stores the session in memory, so subsequent service calls include the bearer token automatically.

However, you can choose to store the session yourself if your process needs to survive restarts. See the createClient Reference for more details.

You can then pass the stored session tokens directly into createClient to restore the session.

You're good to go! 🎉

Read vehicles

linxio.vehicles.list(params)

Using your newly authenticated client, you can now make requests to the Linxio API.

For example, you can list all vehicles in your fleet using the vehicles.list() method.

This will return a paginated list of vehicles, with a maximum of 100 vehicles per page. You can also use the vehicles.iterate() method to auto-page everything into one array, or the vehicles.stream() method for lazy async iteration.

Full example

Here's a full example of how to initialise, authenticate, and use the Linxio SDK to list all vehicles in your fleet.

This example assumes you have a .env file with your Linxio credentials.


Need full method signatures and return shapes? See the SDK Reference and API Reference.

On this page