Parallèle Docs
Getting started

Setup

Set up your project to use the Parallèle API.

Setup

Get your API key and configure your project to fetch content from Parallèle.

Get Your API Key

  1. Log in to Parallèle
  2. Navigate to Settings > API
  3. Click Generate API Key
  4. Copy and store the key securely

API keys follow this format: prl_xxxxxxxxxxxxxxxxxxxxxxxxxxxx

Environment Variables

Add your API key to your environment:

# .env.local
PARALLELE_API_KEY=prl_your_api_key_here

Warning: Never expose your API key in client-side code. Always use environment variables and server-side fetching.

Create a Helper Function

Create a reusable function to fetch content:

lib/parallele.ts
const API_URL = "https://parallele.ai";
 
export async function getContent(locale: string = "fr") {
  const res = await fetch(`${API_URL}/api/public/content?locale=${locale}`, {
    headers: {
      "x-api-key": process.env.PARALLELE_API_KEY!,
    },
    next: { revalidate: 60 }, // Cache for 60 seconds
  });
 
  if (!res.ok) {
    throw new Error("Failed to fetch content");
  }
 
  return res.json();
}

Fetch Content in Pages

app/page.tsx
import { getContent } from "@/lib/parallele";
 
export default async function HomePage() {
  const content = await getContent("fr");
 
  return (
    <main>
      <h1>{content["hero.title"]}</h1>
      <p>{content["hero.subtitle"]}</p>
    </main>
  );
}

Next Steps

On this page