---
title: "Search active reusable snippet references by full-text token query."
method: POST
path: "/snippets/search"
tags: ["snippet"]
---

# Search active reusable snippet references by full-text token query.

`POST /snippets/search`

Token-based full-text search across snippet name, task summary, and body
using the Spanner SEARCH() function and `idx_snippet_search_reference_search`.
Returns rich per-snippet rows ordered by SCORE() descending.

The `query` follows Spanner search syntax — multi-token queries default to AND.
Callers can join keywords with " OR " for broader recall, or quote phrases.

## Query parameters

- `workspace_id` string, required

## Request body

- SnippetSearchTextRequest — Request body for snippet full-text search.
  - `query` string, required — Full-text search query in Spanner search syntax. Whitespace-only queries return zero results.
  - `search_field` 'combined' | 'name' | 'task_summary' | 'body' — Which tokenlist column to search. Defaults to combined.
  - `snippet_types` SnippetSearchTypeEnum[] — Optional filter restricting results to the listed snippet types.
  - `updated_after` string, date-time — Only return snippets last updated at or after this timestamp.
  - `limit` integer — Maximum number of results to return.

## Response `200`

Search results ordered by relevance score (descending).

- SnippetSearchTextResult — Result envelope for snippet text search.
  - `matches` SnippetSearchTextMatch[], required — Matches ordered by score descending.
    - `invariant_id` string, required — The invariant id of the snippet.
    - `name` string — The display name of the snippet.
    - `description` string — Description of the snippet.
    - `task_summary` string — AI-generated summary of what the snippet does.
    - `labels` string[] — Labels attached to this snippet.
    - `snippet_type` 'javascript' | 'sql' | 'postman'
    - `last_updated_time` string, date-time — When the snippet was last edited.
    - `body_text` string — Decoded body text, capped at 8000 characters server-side.
    - `body_truncated` boolean — True if the body was truncated at the server-side cap.
    - `score` number, double, required — SCORE() value from Spanner full-text search.
    - `matched_field` 'combined' | 'name' | 'task_summary' | 'body', required — Which search field was used.
  - `truncated` boolean, required — True if any match had its body truncated.

## Other responses

- `400` — Invalid or missing parameter
- `401` — User not authenticated
- `403` — User not authorized
- `default` — Unknown error

---

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