> ## 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.

# クロールの作成

> 新しいクロールを開始します。進行状況を追跡するための `id` を受け取ります。操作はサイト、深さ、ページのパラメータに応じて1〜10分かかる場合があります。

<Tip>
  **完了時に通知を受け取る:** クロールが完了したときにHTTP POSTを受け取るために、`webhook` パラメータとあなたのエンドポイントURLを渡します。詳細は[Webhooks](/api-reference/common/webhooks)を参照してください。
</Tip>


## OpenAPI

````yaml ja/openapi/crawls.json POST /v1/crawls
openapi: 3.0.3
info:
  title: クローラーAPI
  version: 1.0.0
servers:
  - url: https://api.olostep.com
security: []
paths:
  /v1/crawls:
    post:
      summary: 新しいクローラーを開始
      description: 指定されたパラメーターで新しいクローラーのプロセスを開始します。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                start_url:
                  type: string
                  description: クローラーの開始地点。
                include_urls:
                  type: array
                  items:
                    type: string
                  description: >-
                    glob構文を使用してクローラーに含めるURLパスパターン。 
                    デフォルトは`/**`で、すべてのURLを含みます。特定のセクションをクロールするには`/blog/**`のようなパターンを使用します（例：ブログページのみ）、`/products/*.html`は商品ページ用、または異なるセクションのために複数のパターンを使用します。*（任意の文字）や**（再帰的マッチング）などの標準的なglob機能をサポートしています。
                exclude_urls:
                  type: array
                  items:
                    type: string
                  description: >-
                    globパターンで除外するURLパス名。例：`/careers/**`。除外されたURLは含まれるURLより優先されます。
                max_pages:
                  type: number
                  description: クロールするページの最大数。ウェブサイト全体をクロールするようなほとんどのユースケースに推奨されます。
                max_depth:
                  type: number
                  description: クロールの最大深度。n次のリンクまでのみ抽出するのに便利です。
                include_external:
                  type: boolean
                  description: 一次外部リンクをクロールします。
                include_subdomain:
                  type: boolean
                  description: ウェブサイトのサブドメインを含めます。デフォルトは`false`です。
                search_query:
                  type: string
                  description: 特定のリンクを見つけるためのオプションの検索クエリで、結果を関連性でソートします。
                top_n:
                  type: number
                  description: 検索クエリに従って、各ページで最も関連性の高いリンクのトップNのみをクロールするオプションの数。
                webhook:
                  type: string
                  format: uri
                  description: >-
                    クロールが完了したときにPOSTリクエストを受け取るためのHTTPS
                    URL。`http://`または`https://`プロトコルを使用して公開アクセス可能なURLでなければなりません。localhostやプライベートIPアドレスを指すことはできません。ペイロード形式と再試行の動作については[Webhooks](/api-reference/common/webhooks)を参照してください。
                timeout:
                  type: number
                  description: >-
                    n秒後にクロールを終了し、その時点までに完了したページを取得します。指定されたタイムアウトから約10秒余分にかかることがあります。
                follow_robots_txt:
                  type: boolean
                  description: >-
                    robots.txtのルールを尊重するかどうか。`false`に設定すると、クローラーはrobots.txtの禁止指令に関係なくウェブサイトをスクレイプします。デフォルトは`true`です。
                  default: true
                scrape_options:
                  type: object
                  description: Olostep APIから各個別ページのスクレイプリクエストを制御します。すべてのフィールドはオプションです。
                  properties:
                    formats:
                      type: array
                      items:
                        type: string
                        enum:
                          - html
                          - markdown
                          - text
                          - json
                          - screenshot
                      description: >-
                        各スクレイプされたページにリクエストする出力形式。省略時は`["html",
                        "markdown"]`がデフォルトです。`html`は常に自動的に含まれます。`parser`が提供されると`json`が自動的に追加されます。注意：`raw_pdf`はサポートされていません—PDFはクロールできません。
                      example:
                        - markdown
                        - screenshot
                    parser:
                      type: string
                      description: >-
                        各ページで実行し、構造化された`json`出力を生成するためのパーサー名（例：`"@olostep/extract-emails"`）。設定されると`formats`に`json`を自動的に追加します。
                      example: '@olostep/extract-emails'
              required:
                - start_url
                - max_pages
      responses:
        '200':
          description: クロールが正常に開始されました。
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: クロールID
                  object:
                    type: string
                    description: オブジェクトの種類。このエンドポイントでは "crawl"。
                  status:
                    type: string
                    description: '`in_progress` または `completed`'
                  created:
                    type: number
                    description: エポックでの作成時間
                  start_date:
                    type: string
                    description: 日付での作成時間
                  start_url:
                    type: string
                  max_pages:
                    type: number
                  max_depth:
                    type: number
                  exclude_urls:
                    type: array
                    items:
                      type: string
                  include_urls:
                    type: array
                    items:
                      type: string
                  include_external:
                    type: boolean
                  search_query:
                    type: string
                  top_n:
                    type: number
                  current_depth:
                    type: number
                    description: クローリングプロセスの現在の深さ。
                  pages_count:
                    type: number
                    description: クロールされたページの数
                  webhook:
                    type: string
                  follow_robots_txt:
                    type: boolean
                  credits_consumed:
                    type: integer
                    nullable: true
                    description: このリクエストで消費されたクレジットの数。実行完了後に設定されるよ。クレジットは請求の基準だよ。
                  cost_usd:
                    type: number
                    nullable: true
                    description: >-
                      このリクエストのUSDでの推定コスト。実行完了後に設定されるよ。消費されたクレジットとプランのレートから計算されるよ
                      — 99%の精度だけど、credits_consumedが正確な値だよ。
        '400':
          description: 不正なリクエスト。パラメータが間違っているか、欠落しています。
        '500':
          description: 内部サーバーエラー。
      security:
        - Authorization: []
components:
  securitySchemes:
    Authorization:
      type: http
      scheme: bearer
      description: Bearer <token>形式のBearer認証ヘッダー。<token>はあなたの認証トークンです。

````