API Reference
Fast, secure API execution for frontend apps.
This guide walks you through:
- Creating a project
- Securing your secret key
- Creating an execution endpoint
- Integrating FusePlane with your app
- Calling endpoints from the frontend
Create a Project
Step 1: Create a new project
From the FusePlane dashboard:
- Click New Project
- Give it a name
- Choose environment (development or production)
Step 2: Get credentials
Once created, you'll receive:
- Secret Project Key
- Base Endpoint URL
Important
Your Secret Project Key must never be exposed in the frontend. It is only used inside a server environment.
Set Up the Server Bundler (Key Security Layer)
To securely attach your FusePlane secret key, you need a lightweight server route. This route simply forwards requests to FusePlane.
Choose one of the integrations below:
ANext.js (App Router)
Recommended1. Create Route Handler
export async function ALL(req, { params }) {
const path = params.path.join("/")
const url = `${process.env.FUSEPLANE_BASE_URL}/${path}`
const response = await fetch(url, {
method: req.method,
headers: {
"Authorization": `Bearer ${process.env.FUSEPLANE_SECRET_KEY}`,
"Content-Type": req.headers.get("content-type") || "application/json"
},
body: req.method === "GET" ? undefined : await req.text()
})
return new Response(response.body, {
status: response.status,
headers: response.headers
})
}2. Environment Variables (.env)
FUSEPLANE_SECRET_KEY=eb_sk_live_xxxxx FUSEPLANE_BASE_URL=https://fuseplane.com/api/p
BVercel Serverless Function
File structure:
/api/p/[...path].jsHandler:
export default async function handler(req, res) {
const path = req.query.path.join("/")
const url = `${process.env.FUSEPLANE_BASE_URL}/${path}`
const response = await fetch(url, {
method: req.method,
headers: {
Authorization: `Bearer ${process.env.FUSEPLANE_SECRET_KEY}`,
"Content-Type": "application/json"
},
body: req.method === "GET" ? null : JSON.stringify(req.body)
})
const data = await response.text()
res.status(response.status).send(data)
}CNetlify Functions
File structure:
/netlify/functions/p.jsHandler:
export async function handler(event) {
const path = event.path.split("/p/")[1]
const url = `${process.env.FUSEPLANE_BASE_URL}/${path}`
const response = await fetch(url, {
method: event.httpMethod,
headers: {
Authorization: `Bearer ${process.env.FUSEPLANE_SECRET_KEY}`,
"Content-Type": "application/json"
},
body: event.httpMethod === "GET" ? null : event.body
})
return {
statusCode: response.status,
body: await response.text()
}
}Create an Execution Endpoint (API Gateway)
Now you'll define what your frontend is allowed to call.
Go to: Project Dashboard → API Gateway → Create Endpoint
Step 1: Name & Capability
- • Endpoint Name: (e.g. chat-completion)
- • Capability: Choose based on API type (AI, Payments, Messaging, Generic HTTP, etc.)
This helps FusePlane configure correct security behavior.
Step 2: Upstream Destination
This is the original API URL you were planning to call directly from the frontend.
https://api.openai.com/v1/chat/completionsTip: You can paste a full fetch() request, OR describe what you're building. FusePlane will suggest the correct upstream URL.
Warning: If the upstream URL is incorrect, the response will also be incorrect. Always verify this step carefully.
Step 3: Key Configuration (Auto-Validation)
FusePlane analyzes the upstream API and shows required headers / keys.
Authorization: Bearer {{OPENAI_API_KEY}}You must:
- Create the keys exactly as suggested
- Map them to provider secrets you added earlier
FusePlane validates this configuration automatically.
Step 4: Create & Deploy
Click Create Endpoint
Your endpoint is:
- validated
- secured
- deployed instantly
Example deployed path:
POST /openai/chatCalling the Endpoint from the Frontend
Now your frontend talks only to your app's API route.
Frontend Example (React / Next.js)
const response = await fetch("/api/p/openai/chat", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "gpt-4",
messages: [
{ role: "user", content: "Hello!" }
]
})
})
const data = await response.json()
console.log(data)You're all set!
Your frontend now securely calls third-party APIs through FusePlane without exposing any secrets.
