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

# API Reference

> Complete API documentation for the trip-page application

This document provides a comprehensive reference for all API endpoints in the trip-page application.

## Base URL

All API endpoints are prefixed with `/api/v1`

## Authentication

Protected endpoints require authentication via a bearer token in the request header:

```http theme={null}
Authorization: Bearer <your_token>
```

## Endpoints

### Trip Endpoints

Base path: `/api/v1/trips`

| Method | Endpoint             | Description                            | Authentication |
| ------ | -------------------- | -------------------------------------- | -------------- |
| GET    | /                    | Get all public trips                   | No             |
| GET    | /landing-page        | Get landing page data                  | No             |
| GET    | /id/:tripId          | Get a specific trip by ID              | Yes            |
| GET    | /:hostSlug/:tripSlug | Get trip details by host and trip slug | No             |

### Payment Endpoints

Base path: `/api/v1/payments`

| Method | Endpoint                   | Description                                       | Authentication |
| ------ | -------------------------- | ------------------------------------------------- | -------------- |
| POST   | /create-order              | Create a new payment order                        | No             |
| POST   | /verify-payment            | Verify a payment                                  | No             |
| POST   | /webhook                   | Handle regular payment webhooks                   | No             |
| POST   | /payment-link-webhook      | Handle payment link webhooks                      | No             |
| GET    | /payment-reminders         | Get all payment reminders (with optional filters) | Yes            |
| POST   | /send-payment-reminder     | Send a manual payment reminder                    | Yes            |
| GET    | /payment-reminders/:leadId | Get reminder history for a specific lead          | Yes            |

### Media Endpoints

Base path: `/api/v1/media`

| Method | Endpoint | Description                       | Authentication |
| ------ | -------- | --------------------------------- | -------------- |
| POST   | /upload  | Upload media file (images/videos) | Yes            |
| POST   | /delete  | Delete media file                 | Yes            |

### Coupon Endpoints

Base path: `/api/v1/coupons`

| Method | Endpoint      | Description                     | Authentication |
| ------ | ------------- | ------------------------------- | -------------- |
| POST   | /             | Create a new coupon             | Yes            |
| GET    | /             | Get all coupons                 | Yes            |
| PATCH  | /:id          | Update a specific coupon        | Yes            |
| DELETE | /:id          | Delete a specific coupon        | Yes            |
| POST   | /validate     | Validate a coupon               | No             |
| GET    | /trip/:tripId | Get coupons for a specific trip | No             |

### Analytics Endpoints

Base path: `/api/v1/analytics`

| Method | Endpoint                   | Description        | Authentication |
| ------ | -------------------------- | ------------------ | -------------- |
| GET    | /trips                     | Get trip analytics | Yes            |
| POST   | /track/:hostName/:tripSlug | Track trip clicks  | No             |

### PostHog Analytics Endpoints

Base path: `/api/v1/posthog-analytics`

| Method | Endpoint               | Description                          | Authentication |
| ------ | ---------------------- | ------------------------------------ | -------------- |
| GET    | /trips                 | Get all trips for analytics dropdown | Yes            |
| GET    | /trips/:tripSlug/stats | Get analytics for a specific trip    | Yes            |

### Host Endpoints

Base path: `/api/v1/hosts`

| Method | Endpoint         | Description      | Authentication |
| ------ | ---------------- | ---------------- | -------------- |
| GET    | /:hostSlug       | Get host profile | No             |
| GET    | /:hostSlug/trips | Get host's trips | No             |
| POST   | /                | Create new host  | Yes            |
| PUT    | /:hostSlug       | Update host      | Yes            |

### Admin Endpoints

Base path: `/api/v1/admin`

| Method | Endpoint                 | Description       | Authentication |
| ------ | ------------------------ | ----------------- | -------------- |
| POST   | /login                   | Admin login       | No             |
| GET    | /profile                 | Get admin profile | Yes            |
| POST   | /create                  | Create new admin  | Yes            |
| GET    | /hosts                   | Get all hosts     | Yes            |
| POST   | /hosts                   | Create host       | Yes            |
| PUT    | /hosts/:hostId           | Update host       | Yes            |
| GET    | /trips                   | Get all trips     | Yes            |
| GET    | /trips/:tripId           | Get specific trip | Yes            |
| POST   | /trips                   | Create trip       | Yes            |
| PUT    | /trips/:tripId           | Update trip       | Yes            |
| DELETE | /trips/:tripId           | Delete trip       | Yes            |
| POST   | /trips/:tripId/duplicate | Duplicate a trip  | Yes            |

## General Notes

* Base API path: `/api/v1`
* Authentication is required for protected endpoints and should be provided via an authentication token
* All authenticated routes require a valid auth token in the request header
* The server includes a health check endpoint at `/api/v1/health` that returns server status
