Unofficial TypeScript client for Ryanair's API that provides easy access to flights, fares, and airport information.
pnpm add @2bad/ryanairWarning: This package is native ESM and no longer provides a CommonJS export. If your project uses CommonJS, you will have to convert to ESM or use the dynamic import() function. Please don't open issues for questions regarding CommonJS / ESM.
import { airports, fares, flights } from '@2bad/ryanair'
// Find your nearest airport
const closest = await airports.getClosest()
// Check available flight dates
const dates = await flights.getDates('BER', 'DUB')
// Get cheapest fares for your trip
const deals = await fares.getCheapestPerDay('BER', 'DUB', '2024-02-01')- Get active airports list
- Find nearest airports
- Discover available destinations
- View airport details
- Search flight routes
- Find cheapest daily fares
- Compare prices across date ranges
- Discover best round-trip deals
- Search by currency preference
- Check flight availability
- View flight schedules
- Search available dates
- Access flight details
flights.getAvailable() calls /api/booking/v4/*/availability. The endpoint checks for a fr-correlation-id cookie (any value, just has to be present) and a client-version header matching the currently-deployed Ryanair web build. The package generates the cookie itself and ships a default client-version as a starting guess.
That pin gets retired whenever Ryanair ships a new frontend. When it happens the next getAvailable() call returns 409 Availability declined, the client scrapes the current version from ryanair.com, updates its in-memory pin, and retries. Nothing for you to do.
If you'd rather skip the one-off discovery request, or want to lock to a specific version, set it explicitly:
RYANAIR_CLIENT_VERSION=3.197.0 node app.jsThe other endpoints (airports, fares, flight dates, schedules) don't need any auth.
IATA codes are three-letter identifiers used in aviation for airports worldwide. For example:
DUB- Dublin AirportBER- Berlin Brandenburg AirportSTN- London Stansted Airport
Find the complete list on IATA's official website.
This is an unofficial package and is not affiliated with Ryanair. Usage is subject to Ryanair's API terms and conditions.
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch
- Submit a pull request
Please ensure your code passes all tests and follows our coding standards.
MIT © 2BAD
Need help? Open an issue or check our Postman collection.