{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/coinrithm-com/json-schema/coinrithm-com-spot-order-request-schema.json",
  "title": "SpotOrderRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/coinrithm-com-spot-api-openapi.yml#/components/schemas/SpotOrderRequest",
  "type": "object",
  "required": [
    "coinId",
    "side",
    "orderType",
    "quantity",
    "idempotencyKey"
  ],
  "properties": {
    "coinId": {
      "type": "string",
      "description": "Coin UCID (e.g. \"1\" = BTC). NOT a ticker symbol."
    },
    "side": {
      "type": "string",
      "enum": [
        "buy",
        "sell"
      ]
    },
    "orderType": {
      "type": "string",
      "enum": [
        "market",
        "limit",
        "stop"
      ]
    },
    "quantity": {
      "type": "number",
      "description": "Amount of the base coin (must be > 0)."
    },
    "limitPrice": {
      "type": "number",
      "description": "Required for limit/stop orders (USD per coin)."
    },
    "stopPrice": {
      "type": "number",
      "description": "Required for stop orders (USD trigger price)."
    },
    "idempotencyKey": {
      "type": "string",
      "description": "REQUIRED for API-key (agent) callers. Unique per intent; reusing\nit replays the original result (`idempotentReplay: true`) instead\nof double-executing — retry a timed-out request with the SAME key.\n"
    },
    "agentTrace": {
      "$ref": "#/$defs/AgentTraceMetadata"
    }
  },
  "$defs": {
    "AgentTraceMetadata": {
      "type": "object",
      "description": "Optional private trace metadata supplied by a user-run agent. CoinRithm\nstores only this structured summary; do not send chain-of-thought,\nsecrets, emails, or private account identity.\n",
      "properties": {
        "runId": {
          "type": [
            "string",
            "null"
          ]
        },
        "decisionId": {
          "type": [
            "string",
            "null"
          ]
        },
        "strategyLabel": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 120
        },
        "confidence": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0,
          "maximum": 1
        },
        "rationaleSummary": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 1200
        }
      }
    }
  }
}