ignitionstack.pro v1.0 is out! Read the announcement →
Skip to Content

HTTP API Reference

When you run npm run dev:all, the documentation site serves on http://localhost:3001  and proxies the Next.js API under http://localhost:3001/api. (If you run only npm run dev, use http://localhost:3000/api.)

All routes live in src/app/api/**/* and are implemented as Route Handlers using the Repository and ActionResult patterns.

Authentication & Rate Limiting

Each response includes X-RateLimit-* headers when available.

AI Routes

EndpointMethodAuthDescription
/api/ai/chatPOSTSupabase sessionServer-Sent Events (SSE) streaming responses from OpenAI / Gemini / Ollama via the Strategy Router with RAG + guardrails.
/api/ai/uploadPOST (multipart)Supabase sessionUploads a document to Supabase Storage and optionally chunks + embeds it for Conversational RAG.
/api/ai/sharePOSTSupabase sessionGenerates a shareable tokenized URL for a conversation.

/api/ai/chat (POST, SSE)

curl -N \ -H "Content-Type: application/json" \ -b "sb-access-token=..." \ -X POST http://localhost:3001/api/ai/chat \ -d '{"message":"Summarize projects","provider":"openai"}'

/api/ai/upload (POST, multipart/form-data)

Fields:

Flow: validates file type/size, uploads to ai-documents bucket, persists metadata through DocumentRepository, extracts text, and (unless skipped) generates embeddings via DocumentProcessor.

/api/ai/share (POST, JSON)

Body: { "conversationId": "uuid", "title?": "optional" }

Returns { success: true, shareUrl, token } where shareUrl points to /ai/shared/{token}. Tokens are base64 payloads containing conversation and user identifiers; treat them as secret and expire them when revoking shares.

Admin Routes

EndpointMethodAuthDescription
/api/admin/upload-imagePOSTSupabase session + admin guardAccepts base64 media from the admin UI, stores it through the uploadImage action (Supabase Storage), and returns { success, url }.
curl -X POST http://localhost:3001/api/admin/upload-image \ -H "Content-Type: application/json" \ -b "sb-access-token=..." \ -d '{"file":"data:image/png;base64,iVBORw0KGgo...","filename":"hero.png"}'

Stripe Integrations

EndpointMethodAuthDescription
/api/stripe/create-checkoutPOSTPublic (rate limited)Creates a Stripe Checkout session for one-time purchases or subscriptions.
/api/stripe/webhookPOSTStripe onlyReceives checkout.session.*, customer.subscription.*, and invoice.payment_* events.

/api/stripe/create-checkout

Body:

{ "priceId": "price_123", "isSubscription": false, "locale": "en", "successUrl": "https://example.com/en/loja/success", "cancelUrl": "https://example.com/en/loja/cancelled", "metadata": { "templateId": "landing-pro" } }

Response:

{ "sessionId": "cs_test_...", "url": "https://checkout.stripe.com/c/pay/cs_test..." }

Internals: getStripeClient() creates the session, metadata is normalized via buildStripeMetadata, and payment types include both card and boleto when not subscription.

/api/stripe/webhook

Always return 200 quickly; perform heavy work via server actions/repositories.

Resend Webhook

EndpointMethodDescription
/api/resend/webhookPOSTVerifies Svix headers and logs email lifecycle events (email.sent, .delivered, .bounced, .complained, .opened, .clicked).

Requirements:

Testing the API

Keep this reference current whenever you add or rename Route Handlers so the CLI and partners know which payloads and headers to provide.