Skip to content

About

The Opaige API for Node: npm install @opaige/node

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

Repository files navigation

Opaige for Node

The Opaige API from Node 18 or later. No dependencies.

import { Opaige, OpaigeError, verifyWebhook } from '@opaige/node';

const opaige = new Opaige(process.env.OPAIGE_KEY);

const answer = await opaige.checkRequirements({ passport: 'IN', destination: 'FR' });

await opaige.sendBookings({ body: { bookings: [{
  ref: 'QX7K2M', flight: { number: 'OP412', destination: 'GB', depart_date: '2026-12-18' },
  passengers: [{ ref: 'QX7K2M-1', passport: 'IN', residence: 'AE' }],
}] } });

const review = await opaige.reviewFile({ file: pdfBytes, fields: { destination: 'FR', purpose: 'business' }, idempotencyKey: 'file-8841' });

Every method is one API call, named as in the API reference. Path values and query values are named in camelCase; JSON goes in body; a PDF comes back as a Uint8Array.

Errors throw OpaigeError with status, code, requestId (quote it to support) and details. Retries: reads, and writes sent with an idempotencyKey, are tried again after 429 and 5xx answers (maxRetries, default 2). Sandbox: a sandbox key answers in the same shape, is never billed and never touches live data. Bookings, students and appointments it sends are kept as test data.

Webhooks

app.post('/opaige', express.raw({ type: 'application/json' }), (req, res) => {
  const event = verifyWebhook(req.body, req.get('Opaige-Signature'), process.env.OPAIGE_WEBHOOK_SECRET);
  // event.event, event.data
  res.sendStatus(200);
});

Pass the raw body: a parsed and re-serialised body no longer matches its signature.

About

The Opaige API for Node: npm install @opaige/node

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages