> ## Documentation Index
> Fetch the complete documentation index at: https://api-trading-docs.ap-markets.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.

`GET /api/v1/trading/requests/{request_id}` requires the submitting token and a
valid account verification. Use the ID from `answer.id` or `answer.ID`; it is not
an order or position ticket.

## Confirmation

Submission returns an ID without waiting for execution. This repeatable GET reads
the stored result; it does not fetch the current position.

| Response | Client action |
| - | - |
| 200 | Read `summary`: the final result may be success, rejection or partial execution. |
| 202 | Pending. Respect `Retry-After`, repeat only GET and set a local tracking deadline. |
| 409 / `TRADE_RESULT_UNAVAILABLE` | No final result was retained; partial data may exist. Reconcile orders and positions before another action. |
| 409 / `TRADE_RESULT_AMBIGUOUS` | ID is ambiguous across sessions. Request reconciliation from the provider. |
| 403 | Check token, scopes and account verification expiry. |

A timeout or unavailable result **does not mean the operation failed**. Do not
resend POST with a new key. Mark overdue requests as uncertain and inspect the account.

## Read `summary`

HTTP 200 and the outer `retcode` describe the query, not trading success.

| `status` | `success` | Meaning |
| - | - | - |
| `succeeded` | true | Action completed; a requested partial close does not close the entire position. |
| `placed` | true | Pending order placed, not yet confirmed filled. |
| `rejected` | false | Rejected; inspect `mt5_code` and `message`. |
| `partially_executed` | null | Partial execution; check remaining volume. |
| `pending` | null | Awaiting confirmation. |
| `no_change` | null | Broker made no changes. |
| `unknown` | null | Uncertain outcome. |

`message` is in English. Common codes: `10009` completed, `10008` pending order
placed, `10010` partial execution, `10019` insufficient margin, `10025` no changes.
`success: null` is neither success nor rejection.

`operation` identifies `market_order`, `place_pending`, `close_position`,
`cancel_order`, `modify_order` or `modify_position`. Historical requests may use
`modify_stops`; unrecognized operations use `unknown`.

## Find the position

Save `summary.position_id` when `position_resolution` is `resolved`. Match it to
`Position` in current positions before closing or modifying. Never infer it from
`order_id` or `deal_id`.

| `position_resolution` | Meaning |
| - | - |
| `pending` | Association in progress; repeat GET later. |
| `resolved` | Associated ticket confirmed. |
| `not_applicable` | This request does not require execution-to-position association. |
| `unavailable` | Could not resolve with available data or attempts. |
| `mismatch` | Inconsistent data; ticket is withheld. |

Association runs in the background and is historical, not proof the position is
still open. Netting trades can share a position. This is not a list of every
partial fill and does not track future activation of pending orders. Association
failure is not a reason to resubmit the trade.

## Request and execution values

`summary.execution` contains values MT5 reported in the stored result:

| Field | Value |
| - | - |
| `symbol`, `side`, `order_type` | Symbol, buy/sell and order type code. |
| `requested_volume`, `executed_volume` | Requested and executed MT5 units: 10000 = 1 lot. |
| `requested_price`, `executed_price` | Requested and reported execution prices. |
| `sl`, `tp` | Protection reported for this request, not current levels. |

Prices and volumes may be strings. `null` means unavailable, not zero. Reported
zeros are preserved. Older results without retained SL/TP keep those fields null.
`retcode` and `answer` remain for compatibility with a limited public field set.
Read account orders or positions for current state.

