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

# Look up an order

> Get the current state of one of your orders

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.

## Request

`GET /session/lookupOrder`

<ParamField query="orderID" type="string" required>
  A 4casters order id. Get one from `data.unmatched.orderID` of `/session/v3/place` or `id` from `/user/getUnmatched`.
</ParamField>

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

## Response

<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` when there is no competing offer on the other side at better odds than this order.
    </ResponseField>

    <ResponseField name="odds" type="integer">American odds of this order (sign-flipped from internal storage).</ResponseField>
    <ResponseField name="type" type="string">`moneyline`, `spread`, `total`, or `moneyline1x2`.</ResponseField>
    <ResponseField name="OU" type="string">Opposite of the order's side for `total` markets. `null` for non-total.</ResponseField>
    <ResponseField name="participant" type="string">Participant id you bet on. `null` for `total`.</ResponseField>

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

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

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

    <ResponseField name="matchedRisk" type="string">Risk that has already been matched (string-formatted, 2 decimals).</ResponseField>
    <ResponseField name="unmatchedRisk" type="string">Remaining risk still resting on the book.</ResponseField>

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

## Errors

| Status | Meaning           |
| ------ | ----------------- |
| `403`  | Not your order.   |
| `404`  | Invalid order 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.

````