Skip to content

Reservations

Terminal window
npm install @limitry/sdk
import { createClient } from "@limitry/sdk";
const limitry = createClient(); // reads LIMITRY_API_KEY

POST /v1/reservations/{reservationId}/extend

Keeps a hold for longer work: it now expires ttlSeconds from now (default 300, at most 3600) — call it again as a heartbeat.

await limitry.reservations.extend("<reservation-id>");
FieldDescription
reservationIdstring, path, required
ttlSecondsnumberSeconds from now. Default 300.
More about this endpoint

Only a held reservation can be extended. Its API-key check is cached briefly for speed: a revoked key can keep working here for up to 60 seconds.

POST /v1/reservations/{reservationId}/commit

Settles a hold with the ACTUAL amount used (cost): less than held gives the rest back at once; more is charged in full — the work happened.

await limitry.reservations.commit("<reservation-id>", {
cost: 3,
});
FieldDescription
reservationIdstring, path, required
costnumber, requiredThe amount actually used.
More about this endpoint

A commit after the hold expired still charges cost. Repeating a commit answers the same. Its API-key check is cached briefly for speed: a revoked key can keep working here for up to 60 seconds.

POST /v1/reservations/{reservationId}/release

Gives the whole hold back — the work did not happen.

await limitry.reservations.release("<reservation-id>");
FieldDescription
reservationIdstring, path, required
More about this endpoint

Repeating a release answers the same; releasing a committed reservation is refused. Its API-key check is cached briefly for speed: a revoked key can keep working here for up to 60 seconds.