prediction-markets

Request a full close of a pm_paper_v2 position

Records a durable request to close the WHOLE position (no partial close). The sale itself runs later on a server-side worker: it settles at the venue's proven final payout if the market has resolved, otherwise sells the exact held token against a freshly acquired book. A new request therefore returns 202 (accepted: true, executed: false); poll /api/agent/pm/v2/positions for exit and terminal. Only positions owned by the calling key are visible (others return 404). Entry flags and house enrollment do not block a close.

idempotencyKey is global: the same key and body returns the existing intent (replayed: true, 200 once filled); a different body returns 409 conflict. If an exit intent is already active for the position, the new request attaches to it. Requires scope trade:pm and counts against the trade-write limit.

post/api/agent/pm/v2/close

Request

  • Base URL: https://api.coinrithm.com
  • URL: https://api.coinrithm.com/api/agent/pm/v2/close
  • Auth: HTTP bearer

Request body

positionIdinteger required

A pm_paper_v2 position id owned by the calling key (JSON integer, not a string).

idempotencyKeystring required

Globally unique per close intent.

detailstring nullable

Optional free-text note stored with the request; no control characters.

Response

Replay of an exit that has already filled (executed: true).

executionModel'pm_paper_v2' required
acceptedboolean required

True when an active or filled exit intent exists for the request.

executedboolean required

True only when the intent is filled.

kind'accepted' | 'cancelled' | 'invalid' | 'not_found' | 'not_v2' | 'not_open' | 'conflict' required
positionIdinteger

accepted / cancelled only

replayedboolean

accepted / cancelled only. True when this idempotencyKey was already recorded.

Changes

No recorded changes to this operation across all 1 revision of this API.