Skip to main content

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",
});
OptionTypeDefaultDescription
apiKeystringrequiredYour user-token.
environment"dev" | "co" | "mx" | "ar" | "uy" | "br" | "cl" | "cr" | "ec" | "pe""dev"Which gateway to call. See Environments.
baseUrlstringresolved from environmentOverrides the base URL, e.g. for a proxy.
timeoutMsnumber15000Request timeout in milliseconds.
fetchtypeof fetchglobal fetchCustom implementation, e.g. to add instrumentation.

Next: Quickstart.