Parallèle Docs
Api

Collections

API reference for collection endpoints.

Collections API

Collections are custom content types for structured data like testimonials, team members, products, FAQs, etc.

List Collections

Fetch all collections in the workspace.

GET /api/public/collections

Query Parameters

ParameterTypeRequiredDescription
localestringNoLocale for item count

Example

curl "https://parallele.ai/api/public/collections" \
  -H "x-api-key: prl_xxx"

Response:

{
  "collections": [
    {
      "slug": "testimonials",
      "name": "Testimonials",
      "singularName": "Testimonial",
      "pluralName": "Testimonials",
      "icon": "quote",
      "itemCount": 12
    },
    {
      "slug": "team",
      "name": "Team Members",
      "singularName": "Team Member",
      "pluralName": "Team Members",
      "icon": "users",
      "itemCount": 5
    }
  ],
  "site": {
    "name": "My Website",
    "domain": "example.com",
    "defaultLocale": "fr",
    "locales": [...]
  }
}

List Collection Items

Fetch published items from a collection.

GET /api/public/collections/:slug

Path Parameters

ParameterTypeRequiredDescription
slugstringYesCollection slug

Query Parameters

ParameterTypeRequiredDescription
localestringNoFilter by locale
allLocalesbooleanNoReturn items in all locales
limitnumberNoMax items to return
offsetnumberNoPagination offset
sortBystringNoSort field: order, createdAt, updatedAt
sortOrderstringNoSort direction: asc, desc

Example

curl "https://parallele.ai/api/public/collections/testimonials?locale=en&limit=10" \
  -H "x-api-key: prl_xxx"

Response:

{
  "collection": {
    "slug": "testimonials",
    "name": "Testimonials",
    "singularName": "Testimonial",
    "pluralName": "Testimonials"
  },
  "items": [
    {
      "slug": "john-doe",
      "locale": "en",
      "data": {
        "name": "John Doe",
        "role": "CEO at TechCorp",
        "quote": "Parallèle transformed how we manage content.",
        "avatar": "https://cdn.example.com/john.jpg",
        "rating": 5
      },
      "publishedAt": "2025-01-10T09:00:00Z",
      "updatedAt": "2025-01-10T09:00:00Z",
      "metaTitle": null,
      "metaDescription": null
    }
  ],
  "pagination": {
    "total": 12,
    "limit": 10,
    "offset": 0
  },
  "site": {
    "name": "My Website",
    "domain": "example.com",
    "defaultLocale": "en",
    "locales": [...]
  }
}

Get Single Item

Fetch a specific collection item by slug.

GET /api/public/collections/:slug/:itemSlug

Path Parameters

ParameterTypeRequiredDescription
slugstringYesCollection slug
itemSlugstringYesItem slug

Query Parameters

ParameterTypeRequiredDescription
localestringNoLocale code

Example

curl "https://parallele.ai/api/public/collections/team/jane-smith?locale=en" \
  -H "x-api-key: prl_xxx"

Response:

{
  "item": {
    "slug": "jane-smith",
    "locale": "en",
    "data": {
      "name": "Jane Smith",
      "role": "Head of Design",
      "bio": "Jane leads our design team with 10+ years of experience...",
      "photo": "https://cdn.example.com/jane.jpg",
      "social": {
        "linkedin": "https://linkedin.com/in/janesmith",
        "twitter": "https://twitter.com/janesmith"
      }
    },
    "publishedAt": "2025-01-05T12:00:00Z",
    "updatedAt": "2025-01-18T16:45:00Z"
  },
  "collection": {
    "slug": "team",
    "name": "Team Members"
  }
}

Pagination

Use limit and offset for pagination:

async function getAllTestimonials(locale: string) {
  const items = [];
  let offset = 0;
  const limit = 20;
 
  while (true) {
    const response = await fetch(
      `https://parallele.ai/api/public/collections/testimonials?locale=${locale}&limit=${limit}&offset=${offset}`,
      { headers: { "x-api-key": process.env.PARALLELE_API_KEY! } }
    );
    const data = await response.json();
    items.push(...data.items);
 
    if (data.items.length < limit) break;
    offset += limit;
  }
 
  return items;
}

Sorting

Control the order of items:

# Sort by creation date, newest first
GET /api/public/collections/blog?sortBy=createdAt&sortOrder=desc
 
# Sort by custom order (as set in CMS)
GET /api/public/collections/testimonials?sortBy=order&sortOrder=asc

On this page