[Idempotency](https://api-trading-docs.ap-markets.com/trading/idempotency.md) · [Volume](https://api-trading-docs.ap-markets.com/trading/volume.md)


## OpenAPI

````yaml openapi.json GET /api/v1/trading/requests/{request_id}
openapi: 3.1.0
info:
  title: AP Markets 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.ap-markets.com
    description: AP Markets API
security: []
paths:
  /api/v1/trading/requests/{request_id}:
    get:
      tags:
        - Trading
      summary: Get a trade request result
      description: >-
        Read a stored request result using the submitting token and a valid
        account verification. 202 means pending; 200 may include a rejection.
        Use summary to determine the outcome. This query does not fetch current
        positions.
      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/TradeResultWithSummary'
        '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 trading parameters.
          content:
            application/json:
              schema:
                type: object
                required:
                  - detail
                properties:
                  detail:
                    type: string
              example:
                detail: Invalid request
      security:
        - HTTPBearer: []
components:
  schemas:
    TradeResultWithSummary:
      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
        summary:
          $ref: '#/components/schemas/TradeOutcome'
      additionalProperties: false
      type: object
      required:
        - retcode
        - answer
        - summary
      title: TradeResultWithSummary
    TradeResultPending:
      properties:
        summary:
          anyOf:
            - $ref: '#/components/schemas/TradeOutcome'
            - type: 'null'
        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:
        summary:
          anyOf:
            - $ref: '#/components/schemas/TradeOutcome'
            - type: 'null'
        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
          description: >-
            Confirmed execution volume in MT5 units: 10000 = 1 lot, independent
            of contract size. May be encoded as a string.
        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
          description: >-
            Executed volume, which may be less than requested. MT5 units: 10000
            = 1 lot, independent of contract size. May be encoded as a string.
        ResultPrice:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Resultprice
        PriceSL:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Pricesl
        PriceTP:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Pricetp
      additionalProperties: false
      type: object
      title: TradeExecutionData
      description: >-
        Public execution fields, including the flat result format used by some
        brokers.
    TradeOutcome:
      properties:
        execution:
          anyOf:
            - $ref: '#/components/schemas/ExecutionDetails'
            - type: 'null'
        deal_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Deal Id
        order_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Order Id
        position_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Position Id
          description: >-
            Verified MT5 deal PositionID; historical association, not proof the
            position is still open.
        position_resolution:
          type: string
          enum:
            - pending
            - resolved
            - unavailable
            - not_applicable
            - mismatch
          title: Position Resolution
          default: pending
        request_id:
          type: integer
          title: Request Id
        operation:
          type: string
          enum:
            - market_order
            - place_pending
            - close_position
            - cancel_order
            - modify_stops
            - modify_position
            - modify_order
            - unknown
          title: Operation
        status:
          type: string
          enum:
            - succeeded
            - rejected
            - partially_executed
            - placed
            - no_change
            - pending
            - unknown
          title: Status
        success:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Success
          description: >-
            True: requested action completed/placed; false: rejected; null:
            partial, pending, unchanged or uncertain. Placement is not a market
            fill.
        mt5_code:
          anyOf:
            - type: integer
            - type: 'null'
          title: Mt5 Code
        message:
          type: string
          title: Message
      type: object
      required:
        - request_id
        - operation
        - status
        - success
        - mt5_code
        - message
      title: TradeOutcome
    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
    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
          description: >-
            Requested volume in MT5 units: 10000 = 1 lot, independent of
            contract size. May be encoded as a string.
        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
          description: >-
            Executed volume, which may be less than requested. MT5 units: 10000
            = 1 lot, independent of contract size. May be encoded as a string.
        ResultPrice:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Resultprice
        PriceSL:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Pricesl
        PriceTP:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Pricetp
      additionalProperties: false
      type: object
      title: TradeRequestData
    ExecutionDetails:
      properties:
        symbol:
          anyOf:
            - type: string
            - type: 'null'
          title: Symbol
        side:
          anyOf:
            - type: string
              enum:
                - buy
                - sell
            - type: 'null'
          title: Side
        order_type:
          anyOf:
            - type: string
            - type: integer
            - type: 'null'
          title: Order Type
        requested_volume:
          anyOf:
            - type: string
            - type: integer
            - type: 'null'
          title: Requested Volume
        executed_volume:
          anyOf:
            - type: string
            - type: integer
            - type: 'null'
          title: Executed Volume
        requested_price:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Requested Price
        executed_price:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Executed Price
        sl:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Sl
          description: >-
            Historical SL reported in this request result; null means
            unavailable, not zero. Not the current position SL.
        tp:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Tp
          description: >-
            Historical TP reported in this request result; null means
            unavailable, not zero. Not the current position TP.
      type: object
      title: ExecutionDetails
  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.