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

# 查詢訂單

> 獲取你某一筆訂單的當前狀態

獲取呼叫方某一筆訂單的當前狀態。回傳帶 `matchedRisk` / `unmatchedRisk` 核算以及底層賽事反正規化快照的訂單。

<h2 id="request">
  請求
</h2>

`GET /session/lookupOrder`

<ParamField query="orderID" type="string" required>
  4casters 訂單 ID。可從 `/session/v3/place` 的 `data.unmatched.orderID` 或 `/user/getUnmatched` 的 `id` 獲取。
</ParamField>

<CodeGroup>
  ```bash curl theme={null}
  curl "https://api.4casters.io/session/lookupOrder?orderID=ORDER_ID" \
    -H "Authorization: Bearer YOUR_TOKEN"
  ```
</CodeGroup>

<h2 id="response">
  回應
</h2>

<ResponseField name="data.order" type="object">
  <Expandable title="order">
    <ResponseField name="id" type="string" />

    <ResponseField name="cancelled" type="boolean" />

    <ResponseField name="isTheBestOffer" type="boolean">
      當對面沒有比該訂單更優賠率的競爭掛單時為 `true`。
    </ResponseField>

    <ResponseField name="odds" type="integer">該訂單的美式賠率（相對內部儲存做了符號翻轉）。</ResponseField>
    <ResponseField name="type" type="string">`moneyline`、`spread`、`total` 或 `moneyline1x2`。</ResponseField>
    <ResponseField name="OU" type="string">`total` 市場上該訂單方向的對面。非大小分盤為 `null`。</ResponseField>
    <ResponseField name="participant" type="string">你下注的參賽方 ID。`total` 為 `null`。</ResponseField>

    <ResponseField name="participantLongName" type="string" />

    <ResponseField name="spread" type="number" />

    <ResponseField name="total" type="number" />

    <ResponseField name="matchedRisk" type="string">已被撮合的風險額（字串格式，兩位小數）。</ResponseField>
    <ResponseField name="unmatchedRisk" type="string">仍掛在訂單簿上的剩餘風險額。</ResponseField>

    <Snippet file="zh-Hant/types/game-summary.mdx" />
  </Expandable>
</ResponseField>

<h2 id="errors">
  錯誤
</h2>

| 狀態 | 含義 |
| - | - |
| `403` | 不是你的訂單。 |
| `404` | 無效的訂單 ID。 |


## OpenAPI

````yaml GET /session/lookupOrder
openapi: 3.1.0
info:
  title: 4casters REST API
  version: 1.0.0
  description: >-
    Public REST API for the 4casters peer-to-peer betting exchange. Use this API
    to manage your account, query the orderbook and games, and place / edit /
    cancel orders.


    All responses (unless noted otherwise) are JSON envelopes of the form `{
    "data": ... }`.
  contact:
    name: 4casters
    url: https://4casters.io
servers:
  - url: https://api.4casters.io
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Authentication
    description: Login and account session management
  - name: User
    description: Read account info, bets, and orders
  - name: Orders
    description: Place, edit, look up, and cancel orders
  - name: Markets
    description: Browse leagues, games, participants, and orderbooks
  - name: Affiliate
    description: Affiliate / referral commission
paths:
  /session/lookupOrder:
    get:
      tags:
        - Orders
      summary: Look up an order
      description: >-
        Get the current state of one of the caller's orders. Returns the order
        with `matchedRisk` / `unmatchedRisk` accounting and a denormalized
        snapshot of the underlying game.
      parameters:
        - name: orderID
          in: query
          required: true
          schema:
            type: string
          description: A 4casters order id (e.g. `id` from `/user/getUnmatched`).
      responses:
        '200':
          description: Order details
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      order:
                        $ref: '#/components/schemas/LookupOrderDetail'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: Not your order
        '404':
          description: Invalid Session ID
components:
  schemas:
    LookupOrderDetail:
      type: object
      properties:
        id:
          type: string
        cancelled:
          type: boolean
        isTheBestOffer:
          type: boolean
          description: >-
            True if there is no competing offer on the other side at better odds
            than this order.
        odds:
          type: integer
          description: American odds of this order (sign-flipped from internal storage).
        type:
          $ref: '#/components/schemas/MarketType'
        OU:
          type: string
          nullable: true
          description: >-
            Opposite of the order's side for `total` markets. `null` for
            non-total.
        participant:
          type: string
          nullable: true
          description: Participant id you bet on. `null` for `total`.
        participantLongName:
          type: string
          nullable: true
        spread:
          type: number
          nullable: true
        total:
          type: number
          nullable: true
        matchedRisk:
          type: string
          description: Risk that has already been matched (string-formatted, 2 decimals).
        unmatchedRisk:
          type: string
          description: Remaining risk still resting on the book.
        game:
          $ref: '#/components/schemas/GameSummary'
    MarketType:
      type: string
      enum:
        - moneyline
        - spread
        - total
        - moneyline1x2
      description: >-
        Market type. `moneyline1x2` is **soccer-only** (three-way money line:
        home / away / draw).
    GameSummary:
      type: object
      properties:
        id:
          type: string
        league:
          type: string
        sport:
          type: string
        start:
          type: string
          format: date-time
        ended:
          type: boolean
        eventName:
          type: string
          nullable: true
        isFutures:
          type: boolean
        participants:
          type: array
          items:
            $ref: '#/components/schemas/Participant'
    Participant:
      type: object
      properties:
        id:
          type: string
        longName:
          type: string
        shortName:
          type: string
        homeAway:
          type: string
          enum:
            - home
            - away
        mainPitcher:
          type: string
          nullable: true
        rotationNumber:
          type: string
          nullable: true
        futuresSide:
          type: string
          nullable: true
        score:
          type: number
          description: Final score; only present for ended games.
  responses:
    Unauthorized:
      description: Missing or invalid auth token
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Pass your auth token in the `Authorization` header. The `Bearer` prefix
        is optional; the server also accepts a signed `auth` cookie or a `token`
        field in the request body.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.