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

# 3連複



## OpenAPI

````yaml /reference/openapi.json get /races/{raceId}/odds/trio
openapi: 3.1.0
info:
  title: BeTerKEIBA Core API
  description: >-
    JV-Data をベースとした競馬データ配信プラットフォーム。Cloudflare Workers (Hono), D1,
    R2を組み合わせたモダンなアーキテクチャで構築されています。


    ### 特徴

    - **高速レスポンス**: Cloudflareのエッジネットワークによる低レイテンシ。

    - **完全なデータ構造**: 産駒から現役、オッズ、マイニングまで網羅。

    - **開発者フレンドリー**: MintlifyドキュメントとTypeScript SDKによる高い開発効率
  version: 1.0.0
servers:
  - url: https://api.beter-keiba.com/v1
    description: 本番環境
security:
  - bearerAuth: []
tags:
  - name: Races
    description: レースデータ。開催情報・出走表・結果など、レース単位で取得する正規データ
  - name: Odds
    description: オッズデータ。単勝・複勝・枠連・馬連・ワイド・馬単・3連複・3連単の確定オッズおよび最終オッズ
  - name: Masters
    description: マスタデータ。競走馬・騎手・調教師・生産者・馬主・繁殖牝馬といった静的な実体情報
  - name: Updates
    description: 更新データ。スケジュール・調教・WIN5・予想指数など、随時更新が発生する派生データ
