---
title: "GET /v2/search"
method: GET
path: "/v2/search"
tags: ["messages", "contacts", "search"]
---

# GET /v2/search

`GET /v2/search`

Simple API to execute full-text searches within user's indexes. A more complexe API will be available with a POST verb.

## Query parameters

- `term` string, required
- `field` string
- `doctype` 'message' | 'contact' | ''
- `limit` integer
- `offset` integer

## Headers

- `X-Caliopen-IL` string, required

## Response `200`

an object holding an array of documents found. Docs are assembled by type.

- object
  - `total` integer — total number of documents found
  - `message_hits` object
    - `total` integer — total number of messages found
    - `messages` SearchResponse[] — at most 5 documents are returned if query param « type » is not specified.
      - `id` string — id of document (shortcut to fetch full doc from db if needed).
      - `score` number, float — how confident is our index for this document to match the request. Higher is better. Documents are sorted on this field by default.
      - `highlights` object — Field names where terms of request where found. Each key maps to an array of excerpts.
      - `document` object — full document returned from index.
  - `contact_hits` object
    - `total` integer — total number of contacts found
    - `contacts` SearchResponse[] — at most 5 documents are returned if query param « type » is not specified.
      - `id` string — id of document (shortcut to fetch full doc from db if needed).
      - `score` number, float — how confident is our index for this document to match the request. Higher is better. Documents are sorted on this field by default.
      - `highlights` object — Field names where terms of request where found. Each key maps to an array of excerpts.
      - `document` object — full document returned from index.

## Other responses

- `400` — malform request
- `401` — Unauthorized access

---

[API](https://skmtc.net/caliopen/apis/caliopen-http-rest-api.md) · [All operations](https://skmtc.net/caliopen/apis/caliopen-http-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/caliopen/caliopen-http-rest-api/revisions/f32b5d08284d/schema)
