> ## Documentation Index
> Fetch the complete documentation index at: https://docs.takehome.api.br/llms.txt
> Use this file to discover all available pages before exploring further.

# API v2

> Travel API v2 - authentication and enhanced features

# Travel API v2

The v2 API builds on v1 with authentication, enhanced booking features, and additional endpoints for a more realistic API experience.

## Key Features

* **User Authentication** — Register and authenticate to access protected endpoints
* **Enhanced Flight Search** — More powerful filtering and search options
* **Advanced Booking** — Support for round-trip flights and more booking configurations
* **User Preferences** — Save and manage user-specific data
* **Session Management** — Maintain state across multiple requests

## Getting Started

The Travel v2 API is accessible at:

```
/api/travel/v2
```

Before making requests to protected endpoints, you'll need to authenticate. The API uses token-based authentication for secure access.

## Authentication

Some endpoints in v2 require authentication. The API uses API tokens or user credentials to protect certain operations.

Check the OpenAPI specification for which endpoints require authentication and how to provide credentials.

## OpenAPI Specification

The complete API specification is available at `/api/travel/v2/docs` (Swagger UI) or `/api/travel/v2/openapi.json` (OpenAPI spec).

## Differences from v1

* **Authentication required** for user-specific endpoints
* **Round-trip flight support** in addition to one-way flights
* **More endpoint coverage** for booking management
* **Enhanced filtering options** for flight search
* **Better error handling** with more detailed error messages

## Example Use Cases

1. **Authenticate as a user** before accessing your bookings
2. **Search for round-trip flights** with outbound and return dates
3. **Make authenticated bookings** linked to your user account
4. **View personalized booking history** with all your reservations
5. **Manage user preferences** and saved flight routes

## Exploring Schema Differences

The best way to discover the differences between v1 and v2 is by:

1. **Comparing the OpenAPI specs** for each version
2. **Using the interactive Swagger UI** to explore endpoints
3. **Making actual API requests** to see how responses differ
4. **Checking error responses** to understand validation rules

Visit both `/api/travel/v1/docs` and `/api/travel/v2/docs` to see the side-by-side differences.
