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

# Query result

> Retrieve the result of a request submitted by your token.

## Persistent collection and repeat queries

The API collects MT5 events in background batches on the same physical connection
that submitted the request. Client GETs read the saved result from the database;
they do not consume MT5 events. Submission returns its ID without waiting for
execution. There can be a short delay before the collector saves the result.

* `200`: saved final result, including rejection or partial execution. Check MT5 codes.
* `202`: `{"status":"pending","request_id":1586,"result":null}`. Wait at least
  the `Retry-After` interval (currently one second), then repeat only this GET.
* `409` with `TRADE_RESULT_UNAVAILABLE`: no final result was retained. An optional
  `result` contains the last public snapshot. Reconcile positions/orders; never
  automatically resubmit the order.
* `409` with `TRADE_RESULT_AMBIGUOUS`: MT5 reused an ID across sessions for this
  token. Reconcile instead of guessing the operation.

A saved final result remains queryable after restart while the token and account
verification remain valid. Results consumed before this feature was deployed are
not recoverable through this cache. A crash between consuming and persisting an
event can still lose it; unavailable does not mean the trade failed.

## What this operation does

Use the ID from answer.id or answer.ID, not a position ticket. Only the token that submitted the request can query it, with an active account verification. HTTP 200 does not imply successful execution.

## Complete workflow

See [the step-by-step guide](/trading/results) and [errors and their handling](/errors).

Playground values are examples. Replace the account, symbol, volume, and price with valid data for your integration.

## Reduced response

The response uses an explicit allowlist of public fields. It preserves `retcode`
and `answer`; ID-grouped events retain their structure only for the requested ID.
Flat results and event lists are also supported. Missing fields are omitted;
no status or value is invented.

The `result` event allows `ID`, `Retcode`, `DealID`, `OrderID`, `Volume`, and `Price`.
Flat results also allow `ResultRetcode`, `ResultDeal`, `ResultOrder`, `ResultVolume`,
and `ResultPrice`. The `answer` event allows `IDClient`, `Symbol`, `Type`, `TypeFill`,
`Volume`, `PriceOrder`, `Position`, and those five `Result*` fields. Account logins,
Manager login, IP, comments, gateway data, extended volumes, `ApiData`, and unknown
fields are excluded.

