Guides/Idempotency
Network issues happen — if a request to a write endpoint times out, you can't always tell whether it actually went through. Send an Idempotency-Key header on any POST or PATCH request and it's safe to retry.
const idempotencyKey = crypto.randomUUID()async function createBooking() {const response = await fetch('https://your-rideloop-domain/api/v1/bookings', {method: 'POST',headers: {Authorization: 'Bearer rlk_...','Content-Type': 'application/json','Idempotency-Key': idempotencyKey,},body: JSON.stringify({categoryId: '…',size: 'M',startDate: '2026-08-01',endDate: '2026-08-03',guestName: 'Jane Doe',guestEmail: 'jane@example.com',}),})return response.json()}// Safe to call again on a timeout/network error — the same idempotencyKey// and body always replay the same { reference: "RB-2026-000124", ... } response.const booking = await createBooking()