Official Java SDK for the Nowah Travel API.
- Java 11+
- No runtime dependencies (stdlib only)
<dependency>
<groupId>xyz.nowah</groupId>
<artifactId>sdk</artifactId>
<version>0.2.0</version>
</dependency>implementation 'xyz.nowah:sdk:0.2.0'import com.nowah.sdk.*;
import com.nowah.sdk.model.*;
NowahClient client = NowahClient.builder("your-api-key").build();
// Search flights
ApiResponse<SearchFlightsResult> flights = client.searchFlights(
SearchFlightsParams.builder("JFK", "LAX", "2025-06-15", new Passengers(1))
.cabinClass(CabinClass.ECONOMY)
.build()
);
for (FlightOffer offer : flights.getData().getOffers()) {
System.out.println(offer.getAirline() + ": " + offer.getPriceAmount());
}NowahClient client = NowahClient.builder("your-api-key")
.baseUrl("https://custom-api.example.com") // Custom base URL
.httpClient(HttpClient.newHttpClient()) // Custom HttpClient
.maxRetries(2) // Retry count (default: 1)
.build();Stable Nowah-owned responses and normalized flight results use typed ApiResponse<T> models.
Provider passthrough methods continue to return raw JSON strings.
client.searchFlights(params) // Typed normalized flight offers
client.searchFlightsRaw(params) // Unparsed flight response
client.searchLocations(params) // Search airports/cities
client.getOffer(params) // Get offer details (with optional seat map)
client.getOfferServices(offerId) // Get available services for an offerclient.searchHotels(params) // Search hotels
client.getHotelQuote(rateId) // Get a hotel rate quoteclient.listTrips() // List all trips
client.listTrips(params) // List trips with pagination
client.getTrip(tripId) // Get a single trip
client.createTrip(params) // Create a trip from an offer
client.updateTrip(params) // Update trip details
client.cancelTrip(params) // Cancel a trip
client.getTripDocuments(tripId) // Get trip documentsclient.bookFlight(params) // Book a flight (idempotent)
client.getBookingFees() // Get booking fee schedule
client.bookHotel(params) // Book a hotel (idempotent)client.createCheckoutSession(params) // Create Stripe checkout session
client.listPaymentMethods() // List saved payment methods
client.payWithSavedCard(params) // Pay with a saved card
client.getPaymentStatus(paymentIntentId) // Check payment status
client.managePaymentMethod(params) // Delete or set defaultclient.getCancellationQuote(orderId) // Get cancellation quote
client.confirmCancellation(cancelId) // Confirm cancellation (idempotent)
client.getOrderServices(orderId) // List available services
client.addOrderServices(params) // Add services (idempotent)
client.createChangeRequest(params) // Request flight change
client.confirmFlightChange(params) // Confirm change (idempotent)client.getSeatInfo(params) // Get seat layout/best/avoid
client.getSeatRecommendations(params) // Get AI seat recommendationsclient.getFlightInfo(params) // Get flight status/position
client.getBookingTracking(bookingId) // Track a booking's flights
client.getAirportDelays(airportCode) // Get airport delay infoclient.getVisaRequirements(passport, dest) // Visa requirements
client.getWeather(params) // Current or forecast weather
client.convertCurrency(params) // Convert or get rates
client.getSafetyInfo(country) // Country safety infoclient.findPois(params) // Search or nearby POIs
client.generateItinerary(params) // AI-generated itineraryclient.checkClaimEligibility(params) // Check if claim is eligible
client.fileClaim(params) // File a claim
client.listClaims() // List all claims
client.listClaims(params) // List claims with filtersclient.getUsageStats() // Get API usage stats
client.getUsageStats(params) // With period/endpoint filterclient.chatWithAgent(params) // Non-streaming chat
client.chatWithAgentStream(params) // Streaming chatAll errors throw NowahException (unchecked):
try {
client.getTrip("nonexistent");
} catch (NowahException e) {
if (e.isNotFound()) {
System.out.println("Trip not found");
} else if (e.isUnauthorized()) {
System.out.println("Invalid API key");
} else if (e.isRateLimited()) {
System.out.println("Rate limited, retry later");
} else if (e.isTimeout()) {
System.out.println("Request timed out");
}
System.out.println("Status: " + e.getStatusCode());
System.out.println("Code: " + e.getCode());
System.out.println("Retryable: " + e.isRetryable());
}- Retries: 5xx and network errors are retried (default: 1 retry with exponential backoff). 4xx errors are never retried.
- Idempotency:
bookFlight,bookHotel,confirmCancellation,addOrderServices, andconfirmFlightChangeautomatically generateX-Idempotency-Keyheaders. - Timeouts: 30s for standard requests, 120s for streaming.
NowahClient is thread-safe. The underlying HttpClient and all parameter classes are immutable.
Apache 2.0