> ## Documentation Index
> Fetch the complete documentation index at: https://platform.trendlinelabs.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel an order by your id

> Beta: not yet enabled; the launch venues are Polymarket, predict.fun and Limitless (Kalshi comes later). Requests answer 404 with {"detail": "Not Found"}, as an unregistered path does, until trading is switched on. Cancel an order you placed through the API, by your own client_order_id; the same answers as DELETE /public/v1/orders/{id}. Refusals: 404 order_not_found; 409 order_not_cancellable, request_in_progress; 503 venue_unavailable; 422 invalid_request.



## OpenAPI

````yaml /openapi.json delete /public/v1/orders
openapi: 3.1.0
info:
  description: >-
    Prediction-market data across Polymarket, Kalshi, Limitless and predict.fun
    over REST, and (Beta) order placement. Every request sends your key as
    `Authorization: Bearer tl_live_…`; try any endpoint from its page.
  title: TrendlineLabs Public API
  version: '1'
servers:
  - description: Production
    url: https://systems.trendlinelabs.ai
security: []
tags:
  - description: 'Read back the key you are calling with: its scopes, tier and rate limit.'
    name: Your key
  - description: Events group markets across venues; each carries a `universal_id`.
    name: Events
  - description: One market's order book, price history and trades on one venue.
    name: Markets
  - description: Current prices for a set of markets in one call.
    name: Prices
  - description: Live cross-venue price gaps on the same market.
    name: Opportunities
  - description: >-
      Beta, not yet enabled: place and cancel limit orders on your own venue
      accounts.
    name: Trading