`Volume` in the `answer` event is the requested volume; `ResultVolume` is the
reported executed volume. Request, order, and deal IDs are not position tickets.
Query positions to reconcile execution.

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "retcode": "0 Done",
  "answer": {
    "1584": [
      {
        "result": {
          "ID": "1584",
          "Retcode": "10009",
          "Volume": "100",
          "Price": "1.12806000"
        }
      },
      {
        "answer": {
          "IDClient": "1584",
          "Symbol": "EURUSD",
          "Type": "0",
          "TypeFill": "1",
          "Volume": "100",
          "PriceOrder": "1.12806",
          "Position": "0",
          "ResultRetcode": "10009",
          "ResultDeal": "84335209",
          "ResultOrder": "84668447",
          "ResultVolume": "100",
          "ResultPrice": "1.12806"
        }
      }
    ]
  }
}
```


## OpenAPI

````yaml openapi.json GET /api/v1/trading/requests/{request_id}
openapi: 3.1.0
info:
  title: MT5 API — Partner Portal
  description: >-
    Secure endpoints for account ownership verification, market data, and
    trading on previously verified accounts.
  version: 0.1.0
servers:
  - url: https://api-trading.vexprofx.com
    description: API Trading · Partners
security: []
paths:
  /api/v1/trading/requests/{request_id}:
    get:
      tags:
        - Trading
      summary: Get a trade request result
      operationId: trade_request_result_api_v1_trading_requests__request_id__get
      parameters:
        - name: request_id
          in: path
          required: true
          schema:
            type: integer
            title: Request Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TradeResultResponse'
        '202':
          description: Result collection is pending; retry GET after Retry-After.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TradeResultPending'
        '409':
          description: >-
            Result unavailable or identifier ambiguous; reconcile without
            resubmitting.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TradeResultUnavailable'
        '422':
          description: Invalid request or incompatible closing parameters.
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    type: string
              example:
                detail: Invalid request
      security:
        - HTTPBearer: []
components:
  schemas:
    TradeResultResponse:
      properties:
        retcode:
          type: string
          title: Retcode
        answer:
          anyOf:
            - additionalProperties:
                items:
                  $ref: '#/components/schemas/TradeResultEvent'
                type: array
              type: object
            - items:
                $ref: '#/components/schemas/TradeResultEvent'
              type: array
            - $ref: '#/components/schemas/TradeExecutionData'
          title: Answer
      additionalProperties: false
      type: object
      required:
        - retcode
        - answer
      title: TradeResultResponse
    TradeResultPending:
      properties:
        status:
          type: string
          const: pending
          title: Status
        request_id:
          type: integer
          title: Request Id
        result:
          anyOf:
            - $ref: '#/components/schemas/TradeResultResponse'
            - type: 'null'
      type: object
      required:
        - status
        - request_id
      title: TradeResultPending
    TradeResultUnavailable:
      properties:
        code:
          type: string
          enum:
            - TRADE_RESULT_UNAVAILABLE
            - TRADE_RESULT_AMBIGUOUS
          title: Code
        request_id:
          type: integer
          title: Request Id
        detail:
          type: string
          title: Detail
        result:
          anyOf:
            - $ref: '#/components/schemas/TradeResultResponse'
            - type: 'null'
      type: object
      required:
        - code
        - request_id
        - detail
      title: TradeResultUnavailable
    TradeResultEvent:
      properties:
        result:
          anyOf:
            - $ref: '#/components/schemas/TradeExecutionData'
            - type: 'null'
        answer:
          anyOf:
            - $ref: '#/components/schemas/TradeRequestData'
            - type: 'null'
      additionalProperties: false
      type: object
      title: TradeResultEvent
    TradeExecutionData:
      properties:
        ID:
          anyOf:
            - type: string
            - type: integer
            - type: 'null'
          title: Id
        Retcode:
          anyOf:
            - type: string
            - type: integer
            - type: 'null'
          title: Retcode
        DealID:
          anyOf:
            - type: string
            - type: integer
            - type: 'null'
          title: Dealid
        OrderID:
          anyOf:
            - type: string
            - type: integer
            - type: 'null'
          title: Orderid
        Volume:
          anyOf:
            - type: string
            - type: integer
            - type: 'null'
          title: Volume
        Price:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Price
        ResultRetcode:
          anyOf:
            - type: string
            - type: integer
            - type: 'null'
          title: Resultretcode
        ResultDeal:
          anyOf:
            - type: string
            - type: integer
            - type: 'null'
          title: Resultdeal
        ResultOrder:
          anyOf:
            - type: string
            - type: integer
            - type: 'null'
          title: Resultorder
        ResultVolume:
          anyOf:
            - type: string
            - type: integer
            - type: 'null'
          title: Resultvolume
        ResultPrice:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Resultprice
      additionalProperties: false
      type: object
      title: TradeExecutionData
      description: >-
        Public execution fields, including the flat result format used by some
        brokers.
    TradeRequestData:
      properties:
        IDClient:
          anyOf:
            - type: string
            - type: integer
            - type: 'null'
          title: Idclient
        Symbol:
          anyOf:
            - type: string
            - type: 'null'
          title: Symbol
        Type:
          anyOf:
            - type: string
            - type: integer
            - type: 'null'
          title: Type
        TypeFill:
          anyOf:
            - type: string
            - type: integer
            - type: 'null'
          title: Typefill
        Volume:
          anyOf:
            - type: string
            - type: integer
            - type: 'null'
          title: Volume
        PriceOrder:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Priceorder
        Position:
          anyOf:
            - type: string
            - type: integer
            - type: 'null'
          title: Position
        ResultRetcode:
          anyOf:
            - type: string
            - type: integer
            - type: 'null'
          title: Resultretcode
        ResultDeal:
          anyOf:
            - type: string
            - type: integer
            - type: 'null'
          title: Resultdeal
        ResultOrder:
          anyOf:
            - type: string
            - type: integer
            - type: 'null'
          title: Resultorder
        ResultVolume:
          anyOf:
            - type: string
            - type: integer
            - type: 'null'
          title: Resultvolume
        ResultPrice:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Resultprice
      additionalProperties: false
      type: object
      title: TradeRequestData
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer
      description: >-
        Send the provider-issued token in the Authorization header using Bearer
        authentication.

````

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