---
title: "Search API"
url: "https://adaptocms.com/docs/search-api/"
source: adaptocms.com
---

# Search API

The Search API provides full-text search across all your content types — articles, pages, and custom collection items — from a single endpoint.

## Endpoint

Method

Endpoint

Description

`GET`

`/v1/search`

Search across entities

* * *

## Search

```
GET /v1/search
```

Performs a full-text search and returns matching results from across content types.

### Query Parameters

Parameter

Type

Required

Description

`keyword`

string

**Yes**

The search term

`scope`

string

No

Limit search scope: `articles`, `pages`, `collections`, or a specific collection UUID

`limit`

integer

No

Maximum number of results to return

### Scope Options

-   **No scope** — Searches across all entity types (articles, pages, and collection items).
-   `articles` — Search only in articles.
-   `pages` — Search only in pages.
-   `collections` — Search across all custom collection items.
-   **Collection UUID** — Search only within a specific custom collection's items.

### Example Request: Global Search

```
curl -X GET "https://public-api.adaptocms.com/v1/search?keyword=getting+started&limit=10" \
  -H "x-api-key: YOUR_API_KEY"
```

### Example Request: Scoped to Articles

```
curl -X GET "https://public-api.adaptocms.com/v1/search?keyword=tutorial&scope=articles&limit=5" \
  -H "x-api-key: YOUR_API_KEY"
```

### Example Request: Scoped to a Specific Collection

```
curl -X GET "https://public-api.adaptocms.com/v1/search?keyword=engineer&scope=coll-001&limit=5" \
  -H "x-api-key: YOUR_API_KEY"
```

### Response Format

Returns an array of `SearchResultModel` objects:

```
[
  {
    "entity_type": "article",
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "title": "Getting Started with Adapto CMS",
    "slug": "getting-started-with-adapto-cms",
    "parent_id": null,
    "parent_name": null
  },
  {
    "entity_type": "page",
    "id": "page-001",
    "title": "Getting Started Guide",
    "slug": "getting-started-guide",
    "parent_id": null,
    "parent_name": null
  },
  {
    "entity_type": "collection_item",
    "id": "item-042",
    "title": "Quick Start Tutorial",
    "slug": "quick-start-tutorial",
    "parent_id": "coll-005",
    "parent_name": "Documentation"
  }
]
```

### SearchResultModel Fields

Field

Type

Description

`entity_type`

string

Type of entity: `article`, `page`, or `collection_item`

`id`

string

Unique identifier of the matched entity

`title`

string

Title of the matched entity

`slug`

string

URL-friendly slug

`parent_id`

string | null

Parent page ID or collection ID (for collection items)

`parent_name`

string | null

Parent page title or collection name

### Use Case: Site-Wide Search

```
async function siteSearch(query) {
  const results = await fetch(
    `${BASE_URL}/v1/search?keyword=${encodeURIComponent(query)}&limit=20`,
    { headers: { 'x-api-key': API_KEY } }
  ).then(r => r.json());

  // Group results by type
  const grouped = {
    articles: results.filter(r => r.entity_type === 'article'),
    pages: results.filter(r => r.entity_type === 'page'),
    collections: results.filter(r => r.entity_type === 'collection_item')
  };

  return grouped;
}

// Build search result links
function getResultUrl(result) {
  switch (result.entity_type) {
    case 'article': return `/blog/${result.slug}`;
    case 'page': return `/${result.slug}`;
    case 'collection_item': return `/collections/${result.parent_id}/${result.slug}`;
  }
}
```
