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

# Cancel a pending order

> Provide the verified account login. The API checks ownership and sends a cancellation for this pending order only. The response acknowledges submission, not final cancellation; inspect the execution result. If the order executes first, cancellation can fail and does not close the resulting position.

Send only the verified account login. The order ticket is in the URL. The receipt is not a final cancellation: query the returned request ID. If the order executes first, cancellation may fail; the resulting position is never closed automatically.

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{"login": 104205}
```

`Idempotency-Key` is required. Reuse the same key when retrying the same intent.


## OpenAPI

````yaml POST /api/v1/orders/{order}/cancel
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/orders/{order}/cancel:
    post:
      tags:
        - Trading
      summary: Cancelar una orden pendiente
      description: >-
        Indica el login de la cuenta verificada. La API comprueba la titularidad
        y envía la cancelación de esa orden pendiente. La respuesta confirma el
        envío, no la cancelación final: consulta el resultado de ejecución. Si
        la orden se ejecuta primero, la cancelación puede fallar y no cierra la
        posición resultante.
      operationId: cancel_order_api_v1_orders__order__cancel_post
      parameters:
        - name: order
          in: path
          required: true
          schema:
            type: integer
            title: Order
        - name: Idempotency-Key
          in: header
          required: true
          schema:
            type: string
            minLength: 16
            maxLength: 128
            pattern: ^[A-Za-z0-9._:-]{16,128}$
            example: 550e8400-e29b-41d4-a716-446655440000
          description: >-
            Clave persistida para esta intención. Reutiliza la misma clave y
            cuerpo al repetirla; utiliza una clave nueva para otra apertura o
            cierre.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelOrderRequest'
      responses:
        '200':
          description: Respuesta satisfactoria
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: 'Respuesta: Cancelar una orden pendiente'
        '400':
          description: Idempotency-Key ausente o inválida.
        '409':
          description: Clave reutilizada con otros datos o solicitud pendiente.
        '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:
    CancelOrderRequest:
      properties:
        login:
          type: integer
          exclusiveMinimum: 0
          title: Login
          description: Verified owner account login.
          example: 123456
      additionalProperties: false
      type: object
      required:
        - login
      title: CancelOrderRequest
      examples:
        - login: 104205
  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.