---
title: "Retrieves content from the dotCMS repository"
method: POST
path: "/api/v1/content/search"
tags: ["Content"]
---

# Retrieves content from the dotCMS repository

`POST /api/v1/content/search`

Abstracts the generation of the required Lucene query to look for user searchable fields in a Content Type, and returns the expected results. Payload info:

| Property                        | Type    | Description                                           |
|---------------------------------|---------|-------------------------------------------------------|
| `globalSearch`                  | String  | Global search term (like the main search box)         |
| `searchableFieldsByContentType` | Object  | Content-type specific field searches. Value object consists of content type variables as keys, and objects as values, the latter consisting of the system variables of fields as keys, and query strings as values. See table below for how to interact with different field types, and the example request for how to structure the payload. |
| `systemSearchableFields`        | Object  | System-level filters: `siteid`, `languageId`, `folderId`, `workflowSchemeId`, `workflowStepId`, and `variantName` (defaults to "DEFAULT"). `systemHostContent` determines whether to include content from the SYSTEM_HOST (defaults to "true"). |
| `archivedContent`               | Boolean String | Include archived content ("true"/"false")         |
| `unpublishedContent`            | Boolean String | Include unpublished content ("true"/"false")      |
| `lockedContent`                 | Boolean String | Include locked content ("true"/"false")           |
| `orderBy`                       | String  | Sort criteria (defaults to "score,modDate desc")    |
| `page`                          | Integer | Page number for pagination                            |
| `perPage`                       | Integer | Results per page                                      |

When using `searchableFieldsByContentType`, different fields may require different string types:

| Field Type                  | Description                                 |
|-----------------------------|---------------------------------------------|
| title, textArea, wysiwyg    | Text search                                 |
| category                    | Comma-separated category IDs                |
| checkbox, multiSelect       | Comma-separated values (not labels)         |
| radio, select               | Values (not labels)                         |
| date, dateAndTime           | Date or range: "2023-01-01 TO 2023-12-31" |
| time                        | Time or range with TO                       |
| tag                         | Comma-separated tag names                   |
| relationships               | Child contentlet ID                         |
| json, keyValue              | Matches any string in JSON                  |
| binary, blockEditor, custom | Text search

## Request body

- ContentSearchForm — Form for searching content with support for global search, content type specific fields, and system filters
  - `globalSearch` string
  - `systemSearchableFields` object
  - `archivedContent` string
  - `unpublishedContent` string
  - `lockedContent` string
  - `orderBy` string
  - `page` integer
  - `perPage` integer
  - `searchableFieldsByContentType` object

## Response `200`

The query has been executed. It's possible that no contents matched the search criteria.

- SearchView
  - `resultsSize` integer
  - `queryTook` integer
  - `contentTook` integer
  - `jsonObjectView` JsonObjectView
    - `jsonObject` object
      - `asMap` object
      - `empty` boolean

## Other responses

- `400` — Bad request. Malformed JSON body
- `401` — Invalid User, or not logged in
- `403` — Forbidden
- `500` — Internal Server Error

---

[API](https://skmtc.dev/jostens/apis/dotcms-rest-api.md) · [All operations](https://skmtc.dev/jostens/apis/dotcms-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/jostens/dotcms-rest-api/revisions/a088fe9f515c/schema)
