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 works, only the presence matters) and a client-version header matching a current Ryanair web build. The package generates the cookie itself and defaults client-version to 3.196.0.
When Ryanair drops that version, getAvailable() starts returning 409 Availability declined. Grab a current value from ryanair.com (open DevTools, find any availability XHR, copy its client-version request header) and override:
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.