createAndWait creates the job and polls until it reaches done, error, cancelled or expired. It returns the final job, so check job.state and job.stateMessage rather than expecting an exception for a failed print.
Configuration
The SDK retries
429 responses, waiting for Retry-After when it is present, and retries 5xx responses and network errors with exponential backoff. printJobs.create and createAndWait send an Idempotency-Key automatically and reuse it on every retry, so a retry cannot print twice. Pass { idempotencyKey } as the second argument to use your own key. Other POST requests are not retried on 5xx errors.
Errors
Any non-2xx response that survives the retries throws anInkRelayError with status, code and requestId. createAndWait throws an InkRelayTimeoutError when the job is still not in a final state after timeoutMs (default 60 seconds); its job property holds the last known job, which may still print.
Pagination
list(params) returns one page, { data, hasMore, nextCursor }. iterate(params) is an async generator that follows nextCursor for you and yields every item:
computers, printers, printJobs and webhooks have list, iterate and get. events (and webhook deliveries) have list and iterate only, with no get. Pass after and dir: "asc" to events.list to poll for new events.
Webhooks
ir.webhooks.verify(body, headers, secret) checks the signature of a request and throws WebhookVerificationError if it is invalid or older than 5 minutes. Pass the raw body string, not parsed JSON.
ir.webhooks.create, update, delete, deliveries(id) and replay(deliveryId). create returns the signing secret once. See Webhooks for a full receiver.