{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cow-protocol/json-schema/cow-protocol-simulation-request-schema.json",
  "title": "SimulationRequest",
  "description": "Request body for simulating an arbitrary order without it being stored in the orderbook.\n",
  "x-generated": "2026-10-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/orderbook.yml#/components/schemas/SimulationRequest",
  "type": "object",
  "properties": {
    "sellToken": {
      "description": "The token being sold.",
      "allOf": [
        {
          "$ref": "#/$defs/Address"
        }
      ]
    },
    "buyToken": {
      "description": "The token being bought.",
      "allOf": [
        {
          "$ref": "#/$defs/Address"
        }
      ]
    },
    "sellAmount": {
      "description": "Amount of sell token (hex- or decimal-encoded uint256). Must be greater than zero.\n",
      "allOf": [
        {
          "$ref": "#/$defs/TokenAmount"
        }
      ]
    },
    "buyAmount": {
      "description": "Amount of buy token (hex- or decimal-encoded uint256).",
      "allOf": [
        {
          "$ref": "#/$defs/TokenAmount"
        }
      ]
    },
    "kind": {
      "description": "Whether this is a sell or buy order.",
      "allOf": [
        {
          "$ref": "#/$defs/OrderKind"
        }
      ]
    },
    "owner": {
      "description": "The address of the order owner.",
      "allOf": [
        {
          "$ref": "#/$defs/Address"
        }
      ]
    },
    "receiver": {
      "description": "The address that will receive the buy tokens. Defaults to the owner if omitted.\n",
      "allOf": [
        {
          "$ref": "#/$defs/Address"
        }
      ]
    },
    "sellTokenBalance": {
      "deprecated": true,
      "description": "Where the sell token should be drawn from.",
      "allOf": [
        {
          "$ref": "#/$defs/SellTokenSource"
        }
      ]
    },
    "buyTokenBalance": {
      "deprecated": true,
      "description": "Where the buy token should be transferred to.",
      "allOf": [
        {
          "$ref": "#/$defs/BuyTokenDestination"
        }
      ]
    },
    "appData": {
      "description": "Full app data JSON string.\n",
      "type": "string"
    },
    "blockNumber": {
      "type": [
        "integer",
        "null"
      ]
    },
    "signingScheme": {
      "$ref": "#/$defs/SigningScheme"
    },
    "signature": {
      "$ref": "#/$defs/Signature"
    },
    "feeAmount": {
      "description": "The fee amount in sell token atoms. Expected to be 0; only present because it must be part of the signed order data.\n",
      "allOf": [
        {
          "$ref": "#/$defs/TokenAmount"
        }
      ]
    },
    "validTo": {
      "description": "Unix timestamp (`uint32`) until which the order is valid.",
      "type": "integer"
    },
    "partiallyFillable": {
      "description": "Whether the order can be partially filled or must be filled all at once.",
      "type": "boolean"
    }
  },
  "required": [
    "sellToken",
    "buyToken",
    "sellAmount",
    "buyAmount",
    "kind",
    "owner",
    "signingScheme",
    "signature",
    "feeAmount",
    "validTo",
    "partiallyFillable",
    "appData"
  ],
  "$defs": {
    "Address": {
      "description": "20 byte Ethereum address encoded as a hex with `0x` prefix.",
      "type": "string"
    },
    "BuyTokenDestination": {
      "description": "Where should the `buyToken` be transferred to?\n\n**Only `erc20` is accepted for new orders.** The `internal` (Balancer Vault)\ndestination is rejected at creation with `UnsupportedBuyTokenDestination`.\nThe value remains in the enum because it may still appear on historical\norders returned by the API.",
      "type": "string",
      "enum": [
        "erc20",
        "internal"
      ]
    },
    "EcdsaSignature": {
      "description": "65 bytes encoded as hex with `0x` prefix. `r || s || v` from the spec.",
      "type": "string"
    },
    "OrderKind": {
      "description": "Is this order a buy or sell?",
      "type": "string",
      "enum": [
        "buy",
        "sell"
      ]
    },
    "PreSignature": {
      "description": "Empty signature bytes. Used for \"presign\" signatures.",
      "type": "string"
    },
    "SellTokenSource": {
      "description": "Where should the `sellToken` be drawn from?\n\n**Only `erc20` is accepted for new orders.** The `internal` and `external`\n(Balancer Vault) sources are deprecated: orders using them are rejected at\ncreation with `UnsupportedSellTokenSource`. The values remain in the enum\nbecause they may still appear on historical orders returned by the API.",
      "type": "string",
      "enum": [
        "erc20",
        "internal",
        "external"
      ]
    },
    "Signature": {
      "description": "A signature.",
      "oneOf": [
        {
          "$ref": "#/$defs/EcdsaSignature"
        },
        {
          "$ref": "#/$defs/PreSignature"
        }
      ]
    },
    "SigningScheme": {
      "description": "How was the order signed?",
      "type": "string",
      "enum": [
        "eip712",
        "ethsign",
        "presign",
        "eip1271"
      ]
    },
    "TokenAmount": {
      "description": "Amount of a token. `uint256` encoded in decimal.",
      "type": "string"
    }
  }
}