---
title: "Search Blocks"
method: GET
path: "/api/blocks/search"
tags: ["blocks"]
---

# Search Blocks

`GET /api/blocks/search`

## Request

- Base URL: `https://app.ctlsurf.com` (the document declares no server; this is the origin it was published from)
- URL: `https://app.ctlsurf.com/api/blocks/search`
- Auth: HTTP bearer

Search over block content using PostgreSQL full-text search with trigram fuzzy matching fallback.
Returns snippets only; fetch full text via /blocks/{block_id}/slice.

Features:
- Full-text search with stemming (run/running/ran all match)
- Trigram fuzzy matching for typo tolerance (threshold 0.3)
- Results ranked by relevance

## Query parameters

- `q` string, required
- `page_id` string, uuid, nullable
- `limit` integer
- `offset` integer

## Response `200`

Successful Response

- BlockSearchResponse
  - `results` BlockSearchResult[], required
    - `block_id` string, uuid, required
    - `page_id` string, uuid, required
    - `page_title` string, nullable, required
    - `title` string, nullable, required
    - `type` 'text' | 'checklist' | 'table' | 'react_flow' | 'agent_control' | 'tree' | 'ctlsurf_task' | 'page_summary' | 'file' | 'mindmap' | 'datastore' | 'state' | 'log' | 'presentation', required
    - `match_start` integer, required
    - `match_end` integer, required
    - `snippet` string, required
    - `size_bytes` integer, required
    - `content_type` string, required
  - `total` integer, required
  - `limit` integer, required
  - `offset` integer, required
  - `has_more` boolean, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/ctlsurf/apis/notebook-control-plane.md) · [All operations](https://skmtc.dev/ctlsurf/apis/notebook-control-plane/llms.txt) · [OpenAPI document](https://skmtc.dev/ctlsurf/apis/notebook-control-plane/revisions/ddfbbe20d5ce?raw)
