Skip to content

Search shared pull requests, guides and review discussion in one authorized workspace

Search shared pull requests, guides and review discussion in one authorized workspace

POST /api/v1/search

Personal token · read

Read-only hybrid search. Results use current canonical content and guide-specific navigation. Review comments retain their actual author; decision rationale is historical text, never evidence of current approval. Cursors expire after five minutes and are bound to the credential, scope, query, filters, limit and active index. Changed rankings invalidate a cursor with conflict; start a new search. Search never starts ingestion or repairs an index. Pending authorization returns search_authorization_pending; a disabled or unavailable provider returns search_unavailable. Missing or lagging index coverage returns an incomplete page.

Example request

Link to this section
Shell
# Replace workspace_id with the workspace ID from GET /me.
# Set your token and resource IDs first.
API_BASE_URL="https://app.theseus.dev/api/v1"

curl --fail-with-body --request POST \
  -H "Authorization: Bearer ${THESEUS_API_TOKEN:?}" \
  -H "Content-Type: application/json" \
  --data '{"query":"notifications after reconnect","workspace_id":"wsp_YOUR_ID","limit":10}' \
  "${API_BASE_URL}/search"

Content type application/json

  • query string required

    Minimum length 1 · Maximum length 1024

  • workspace_id string required

    Pattern ^[A-Za-z0-9_-]{1,128}$

  • repository_ids array of string or null

    Default null · Maximum items 1000 · Each item: Pattern ^rep_[0-9A-Z]{26}$

  • limit integer

    Default 20 · Minimum 1 · Maximum 50

  • cursor string

    Maximum length 2048 · Pattern ^sr1_[0-9a-f]{24}\.(?:[0-9a-f]{2})+$

  • filters object

    filters fields
    • kinds array of string

      Minimum items 1 · Maximum items 5 · Each item: One of pull-request, summary, claim, comment, decision-rationale

    • paths array of string

      Minimum items 1 · Maximum items 20 · Each item: Minimum length 1 · Each item: Maximum length 1024

Bounded, grouped canonical search results

Response fields

Content type application/json

  • data array of SearchHit required

    Maximum items 50

    data fields
    • kind string required

      One of pull-request, summary, claim, comment, decision-rationale

    • source_id string required

    • repository object required

      repository fields
      • id string required

      • name string required

    • changeset_id string or null required

    • guide_id string or null required

    • claim_key string or null required

    • pull_request_number integer or null required

    • review_id string or null required

    • author one of required

      author variants

      One of:

      kind: user

      • kind string required

        Always user

      • user_id string required

      • display_name string required

      kind: github

      • kind string required

        Always github

      • github_user_id integer required

      • github_login string required

      • display_name string required

      Option 3

      null

    • historical boolean required

    • title string required

      Maximum length 1024

    • snippet string required

      Maximum length 512

    • paths array of string required

      Maximum items 20 · Each item: Maximum length 1024

    • url string (uri) required

  • next_cursor string or null required

  • has_more boolean required

  • incomplete boolean required

    Some authorized repositories lack a current index, or canonical candidates were discarded. An empty incomplete page is not evidence of no matches.

  • truncated boolean required

    The fixed 128-candidate / 32-source ranking window was exhausted. Narrow the query or repository scope to search further.

Example responses

Link to this section

Matching claim

Illustrative response · complete

{
  "data": [
    {
      "kind": "claim",
      "source_id": "chg_EXAMPLE",
      "repository": {
        "id": "rep_EXAMPLE",
        "name": "example/project"
      },
      "changeset_id": "set_EXAMPLE",
      "guide_id": "ver_EXAMPLE",
      "review_id": null,
      "author": null,
      "historical": false,
      "claim_key": "notification-preferences",
      "pull_request_number": null,
      "title": "Notifications survive a reconnect",
      "snippet": "Reconnecting keeps the existing notification preference.",
      "paths": [
        "src/notifications.ts"
      ],
      "url": "https://example-team.theseus.dev/example/project/pr/42/notification-preferences?version=ver_EXAMPLE"
    }
  ],
  "next_cursor": null,
  "has_more": false,
  "incomplete": false,
  "truncated": false
}
400 · The request is not valid

Error response fields

401 · A valid bearer token is required

Error response fields

403 · The credential's scopes do not allow this

Error response fields

404 · Not found

Error response fields

409 · The request conflicts with the resource as it is

Error response fields

426 · Upgrade the CLI: run theseus update

Error response fields

429 · Too many requests

Headers

  • Retry-After integer

    Seconds to wait before the next request, when known

Error response fields

503 · Theseus is unavailable; retry the same request

Headers

  • Retry-After integer

    Seconds to wait before the next request, when known

Error response fields

Error response fields

Content type application/problem+json

  • type string (uri) required

    Identifies the problem type; branch on code instead

  • title string required

  • status integer required

  • detail string

  • code string required

    Why the request failed. New codes may be added: treat an unknown one by its status

    One of invalid_request, unauthenticated, not_in_plan, insufficient_scope, admission_required, not_found, ambiguous, conflict, rate_limited, internal_error, unavailable, search_authorization_pending, search_unavailable, cli_upgrade_required

  • request_id string required

    Quote this when reporting the problem

  • errors array of FieldError

    With invalid_request: what is wrong with each field

    errors fields
    • path string required

      Where in the request, as dotted segments

    • message string required

  • required_scope string

    With insufficient_scope: the scope the operation needs

  • next string

    Recovery action, such as theseus update

  • candidates array of Candidate

    With ambiguous: what the request could mean; ask which

    candidates fields
    • id string required

    • path string required

    • kind string required

    • title string required

    • url string (uri) required