Reservations
Set up
Section titled “Set up”npm install @limitry/sdkimport { createClient } from "@limitry/sdk";
const limitry = createClient(); // reads LIMITRY_API_KEYpip install limitryfrom limitry import Limitry
limitry = Limitry() # reads LIMITRY_API_KEYnpm install -g @limitry/clilimitry loginexport LIMITRY_API_KEY="lim_test_…"Extend a reservation
Section titled “Extend a reservation”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>");limitry.reservations.extend("<reservation-id>")limitry reservations extend '<reservation-id>'curl -X POST "https://api.limitry.com/v1/reservations/<reservation-id>/extend" \ -H "Authorization: Bearer $LIMITRY_API_KEY" \ -H "Content-Type: application/json" \ -d '{}'| Field | Description |
|---|---|
reservationId | |
ttlSeconds | Seconds 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.
Commit a reservation
Section titled “Commit a reservation”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,});limitry.reservations.commit("<reservation-id>", cost=3)limitry reservations commit '<reservation-id>' --cost 3curl -X POST "https://api.limitry.com/v1/reservations/<reservation-id>/commit" \ -H "Authorization: Bearer $LIMITRY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"cost":3}'| Field | Description |
|---|---|
reservationId | |
cost | The 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.
Release a reservation
Section titled “Release a reservation”POST /v1/reservations/{reservationId}/release
Gives the whole hold back — the work did not happen.
await limitry.reservations.release("<reservation-id>");limitry.reservations.release("<reservation-id>")limitry reservations release '<reservation-id>'curl -X POST "https://api.limitry.com/v1/reservations/<reservation-id>/release" \ -H "Authorization: Bearer $LIMITRY_API_KEY"| Field | Description |
|---|---|
reservationId |
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.