SDK Quickstart
Install and configure the official Renta TypeScript SDK.
The official @renta/sdk package provides a TypeScript-first client for the Renta API with zero dependencies, full type coverage, auto-pagination, and automatic retries.
Features
- Zero dependencies — uses native
fetchandcrypto - TypeScript-first — full type coverage, no
anyescapes - Isomorphic — works in Node.js 18+, Bun, Deno, Cloudflare Workers, and browsers
- Dual format — ESM + CJS builds
- Stripe-like DX — nested resources, auto-pagination, typed errors
- Auto-retry — exponential backoff for rate limits and server errors
Installation
npm install @renta/sdkpnpm add @renta/sdkyarn add @renta/sdkbun add @renta/sdkQuick Setup
Server-Side (Secret Key)
import { Renta } from '@renta/sdk';
const renta = new Renta({
apiKey: process.env.RENTA_API_KEY!, // renta_sk_live_...
});
// List fleet items
const items = await renta.fleet.items.list();
console.log(items.data);
// Create a booking
const booking = await renta.bookings.create({
customer_id: 'cust_abc',
pickup_date: '2026-07-01T09:00:00Z',
return_date: '2026-07-03T17:00:00Z',
line_items: [{ fleet_item_id: 'fi_123' }],
});Client-Side / Storefront (Publishable Key)
import { RentaStorefront } from '@renta/sdk/storefront';
const storefront = new RentaStorefront({
apiKey: 'renta_pk_live_...', // publishable key — safe for browsers
});
// Get shop profile
const shop = await storefront.shop();
// Browse available inventory
const inventory = await storefront.inventory({
pickup_date: '2026-07-01T09:00:00Z',
return_date: '2026-07-03T17:00:00Z',
});
// Browse reviews (approved only)
const reviews = await storefront.reviews.list();
// Submit a review
await storefront.reviews.create({
booking_id: 'bk_abc',
rating: 5,
text: 'Amazing experience!',
});
// Create a booking
const result = await storefront.book({
payment_intent_id: 'pi_stripe_123',
pickup_date: '2026-07-01T09:00:00Z',
return_date: '2026-07-03T17:00:00Z',
line_items: [{ fleet_item_id: 'fi_123' }],
});RentaStorefront only accepts publishable keys (renta_pk_). Passing a secret key throws RentaAuthError.
Configuration
const renta = new Renta({
// Required
apiKey: 'renta_sk_live_...',
// Optional
baseUrl: 'https://api.getrenta.io/v1', // API base URL
timeout: 30000, // Request timeout (ms)
maxRetries: 3, // Retry attempts for 429/5xx
retryDelay: 1000, // Base retry delay (ms)
fetch: customFetch, // Custom fetch implementation
logger: {
info: (msg, meta) => console.log(msg, meta),
warn: (msg, meta) => console.warn(msg, meta),
error: (msg, meta) => console.error(msg, meta),
},
});Available Resources
The SDK provides access to all API resources:
// Fleet & Inventory
renta.fleet.categories // Fleet categories CRUD
renta.fleet.items // Fleet items CRUD
renta.fleet.photos // Photo upload/delete (secret key only)
renta.locations // Pickup locations CRUD
// Bookings & Customers
renta.bookings // Bookings lifecycle (includes adjustments)
renta.customers // Customer profiles
renta.reviews // Reviews CRUD + moderation
// Pricing & Payments
renta.pricing.calculate() // Price calculation
renta.pricing.rules // Pricing rules CRUD (seasonal, multi-day)
renta.payments // Payment intent creation
renta.deposits // Deposit hold/capture/release
renta.coupons // Coupons CRUD + validation
// Add-ons & Availability
renta.addons // Add-ons CRUD
renta.availability // Availability checking
// Documents & Waivers
renta.documents.templates // Document template CRUD
renta.documents.sessions // Signing sessions (create, send, void)
renta.waivers // Waiver templates + signing
// Tenant & Settings
renta.tenant // Tenant profile get/update (secret key only)
renta.settings // Tenant settings get/update (secret key only)
// Maintenance
renta.maintenance.logs // Maintenance log list/create (secret key only)
// Calendar & Webhooks
renta.calendar.feeds // Calendar feed CRUD + iCal
renta.webhooks // Webhook managementRequirements
- Node.js 18+ (for native
fetchsupport) - TypeScript 5.0+ (recommended but not required)
Next Steps
- Pagination — auto-pagination, async iteration, manual paging
- Error Handling — typed exceptions and retry behavior
- TypeScript Types — all exported types and interfaces