TypeScript installation
Requirements
- Node.js 22 or later (the SDK uses the built-in
fetch). Node 18 and 20 are end-of-life and no longer receive security fixes. - TypeScript 5+ is recommended to get the full benefit of the types, but plain JavaScript works.
Install
npm install @rappi_cargo/cargo-core-api-sdk
The package ships ESM and CommonJS builds with bundled type definitions, so both import styles
work and no @types package is needed.
// ESM / TypeScript
import { CargoClient } from "@rappi_cargo/cargo-core-api-sdk";
// CommonJS
const { CargoClient } = require("@rappi_cargo/cargo-core-api-sdk");
Configure
const client = new CargoClient({
apiKey: process.env.CARGO_API_KEY!,
environment: "dev",
});
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | required | Your user-token. |
environment | "dev" | "co" | "mx" | "ar" | "uy" | "br" | "cl" | "cr" | "ec" | "pe" | "dev" | Which gateway to call. See Environments. |
baseUrl | string | resolved from environment | Overrides the base URL, e.g. for a proxy. |
timeoutMs | number | 15000 | Request timeout in milliseconds. |
fetch | typeof fetch | global fetch | Custom implementation, e.g. to add instrumentation. |
Next: Quickstart.