paths:
  /public/v1/orders:
    delete:
      tags:
        - Trading
      summary: Cancel an order by your id
      description: >-
        Beta: not yet enabled; the launch venues are Polymarket, predict.fun and
        Limitless (Kalshi comes later). Requests answer 404 with {"detail": "Not
        Found"}, as an unregistered path does, until trading is switched on.
        Cancel an order you placed through the API, by your own client_order_id;
        the same answers as DELETE /public/v1/orders/{id}. Refusals: 404
        order_not_found; 409 order_not_cancellable, request_in_progress; 503
        venue_unavailable; 422 invalid_request.
      operationId: cancelOrderByClientId
      parameters:
        - description: your id for the order, as sent when placing it
          in: query
          name: client_order_id
          required: true
          schema:
            description: your id for the order, as sent when placing it
            pattern: ^[A-Za-z0-9_-]{1,64}$
            title: Client Order Id
            type: string
      responses:
        '200':
          content:
            application/json:
              example:
                avg_price: null
                cancelled_size: '10'
                client_order_id: s1-0001
                created_at: '2026-10-06T05:59:59+00:00'
                filled_size: '0'
                id: ord_6702291f8e1c2a0012ab34cd
                notional_reserved: '4.20'
                outcome: 'yes'
                price: '0.42'
                remaining_size: '0'
                side: buy
                size: 10
                status: cancelled
                time_in_force: gtc
                type: limit
                universal_id: mk-btc-100k-2026
                updated_at: '2026-10-06T06:00:00+00:00'
                venue: polymarket
                venue_market_id: bitcoin-above-100k-on-december-31
                venue_market_title: Bitcoin above $100,000 on December 31?
                venue_order_id: >-
                  0x5e5e5e5e5e5e5e5e5e5e5e5e5e5e5e5e5e5e5e5e5e5e5e5e5e5e5e5e5e5e5e5e
              schema:
                $ref: '#/components/schemas/PublicCancel'
          description: Successful Response
          headers:
            Cache-Control:
              description: no-store on every answer
              schema:
                type: string
            X-RateLimit-Limit:
              description: >-
                requests allowed per window for this key; present once the key
                passed the limiter
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: >-
                requests left in this window; present once the key passed the
                limiter
              schema:
                type: integer
            X-RateLimit-Reset:
              description: >-
                seconds until the window resets; present once the key passed the
                limiter
              schema:
                type: integer
            X-Request-Id:
              description: >-
                this request's id (yours, when you sent X-Request-Id); equals
                the envelope's request_id
              schema:
                type: string
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicError'
          description: 'unauthorized: no key, or a key that is unknown, revoked or expired.'
          headers:
            Cache-Control:
              description: no-store on every answer
              schema:
                type: string
            WWW-Authenticate:
              description: Bearer realm="public-api"
              schema:
                type: string
            X-Request-Id:
              description: >-
                this request's id (yours, when you sent X-Request-Id); equals
                the envelope's request_id
              schema:
                type: string
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicError'
          description: >-
            insufficient_scope: the key lacks the scope this route needs;
            ip_not_allowed: the request came from an address outside the key's
            allowlist; tier_required: the key owner's plan does not include API
            access; access_not_granted: API access is free but granted on
            request; request it on https://trendlinelabs.ai/developer;
            trade_not_granted: the account holds no active trade grant;
            jurisdiction_refused: the jurisdiction recorded on your trade grant
            may not trade on that venue; trading_tier_required: the account's
            plan may not trade on that venue.
          headers:
            Cache-Control:
              description: no-store on every answer
              schema:
                type: string
            X-Request-Id:
              description: >-
                this request's id (yours, when you sent X-Request-Id); equals
                the envelope's request_id
              schema:
                type: string
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicError'
          description: >-
            not_found: no such event, market or key; venue_not_listed: the
            market has no leg on that venue; venue_not_connected: we hold no
            usable account of yours for that venue: not connected, held by
            another account, or (Limitless positions) an empty answer for a
            profile not verified as your sub-account (found only through its
            public profile); the message names the reason; order_not_found: no
            order with that id was placed through the API by this account.
          headers:
            Cache-Control:
              description: no-store on every answer
              schema:
                type: string
            X-RateLimit-Limit:
              description: >-
                requests allowed per window for this key; present once the key
                passed the limiter
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: >-
                requests left in this window; present once the key passed the
                limiter
              schema:
                type: integer
            X-RateLimit-Reset:
              description: >-
                seconds until the window resets; present once the key passed the
                limiter
              schema:
                type: integer
            X-Request-Id:
              description: >-
                this request's id (yours, when you sent X-Request-Id); equals
                the envelope's request_id
              schema:
                type: string
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicError'
          description: >-
            idempotency_conflict: the client_order_id was already used with a
            different request; request_in_progress: a request with this
            client_order_id is still in flight; retry after Retry-After;
            venue_leg_unverified: the market's leg is not the venue market you
            named, or could not be verified; nothing was sent;
            venue_auth_failed: the venue refused your own stored credential;
            reconnect it; order_not_cancellable: the order is no longer open,
            the venue no longer holds it, or another credential placed it.
          headers:
            Cache-Control:
              description: no-store on every answer
              schema:
                type: string
            Retry-After:
              description: seconds to wait before retrying
              schema:
                type: integer
            X-RateLimit-Limit:
              description: >-
                requests allowed per window for this key; present once the key
                passed the limiter
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: >-
                requests left in this window; present once the key passed the
                limiter
              schema:
                type: integer
            X-RateLimit-Reset:
              description: >-
                seconds until the window resets; present once the key passed the
                limiter
              schema:
                type: integer
            X-Request-Id:
              description: >-
                this request's id (yours, when you sent X-Request-Id); equals
                the envelope's request_id
              schema:
                type: string
        '410':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicError'
          description: 'market_closed: the market''s leg on that venue no longer trades.'
          headers:
            Cache-Control:
              description: no-store on every answer
              schema:
                type: string
            X-RateLimit-Limit:
              description: >-
                requests allowed per window for this key; present once the key
                passed the limiter
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: >-
                requests left in this window; present once the key passed the
                limiter
              schema:
                type: integer
            X-RateLimit-Reset:
              description: >-
                seconds until the window resets; present once the key passed the
                limiter
              schema:
                type: integer
            X-Request-Id:
              description: >-
                this request's id (yours, when you sent X-Request-Id); equals
                the envelope's request_id
              schema:
                type: string
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicError'
          description: >-
            invalid_request: a parameter is missing, unknown, malformed or out
            of bounds, or a cursor does not match; venue_unsupported: the route
            does not serve that venue; price_off_tick: the price is not on the
            venue's price grid; it is refused, never rounded; limit_exceeded:
            the order's maximum loss is over the per-order or daily limit, or no
            limit is set (limit_unset); venue_rejected: the venue rejected the
            order; the message carries the venue's own error code only.
          headers:
            Cache-Control:
              description: no-store on every answer
              schema:
                type: string
            X-RateLimit-Limit:
              description: >-
                requests allowed per window for this key; present once the key
                passed the limiter
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: >-
                requests left in this window; present once the key passed the
                limiter
              schema:
                type: integer
            X-RateLimit-Reset:
              description: >-
                seconds until the window resets; present once the key passed the
                limiter
              schema:
                type: integer
            X-Request-Id:
              description: >-
                this request's id (yours, when you sent X-Request-Id); equals
                the envelope's request_id
              schema:
                type: string
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicError'
          description: >-
            rate_limited: too many requests, or too many failed authentications;
            wait Retry-After seconds.
          headers:
            Cache-Control:
              description: no-store on every answer
              schema:
                type: string
            Retry-After:
              description: seconds to wait before retrying
              schema:
                type: integer
            X-RateLimit-Limit:
              description: >-
                requests allowed per window for this key; present once the key
                passed the limiter
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: >-
                requests left in this window; present once the key passed the
                limiter
              schema:
                type: integer
            X-RateLimit-Reset:
              description: >-
                seconds until the window resets; present once the key passed the
                limiter
              schema:
                type: integer
            X-Request-Id:
              description: >-
                this request's id (yours, when you sent X-Request-Id); equals
                the envelope's request_id
              schema:
                type: string
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicError'
          description: >-
            internal_error: an unexpected failure on our side; quote the request
            id. The body may instead be text/plain with no envelope and no
            X-RateLimit-* headers when a failure escapes the route's own
            handling.
          headers:
            Cache-Control:
              description: no-store on every answer
              schema:
                type: string
            X-RateLimit-Limit:
              description: >-
                requests allowed per window for this key; present once the key
                passed the limiter
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: >-
                requests left in this window; present once the key passed the
                limiter
              schema:
                type: integer
            X-RateLimit-Reset:
              description: >-
                seconds until the window resets; present once the key passed the
                limiter
              schema:
                type: integer
            X-Request-Id:
              description: >-
                this request's id (yours, when you sent X-Request-Id); equals
                the envelope's request_id
              schema:
                type: string
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicError'
          description: >-
            dependency_unavailable: one of our own stores could not be read;
            retry later; trading_halted: new orders are halted for everyone;
            cancels, replays and reconciles still answer; venue_unavailable: the
            venue could not be read; the message names why; retry after
            Retry-After.
          headers:
            Cache-Control:
              description: no-store on every answer
              schema:
                type: string
            Retry-After:
              description: seconds to wait before retrying
              schema:
                type: integer
            X-RateLimit-Limit:
              description: >-
                requests allowed per window for this key; present once the key
                passed the limiter
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: >-
                requests left in this window; present once the key passed the
                limiter
              schema:
                type: integer
            X-RateLimit-Reset:
              description: >-
                seconds until the window resets; present once the key passed the
                limiter
              schema:
                type: integer
            X-Request-Id:
              description: >-
                this request's id (yours, when you sent X-Request-Id); equals
                the envelope's request_id
              schema:
                type: string
      security:
        - HTTPBearer: []
      x-codeSamples:
        - label: cURL
          lang: bash
          source: >
            #!/bin/sh

            # cancelOrderByClientId: Cancel an order by your id. Needs
            TRENDLINE_API_KEY; TRENDLINE_API_BASE overrides the base.

            curl -sS -X DELETE
            "${TRENDLINE_API_BASE:-https://systems.trendlinelabs.ai}/public/v1/orders?client_order_id=s1-0001"
            \
              -H "Authorization: Bearer $TRENDLINE_API_KEY"
        - label: Python
          lang: python
          source: >
            """cancelOrderByClientId: Cancel an order by your id. Needs
            TRENDLINE_API_KEY; TRENDLINE_API_BASE overrides the base."""

            import os


            import requests


            BASE = os.environ.get("TRENDLINE_API_BASE",
            "https://systems.trendlinelabs.ai")

            KEY = os.environ["TRENDLINE_API_KEY"]


            r = requests.delete(f"{BASE}/public/v1/orders",
            params={"client_order_id": "s1-0001"},
                                headers={"Authorization": f"Bearer {KEY}"}, timeout=10)
            print(r.status_code, r.json())
        - label: JavaScript
          lang: javascript
          source: >
            // cancelOrderByClientId: Cancel an order by your id. Needs
            TRENDLINE_API_KEY; TRENDLINE_API_BASE overrides the base.

            const BASE = process.env.TRENDLINE_API_BASE ??
            "https://systems.trendlinelabs.ai";

            const KEY = process.env.TRENDLINE_API_KEY;

            const r = await
            fetch(`${BASE}/public/v1/orders?client_order_id=s1-0001`, { method:
            "DELETE", headers: { Authorization: `Bearer ${KEY}` } });

            console.log(r.status, await r.json());
components:
  schemas:
    PublicCancel:
      properties:
        avg_price:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            the average fill price of `outcome`, 0..1 as a decimal string, when
            the venue reported one
          title: Avg Price
        cancelled_size:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            contracts this request removed from the book, a decimal string (0
            when the order was already final); null when the venue's answer did
            not say
          title: Cancelled Size
        client_order_id:
          description: your id for this order
          title: Client Order Id
          type: string
        created_at:
          description: when we accepted the order, ISO 8601
          title: Created At
          type: string
        filled_size:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            contracts filled, an exact decimal string; null while the status is
            unknown
          title: Filled Size
        id:
          description: >-
            our id for the order, ord_ and 24 hex digits; it exists from the
            moment we accept the request, so an order whose status is unknown
            has one too
          pattern: ^ord_[0-9a-f]{24}$
          title: Id
          type: string
        notional_reserved:
          description: >-
            the order's maximum loss counted against your limits, USD as a
            decimal string
          title: Notional Reserved
          type: string
        outcome:
          description: the venue's own outcome label
          title: Outcome
          type: string
        price:
          description: the limit price of `outcome`, a decimal string
          title: Price
          type: string
        remaining_size:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            contracts still resting, an exact decimal string; null while the
            status is unknown
          title: Remaining Size
        side:
          description: buy or sell, the action on `outcome` at `price`
          enum:
            - buy
            - sell
          title: Side
          type: string
        size:
          description: whole contracts ordered
          title: Size
          type: integer
        status:
          description: >-
            unknown: the venue's answer was not received; retry with the same
            client_order_id or read GET /public/v1/orders/{id}, never send a new
            id. On a venue that cannot prove an order's absence it may stay
            unknown: check the venue before trading the same intent again
          enum:
            - open
            - filled
            - partially_filled
            - cancelled
            - unknown
            - not_placed
          title: Status
          type: string
        time_in_force:
          description: as requested
          enum:
            - gtc
            - ioc
          title: Time In Force
          type: string
        type:
          const: limit
          description: the order type; only limit
          title: Type
          type: string
        universal_id:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            the market universal id holding the leg; null when no market lists
            it
          title: Universal Id
        updated_at:
          description: when we last recorded a change to the order, ISO 8601
          title: Updated At
          type: string
        venue:
          description: the venue the order was sent to
          enum:
            - kalshi
            - polymarket
            - limitless
            - predictfun
          title: Venue
          type: string
        venue_market_id:
          description: the venue's own market id the order went to
          title: Venue Market Id
          type: string
        venue_market_title:
          anyOf:
            - type: string
            - type: 'null'
          description: the leg's title on the venue, when our mirror holds it
          title: Venue Market Title
        venue_order_id:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            the venue's order id; null while the status is unknown and for an
            order that was never placed
          title: Venue Order Id
      required:
        - id
        - client_order_id
        - venue
        - universal_id
        - venue_market_id
        - outcome
        - side
        - type
        - price
        - size
        - time_in_force
        - status
        - notional_reserved
        - created_at
        - updated_at
      title: PublicCancel
      type: object
    PublicError:
      properties:
        error:
          $ref: '#/components/schemas/PublicErrorBody'
          description: the refusal
      required:
        - error
      title: PublicError
      type: object
    PublicErrorBody:
      properties:
        code:
          description: >-
            a machine-readable code from x-known-codes; a new code may be added,
            so handle an unknown one by its status
          title: Code
          type: string
          x-known-codes:
            - access_not_granted
            - dependency_unavailable
            - idempotency_conflict
            - insufficient_scope
            - internal_error
            - invalid_request
            - ip_not_allowed
            - jurisdiction_refused
            - limit_exceeded
            - market_closed
            - not_found
            - order_not_cancellable
            - order_not_found
            - price_off_tick
            - rate_limited
            - request_in_progress
            - tier_required
            - trade_not_granted
            - trading_halted
            - trading_tier_required
            - unauthorized
            - upstream_unavailable
            - venue_auth_failed
            - venue_leg_unverified
            - venue_not_connected
            - venue_not_listed
            - venue_rejected
            - venue_unavailable
            - venue_unsupported
        message:
          description: a human-readable explanation; never parse it
          title: Message
          type: string
        request_id:
          description: >-
            this request's id, also sent as the X-Request-Id header; quote it
            when asking for help
          title: Request Id
          type: string
      required:
        - code
        - message
        - request_id
      title: PublicErrorBody
      type: object
  securitySchemes:
    HTTPBearer:
      description: 'Authorization: Bearer tl_live_…'
      scheme: bearer
      type: http

````

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