paths:
  /races/{raceId}/odds/trio:
    get:
      tags:
        - Odds
      summary: 3連複
      operationId: getRaceOddsTrio
      parameters:
        - $ref: '#/components/parameters/raceId'
        - $ref: '#/components/parameters/cutoff'
        - $ref: '#/components/parameters/minOdds'
        - $ref: '#/components/parameters/maxOdds'
        - $ref: '#/components/parameters/horseNumber'
        - $ref: '#/components/parameters/fields'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/SuccessResponse'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/OddsTrio'
              example:
                code: SUCCESS
                data:
                  raceId: ra_2024052605021211
                  dataType: '3'
                  dataUpdatedAt: 1716715200
                  announcedAt: 1716704000
                  entryCount: 18
                  starterCount: 18
                  createdAt: 1716704005
                  id: o5_2024052605021211
                  saleFlag: 7
                  odds:
                    - key: 05-12
                      odds: 46.6
                      popularity: 9
                  totalVotes: 540000000
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    raceId:
      name: raceId
      in: path
      required: true
      schema:
        $ref: '#/components/schemas/RaceId'
    cutoff:
      name: cutoff
      in: query
      schema:
        type: number
        minimum: 1
        maximum: 28
      description: 人気順で上位N件のみ取得 (1 以上 28 以下。中央競馬は最大 18 頭、海外国際レースは最大 28 頭まで)
    minOdds:
      name: minOdds
      in: query
      schema:
        type: number
        minimum: 0
      description: 指定したオッズ以上の組み合わせを抽出 (0 以上)
    maxOdds:
      name: maxOdds
      in: query
      schema:
        type: number
        minimum: 0
      description: 指定したオッズ以下の組み合わせを抽出 (0 以上)
    horseNumber:
      name: horseNumber
      in: query
      schema:
        type: number
        minimum: 1
        maximum: 28
      description: その馬番が含まれる組み合わせのみ抽出 (1 以上 28 以下。中央競馬は最大 18 頭、海外国際レースは最大 28 頭まで)
    fields:
      name: fields
      in: query
      schema:
        type: string
        maxLength: 500
      description: 取得するフィールドの絞り込み（カンマ区切り）
  schemas:
    SuccessResponse:
      type: object
      description: >-
        成功レスポンスの共通ラッパー。code は常に "SUCCESS"、data にエンドポイント固有のレスポンスボディ、extensions
        に補助情報 (pagination や統計など) を含みます。
      required:
        - code
        - data
      properties:
        code:
          type: string
          description: 処理結果コード。成功時は常に 'SUCCESS'
          example: SUCCESS
        data:
          description: 取得されたデータ本体
        extensions:
          $ref: '#/components/schemas/ResponseExtensions'
    OddsTrio:
      description: 3連複オッズ。3着までに入る3頭の組み合わせ（着順不問）に対するオッズ
      allOf:
        - $ref: '#/components/schemas/OddsBase'
        - type: object
          required:
            - id
            - raceId
            - dataType
          properties:
            id:
              $ref: '#/components/schemas/OddsTrioId'
            saleFlag:
              type: integer
              description: '発売フラグ (JV-Data O5: 0:発売なし / 1:発売前取消 / 3:発売後取消 / 7:発売あり)'
              example: 7
            odds:
              type: array
              description: 3連複組み合わせごとのオッズリスト
              items:
                $ref: '#/components/schemas/OddsItemSimple'
            totalVotes:
              type: integer
              description: 3連複の合計売上金額 (円、返還分を含む。JV-Data O5 レコード §15 由来 (H1 §36 と同値))
              example: 540000000
    RaceId:
      type: string
      pattern: ^ra_[0-9]{16}$
      example: ra_2024052605021211
      description: >-
        Race entity ID。JV-Data RA レコード由来の合成 PK (開催年月日 8 桁 + 場コード 2 桁 + 開催回 2 桁 +
        開催日目 2 桁 + レース番号 2 桁)
    ResponseExtensions:
      type: object
      description: レスポンスに関する補助情報（メタデータ）。一覧取得時にはページネーション情報が含まれます。
      properties:
        totalCount:
          type: integer
          description: 検索条件に一致する全データの総件数
          example: 150
        limit:
          type: integer
          description: 1リクエストあたりの最大取得件数
          example: 50
        page:
          type: integer
          description: 現在のページ番号
          example: 1
        totalPages:
          type: integer
          description: 全件数をlimitで割った合計ページ数
          example: 3
        dataUpdatedAt:
          type: integer
          description: 返却されたデータの最終更新日時 (Unix Timestamp)。キャッシュ制御などに利用します。
          example: 1716715200
    OddsBase:
      type: object
      description: Odds 系レコードに共通するメタデータ (JV-Data オッズレコード O1〜O6 の共通フィールド)
      properties:
        raceId:
          $ref: '#/components/schemas/RaceId'
        dataType:
          type: string
          description: >-
            データ区分 (JV-Data O1〜O6 レコード §2 由来)。1:中間, 2:前日売最終, 3:最終, 4:確定,
            5:確定(月曜), 9:レース中止, 0:該当レコード削除(提供ミスなどの理由による)
          example: '3'
          maxLength: 1
        dataUpdatedAt:
          type: integer
          description: データ作成日時 (JV-Data O1〜O6 レコード §3 由来、Unix Timestamp)
          example: 1716715200
        announcedAt:
          type: integer
          description: JRAから発表された月日時分 (Unix Timestamp)
          example: 1716704000
        entryCount:
          type: integer
          description: 登録頭数 (出馬表発表時、JV-Data O1〜O6 レコード §11 由来)
          example: 18
        starterCount:
          type: integer
          description: 出走頭数 (登録頭数から出走取消・競走除外・発走除外を除いた頭数、JV-Data O1〜O6 レコード §12 由来)
          example: 18
        createdAt:
          type: integer
          description: システムへのレコード登録日時 (Unix Timestamp)
          example: 1716704005
    OddsTrioId:
      type: string
      pattern: ^o5_[0-9]{16}$
      example: o5_2024052605021211
      description: >-
        OddsTrio record ID。race と 1:1 で対応する自然キー (= RaceId 16 桁に `o5_`
        prefix)。JV-Data O5 レコード由来 (3連複オッズ)
    OddsItemSimple:
      type: object
      description: 標準的なオッズ的中ユニット
      properties:
        key:
          type: string
          description: 馬番または組番。ハイフン区切りの文字列 (単勝/複勝の馬番 2 桁 〜 3連単 6 桁まで shared schema として共用)
          example: 05-12
          maxLength: 8
        odds:
          type: number
          description: 単一の確定オッズ値
          example: 46.6
        popularity:
          type: integer
          description: >-
            その時点での人気順位 (1〜)。JV-Data 原値が `sp:登録なし` / `--:発売前取消` / `**:発売後取消`
            の場合は本フィールドが省略される。無投票時は発売されている組合せの最大値が設定される
          example: 9
    ErrorResponse:
      type: object
      description: >-
        エラーレスポンスの共通ラッパー。すべての 4xx / 5xx で同一構造を返します。トップレベルの `error`
        フィールドに、プログラム判定用の `code`、人間向け `message`、問い合わせ追跡用の `requestId` を入れます。
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: エラーコード。プログラムで判定可能な SCREAMING_SNAKE_CASE 文字列
              example: UNAUTHORIZED
            message:
              type: string
              description: エラーの内容（人間向けメッセージ）
              example: 有効なAPIアクセスキーが必要です。
            requestId:
              type: string
              description: 問い合わせ用ID
              example: req_abcd1234
  responses:
    BadRequest:
      description: リクエストの構文エラーや型不整合
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: BAD_REQUEST
              message: リクエストの形式が正しくありません。
    Unauthorized:
      description: >-
        認証エラー（APIキー未設定、または無効）。`Authorization: Bearer <sk_live_... or
        sk_test_...>` を必ず付与してください。失敗理由（キー欠落 / 不明 / 失効）は同一 body で返します。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: UNAUTHORIZED
              message: 有効なAPIキーが必要です。
    NotFound:
      description: リソースが見つからない場合
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: NOT_FOUND
              message: 指定されたIDのリソースが見つかりませんでした。
    InternalServerError:
      description: サーバー内部エラー
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: INTERNAL_SERVER_ERROR
              message: サーバー内部で予期せぬエラーが発生しました。
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        APIダッシュボードで発行された `sk_live_...` または `sk_test_...` キーを入力してください。prefix は
        mode を示し、両 mode とも同じ API URL で利用できます (`sk_live_*` = live mode /
        本番、`sk_test_*` = test mode / 開発・自動テスト)。

````