Loading…
Loading…
Reference for all generated Next.js API route handlers
@woographql/next generates Next.js API route handlers in app/api/ that proxy GraphQL requests to the WordPress backend and manage session state.
| Route | Method | Description |
|---|---|---|
/api/auth | GET | Validate authentication tokens |
/api/session | GET, POST | Session initialization and management |
/api/login | POST | User login (password or OAuth) |
/api/customer | GET, POST | Customer data fetch and update |
/api/cart | GET, POST | Cart operations (add, remove, update) |
/api/products | GET | Product listing with pagination and filters |
/api/product | GET | Single product data |
/api/product/[...ids] | GET | Product data by database IDs |
/api/products-count | GET | Total product count for pagination |
/api/categories | GET | Product category listing |
/api/collection-data | GET | Collection metadata for filtering |
/api/countries | GET | Shipping countries list |
/api/countries/[country] | GET | States/provinces for a country |
/api/oauth | GET | Available OAuth login providers |
Generated when includeCheckout: true:
| Route | Method | Description |
|---|---|---|
/api/create-order | POST | Create a WooCommerce order |
/api/stripe/intent | POST | Create Stripe payment intent |
/api/stripe/customer | GET, POST | Stripe customer management |
Generated when includeAccountPages: true:
| Route | Method | Description |
|---|---|---|
/api/payment-methods | GET, POST, DELETE | Manage saved payment methods |
Generated when includeAccountPages: true and productTypes includes subscription:
| Route | Method | Description |
|---|---|---|
/api/subscription | GET, POST | Subscription management (cancel, reactivate) |
Generated when usingNextPress: true:
| Route | Method | Description |
|---|---|---|
/api/post/content/[...uri] | GET | Fetch WordPress post content by URI |
/api/post/assets/[...uri] | GET | Fetch WordPress post assets by URI |
/api/order | GET | Order data for NextPress checkout flow |
Most routes use the withTokenManager utility to manage session tokens. For cookie-based sessions, this reads/writes HTTP-only cookies. For browser-based sessions, tokens are passed via request headers.
All API routes include companion .spec.ts test files using node-mocks-http for request/response mocking.