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

# Consultar resultado

> Obtiene el resultado de una solicitud enviada por tu token.

## Recogida persistente y consultas repetidas

La API recoge eventos MT5 por lotes en segundo plano usando la conexión física
que envió la solicitud. El GET del cliente lee RDS: no consume eventos de MT5.
El envío devuelve su ID sin esperar la ejecución. Puede haber una breve demora
hasta que el recolector guarde el resultado.

* `200`: resultado final guardado, incluso rechazo o ejecución parcial. Revisar códigos MT5.
* `202`: `{"status":"pending","request_id":1586,"result":null}`. Esperar al menos
  lo indicado en `Retry-After` (un segundo) y repetir únicamente este GET.
* `409` con `TRADE_RESULT_UNAVAILABLE`: no se conservó un resultado final. El campo
  `result` puede contener la última instantánea pública. Reconciliar posiciones y
  órdenes; no reenviar automáticamente la operación.
* `409` con `TRADE_RESULT_AMBIGUOUS`: MT5 reutilizó un ID entre sesiones para ese
  token. Reconciliar sin adivinar a qué operación corresponde.

El resultado final guardado se puede consultar después de reiniciar mientras el
token y la verificación sigan vigentes. Los resultados consumidos antes de instalar
esta mejora no se recuperan con la caché. Una caída entre consumir y guardar un
evento todavía puede perderlo; no disponible no significa operación fallida.

## Qué hace esta operación

Usa el ID de answer.id o answer.ID, no un ticket de posición. Solo el token que envió la solicitud puede consultarla, con verificación vigente de la cuenta. HTTP 200 no implica ejecución exitosa.

## Proceso completo

Consulta [la guía paso a paso](/es/trading/results) y [los errores y su tratamiento](/es/errors).

Los valores del explorador son ejemplos. Sustituye cuenta, símbolo, volumen y precio con datos válidos para tu integración.

## Respuesta reducida

La respuesta usa una lista explícita de campos públicos. Mantiene `retcode` y
`answer`; si MT5 devuelve eventos agrupados por ID, conserva ese formato solo para
la solicitud consultada. También admite resultados planos y listas de eventos.
Los campos ausentes se omiten; no se inventan estados ni valores.

En `result` se conservan `ID`, `Retcode`, `DealID`, `OrderID`, `Volume` y `Price`;
los resultados planos también admiten `ResultRetcode`, `ResultDeal`, `ResultOrder`,
`ResultVolume` y `ResultPrice`. En el evento `answer` se conservan `IDClient`,
`Symbol`, `Type`, `TypeFill`, `Volume`, `PriceOrder`, `Position` y esos cinco campos
`Result*`. Se excluyen cuentas, login Manager, IP, comentarios, datos del gateway,
volúmenes extendidos, `ApiData` y campos nuevos no autorizados.

`Volume` en el evento `answer` es el volumen solicitado; `ResultVolume` es el
volumen ejecutado informado. Un ID de solicitud, orden o deal no debe confundirse
con el ticket de posición. Consulta posiciones para reconciliar el resultado.

```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 es/openapi.json GET /api/v1/trading/requests/{request_id}
openapi: 3.1.0
info:
  title: API MT5 — Portal de partners
  description: >-
    Endpoints seguros para verificar la propiedad de cuentas, consultar el
    mercado y operar en cuentas previamente verificadas.
  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: Consultar resultado de solicitud
      operationId: trade_request_result_api_v1_trading_requests__request_id__get
      parameters:
        - name: request_id
          in: path
          required: true
          schema:
            type: integer
            title: ID de solicitud
      responses:
        '200':
          description: Respuesta satisfactoria
          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: Solicitud inválida o parámetros de cierre incompatibles.
          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: ID de solicitud
        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: ID de solicitud
        detail:
          type: string
          title: Detalle
        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: Volumen
        Price:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Precio
        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: Símbolo
        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: Volumen
        PriceOrder:
          anyOf:
            - type: string
            - type: integer
            - type: number
            - type: 'null'
          title: Priceorder
        Position:
          anyOf:
            - type: string
            - type: integer
            - type: 'null'
          title: Posición
        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: >-
        Envía el token entregado por el proveedor en el encabezado Authorization
        mediante autenticación Bearer.

````

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