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

# Consultar uma ordem

> Obtenha o estado atual de uma das suas ordens

Obtenha o estado atual de uma das ordens da conta autenticada. Retorna a ordem com o detalhamento `matchedRisk` / `unmatchedRisk` e um instantâneo desnormalizado do evento subjacente.

## Requisição

`GET /session/lookupOrder`

**orderID** `string` *required*

Um id de ordem da 4casters. Obtenha um de `data.unmatched.orderID` de `/session/v3/place` ou de `id` de `/user/getUnmatched`.

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

## Resposta

**data.order** `object`

**order**

**id** `string`

**cancelled** `boolean`

**isTheBestOffer** `boolean`

`true` quando não há uma oferta concorrente do outro lado com odds melhores que esta ordem.

**odds** `integer`

Odds americanas desta ordem (sinal invertido em relação ao armazenamento interno).

**type** `string`

`moneyline`, `spread`, `total` ou `moneyline1x2`.

**OU** `string`

Oposto do lado da ordem em mercados `total`. `null` se não for total.

**participant** `string`

Id do participante no qual você apostou. `null` em `total`.

**participantLongName** `string`

**spread** `number`

**total** `number`

**matchedRisk** `string`

Risco que já foi casado (formatado como string, 2 casas decimais).

**unmatchedRisk** `string`

Risco restante que continua no livro.

<Snippet file="pt-BR/types/game-summary.mdx" />

## Erros

| Status | Significado |
| - | - |
| `403` | Não é a sua ordem. |
| `404` | Id de ordem inválido. |


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