Skip to content
Start Trading

Cancel Position Instruction

DELETE/v1/accounts/{account_id}/positions/instructions/{instruction_id}

Cancel an outstanding position instruction by its server-assigned id. Returns the updated instruction with status CANCEL_REQUESTED. The terminal CANCELLED or CANCEL_FAILED state arrives asynchronously and is observable via subsequent GETs.

Path ParametersExpand Collapse
account_id: number
instruction_id: string
ReturnsExpand Collapse
data: PositionInstruction { id, account_id, client_instruction_id, 11 more }

A position instruction and its current lifecycle state.

id: string

Server-assigned id. Used as the path parameter on cancel.

formatuuid
account_id: number

Account the instruction belongs to.

formatint64
client_instruction_id: string

Caller-supplied idempotency key echoed from the submit request; the server-assigned fallback when none was supplied.

instruction_type: PositionInstructionType

The action this instruction requests.

One of the following:
"EXERCISE"
"DO_NOT_EXERCISE"
"CONTRARY_EXERCISE"
instrument_id: string

Identifier of the options contract this instruction acts on.

formatuuid
quantity: string

Number of contracts included in the instruction.

Current lifecycle status.

One of the following:
"SENT"
"ACCEPTED"
"REJECTED"
"CANCEL_REQUESTED"
"CANCELLED"
"CANCEL_FAILED"
"UNKNOWN"
symbol: string

Options symbol (OSI) for display.

accepted_quantity: optional string

Number of contracts accepted by the clearing venue. Populated once the instruction reaches ACCEPTED. When a null/undefined value is observed, it indicates that there is no available data.

created_at: optional string

When the instruction was first accepted by the service. When a null/undefined value is observed, it indicates that there is no available data.

formatdate-time
rejection: optional PositionInstructionRejection { description, domain, metadata, reason }

Machine-readable counterpart to rejection_reason: a stable reason code, human-readable description, and params, present on every rejected row — on submit, cancel, get, and list alike. Branch on rejection.reason and read rejection.description instead of the top-level rejection_reason. When a null/undefined value is observed, it indicates it does not apply.

description: string

Human-readable explanation of the rejection. Duplicates the top-level rejection_reason; prefer this field.

domain: string

Namespacing domain of the reason code — com.clearstreet.oems.exercise for reasons OEMS validates, com.clearstreet.oems.clearing for clearing-owned reasons.

metadata: map[string]

Reason-specific parameters as a string→string map. Which keys are present depends on reason:

  • INSUFFICIENT_POSITION → available, requested
  • DNE_NOT_ON_EXPIRY / CEA_NOT_ON_EXPIRY → expiry, business_date
  • EXERCISE_PAST_CUTOFF → cutoff_time
  • DUPLICATE_INSTRUCTION → existing_id

Empty for reasons that carry no parameters. New keys may be added over time, so treat unknown keys leniently.

reason: string

Stable, machine-readable reason code, e.g. DNE_NOT_ON_EXPIRY, INSUFFICIENT_POSITION, OPTIONS_LEVEL_EXCEEDED, EXERCISE_PAST_CUTOFF.

rejection_reason: optional string

Human-readable explanation populated on any non-success terminal status — REJECTED or CANCEL_FAILED. On a 207 Multi-Status batch submit the top-level error field summarizes the batch; per-row detail continues to live here. When a null/undefined value is observed, it indicates it does not apply.

underlying_instrument_id: optional string

Identifier of the underlying instrument, when available. When a null/undefined value is observed, it indicates it does not apply.

formatuuid
updated_at: optional string

When the instruction’s lifecycle state last changed. When a null/undefined value is observed, it indicates that there is no available data.

formatdate-time

Cancel Position Instruction

curl https://api.clearstreet.com/v1/accounts/$ACCOUNT_ID/positions/instructions/$INSTRUCTION_ID \
    -X DELETE \
    -H "Authorization: Bearer $API_KEY"
{
  "data": {
    "accepted_quantity": null,
    "account_id": 122503,
    "client_instruction_id": "ui-20260424-001",
    "created_at": "2026-04-24T14:30:00Z",
    "id": "0195f6d0-a1b2-7c3d-8e4f-5a6b7c8d9e09",
    "instruction_type": "EXERCISE",
    "instrument_id": "0195f6d0-a1b2-7c3d-8e4f-5a6b7c8d9e01",
    "quantity": "1",
    "rejection_reason": null,
    "status": "CANCEL_REQUESTED",
    "symbol": "AAPL  280121C00195000",
    "updated_at": "2026-04-24T14:35:00Z"
  },
  "error": null,
  "metadata": {
    "request_id": "0a5c9ebf-a9a7-4f2d-9c7e-f2b5f0b1bd08"
  }
}
Returns Examples
{
  "data": {
    "accepted_quantity": null,
    "account_id": 122503,
    "client_instruction_id": "ui-20260424-001",
    "created_at": "2026-04-24T14:30:00Z",
    "id": "0195f6d0-a1b2-7c3d-8e4f-5a6b7c8d9e09",
    "instruction_type": "EXERCISE",
    "instrument_id": "0195f6d0-a1b2-7c3d-8e4f-5a6b7c8d9e01",
    "quantity": "1",
    "rejection_reason": null,
    "status": "CANCEL_REQUESTED",
    "symbol": "AAPL  280121C00195000",
    "updated_at": "2026-04-24T14:35:00Z"
  },
  "error": null,
  "metadata": {
    "request_id": "0a5c9ebf-a9a7-4f2d-9c7e-f2b5f0b1bd08"
  }
}