{
  "searchRecords": {
    "get": {
      "operationId": "searchRecords",
      "tags": ["Records"],
      "summary": "Search readable records",
      "description": "Searches current records linked to the calling connection. All words must match. The last word also matches a prefix. Each page uses current permissions, and edits can move records between pages. When fields is supplied, each hit includes the selected canonical record under record.",
      "parameters": [
        {"name": "q", "in": "query", "required": true, "schema": {"type": "string", "minLength": 1, "maxLength": 200}},
        {
          "name": "kind",
          "in": "query",
          "schema": {
            "type": "string",
            "enum": ["place", "event", "recipe", "guide", "workout", "note", "link", "media", "product", "tab"]
          }
        },
        {"name": "limit", "in": "query", "schema": {"type": "integer", "minimum": 1, "maximum": 100, "default": 100}},
        {
          "name": "cursor",
          "in": "query",
          "description": "Use next_cursor from the previous page with the same query, kind and deep flag.",
          "schema": {"type": "string"}
        },
        {
          "name": "deep",
          "in": "query",
          "description": "Search retained source captions, transcripts and page text. Requires a first-party Pigeon session and Pro.",
          "schema": {"type": "boolean", "default": false}
        },
        {"$ref": "../components/parameters.yaml#/Fields"}
      ],
      "x-route-error-codes": {"400": ["invalid_request", "invalid_cursor"], "404": ["not_found"], "422": ["unsupported_schema"]},
      "responses": {
        "200": {
          "description": "A page of matching records. A null cursor indicates the final page.",
          "headers": {
            "request-id": {"$ref": "../components/headers.yaml#/RequestId"},
            "Cache-Control": {"$ref": "../components/headers.yaml#/CacheControl"}
          },
          "content": {"application/json": {"schema": {"$ref": "#/SearchPage"}}}
        },
        "400": {
          "description": "Invalid field selection, search input or a cursor that no longer matches the request.",
          "headers": {"request-id": {"$ref": "../components/headers.yaml#/RequestId"}, "Cache-Control": {"$ref": "../components/headers.yaml#/CacheControl"}},
          "content": {"application/problem+json": {"schema": {"$ref": "../components/schemas.yaml#/Problem"}}},
          "x-error-codes": ["invalid_cursor", "invalid_fields", "invalid_request"]
        },
        "401": {
          "description": "The credential is missing, invalid or tied to a superseded grant.",
          "headers": {"request-id": {"$ref": "../components/headers.yaml#/RequestId"}, "Cache-Control": {"$ref": "../components/headers.yaml#/CacheControl"}},
          "content": {"application/problem+json": {"schema": {"$ref": "../components/schemas.yaml#/Problem"}}},
          "x-error-codes": ["episode_superseded", "unauthorized"]
        },
        "402": {
          "description": "Deep search requires Pro.",
          "headers": {"request-id": {"$ref": "../components/headers.yaml#/RequestId"}, "Cache-Control": {"$ref": "../components/headers.yaml#/CacheControl"}},
          "content": {"application/problem+json": {"schema": {"$ref": "../components/schemas.yaml#/Problem"}}},
          "x-error-codes": ["pro_required"]
        },
        "403": {
          "description": "The connection, account or requested search mode is unavailable.",
          "headers": {"request-id": {"$ref": "../components/headers.yaml#/RequestId"}, "Cache-Control": {"$ref": "../components/headers.yaml#/CacheControl"}},
          "content": {"application/problem+json": {"schema": {"$ref": "../components/schemas.yaml#/Problem"}}},
          "x-error-codes": ["connection_disconnected", "connection_paused", "connection_required", "pro_required", "sapphire_account_required", "scope_denied"]
        },
        "404": {
          "description": "The requested object was not found.",
          "headers": {"request-id": {"$ref": "../components/headers.yaml#/RequestId"}, "Cache-Control": {"$ref": "../components/headers.yaml#/CacheControl"}},
          "content": {"application/problem+json": {"schema": {"$ref": "../components/schemas.yaml#/Problem"}}},
          "x-error-codes": ["not_found"]
        },
        "409": {
          "description": "Pigeon data deletion is in progress.",
          "headers": {"request-id": {"$ref": "../components/headers.yaml#/RequestId"}, "Cache-Control": {"$ref": "../components/headers.yaml#/CacheControl"}},
          "content": {"application/problem+json": {"schema": {"$ref": "../components/schemas.yaml#/Problem"}}},
          "x-error-codes": ["pigeon_data_deleting"]
        },
        "410": {
          "description": "The account, snapshot, cursor or history is no longer available.",
          "headers": {"request-id": {"$ref": "../components/headers.yaml#/RequestId"}, "Cache-Control": {"$ref": "../components/headers.yaml#/CacheControl"}},
          "content": {"application/problem+json": {"schema": {"$ref": "../components/schemas.yaml#/Problem"}}},
          "x-error-codes": ["account_deleted"]
        },
        "413": {
          "description": "The request, response or resulting work exceeds its limit.",
          "headers": {"request-id": {"$ref": "../components/headers.yaml#/RequestId"}, "Cache-Control": {"$ref": "../components/headers.yaml#/CacheControl"}},
          "content": {"application/problem+json": {"schema": {"$ref": "../components/schemas.yaml#/Problem"}}},
          "x-error-codes": ["response_too_large"]
        },
        "422": {
          "description": "The request violates a protocol or data rule.",
          "headers": {"request-id": {"$ref": "../components/headers.yaml#/RequestId"}, "Cache-Control": {"$ref": "../components/headers.yaml#/CacheControl"}},
          "content": {"application/problem+json": {"schema": {"$ref": "../components/schemas.yaml#/Problem"}}},
          "x-error-codes": ["unsupported_schema"]
        },
        "429": {
          "description": "The connection's read rate limit was reached.",
          "headers": {"request-id": {"$ref": "../components/headers.yaml#/RequestId"}, "Cache-Control": {"$ref": "../components/headers.yaml#/CacheControl"}, "Retry-After": {"$ref": "../components/headers.yaml#/RetryAfter"}},
          "content": {"application/problem+json": {"schema": {"$ref": "../components/schemas.yaml#/Problem"}}},
          "x-error-codes": ["rate_limited"]
        },
        "503": {
          "description": "Search is temporarily unavailable.",
          "headers": {"request-id": {"$ref": "../components/headers.yaml#/RequestId"}, "Cache-Control": {"$ref": "../components/headers.yaml#/CacheControl"}, "Retry-After": {"$ref": "../components/headers.yaml#/RetryAfter"}},
          "content": {"application/problem+json": {"schema": {"$ref": "../components/schemas.yaml#/Problem"}}},
          "x-error-codes": ["hub_not_ready", "identity_unavailable", "internal_error"]
        }
      }
    }
  },
  "SearchPage": {"$ref": "../components/schemas.yaml#/SearchPage"}
}
