> ## Documentation Index
> Fetch the complete documentation index at: https://docs.olostep.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 検索を作成

> 自然言語クエリでウェブを検索し、タイトルと説明付きの関連リンクの重複排除リストを取得します。  クエリをウェブ全体で意味的に検索し、結果を返します。  オプションで`scrape_options`を渡して、返された各URLをスクレイピングし、`markdown_content` / `html_content`を各リンクに直接埋め込むこともできます。ページスクレイピングは、基盤となる/v1/scrapesエンドポイントを通じて自動的にチームに請求されます。  [検索機能](/features/search)を参照してください。



## OpenAPI

````yaml ja/openapi/search.json POST /v1/searches
openapi: 3.0.3
info:
  title: 検索API
  version: 1.1.0
servers:
  - url: https://api.olostep.com
security: []
paths:
  /v1/searches:
    post:
      summary: 検索を作成
      description: >-
        自然言語クエリでウェブを検索し、タイトルと説明付きの関連リンクの重複排除リストを取得します。 
        クエリをウェブ全体で意味的に検索し、結果を返します。 
        オプションで`scrape_options`を渡して、返された各URLをスクレイピングし、`markdown_content` /
        `html_content`を各リンクに直接埋め込むこともできます。ページスクレイピングは、基盤となる/v1/scrapesエンドポイントを通じて自動的にチームに請求されます。 
        [検索機能](/features/search)を参照してください。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                query:
                  type: string
                  description: 自然言語での検索クエリ。
                  example: What's going on with OpenAI's Sora shutting down?
                limit:
                  type: integer
                  description: 重複排除後に返すリンクの最大数。
                  minimum: 1
                  maximum: 25
                  default: 12
                  example: 10
                include_domains:
                  type: array
                  description: >-
                    結果をこれらのドメインに制限します。ホスト名のみ — 先頭の `http(s)://`
                    と末尾のスラッシュは自動的に削除されます。
                  items:
                    type: string
                  example:
                    - nytimes.com
                    - wsj.com
                exclude_domains:
                  type: array
                  description: >-
                    これらのドメインからの結果を除外します。ホスト名のみ — 先頭の `http(s)://`
                    と末尾のスラッシュは自動的に削除されます。
                  items:
                    type: string
                  example:
                    - reddit.com
                fast_mode:
                  type: boolean
                  description: >-
                    クエリをそのまま使って直接、低遅延の検索をリクエストします。デフォルトモードでは、より広範囲の結果をカバーするために広い検索を行います。
                  default: false
                scrape_options:
                  $ref: '#/components/schemas/ScrapeOptions'
              required:
                - query
            examples:
              minimal:
                summary: 最小限 — クエリのみ
                value:
                  query: Best Answer Engine Optimization startups
              withScrape:
                summary: scrape_options + ドメインフィルター + 制限付き
                value:
                  query: What's going on with OpenAI's Sora shutting down?
                  limit: 10
                  include_domains:
                    - nytimes.com
                    - wsj.com
                  exclude_domains:
                    - pinterest.com
                  scrape_options:
                    formats:
                      - markdown
                    remove_css_selectors: default
                    timeout: 25
      responses:
        '200':
          description: 検索結果を含む成功したレスポンス。
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    example: search_9bi0sbj9xa
                  object:
                    type: string
                    example: search
                  created:
                    type: integer
                    example: 1760327323
                  metadata:
                    type: object
                  query:
                    type: string
                    example: Best Answer Engine Optimization startups
                  credits_consumed:
                    type: integer
                    description: >-
                      このリクエストで消費された合計クレジット: 5 基本検索クレジット + scrape_options
                      を使用した場合のページごとのスクレイプクレジットの合計。
                    example: 10
                  result:
                    type: object
                    properties:
                      json_content:
                        type: string
                        description: 検索結果全体の文字列化されたJSON。
                      json_hosted_url:
                        type: string
                        description: S3上のホストされたJSONファイルのURL。
                        nullable: true
                      links:
                        type: array
                        description: >-
                          複数の検索で見つかった関連リンクの重複排除リスト。scrape_options
                          が提供された場合、各リンクには `markdown_content` や `html_content`
                          が含まれることがあります。
                        items:
                          $ref: '#/components/schemas/SearchLink'
                      size_exceeded:
                        type: boolean
                        description: >-
                          インラインのリンクごとのコンテンツが9MBの安全上限を超えた場合にtrueになります。trueの場合、レスポンス内のコンテンツフィールドはnullになり、完全なペイロードを取得するにはjson_hosted_urlを使用してください。
                      credits_consumed:
                        type: integer
                        description: トップレベルのcredits_consumedと同じ値。
        '400':
          description: >-
            不正なリクエスト —
            検証に失敗しました（クエリがない、無効な制限、サポートされていないscrape_options.formatsの値など）。レスポンスボディは
            `{ "message": "<理由>" }` です。
        '401':
          description: 無効なAPIキー
        '500':
          description: 内部サーバーエラー
      security:
        - Authorization: []
components:
  schemas:
    ScrapeOptions:
      type: object
      description: >-
        任意。指定された場合、返された各リンクもスクレイピングされ、その内容がレスポンスに埋め込まれます。ページごとのスクレイピングクレジットは、基盤となる/v1/scrapesエンドポイントによって自動的に請求されます。
      properties:
        formats:
          type: array
          description: >-
            各スクレイピングされたページに要求する出力フォーマット。省略時は['markdown']がデフォルトです。現在、/v1/searchesでサポートされているのは'html'と'markdown'のみです。
          items:
            type: string
            enum:
              - html
              - markdown
          default:
            - markdown
          example:
            - markdown
        remove_css_selectors:
          type: string
          description: >-
            コンテンツから特定のCSSセレクタを削除するオプション。/v1/scrapesに転送されます。デフォルトは'default'で、['nav','footer','script','style','noscript','svg',[role=alert],[role=banner],[role=dialog],[role=alertdialog],[role=region][aria-label*=skip
            i],[aria-modal=true]]を削除します。無効にするには'none'を渡すか、削除するセレクタのJSON文字列化された配列を渡します。
          default: default
        timeout:
          type: integer
          description: >-
            スクレイピングフェーズ全体のウォールクロック予算（秒単位）。これが経過すると、利用可能なリンクで検索が返されます —
            スクレイピングが完了していないリンクのコンテンツフィールドはnullになります。
          minimum: 1
          maximum: 60
          default: 25
    SearchLink:
      type: object
      properties:
        url:
          type: string
          description: 結果のURL。
        title:
          type: string
          nullable: true
          description: 結果ページのタイトル。
        description:
          type: string
          nullable: true
          description: 結果の短いスニペットまたは説明。
        markdown_content:
          type: string
          nullable: true
          description: >-
            ページのMarkdownコンテンツ。scrape_options.formatsに'markdown'が含まれている場合のみ存在します。スクレイピングが失敗した場合、空の場合、またはグローバルタイムアウトに達した場合はnullです。RedditコメントURLの場合、これは@olostep/reddit-postパーサーの構造化JSONから生成され、より高品質です。
        html_content:
          type: string
          nullable: true
          description: >-
            ページのHTMLコンテンツ。scrape_options.formatsに'html'が含まれている場合のみ存在します。スクレイピングが失敗した場合、空の場合、またはグローバルタイムアウトに達した場合はnullです。
  securitySchemes:
    Authorization:
      type: http
      scheme: bearer
      description: Bearer <token>形式のBearer認証ヘッダー。<token>はあなたの認証トークンです。

````