# Backtest an automation

Estimates how a draft or saved automation would have behaved over a historical range. Use it before creating or changing an automation; inspect the returned status, limitations and timing changes before using the estimate. Historical prices do not establish executable fills.

`POST /v1/users/{userId}/automations/backtest`

## Authentication

Both headers are required.

- Header: `X-Api-Key: YOUR_API_KEY`
- Header: `Authorization: Bearer YOUR_USER_TOKEN` — A user's session token, from Create a session.

## Path parameters



```json
[
  {
    "schema": {
      "type": "string",
      "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
    },
    "in": "path",
    "name": "userId",
    "required": true,
    "description": "Your id for the user: the `userId` you sent to Create a user. It must be the session's user."
  }
]
```


## Request body



```json
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "target": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "draft"
                    ]
                  },
                  "definition": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      },
                      "prompt": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 8192,
                        "description": "Only the user's instructions for each later run, preserved exactly with their constraints; monitoring conditions belong in rule."
                      },
                      "rule": {
                        "$ref": "#/components/schemas/AutomationRuleInput"
                      },
                      "contract": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "description": "Which contract template this is.",
                                "enum": [
                                  "near_intents_transfer"
                                ]
                              },
                              "actions": {
                                "minItems": 1,
                                "maxItems": 16,
                                "type": "array",
                                "items": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Exchange one asset for another; custody never leaves the agent wallet.",
                                          "enum": [
                                            "swap"
                                          ]
                                        },
                                        "input": {
                                          "anyOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "pinned": {
                                                  "type": "object",
                                                  "properties": {
                                                    "tokenId": {
                                                      "type": "string",
                                                      "maxLength": 256,
                                                      "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                                      "description": "The exact ledger asset identifier, including its token standard namespace."
                                                    },
                                                    "decimals": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 38,
                                                      "description": "How many decimal places the token's smallest unit represents."
                                                    }
                                                  },
                                                  "required": [
                                                    "tokenId",
                                                    "decimals"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "The exact token this asset is pinned to."
                                                }
                                              },
                                              "required": [
                                                "pinned"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "any": {
                                                  "type": "boolean",
                                                  "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                                  "enum": [
                                                    true
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "any"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ],
                                          "description": "The asset this action spends: pinned to one token, or any token the agent wallet holds."
                                        },
                                        "quantity": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Spend an exact amount of the input token.",
                                                  "enum": [
                                                    "exact_input_tokens"
                                                  ]
                                                },
                                                "amountRaw": {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9]\\d{0,38})$",
                                                  "description": "The exact input amount, in the input token's smallest unit."
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "amountRaw"
                                              ],
                                              "additionalProperties": false,
                                              "description": "An exact quantity of the input token, not its USD value: exactly 5 USDC at decimals 6 is amountRaw \"5000000\". No floating-point arithmetic or bash."
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Spend a USD-denominated value of the input token.",
                                                  "enum": [
                                                    "exact_input_value_usd"
                                                  ]
                                                },
                                                "value": {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9]\\d{0,38})(?:\\.\\d{1,18})?$",
                                                  "description": "The USD value to spend, as a decimal string."
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "value"
                                              ],
                                              "additionalProperties": false,
                                              "description": "A USD value of the input token: \"$5 worth of USDC\" is value \"5\", never exactly 5 USDC. The host converts it at live prices."
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Receive an exact amount of the output token.",
                                                  "enum": [
                                                    "exact_output_tokens"
                                                  ]
                                                },
                                                "amountRaw": {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9]\\d{0,38})$",
                                                  "description": "The exact output amount, in the output token's smallest unit."
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "amountRaw"
                                              ],
                                              "additionalProperties": false,
                                              "description": "An exact quantity of the output token, scaled by its verified decimals; the host calculates the input."
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Spend everything the agent wallet holds of the input asset.",
                                                  "enum": [
                                                    "all_of_input"
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "kind"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Spend a fraction of the input asset.",
                                                  "enum": [
                                                    "fraction_of_input"
                                                  ]
                                                },
                                                "bps": {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9]\\d{0,4})$",
                                                  "description": "The fraction to spend, in basis points of the input asset."
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "bps"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Sell a fraction of this automation's own position in the input asset.",
                                                  "enum": [
                                                    "fraction_of_position"
                                                  ]
                                                },
                                                "bps": {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9]\\d{0,4})$",
                                                  "description": "The fraction to sell, in basis points of this automation's own position; 10000 is all of it."
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "bps"
                                              ],
                                              "additionalProperties": false,
                                              "description": "A fraction of what THIS automation's own settled fills still hold of the input asset, never of the wallet balance; only on an action with an `exit` guard."
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Sell only the gain on this automation's own position in the input asset.",
                                                  "enum": [
                                                    "gain_of_position"
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "kind"
                                              ],
                                              "additionalProperties": false,
                                              "description": "Only the gain on THIS automation's own position, priced in the token its buys paid with; only with a take_profit or harvest_every `exit` guard and a pinned output other than that token."
                                            }
                                          ],
                                          "description": "How much moves: an exact token amount, an exact USD value, an exact output amount, all of the input, or a fraction of it."
                                        },
                                        "output": {
                                          "anyOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "pinned": {
                                                  "type": "object",
                                                  "properties": {
                                                    "tokenId": {
                                                      "type": "string",
                                                      "maxLength": 256,
                                                      "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                                      "description": "The exact ledger asset identifier, including its token standard namespace."
                                                    },
                                                    "decimals": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 38,
                                                      "description": "How many decimal places the token's smallest unit represents."
                                                    }
                                                  },
                                                  "required": [
                                                    "tokenId",
                                                    "decimals"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "The exact token this asset is pinned to."
                                                }
                                              },
                                              "required": [
                                                "pinned"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "any": {
                                                  "type": "boolean",
                                                  "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                                  "enum": [
                                                    true
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "any"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ],
                                          "description": "The asset this action produces: pinned to one token, or left open."
                                        },
                                        "exit": {
                                          "description": "Optional exit guard: this action sells only when the asset's price in its output token crosses the automation's own average cost by the approved amount.",
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Sell when the asset is this far ABOVE the automation's average cost.",
                                                  "enum": [
                                                    "take_profit"
                                                  ]
                                                },
                                                "gainBps": {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9]\\d{0,4})$",
                                                  "description": "How far above the average cost the price must be, in basis points."
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "gainBps"
                                              ],
                                              "additionalProperties": false,
                                              "description": "A take-profit exit: sell once the price is up this much on average cost."
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Sell when the asset is this far BELOW the automation's average cost.",
                                                  "enum": [
                                                    "stop_loss"
                                                  ]
                                                },
                                                "lossBps": {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9]\\d{0,4})$",
                                                  "description": "How far below the average cost the price must be, in basis points."
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "lossBps"
                                              ],
                                              "additionalProperties": false,
                                              "description": "A stop-loss exit: sell once the price is down this much on average cost."
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Take profits on a schedule: sell only the gain every this many days, counted from the last harvest that settled, or from the first deposit that settled.",
                                                  "enum": [
                                                    "harvest_every"
                                                  ]
                                                },
                                                "days": {
                                                  "type": "string",
                                                  "pattern": "^[1-9]\\d{0,2}$",
                                                  "description": "How many days apart harvests are, 7 to 365, as a decimal string: \"7\" weekly, \"30\" monthly."
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "days"
                                              ],
                                              "additionalProperties": false,
                                              "description": "A scheduled harvest: only on a gain_of_position exit selling a curated yield vault's share token (earn_vaults). Every `days` days it sells only the gain, if there is any, and the automation keeps running."
                                            }
                                          ]
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "input",
                                        "quantity",
                                        "output"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Return an asset to the account that owns the agent wallet.",
                                          "enum": [
                                            "withdraw_to_owner"
                                          ]
                                        },
                                        "input": {
                                          "anyOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "pinned": {
                                                  "type": "object",
                                                  "properties": {
                                                    "tokenId": {
                                                      "type": "string",
                                                      "maxLength": 256,
                                                      "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                                      "description": "The exact ledger asset identifier, including its token standard namespace."
                                                    },
                                                    "decimals": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 38,
                                                      "description": "How many decimal places the token's smallest unit represents."
                                                    }
                                                  },
                                                  "required": [
                                                    "tokenId",
                                                    "decimals"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "The exact token this asset is pinned to."
                                                }
                                              },
                                              "required": [
                                                "pinned"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "any": {
                                                  "type": "boolean",
                                                  "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                                  "enum": [
                                                    true
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "any"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ],
                                          "description": "The asset this action spends: pinned to one token, or any token the agent wallet holds."
                                        },
                                        "quantity": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Spend an exact amount of the input token.",
                                                  "enum": [
                                                    "exact_input_tokens"
                                                  ]
                                                },
                                                "amountRaw": {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9]\\d{0,38})$",
                                                  "description": "The exact input amount, in the input token's smallest unit."
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "amountRaw"
                                              ],
                                              "additionalProperties": false,
                                              "description": "An exact quantity of the input token, not its USD value: exactly 5 USDC at decimals 6 is amountRaw \"5000000\". No floating-point arithmetic or bash."
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Spend a USD-denominated value of the input token.",
                                                  "enum": [
                                                    "exact_input_value_usd"
                                                  ]
                                                },
                                                "value": {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9]\\d{0,38})(?:\\.\\d{1,18})?$",
                                                  "description": "The USD value to spend, as a decimal string."
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "value"
                                              ],
                                              "additionalProperties": false,
                                              "description": "A USD value of the input token: \"$5 worth of USDC\" is value \"5\", never exactly 5 USDC. The host converts it at live prices."
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Receive an exact amount of the output token.",
                                                  "enum": [
                                                    "exact_output_tokens"
                                                  ]
                                                },
                                                "amountRaw": {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9]\\d{0,38})$",
                                                  "description": "The exact output amount, in the output token's smallest unit."
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "amountRaw"
                                              ],
                                              "additionalProperties": false,
                                              "description": "An exact quantity of the output token, scaled by its verified decimals; the host calculates the input."
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Spend everything the agent wallet holds of the input asset.",
                                                  "enum": [
                                                    "all_of_input"
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "kind"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Spend a fraction of the input asset.",
                                                  "enum": [
                                                    "fraction_of_input"
                                                  ]
                                                },
                                                "bps": {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9]\\d{0,4})$",
                                                  "description": "The fraction to spend, in basis points of the input asset."
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "bps"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Sell a fraction of this automation's own position in the input asset.",
                                                  "enum": [
                                                    "fraction_of_position"
                                                  ]
                                                },
                                                "bps": {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9]\\d{0,4})$",
                                                  "description": "The fraction to sell, in basis points of this automation's own position; 10000 is all of it."
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "bps"
                                              ],
                                              "additionalProperties": false,
                                              "description": "A fraction of what THIS automation's own settled fills still hold of the input asset, never of the wallet balance; only on an action with an `exit` guard."
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Sell only the gain on this automation's own position in the input asset.",
                                                  "enum": [
                                                    "gain_of_position"
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "kind"
                                              ],
                                              "additionalProperties": false,
                                              "description": "Only the gain on THIS automation's own position, priced in the token its buys paid with; only with a take_profit or harvest_every `exit` guard and a pinned output other than that token."
                                            }
                                          ],
                                          "description": "How much moves: an exact token amount, an exact USD value, an exact output amount, all of the input, or a fraction of it."
                                        },
                                        "output": {
                                          "anyOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "pinned": {
                                                  "type": "object",
                                                  "properties": {
                                                    "tokenId": {
                                                      "type": "string",
                                                      "maxLength": 256,
                                                      "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                                      "description": "The exact ledger asset identifier, including its token standard namespace."
                                                    },
                                                    "decimals": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 38,
                                                      "description": "How many decimal places the token's smallest unit represents."
                                                    }
                                                  },
                                                  "required": [
                                                    "tokenId",
                                                    "decimals"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "The exact token this asset is pinned to."
                                                }
                                              },
                                              "required": [
                                                "pinned"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "any": {
                                                  "type": "boolean",
                                                  "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                                  "enum": [
                                                    true
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "any"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ],
                                          "description": "The asset this action produces: pinned to one token, or left open."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "input",
                                        "quantity",
                                        "output"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Pay the exact approved destination through the provider’s chain or Intents transfer route.",
                                          "enum": [
                                            "withdraw_transfer"
                                          ]
                                        },
                                        "input": {
                                          "anyOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "pinned": {
                                                  "type": "object",
                                                  "properties": {
                                                    "tokenId": {
                                                      "type": "string",
                                                      "maxLength": 256,
                                                      "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                                      "description": "The exact ledger asset identifier, including its token standard namespace."
                                                    },
                                                    "decimals": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 38,
                                                      "description": "How many decimal places the token's smallest unit represents."
                                                    }
                                                  },
                                                  "required": [
                                                    "tokenId",
                                                    "decimals"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "The exact token this asset is pinned to."
                                                }
                                              },
                                              "required": [
                                                "pinned"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "any": {
                                                  "type": "boolean",
                                                  "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                                  "enum": [
                                                    true
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "any"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ],
                                          "description": "The asset this action spends: pinned to one token, or any token the agent wallet holds."
                                        },
                                        "quantity": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Spend an exact amount of the input token.",
                                                  "enum": [
                                                    "exact_input_tokens"
                                                  ]
                                                },
                                                "amountRaw": {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9]\\d{0,38})$",
                                                  "description": "The exact input amount, in the input token's smallest unit."
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "amountRaw"
                                              ],
                                              "additionalProperties": false,
                                              "description": "An exact quantity of the input token, not its USD value: exactly 5 USDC at decimals 6 is amountRaw \"5000000\". No floating-point arithmetic or bash."
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Spend a USD-denominated value of the input token.",
                                                  "enum": [
                                                    "exact_input_value_usd"
                                                  ]
                                                },
                                                "value": {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9]\\d{0,38})(?:\\.\\d{1,18})?$",
                                                  "description": "The USD value to spend, as a decimal string."
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "value"
                                              ],
                                              "additionalProperties": false,
                                              "description": "A USD value of the input token: \"$5 worth of USDC\" is value \"5\", never exactly 5 USDC. The host converts it at live prices."
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Receive an exact amount of the output token.",
                                                  "enum": [
                                                    "exact_output_tokens"
                                                  ]
                                                },
                                                "amountRaw": {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9]\\d{0,38})$",
                                                  "description": "The exact output amount, in the output token's smallest unit."
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "amountRaw"
                                              ],
                                              "additionalProperties": false,
                                              "description": "An exact quantity of the output token, scaled by its verified decimals; the host calculates the input."
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Spend everything the agent wallet holds of the input asset.",
                                                  "enum": [
                                                    "all_of_input"
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "kind"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Spend a fraction of the input asset.",
                                                  "enum": [
                                                    "fraction_of_input"
                                                  ]
                                                },
                                                "bps": {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9]\\d{0,4})$",
                                                  "description": "The fraction to spend, in basis points of the input asset."
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "bps"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Sell a fraction of this automation's own position in the input asset.",
                                                  "enum": [
                                                    "fraction_of_position"
                                                  ]
                                                },
                                                "bps": {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9]\\d{0,4})$",
                                                  "description": "The fraction to sell, in basis points of this automation's own position; 10000 is all of it."
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "bps"
                                              ],
                                              "additionalProperties": false,
                                              "description": "A fraction of what THIS automation's own settled fills still hold of the input asset, never of the wallet balance; only on an action with an `exit` guard."
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Sell only the gain on this automation's own position in the input asset.",
                                                  "enum": [
                                                    "gain_of_position"
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "kind"
                                              ],
                                              "additionalProperties": false,
                                              "description": "Only the gain on THIS automation's own position, priced in the token its buys paid with; only with a take_profit or harvest_every `exit` guard and a pinned output other than that token."
                                            }
                                          ],
                                          "description": "How much moves: an exact token amount, an exact USD value, an exact output amount, all of the input, or a fraction of it."
                                        },
                                        "output": {
                                          "anyOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "pinned": {
                                                  "type": "object",
                                                  "properties": {
                                                    "tokenId": {
                                                      "type": "string",
                                                      "maxLength": 256,
                                                      "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                                      "description": "The exact ledger asset identifier, including its token standard namespace."
                                                    },
                                                    "decimals": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 38,
                                                      "description": "How many decimal places the token's smallest unit represents."
                                                    }
                                                  },
                                                  "required": [
                                                    "tokenId",
                                                    "decimals"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "The exact token this asset is pinned to."
                                                }
                                              },
                                              "required": [
                                                "pinned"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "any": {
                                                  "type": "boolean",
                                                  "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                                  "enum": [
                                                    true
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "any"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ],
                                          "description": "The asset this action produces: pinned to one token, or left open."
                                        },
                                        "recipient": {
                                          "type": "object",
                                          "properties": {
                                            "rail": {
                                              "type": "string",
                                              "enum": [
                                                "chain",
                                                "intents"
                                              ],
                                              "description": "A native blockchain transfer or a signed transfer within an Intents ledger."
                                            },
                                            "network": {
                                              "type": "string",
                                              "pattern": "^[a-z][a-z0-9-]{0,63}$",
                                              "description": "Exact network identifier from wallet capabilities; near-intents and near-intents-confidential are ledgers, not the NEAR blockchain."
                                            },
                                            "address": {
                                              "type": "string",
                                              "pattern": "^[\\x21-\\x7e]{1,256}$",
                                              "description": "Exact network address, preserving case and any routing metadata encoded in its native address format. Names must be resolved before approval."
                                            },
                                            "memo": {
                                              "type": "null",
                                              "description": "Standalone routing memos are unsupported; routing must be encoded in the approved address."
                                            }
                                          },
                                          "required": [
                                            "rail",
                                            "network",
                                            "address",
                                            "memo"
                                          ],
                                          "additionalProperties": false,
                                          "description": "The exact approved payout rail, network and address."
                                        },
                                        "minimumReceivedRaw": {
                                          "anyOf": [
                                            {
                                              "type": "string",
                                              "pattern": "^(0|[1-9]\\d{0,38})$"
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ],
                                          "description": "Minimum acceptable payout in output-asset atomic units, or null when the approved all-in loss bound alone sets the floor."
                                        },
                                        "maxFeeRaw": {
                                          "anyOf": [
                                            {
                                              "type": "string",
                                              "pattern": "^(0|[1-9]\\d{0,38})$"
                                            },
                                            {
                                              "type": "null"
                                            }
                                          ],
                                          "description": "Optional separate withdrawal fee cap in output-asset atomic units; null means undisclosed, while all-in loss and minimum receive remain enforced."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "input",
                                        "quantity",
                                        "output",
                                        "recipient",
                                        "minimumReceivedRaw",
                                        "maxFeeRaw"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Not executable, and refused in new contracts: pay an address with withdraw_transfer.",
                                          "enum": [
                                            "send"
                                          ]
                                        },
                                        "input": {
                                          "anyOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "pinned": {
                                                  "type": "object",
                                                  "properties": {
                                                    "tokenId": {
                                                      "type": "string",
                                                      "maxLength": 256,
                                                      "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                                      "description": "The exact ledger asset identifier, including its token standard namespace."
                                                    },
                                                    "decimals": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 38,
                                                      "description": "How many decimal places the token's smallest unit represents."
                                                    }
                                                  },
                                                  "required": [
                                                    "tokenId",
                                                    "decimals"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "The exact token this asset is pinned to."
                                                }
                                              },
                                              "required": [
                                                "pinned"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "any": {
                                                  "type": "boolean",
                                                  "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                                  "enum": [
                                                    true
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "any"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ],
                                          "description": "The asset this action spends: pinned to one token, or any token the agent wallet holds."
                                        },
                                        "quantity": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Spend an exact amount of the input token.",
                                                  "enum": [
                                                    "exact_input_tokens"
                                                  ]
                                                },
                                                "amountRaw": {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9]\\d{0,38})$",
                                                  "description": "The exact input amount, in the input token's smallest unit."
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "amountRaw"
                                              ],
                                              "additionalProperties": false,
                                              "description": "An exact quantity of the input token, not its USD value: exactly 5 USDC at decimals 6 is amountRaw \"5000000\". No floating-point arithmetic or bash."
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Spend a USD-denominated value of the input token.",
                                                  "enum": [
                                                    "exact_input_value_usd"
                                                  ]
                                                },
                                                "value": {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9]\\d{0,38})(?:\\.\\d{1,18})?$",
                                                  "description": "The USD value to spend, as a decimal string."
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "value"
                                              ],
                                              "additionalProperties": false,
                                              "description": "A USD value of the input token: \"$5 worth of USDC\" is value \"5\", never exactly 5 USDC. The host converts it at live prices."
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Receive an exact amount of the output token.",
                                                  "enum": [
                                                    "exact_output_tokens"
                                                  ]
                                                },
                                                "amountRaw": {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9]\\d{0,38})$",
                                                  "description": "The exact output amount, in the output token's smallest unit."
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "amountRaw"
                                              ],
                                              "additionalProperties": false,
                                              "description": "An exact quantity of the output token, scaled by its verified decimals; the host calculates the input."
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Spend everything the agent wallet holds of the input asset.",
                                                  "enum": [
                                                    "all_of_input"
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "kind"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Spend a fraction of the input asset.",
                                                  "enum": [
                                                    "fraction_of_input"
                                                  ]
                                                },
                                                "bps": {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9]\\d{0,4})$",
                                                  "description": "The fraction to spend, in basis points of the input asset."
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "bps"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Sell a fraction of this automation's own position in the input asset.",
                                                  "enum": [
                                                    "fraction_of_position"
                                                  ]
                                                },
                                                "bps": {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9]\\d{0,4})$",
                                                  "description": "The fraction to sell, in basis points of this automation's own position; 10000 is all of it."
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "bps"
                                              ],
                                              "additionalProperties": false,
                                              "description": "A fraction of what THIS automation's own settled fills still hold of the input asset, never of the wallet balance; only on an action with an `exit` guard."
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "description": "Sell only the gain on this automation's own position in the input asset.",
                                                  "enum": [
                                                    "gain_of_position"
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "kind"
                                              ],
                                              "additionalProperties": false,
                                              "description": "Only the gain on THIS automation's own position, priced in the token its buys paid with; only with a take_profit or harvest_every `exit` guard and a pinned output other than that token."
                                            }
                                          ],
                                          "description": "How much moves: an exact token amount, an exact USD value, an exact output amount, all of the input, or a fraction of it."
                                        },
                                        "output": {
                                          "anyOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "pinned": {
                                                  "type": "object",
                                                  "properties": {
                                                    "tokenId": {
                                                      "type": "string",
                                                      "maxLength": 256,
                                                      "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                                      "description": "The exact ledger asset identifier, including its token standard namespace."
                                                    },
                                                    "decimals": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 38,
                                                      "description": "How many decimal places the token's smallest unit represents."
                                                    }
                                                  },
                                                  "required": [
                                                    "tokenId",
                                                    "decimals"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "The exact token this asset is pinned to."
                                                }
                                              },
                                              "required": [
                                                "pinned"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "any": {
                                                  "type": "boolean",
                                                  "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                                  "enum": [
                                                    true
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "any"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ],
                                          "description": "The asset this action produces: pinned to one token, or left open."
                                        },
                                        "recipient": {
                                          "type": "object",
                                          "properties": {
                                            "chain": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 32,
                                              "description": "Which chain the destination address is on."
                                            },
                                            "address": {
                                              "type": "string",
                                              "pattern": "^[\\x21-\\x7e]{1,128}$",
                                              "description": "The destination address on that chain."
                                            }
                                          },
                                          "required": [
                                            "chain",
                                            "address"
                                          ],
                                          "additionalProperties": false,
                                          "description": "The pinned destination this action pays."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "input",
                                        "quantity",
                                        "output",
                                        "recipient"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                },
                                "description": "The actions this contract authorizes, executed in order."
                              },
                              "validUntil": {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                                "description": "When this contract's authority expires."
                              },
                              "maxExecutions": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 10000,
                                "description": "How many times this contract may be executed before it is exhausted."
                              },
                              "maxTotalInput": {
                                "description": "Optional total cap on what all executions together may spend, per input token, in raw units. A $500 budget paid in USDC is 500 USDC. Every action input must be pinned and capped.",
                                "minItems": 1,
                                "maxItems": 16,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "tokenId": {
                                      "type": "string",
                                      "maxLength": 256,
                                      "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                      "description": "The exact ledger asset identifier, including its token standard namespace."
                                    },
                                    "decimals": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 38,
                                      "description": "How many decimal places the token's smallest unit represents."
                                    },
                                    "amountRaw": {
                                      "type": "string",
                                      "pattern": "^(0|[1-9]\\d{0,38})$",
                                      "description": "The most this contract may spend of this token in total, across every execution, in the token's smallest unit."
                                    }
                                  },
                                  "required": [
                                    "tokenId",
                                    "decimals",
                                    "amountRaw"
                                  ],
                                  "additionalProperties": false,
                                  "description": "One capped input token and its total spend ceiling."
                                }
                              },
                              "bounds": {
                                "type": "object",
                                "properties": {
                                  "maxValueLossBps": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9]\\d{0,4})$",
                                    "description": "The most value an execution may give up to price movement and fees together, in basis points; 0 allows no loss."
                                  },
                                  "maxSignatureLifetimeSeconds": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 259500,
                                    "description": "Explicit maximum lifetime of each released transfer signature, in seconds. 1Click confidential swaps require up to 259500 seconds (72 hours 5 minutes). This does not extend the execution window or approval validity."
                                  }
                                },
                                "required": [
                                  "maxValueLossBps",
                                  "maxSignatureLifetimeSeconds"
                                ],
                                "additionalProperties": false,
                                "description": "The value-loss and signature-lifetime limits every execution must respect."
                              },
                              "execution": {
                                "description": "Optional explicit recovery authority, signed with these exact actions and bounds; omitted on historical approvals.",
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "mode": {
                                        "type": "string",
                                        "enum": [
                                          "ordered",
                                          "parallel_independent"
                                        ],
                                        "description": "Ordered actions run in approved order. Parallel-independent actions run up to four concurrently after the complete initially funded request is reserved."
                                      },
                                      "maxPreparationAttempts": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 3,
                                        "description": "The maximum unsigned preparation attempts for each approved action, including its first attempt."
                                      },
                                      "dispatchWindowSeconds": {
                                        "type": "integer",
                                        "minimum": 60,
                                        "maximum": 86400,
                                        "description": "The maximum dispatch window in seconds for this operation, from when its approval opened: exactly 1200 for a new chat request, and up to its signed deadline for an automation's grant. Closing dispatch never proves a submitted transfer did not move; observation continues."
                                      }
                                    },
                                    "required": [
                                      "mode",
                                      "maxPreparationAttempts",
                                      "dispatchWindowSeconds"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "mode": {
                                        "type": "string",
                                        "enum": [
                                          "dependency_graph"
                                        ]
                                      },
                                      "dependencies": {
                                        "minItems": 1,
                                        "maxItems": 16,
                                        "type": "array",
                                        "items": {
                                          "maxItems": 16,
                                          "type": "array",
                                          "items": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 15
                                          }
                                        },
                                        "description": "One row per requested action, listing its sorted unique predecessor action indices. A successor requires confirmed predecessor settlement. Every action must be funded from initial holdings."
                                      },
                                      "maxPreparationAttempts": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 3,
                                        "description": "The maximum unsigned preparation attempts for each approved action, including its first attempt."
                                      },
                                      "dispatchWindowSeconds": {
                                        "type": "integer",
                                        "minimum": 60,
                                        "maximum": 86400,
                                        "description": "The maximum dispatch window in seconds for this operation, from when its approval opened: exactly 1200 for a new chat request, and up to its signed deadline for an automation's grant. Closing dispatch never proves a submitted transfer did not move; observation continues."
                                      }
                                    },
                                    "required": [
                                      "mode",
                                      "dependencies",
                                      "maxPreparationAttempts",
                                      "dispatchWindowSeconds"
                                    ],
                                    "additionalProperties": false
                                  }
                                ]
                              }
                            },
                            "required": [
                              "type",
                              "actions",
                              "validUntil",
                              "maxExecutions",
                              "bounds"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "$ref": "#/components/schemas/PerpsAutomationContractInput"
                          },
                          {
                            "$ref": "#/components/schemas/PredictionAutomationContractInput"
                          },
                          {
                            "oneOf": [
                              {
                                "$ref": "#/components/schemas/SolanaBuyContractInput"
                              },
                              {
                                "$ref": "#/components/schemas/SolanaSellContractInput"
                              }
                            ],
                            "description": "A standing Solana grant: an exact buy, or a sale of a fraction of the holding for USDC, made exactly as approved each time the automation fires."
                          }
                        ],
                        "description": "Standing authority for the runs this automation fires: a NEAR Intents transfer contract, a perps automation that opens, reduces or adds margin to the agent's own Hyperliquid position, a Polymarket buy or sale of one outcome, or a Solana buy or sell made exactly as approved."
                      },
                      "maxSigningDelaySeconds": {
                        "description": "Required with a contract and omitted without one: the owner's approved maximum delay after a firing during which its run may obtain signatures, in seconds; separate from delivery lateness and signature lifetime.",
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 86400
                      },
                      "missedRun": {
                        "type": "string",
                        "enum": [
                          "skip",
                          "ask"
                        ],
                        "description": "What happens to a run that can't go through before its deadline: `skip` counts it and keeps the schedule, `ask` pauses the automation until its owner decides. A failure only the owner can fix pauses either way."
                      }
                    },
                    "required": [
                      "name",
                      "prompt",
                      "rule"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "kind",
                  "definition"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "saved"
                    ]
                  },
                  "automationId": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                    "description": "The automation's id."
                  },
                  "definitionVersion": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "kind",
                  "automationId"
                ],
                "additionalProperties": false
              }
            ]
          },
          "startAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "endAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
          },
          "resolution": {
            "type": "string",
            "enum": [
              "hourly",
              "daily"
            ]
          },
          "timing": {
            "type": "string",
            "enum": [
              "preserved",
              "sampled"
            ]
          },
          "execution": {
            "type": "string",
            "enum": [
              "contract_terms",
              "triggers_only"
            ],
            "description": "Select triggers_only for a discretionary prompt whose concrete trades are unresolved. contract_terms hypothetically executes the fixed proposed trade terms; it does not simulate model decisions or discretionary instructions."
          },
          "initialHoldings": {
            "maxItems": 16,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "tokenId": {
                  "type": "string",
                  "maxLength": 256,
                  "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                  "description": "The exact ledger asset identifier, including its token standard namespace."
                },
                "decimals": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 38,
                  "description": "How many decimal places the token's smallest unit represents."
                },
                "amountRaw": {
                  "type": "string",
                  "pattern": "^(0|[1-9]\\d{0,38})$"
                }
              },
              "required": [
                "tokenId",
                "decimals",
                "amountRaw"
              ],
              "additionalProperties": false
            }
          },
          "funding": {
            "description": "Select strategy_budget to set aside a finite starting budget from entry sizes and run limits at opening historical prices. Requires empty initialHoldings and cannot be combined with contributeInputs: true. Omit both automatic options to use an explicitly supplied starting portfolio. No live wallet balance is read.",
            "type": "string",
            "enum": [
              "strategy_budget"
            ]
          },
          "contributeInputs": {
            "description": "When true, start empty and hypothetically supply the input assets for each successfully modeled fixed purchase, valued at its fill time. Requires empty initialHoldings and omitted funding. Contributions are capital, not profit; exits receive no new capital. False or omission leaves the existing funding or explicit portfolio behavior unchanged.",
            "type": "boolean"
          },
          "costBps": {
            "type": "integer",
            "minimum": 0,
            "maximum": 300
          }
        },
        "required": [
          "target",
          "startAt",
          "endAt",
          "resolution",
          "timing",
          "execution",
          "initialHoldings",
          "costBps"
        ],
        "additionalProperties": false
      }
    }
  }
}
```


## Request example

Illustrative request. Replace the host, credentials and resource IDs with your own. If a request file is shown, create it from the schema above. Review the requested action before sending it.

```sh
curl --request POST 'https://api.example.test/v1/users/YOUR_USER_ID/automations/backtest' \
  --header 'X-Api-Key: YOUR_API_KEY' \
  --header 'Authorization: Bearer YOUR_USER_TOKEN' \
  --header 'Content-Type: application/json' \
  --data-binary '@request.json'
```

## Responses

### 200

The historical estimate and its data limitations.



```json
{
  "description": "The historical estimate and its data limitations.",
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "estimated",
              "trigger_only",
              "unavailable",
              "incomplete"
            ]
          },
          "reason": {
            "anyOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 4096
              },
              {
                "type": "null"
              }
            ]
          },
          "metrics": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "startingValueUsdDecimal": {
                    "type": "string",
                    "pattern": "^-?(0|[1-9]\\d{0,77})(\\.\\d{1,36})?$"
                  },
                  "contributedValueUsdDecimal": {
                    "description": "Total external input contributions valued at their modeled fills; contributions are excluded from profit.",
                    "type": "string",
                    "pattern": "^-?(0|[1-9]\\d{0,77})(\\.\\d{1,36})?$"
                  },
                  "endingValueUsdDecimal": {
                    "type": "string",
                    "pattern": "^-?(0|[1-9]\\d{0,77})(\\.\\d{1,36})?$"
                  },
                  "pnlUsdDecimal": {
                    "type": "string",
                    "pattern": "^-?(0|[1-9]\\d{0,77})(\\.\\d{1,36})?$"
                  },
                  "returnPercentDecimal": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^-?(0|[1-9]\\d{0,77})(\\.\\d{1,36})?$"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Net profit divided by starting value plus total contributed value, times 100. Null when no capital was invested; this is not an annualized or time-weighted return."
                  },
                  "maxDrawdownPercentDecimal": {
                    "type": "string",
                    "pattern": "^-?(0|[1-9]\\d{0,77})(\\.\\d{1,36})?$",
                    "description": "Largest sampled peak-to-trough fall. Contribution-funded estimates use a flow-adjusted index rounded down at each mark to 36 decimal places; financial amounts and trade decisions remain exact."
                  },
                  "holdValueUsdDecimal": {
                    "type": "string",
                    "pattern": "^-?(0|[1-9]\\d{0,77})(\\.\\d{1,36})?$"
                  },
                  "totalCostUsdDecimal": {
                    "type": "string",
                    "pattern": "^-?(0|[1-9]\\d{0,77})(\\.\\d{1,36})?$"
                  }
                },
                "required": [
                  "startingValueUsdDecimal",
                  "endingValueUsdDecimal",
                  "pnlUsdDecimal",
                  "returnPercentDecimal",
                  "maxDrawdownPercentDecimal",
                  "holdValueUsdDecimal",
                  "totalCostUsdDecimal"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "counts": {
            "type": "object",
            "properties": {
              "evaluations": {
                "type": "integer",
                "minimum": 0,
                "maximum": 250000
              },
              "firings": {
                "type": "integer",
                "minimum": 0,
                "maximum": 250000
              },
              "filledLegs": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000
              },
              "skipped": {
                "type": "integer",
                "minimum": 0,
                "maximum": 250000
              },
              "unknown": {
                "type": "integer",
                "minimum": 0,
                "maximum": 250000
              }
            },
            "required": [
              "evaluations",
              "firings",
              "filledLegs",
              "skipped",
              "unknown"
            ]
          },
          "throughAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "limitations": {
            "maxItems": 128,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096
            }
          },
          "scenario": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "prompt": {
                "type": "string",
                "minLength": 1,
                "maxLength": 8192,
                "description": "Only the user's instructions for each later run, preserved exactly with their constraints; monitoring conditions belong in rule."
              },
              "rule": {
                "$ref": "#/components/schemas/AutomationRule"
              },
              "contract": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "description": "Which contract template this is.",
                        "enum": [
                          "near_intents_transfer"
                        ]
                      },
                      "actions": {
                        "minItems": 1,
                        "maxItems": 16,
                        "type": "array",
                        "items": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "description": "Exchange one asset for another; custody never leaves the agent wallet.",
                                  "enum": [
                                    "swap"
                                  ]
                                },
                                "input": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "pinned": {
                                          "type": "object",
                                          "properties": {
                                            "tokenId": {
                                              "type": "string",
                                              "maxLength": 256,
                                              "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                              "description": "The exact ledger asset identifier, including its token standard namespace."
                                            },
                                            "decimals": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 38,
                                              "description": "How many decimal places the token's smallest unit represents."
                                            }
                                          },
                                          "required": [
                                            "tokenId",
                                            "decimals"
                                          ],
                                          "description": "The exact token this asset is pinned to."
                                        }
                                      },
                                      "required": [
                                        "pinned"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "any": {
                                          "type": "boolean",
                                          "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                          "enum": [
                                            true
                                          ]
                                        }
                                      },
                                      "required": [
                                        "any"
                                      ]
                                    }
                                  ],
                                  "description": "The asset this action spends: pinned to one token, or any token the agent wallet holds."
                                },
                                "quantity": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Spend an exact amount of the input token.",
                                          "enum": [
                                            "exact_input_tokens"
                                          ]
                                        },
                                        "amountRaw": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9]\\d{0,38})$",
                                          "description": "The exact input amount, in the input token's smallest unit."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "amountRaw"
                                      ],
                                      "description": "An exact quantity of the input token, not its USD value: exactly 5 USDC at decimals 6 is amountRaw \"5000000\". No floating-point arithmetic or bash."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Spend a USD-denominated value of the input token.",
                                          "enum": [
                                            "exact_input_value_usd"
                                          ]
                                        },
                                        "value": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9]\\d{0,38})(?:\\.\\d{1,18})?$",
                                          "description": "The USD value to spend, as a decimal string."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "value"
                                      ],
                                      "description": "A USD value of the input token: \"$5 worth of USDC\" is value \"5\", never exactly 5 USDC. The host converts it at live prices."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Receive an exact amount of the output token.",
                                          "enum": [
                                            "exact_output_tokens"
                                          ]
                                        },
                                        "amountRaw": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9]\\d{0,38})$",
                                          "description": "The exact output amount, in the output token's smallest unit."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "amountRaw"
                                      ],
                                      "description": "An exact quantity of the output token, scaled by its verified decimals; the host calculates the input."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Spend everything the agent wallet holds of the input asset.",
                                          "enum": [
                                            "all_of_input"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Spend a fraction of the input asset.",
                                          "enum": [
                                            "fraction_of_input"
                                          ]
                                        },
                                        "bps": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9]\\d{0,4})$",
                                          "description": "The fraction to spend, in basis points of the input asset."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "bps"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Sell a fraction of this automation's own position in the input asset.",
                                          "enum": [
                                            "fraction_of_position"
                                          ]
                                        },
                                        "bps": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9]\\d{0,4})$",
                                          "description": "The fraction to sell, in basis points of this automation's own position; 10000 is all of it."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "bps"
                                      ],
                                      "description": "A fraction of what THIS automation's own settled fills still hold of the input asset, never of the wallet balance; only on an action with an `exit` guard."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Sell only the gain on this automation's own position in the input asset.",
                                          "enum": [
                                            "gain_of_position"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "description": "Only the gain on THIS automation's own position, priced in the token its buys paid with; only with a take_profit or harvest_every `exit` guard and a pinned output other than that token."
                                    }
                                  ],
                                  "description": "How much moves: an exact token amount, an exact USD value, an exact output amount, all of the input, or a fraction of it."
                                },
                                "output": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "pinned": {
                                          "type": "object",
                                          "properties": {
                                            "tokenId": {
                                              "type": "string",
                                              "maxLength": 256,
                                              "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                              "description": "The exact ledger asset identifier, including its token standard namespace."
                                            },
                                            "decimals": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 38,
                                              "description": "How many decimal places the token's smallest unit represents."
                                            }
                                          },
                                          "required": [
                                            "tokenId",
                                            "decimals"
                                          ],
                                          "description": "The exact token this asset is pinned to."
                                        }
                                      },
                                      "required": [
                                        "pinned"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "any": {
                                          "type": "boolean",
                                          "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                          "enum": [
                                            true
                                          ]
                                        }
                                      },
                                      "required": [
                                        "any"
                                      ]
                                    }
                                  ],
                                  "description": "The asset this action produces: pinned to one token, or left open."
                                },
                                "exit": {
                                  "description": "Optional exit guard: this action sells only when the asset's price in its output token crosses the automation's own average cost by the approved amount.",
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Sell when the asset is this far ABOVE the automation's average cost.",
                                          "enum": [
                                            "take_profit"
                                          ]
                                        },
                                        "gainBps": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9]\\d{0,4})$",
                                          "description": "How far above the average cost the price must be, in basis points."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "gainBps"
                                      ],
                                      "description": "A take-profit exit: sell once the price is up this much on average cost."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Sell when the asset is this far BELOW the automation's average cost.",
                                          "enum": [
                                            "stop_loss"
                                          ]
                                        },
                                        "lossBps": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9]\\d{0,4})$",
                                          "description": "How far below the average cost the price must be, in basis points."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "lossBps"
                                      ],
                                      "description": "A stop-loss exit: sell once the price is down this much on average cost."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Take profits on a schedule: sell only the gain every this many days, counted from the last harvest that settled, or from the first deposit that settled.",
                                          "enum": [
                                            "harvest_every"
                                          ]
                                        },
                                        "days": {
                                          "type": "string",
                                          "pattern": "^[1-9]\\d{0,2}$",
                                          "description": "How many days apart harvests are, 7 to 365, as a decimal string: \"7\" weekly, \"30\" monthly."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "days"
                                      ],
                                      "description": "A scheduled harvest: only on a gain_of_position exit selling a curated yield vault's share token (earn_vaults). Every `days` days it sells only the gain, if there is any, and the automation keeps running."
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "kind",
                                "input",
                                "quantity",
                                "output"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "description": "Return an asset to the account that owns the agent wallet.",
                                  "enum": [
                                    "withdraw_to_owner"
                                  ]
                                },
                                "input": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "pinned": {
                                          "type": "object",
                                          "properties": {
                                            "tokenId": {
                                              "type": "string",
                                              "maxLength": 256,
                                              "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                              "description": "The exact ledger asset identifier, including its token standard namespace."
                                            },
                                            "decimals": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 38,
                                              "description": "How many decimal places the token's smallest unit represents."
                                            }
                                          },
                                          "required": [
                                            "tokenId",
                                            "decimals"
                                          ],
                                          "description": "The exact token this asset is pinned to."
                                        }
                                      },
                                      "required": [
                                        "pinned"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "any": {
                                          "type": "boolean",
                                          "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                          "enum": [
                                            true
                                          ]
                                        }
                                      },
                                      "required": [
                                        "any"
                                      ]
                                    }
                                  ],
                                  "description": "The asset this action spends: pinned to one token, or any token the agent wallet holds."
                                },
                                "quantity": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Spend an exact amount of the input token.",
                                          "enum": [
                                            "exact_input_tokens"
                                          ]
                                        },
                                        "amountRaw": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9]\\d{0,38})$",
                                          "description": "The exact input amount, in the input token's smallest unit."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "amountRaw"
                                      ],
                                      "description": "An exact quantity of the input token, not its USD value: exactly 5 USDC at decimals 6 is amountRaw \"5000000\". No floating-point arithmetic or bash."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Spend a USD-denominated value of the input token.",
                                          "enum": [
                                            "exact_input_value_usd"
                                          ]
                                        },
                                        "value": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9]\\d{0,38})(?:\\.\\d{1,18})?$",
                                          "description": "The USD value to spend, as a decimal string."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "value"
                                      ],
                                      "description": "A USD value of the input token: \"$5 worth of USDC\" is value \"5\", never exactly 5 USDC. The host converts it at live prices."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Receive an exact amount of the output token.",
                                          "enum": [
                                            "exact_output_tokens"
                                          ]
                                        },
                                        "amountRaw": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9]\\d{0,38})$",
                                          "description": "The exact output amount, in the output token's smallest unit."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "amountRaw"
                                      ],
                                      "description": "An exact quantity of the output token, scaled by its verified decimals; the host calculates the input."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Spend everything the agent wallet holds of the input asset.",
                                          "enum": [
                                            "all_of_input"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Spend a fraction of the input asset.",
                                          "enum": [
                                            "fraction_of_input"
                                          ]
                                        },
                                        "bps": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9]\\d{0,4})$",
                                          "description": "The fraction to spend, in basis points of the input asset."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "bps"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Sell a fraction of this automation's own position in the input asset.",
                                          "enum": [
                                            "fraction_of_position"
                                          ]
                                        },
                                        "bps": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9]\\d{0,4})$",
                                          "description": "The fraction to sell, in basis points of this automation's own position; 10000 is all of it."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "bps"
                                      ],
                                      "description": "A fraction of what THIS automation's own settled fills still hold of the input asset, never of the wallet balance; only on an action with an `exit` guard."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Sell only the gain on this automation's own position in the input asset.",
                                          "enum": [
                                            "gain_of_position"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "description": "Only the gain on THIS automation's own position, priced in the token its buys paid with; only with a take_profit or harvest_every `exit` guard and a pinned output other than that token."
                                    }
                                  ],
                                  "description": "How much moves: an exact token amount, an exact USD value, an exact output amount, all of the input, or a fraction of it."
                                },
                                "output": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "pinned": {
                                          "type": "object",
                                          "properties": {
                                            "tokenId": {
                                              "type": "string",
                                              "maxLength": 256,
                                              "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                              "description": "The exact ledger asset identifier, including its token standard namespace."
                                            },
                                            "decimals": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 38,
                                              "description": "How many decimal places the token's smallest unit represents."
                                            }
                                          },
                                          "required": [
                                            "tokenId",
                                            "decimals"
                                          ],
                                          "description": "The exact token this asset is pinned to."
                                        }
                                      },
                                      "required": [
                                        "pinned"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "any": {
                                          "type": "boolean",
                                          "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                          "enum": [
                                            true
                                          ]
                                        }
                                      },
                                      "required": [
                                        "any"
                                      ]
                                    }
                                  ],
                                  "description": "The asset this action produces: pinned to one token, or left open."
                                }
                              },
                              "required": [
                                "kind",
                                "input",
                                "quantity",
                                "output"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "description": "Pay the exact approved destination through the provider’s chain or Intents transfer route.",
                                  "enum": [
                                    "withdraw_transfer"
                                  ]
                                },
                                "input": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "pinned": {
                                          "type": "object",
                                          "properties": {
                                            "tokenId": {
                                              "type": "string",
                                              "maxLength": 256,
                                              "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                              "description": "The exact ledger asset identifier, including its token standard namespace."
                                            },
                                            "decimals": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 38,
                                              "description": "How many decimal places the token's smallest unit represents."
                                            }
                                          },
                                          "required": [
                                            "tokenId",
                                            "decimals"
                                          ],
                                          "description": "The exact token this asset is pinned to."
                                        }
                                      },
                                      "required": [
                                        "pinned"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "any": {
                                          "type": "boolean",
                                          "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                          "enum": [
                                            true
                                          ]
                                        }
                                      },
                                      "required": [
                                        "any"
                                      ]
                                    }
                                  ],
                                  "description": "The asset this action spends: pinned to one token, or any token the agent wallet holds."
                                },
                                "quantity": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Spend an exact amount of the input token.",
                                          "enum": [
                                            "exact_input_tokens"
                                          ]
                                        },
                                        "amountRaw": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9]\\d{0,38})$",
                                          "description": "The exact input amount, in the input token's smallest unit."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "amountRaw"
                                      ],
                                      "description": "An exact quantity of the input token, not its USD value: exactly 5 USDC at decimals 6 is amountRaw \"5000000\". No floating-point arithmetic or bash."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Spend a USD-denominated value of the input token.",
                                          "enum": [
                                            "exact_input_value_usd"
                                          ]
                                        },
                                        "value": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9]\\d{0,38})(?:\\.\\d{1,18})?$",
                                          "description": "The USD value to spend, as a decimal string."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "value"
                                      ],
                                      "description": "A USD value of the input token: \"$5 worth of USDC\" is value \"5\", never exactly 5 USDC. The host converts it at live prices."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Receive an exact amount of the output token.",
                                          "enum": [
                                            "exact_output_tokens"
                                          ]
                                        },
                                        "amountRaw": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9]\\d{0,38})$",
                                          "description": "The exact output amount, in the output token's smallest unit."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "amountRaw"
                                      ],
                                      "description": "An exact quantity of the output token, scaled by its verified decimals; the host calculates the input."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Spend everything the agent wallet holds of the input asset.",
                                          "enum": [
                                            "all_of_input"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Spend a fraction of the input asset.",
                                          "enum": [
                                            "fraction_of_input"
                                          ]
                                        },
                                        "bps": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9]\\d{0,4})$",
                                          "description": "The fraction to spend, in basis points of the input asset."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "bps"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Sell a fraction of this automation's own position in the input asset.",
                                          "enum": [
                                            "fraction_of_position"
                                          ]
                                        },
                                        "bps": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9]\\d{0,4})$",
                                          "description": "The fraction to sell, in basis points of this automation's own position; 10000 is all of it."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "bps"
                                      ],
                                      "description": "A fraction of what THIS automation's own settled fills still hold of the input asset, never of the wallet balance; only on an action with an `exit` guard."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Sell only the gain on this automation's own position in the input asset.",
                                          "enum": [
                                            "gain_of_position"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "description": "Only the gain on THIS automation's own position, priced in the token its buys paid with; only with a take_profit or harvest_every `exit` guard and a pinned output other than that token."
                                    }
                                  ],
                                  "description": "How much moves: an exact token amount, an exact USD value, an exact output amount, all of the input, or a fraction of it."
                                },
                                "output": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "pinned": {
                                          "type": "object",
                                          "properties": {
                                            "tokenId": {
                                              "type": "string",
                                              "maxLength": 256,
                                              "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                              "description": "The exact ledger asset identifier, including its token standard namespace."
                                            },
                                            "decimals": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 38,
                                              "description": "How many decimal places the token's smallest unit represents."
                                            }
                                          },
                                          "required": [
                                            "tokenId",
                                            "decimals"
                                          ],
                                          "description": "The exact token this asset is pinned to."
                                        }
                                      },
                                      "required": [
                                        "pinned"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "any": {
                                          "type": "boolean",
                                          "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                          "enum": [
                                            true
                                          ]
                                        }
                                      },
                                      "required": [
                                        "any"
                                      ]
                                    }
                                  ],
                                  "description": "The asset this action produces: pinned to one token, or left open."
                                },
                                "recipient": {
                                  "type": "object",
                                  "properties": {
                                    "rail": {
                                      "type": "string",
                                      "enum": [
                                        "chain",
                                        "intents"
                                      ],
                                      "description": "A native blockchain transfer or a signed transfer within an Intents ledger."
                                    },
                                    "network": {
                                      "type": "string",
                                      "pattern": "^[a-z][a-z0-9-]{0,63}$",
                                      "description": "Exact network identifier from wallet capabilities; near-intents and near-intents-confidential are ledgers, not the NEAR blockchain."
                                    },
                                    "address": {
                                      "type": "string",
                                      "pattern": "^[\\x21-\\x7e]{1,256}$",
                                      "description": "Exact network address, preserving case and any routing metadata encoded in its native address format. Names must be resolved before approval."
                                    },
                                    "memo": {
                                      "type": "null",
                                      "description": "Standalone routing memos are unsupported; routing must be encoded in the approved address."
                                    }
                                  },
                                  "required": [
                                    "rail",
                                    "network",
                                    "address",
                                    "memo"
                                  ],
                                  "description": "The exact approved payout rail, network and address."
                                },
                                "minimumReceivedRaw": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "pattern": "^(0|[1-9]\\d{0,38})$"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ],
                                  "description": "Minimum acceptable payout in output-asset atomic units, or null when the approved all-in loss bound alone sets the floor."
                                },
                                "maxFeeRaw": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "pattern": "^(0|[1-9]\\d{0,38})$"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ],
                                  "description": "Optional separate withdrawal fee cap in output-asset atomic units; null means undisclosed, while all-in loss and minimum receive remain enforced."
                                }
                              },
                              "required": [
                                "kind",
                                "input",
                                "quantity",
                                "output",
                                "recipient",
                                "minimumReceivedRaw",
                                "maxFeeRaw"
                              ]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "description": "Not executable, and refused in new contracts: pay an address with withdraw_transfer.",
                                  "enum": [
                                    "send"
                                  ]
                                },
                                "input": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "pinned": {
                                          "type": "object",
                                          "properties": {
                                            "tokenId": {
                                              "type": "string",
                                              "maxLength": 256,
                                              "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                              "description": "The exact ledger asset identifier, including its token standard namespace."
                                            },
                                            "decimals": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 38,
                                              "description": "How many decimal places the token's smallest unit represents."
                                            }
                                          },
                                          "required": [
                                            "tokenId",
                                            "decimals"
                                          ],
                                          "description": "The exact token this asset is pinned to."
                                        }
                                      },
                                      "required": [
                                        "pinned"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "any": {
                                          "type": "boolean",
                                          "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                          "enum": [
                                            true
                                          ]
                                        }
                                      },
                                      "required": [
                                        "any"
                                      ]
                                    }
                                  ],
                                  "description": "The asset this action spends: pinned to one token, or any token the agent wallet holds."
                                },
                                "quantity": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Spend an exact amount of the input token.",
                                          "enum": [
                                            "exact_input_tokens"
                                          ]
                                        },
                                        "amountRaw": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9]\\d{0,38})$",
                                          "description": "The exact input amount, in the input token's smallest unit."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "amountRaw"
                                      ],
                                      "description": "An exact quantity of the input token, not its USD value: exactly 5 USDC at decimals 6 is amountRaw \"5000000\". No floating-point arithmetic or bash."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Spend a USD-denominated value of the input token.",
                                          "enum": [
                                            "exact_input_value_usd"
                                          ]
                                        },
                                        "value": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9]\\d{0,38})(?:\\.\\d{1,18})?$",
                                          "description": "The USD value to spend, as a decimal string."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "value"
                                      ],
                                      "description": "A USD value of the input token: \"$5 worth of USDC\" is value \"5\", never exactly 5 USDC. The host converts it at live prices."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Receive an exact amount of the output token.",
                                          "enum": [
                                            "exact_output_tokens"
                                          ]
                                        },
                                        "amountRaw": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9]\\d{0,38})$",
                                          "description": "The exact output amount, in the output token's smallest unit."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "amountRaw"
                                      ],
                                      "description": "An exact quantity of the output token, scaled by its verified decimals; the host calculates the input."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Spend everything the agent wallet holds of the input asset.",
                                          "enum": [
                                            "all_of_input"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Spend a fraction of the input asset.",
                                          "enum": [
                                            "fraction_of_input"
                                          ]
                                        },
                                        "bps": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9]\\d{0,4})$",
                                          "description": "The fraction to spend, in basis points of the input asset."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "bps"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Sell a fraction of this automation's own position in the input asset.",
                                          "enum": [
                                            "fraction_of_position"
                                          ]
                                        },
                                        "bps": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9]\\d{0,4})$",
                                          "description": "The fraction to sell, in basis points of this automation's own position; 10000 is all of it."
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "bps"
                                      ],
                                      "description": "A fraction of what THIS automation's own settled fills still hold of the input asset, never of the wallet balance; only on an action with an `exit` guard."
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "description": "Sell only the gain on this automation's own position in the input asset.",
                                          "enum": [
                                            "gain_of_position"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "kind"
                                      ],
                                      "description": "Only the gain on THIS automation's own position, priced in the token its buys paid with; only with a take_profit or harvest_every `exit` guard and a pinned output other than that token."
                                    }
                                  ],
                                  "description": "How much moves: an exact token amount, an exact USD value, an exact output amount, all of the input, or a fraction of it."
                                },
                                "output": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "pinned": {
                                          "type": "object",
                                          "properties": {
                                            "tokenId": {
                                              "type": "string",
                                              "maxLength": 256,
                                              "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                              "description": "The exact ledger asset identifier, including its token standard namespace."
                                            },
                                            "decimals": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 38,
                                              "description": "How many decimal places the token's smallest unit represents."
                                            }
                                          },
                                          "required": [
                                            "tokenId",
                                            "decimals"
                                          ],
                                          "description": "The exact token this asset is pinned to."
                                        }
                                      },
                                      "required": [
                                        "pinned"
                                      ]
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "any": {
                                          "type": "boolean",
                                          "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                          "enum": [
                                            true
                                          ]
                                        }
                                      },
                                      "required": [
                                        "any"
                                      ]
                                    }
                                  ],
                                  "description": "The asset this action produces: pinned to one token, or left open."
                                },
                                "recipient": {
                                  "type": "object",
                                  "properties": {
                                    "chain": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 32,
                                      "description": "Which chain the destination address is on."
                                    },
                                    "address": {
                                      "type": "string",
                                      "pattern": "^[\\x21-\\x7e]{1,128}$",
                                      "description": "The destination address on that chain."
                                    }
                                  },
                                  "required": [
                                    "chain",
                                    "address"
                                  ],
                                  "description": "The pinned destination this action pays."
                                }
                              },
                              "required": [
                                "kind",
                                "input",
                                "quantity",
                                "output",
                                "recipient"
                              ]
                            }
                          ]
                        },
                        "description": "The actions this contract authorizes, executed in order."
                      },
                      "validUntil": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                        "description": "When this contract's authority expires."
                      },
                      "maxExecutions": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 10000,
                        "description": "How many times this contract may be executed before it is exhausted."
                      },
                      "maxTotalInput": {
                        "description": "Optional total cap on what all executions together may spend, per input token, in raw units. A $500 budget paid in USDC is 500 USDC. Every action input must be pinned and capped.",
                        "minItems": 1,
                        "maxItems": 16,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "tokenId": {
                              "type": "string",
                              "maxLength": 256,
                              "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                              "description": "The exact ledger asset identifier, including its token standard namespace."
                            },
                            "decimals": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 38,
                              "description": "How many decimal places the token's smallest unit represents."
                            },
                            "amountRaw": {
                              "type": "string",
                              "pattern": "^(0|[1-9]\\d{0,38})$",
                              "description": "The most this contract may spend of this token in total, across every execution, in the token's smallest unit."
                            }
                          },
                          "required": [
                            "tokenId",
                            "decimals",
                            "amountRaw"
                          ],
                          "description": "One capped input token and its total spend ceiling."
                        }
                      },
                      "bounds": {
                        "type": "object",
                        "properties": {
                          "maxValueLossBps": {
                            "type": "string",
                            "pattern": "^(0|[1-9]\\d{0,4})$",
                            "description": "The most value an execution may give up to price movement and fees together, in basis points; 0 allows no loss."
                          },
                          "maxSignatureLifetimeSeconds": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 259500,
                            "description": "Explicit maximum lifetime of each released transfer signature, in seconds. 1Click confidential swaps require up to 259500 seconds (72 hours 5 minutes). This does not extend the execution window or approval validity."
                          }
                        },
                        "required": [
                          "maxValueLossBps",
                          "maxSignatureLifetimeSeconds"
                        ],
                        "description": "The value-loss and signature-lifetime limits every execution must respect."
                      },
                      "execution": {
                        "description": "Optional explicit recovery authority, signed with these exact actions and bounds; omitted on historical approvals.",
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "mode": {
                                "type": "string",
                                "enum": [
                                  "ordered",
                                  "parallel_independent"
                                ],
                                "description": "Ordered actions run in approved order. Parallel-independent actions run up to four concurrently after the complete initially funded request is reserved."
                              },
                              "maxPreparationAttempts": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 3,
                                "description": "The maximum unsigned preparation attempts for each approved action, including its first attempt."
                              },
                              "dispatchWindowSeconds": {
                                "type": "integer",
                                "minimum": 60,
                                "maximum": 86400,
                                "description": "The maximum dispatch window in seconds for this operation, from when its approval opened: exactly 1200 for a new chat request, and up to its signed deadline for an automation's grant. Closing dispatch never proves a submitted transfer did not move; observation continues."
                              }
                            },
                            "required": [
                              "mode",
                              "maxPreparationAttempts",
                              "dispatchWindowSeconds"
                            ]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "mode": {
                                "type": "string",
                                "enum": [
                                  "dependency_graph"
                                ]
                              },
                              "dependencies": {
                                "minItems": 1,
                                "maxItems": 16,
                                "type": "array",
                                "items": {
                                  "maxItems": 16,
                                  "type": "array",
                                  "items": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 15
                                  }
                                },
                                "description": "One row per requested action, listing its sorted unique predecessor action indices. A successor requires confirmed predecessor settlement. Every action must be funded from initial holdings."
                              },
                              "maxPreparationAttempts": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 3,
                                "description": "The maximum unsigned preparation attempts for each approved action, including its first attempt."
                              },
                              "dispatchWindowSeconds": {
                                "type": "integer",
                                "minimum": 60,
                                "maximum": 86400,
                                "description": "The maximum dispatch window in seconds for this operation, from when its approval opened: exactly 1200 for a new chat request, and up to its signed deadline for an automation's grant. Closing dispatch never proves a submitted transfer did not move; observation continues."
                              }
                            },
                            "required": [
                              "mode",
                              "dependencies",
                              "maxPreparationAttempts",
                              "dispatchWindowSeconds"
                            ]
                          }
                        ]
                      }
                    },
                    "required": [
                      "type",
                      "actions",
                      "validUntil",
                      "maxExecutions",
                      "bounds"
                    ]
                  },
                  {
                    "$ref": "#/components/schemas/PerpsAutomationContract"
                  },
                  {
                    "$ref": "#/components/schemas/PredictionAutomationContract"
                  },
                  {
                    "oneOf": [
                      {
                        "$ref": "#/components/schemas/SolanaBuyContract"
                      },
                      {
                        "$ref": "#/components/schemas/SolanaSellContract"
                      }
                    ],
                    "description": "A standing Solana grant: an exact buy, or a sale of a fraction of the holding for USDC, made exactly as approved each time the automation fires."
                  }
                ],
                "description": "Standing authority for the runs this automation fires: a NEAR Intents transfer contract, a perps automation that opens, reduces or adds margin to the agent's own Hyperliquid position, a Polymarket buy or sale of one outcome, or a Solana buy or sell made exactly as approved."
              },
              "maxSigningDelaySeconds": {
                "description": "Required with a contract and omitted without one: the owner's approved maximum delay after a firing during which its run may obtain signatures, in seconds; separate from delivery lateness and signature lifetime.",
                "type": "integer",
                "minimum": 1,
                "maximum": 86400
              },
              "missedRun": {
                "type": "string",
                "enum": [
                  "skip",
                  "ask"
                ],
                "description": "What happens to a run that can't go through before its deadline: `skip` counts it and keeps the schedule, `ask` pauses the automation until its owner decides. A failure only the owner can fix pauses either way."
              },
              "startAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "endAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "resolution": {
                "type": "string",
                "enum": [
                  "hourly",
                  "daily"
                ]
              },
              "timing": {
                "type": "string",
                "enum": [
                  "preserved",
                  "sampled"
                ]
              },
              "execution": {
                "type": "string",
                "enum": [
                  "contract_terms",
                  "triggers_only"
                ],
                "description": "Select triggers_only for a discretionary prompt whose concrete trades are unresolved. contract_terms hypothetically executes the fixed proposed trade terms; it does not simulate model decisions or discretionary instructions."
              },
              "initialHoldings": {
                "maxItems": 16,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "tokenId": {
                      "type": "string",
                      "maxLength": 256,
                      "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                      "description": "The exact ledger asset identifier, including its token standard namespace."
                    },
                    "decimals": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 38,
                      "description": "How many decimal places the token's smallest unit represents."
                    },
                    "amountRaw": {
                      "type": "string",
                      "pattern": "^(0|[1-9]\\d{0,38})$"
                    }
                  },
                  "required": [
                    "tokenId",
                    "decimals",
                    "amountRaw"
                  ]
                }
              },
              "funding": {
                "description": "Select strategy_budget to set aside a finite starting budget from entry sizes and run limits at opening historical prices. Requires empty initialHoldings and cannot be combined with contributeInputs: true. Omit both automatic options to use an explicitly supplied starting portfolio. No live wallet balance is read.",
                "type": "string",
                "enum": [
                  "strategy_budget"
                ]
              },
              "contributeInputs": {
                "description": "When true, start empty and hypothetically supply the input assets for each successfully modeled fixed purchase, valued at its fill time. Requires empty initialHoldings and omitted funding. Contributions are capital, not profit; exits receive no new capital. False or omission leaves the existing funding or explicit portfolio behavior unchanged.",
                "type": "boolean"
              },
              "costBps": {
                "type": "integer",
                "minimum": 0,
                "maximum": 300
              },
              "automationId": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                "description": "The automation's id."
              },
              "definitionVersion": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "name",
              "prompt",
              "rule",
              "startAt",
              "endAt",
              "resolution",
              "timing",
              "execution",
              "initialHoldings",
              "costBps"
            ]
          },
          "scenarioHash": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "dataHash": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "engineVersion": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "timingChanges": {
            "maxItems": 128,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 512
                },
                "before": {
                  "type": "string",
                  "maxLength": 4096
                },
                "after": {
                  "type": "string",
                  "maxLength": 4096
                }
              },
              "required": [
                "path",
                "before",
                "after"
              ]
            }
          },
          "manifest": {
            "type": "object",
            "properties": {
              "source": {
                "type": "string",
                "enum": [
                  "coingecko"
                ]
              },
              "resolution": {
                "type": "string",
                "enum": [
                  "hourly",
                  "daily"
                ]
              },
              "availabilityAssumption": {
                "type": "string",
                "minLength": 1,
                "maxLength": 4096
              },
              "assetIds": {
                "maxItems": 16,
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128,
                  "pattern": "^(?!(?:constructor|prototype|__proto__)$)[a-z0-9][a-z0-9._-]*$"
                }
              },
              "tokenMappings": {
                "maxItems": 16,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "tokenId": {
                      "type": "string",
                      "maxLength": 256,
                      "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                      "description": "The exact ledger asset identifier, including its token standard namespace."
                    },
                    "decimals": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 38,
                      "description": "How many decimal places the token's smallest unit represents."
                    },
                    "assetId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128,
                      "pattern": "^(?!(?:constructor|prototype|__proto__)$)[a-z0-9][a-z0-9._-]*$"
                    }
                  },
                  "required": [
                    "tokenId",
                    "decimals",
                    "assetId"
                  ]
                }
              },
              "firstAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "lastAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "source",
              "resolution",
              "availabilityAssumption",
              "assetIds",
              "tokenMappings",
              "firstAt",
              "lastAt"
            ]
          },
          "skippedByReason": {
            "type": "object",
            "propertyNames": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "additionalProperties": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          "holdings": {
            "maxItems": 16,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "tokenId": {
                  "type": "string",
                  "maxLength": 256,
                  "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                  "description": "The exact ledger asset identifier, including its token standard namespace."
                },
                "decimals": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 38,
                  "description": "How many decimal places the token's smallest unit represents."
                },
                "amountRaw": {
                  "type": "string",
                  "pattern": "^(0|[1-9]\\d{0,38})$"
                }
              },
              "required": [
                "tokenId",
                "decimals",
                "amountRaw"
              ]
            }
          },
          "trades": {
            "maxItems": 1000,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "plannedAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                },
                "filledAt": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                },
                "actionIndex": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 15
                },
                "input": {
                  "type": "object",
                  "properties": {
                    "tokenId": {
                      "type": "string",
                      "maxLength": 256,
                      "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                      "description": "The exact ledger asset identifier, including its token standard namespace."
                    },
                    "decimals": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 38,
                      "description": "How many decimal places the token's smallest unit represents."
                    },
                    "amountRaw": {
                      "type": "string",
                      "pattern": "^(0|[1-9]\\d{0,38})$"
                    }
                  },
                  "required": [
                    "tokenId",
                    "decimals",
                    "amountRaw"
                  ]
                },
                "output": {
                  "type": "object",
                  "properties": {
                    "tokenId": {
                      "type": "string",
                      "maxLength": 256,
                      "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                      "description": "The exact ledger asset identifier, including its token standard namespace."
                    },
                    "decimals": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 38,
                      "description": "How many decimal places the token's smallest unit represents."
                    },
                    "amountRaw": {
                      "type": "string",
                      "pattern": "^(0|[1-9]\\d{0,38})$"
                    }
                  },
                  "required": [
                    "tokenId",
                    "decimals",
                    "amountRaw"
                  ]
                },
                "costUsdDecimal": {
                  "type": "string",
                  "pattern": "^-?(0|[1-9]\\d{0,77})(\\.\\d{1,36})?$"
                }
              },
              "required": [
                "plannedAt",
                "filledAt",
                "actionIndex",
                "input",
                "output",
                "costUsdDecimal"
              ]
            }
          },
          "contributions": {
            "maxItems": 1000,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "tokenId": {
                  "type": "string",
                  "maxLength": 256,
                  "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                  "description": "The exact ledger asset identifier, including its token standard namespace."
                },
                "decimals": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 38,
                  "description": "How many decimal places the token's smallest unit represents."
                },
                "amountRaw": {
                  "type": "string",
                  "pattern": "^(0|[1-9]\\d{0,38})$"
                },
                "at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                  "description": "When the modeled input contribution and purchase settle together."
                },
                "actionIndex": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 15
                },
                "valueUsdDecimal": {
                  "type": "string",
                  "pattern": "^-?(0|[1-9]\\d{0,77})(\\.\\d{1,36})?$",
                  "description": "Historical USD value of the contributed input tokens at the modeled fill, before trading costs."
                }
              },
              "required": [
                "tokenId",
                "decimals",
                "amountRaw",
                "at",
                "actionIndex",
                "valueUsdDecimal"
              ]
            }
          },
          "equity": {
            "maxItems": 1000,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                },
                "valueUsdDecimal": {
                  "type": "string",
                  "pattern": "^-?(0|[1-9]\\d{0,77})(\\.\\d{1,36})?$"
                },
                "contributedValueUsdDecimal": {
                  "description": "Cumulative external contributions through this point, present for contribution-funded estimates. Subtract it and the starting value from portfolio value to chart profit.",
                  "type": "string",
                  "pattern": "^-?(0|[1-9]\\d{0,77})(\\.\\d{1,36})?$"
                }
              },
              "required": [
                "at",
                "valueUsdDecimal"
              ]
            }
          }
        },
        "required": [
          "status",
          "reason",
          "metrics",
          "counts",
          "throughAt",
          "limitations",
          "scenario",
          "scenarioHash",
          "dataHash",
          "engineVersion",
          "timingChanges",
          "manifest",
          "skippedByReason",
          "holdings",
          "trades",
          "equity"
        ]
      }
    }
  }
}
```


### 400

The request could not be read as this operation expects.

- `invalid_input` — the body or query failed validation; `issues` names each field
- `invalid_cursor` — the `cursor` is not one this list minted



```json
{
  "description": "The request could not be read as this operation expects.\n\n- `invalid_input` — the body or query failed validation; `issues` names each field\n- `invalid_cursor` — the `cursor` is not one this list minted",
  "content": {
    "application/problem+json": {
      "schema": {
        "$ref": "#/components/schemas/ProblemDetails"
      }
    }
  }
}
```


### 401

A credential is missing, invalid or expired.

- `partner_key_required` — no `X-Api-Key` header was sent
- `partner_key_invalid` — the `X-Api-Key` is unknown or revoked
- `credential_expired` — the user token has expired; obtain a fresh one



```json
{
  "description": "A credential is missing, invalid or expired.\n\n- `partner_key_required` — no `X-Api-Key` header was sent\n- `partner_key_invalid` — the `X-Api-Key` is unknown or revoked\n- `credential_expired` — the user token has expired; obtain a fresh one",
  "content": {
    "application/problem+json": {
      "schema": {
        "$ref": "#/components/schemas/ProblemDetails"
      }
    }
  }
}
```


### 403

The credentials are valid but may not do this.

- `subject_mismatch` — the `{userId}` in the path is not the token's user
- `account_disabled` — an operator disabled the account
- `origin_rejected` — a browser `Origin` other than the configured web origin
- `permission_required` — the verified credential is not permitted to make this call



```json
{
  "description": "The credentials are valid but may not do this.\n\n- `subject_mismatch` — the `{userId}` in the path is not the token's user\n- `account_disabled` — an operator disabled the account\n- `origin_rejected` — a browser `Origin` other than the configured web origin\n- `permission_required` — the verified credential is not permitted to make this call",
  "content": {
    "application/problem+json": {
      "schema": {
        "$ref": "#/components/schemas/ProblemDetails"
      }
    }
  }
}
```


### 404

The resource is missing, belongs to someone else, or its id is malformed: all three answer alike.



```json
{
  "description": "The resource is missing, belongs to someone else, or its id is malformed: all three answer alike.",
  "content": {
    "application/problem+json": {
      "schema": {
        "$ref": "#/components/schemas/ProblemDetails"
      }
    }
  }
}
```


### 409

The operation lost to the current state.

- `automation_changed` — the automation changed while this request was handled; read it again and retry



```json
{
  "description": "The operation lost to the current state.\n\n- `automation_changed` — the automation changed while this request was handled; read it again and retry",
  "content": {
    "application/problem+json": {
      "schema": {
        "$ref": "#/components/schemas/ProblemDetails"
      }
    }
  }
}
```


### 413

The body exceeds the size this deployment accepts.



```json
{
  "description": "The body exceeds the size this deployment accepts.",
  "content": {
    "application/problem+json": {
      "schema": {
        "$ref": "#/components/schemas/ProblemDetails"
      }
    }
  }
}
```


### 429

A limit refused the request; wait for `Retry-After` when it is sent.

- `rate_limited` — the per-key or per-user limit is spent; honour `Retry-After`
- `partner_request_capacity` — this partner's request quota across all keys and replicas is spent; honour Retry-After



```json
{
  "description": "A limit refused the request; wait for `Retry-After` when it is sent.\n\n- `rate_limited` — the per-key or per-user limit is spent; honour `Retry-After`\n- `partner_request_capacity` — this partner's request quota across all keys and replicas is spent; honour Retry-After",
  "content": {
    "application/problem+json": {
      "schema": {
        "$ref": "#/components/schemas/ProblemDetails"
      }
    }
  }
}
```


### 500

A fault on our side; quote `requestId` when reporting it.

- `internal` — a fault on our side; quote `requestId` when reporting it



```json
{
  "description": "A fault on our side; quote `requestId` when reporting it.\n\n- `internal` — a fault on our side; quote `requestId` when reporting it",
  "content": {
    "application/problem+json": {
      "schema": {
        "$ref": "#/components/schemas/ProblemDetails"
      }
    }
  }
}
```


### 503

The service cannot take this right now (draining, a dependency did not answer, or an operator paused the work); `retryable` says whether to try again.

- `internal` — a fault on our side; quote `requestId` when reporting it



```json
{
  "description": "The service cannot take this right now (draining, a dependency did not answer, or an operator paused the work); `retryable` says whether to try again.\n\n- `internal` — a fault on our side; quote `requestId` when reporting it",
  "content": {
    "application/problem+json": {
      "schema": {
        "$ref": "#/components/schemas/ProblemDetails"
      }
    }
  }
}
```


## Complete OpenAPI definition

The exact operation and all referenced components, including recursive schemas.



```json
{
  "operation": {
    "operationId": "automations.backtest",
    "summary": "Backtest an automation",
    "tags": [
      "automations"
    ],
    "description": "Estimates how a draft or saved automation would have behaved over a historical range. Use it before creating or changing an automation; inspect the returned status, limitations and timing changes before using the estimate. Historical prices do not establish executable fills.",
    "requestBody": {
      "required": true,
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "target": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "draft"
                        ]
                      },
                      "definition": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "prompt": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 8192,
                            "description": "Only the user's instructions for each later run, preserved exactly with their constraints; monitoring conditions belong in rule."
                          },
                          "rule": {
                            "$ref": "#/components/schemas/AutomationRuleInput"
                          },
                          "contract": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "description": "Which contract template this is.",
                                    "enum": [
                                      "near_intents_transfer"
                                    ]
                                  },
                                  "actions": {
                                    "minItems": 1,
                                    "maxItems": 16,
                                    "type": "array",
                                    "items": {
                                      "oneOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "description": "Exchange one asset for another; custody never leaves the agent wallet.",
                                              "enum": [
                                                "swap"
                                              ]
                                            },
                                            "input": {
                                              "anyOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "pinned": {
                                                      "type": "object",
                                                      "properties": {
                                                        "tokenId": {
                                                          "type": "string",
                                                          "maxLength": 256,
                                                          "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                                          "description": "The exact ledger asset identifier, including its token standard namespace."
                                                        },
                                                        "decimals": {
                                                          "type": "integer",
                                                          "minimum": 0,
                                                          "maximum": 38,
                                                          "description": "How many decimal places the token's smallest unit represents."
                                                        }
                                                      },
                                                      "required": [
                                                        "tokenId",
                                                        "decimals"
                                                      ],
                                                      "additionalProperties": false,
                                                      "description": "The exact token this asset is pinned to."
                                                    }
                                                  },
                                                  "required": [
                                                    "pinned"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "any": {
                                                      "type": "boolean",
                                                      "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                                      "enum": [
                                                        true
                                                      ]
                                                    }
                                                  },
                                                  "required": [
                                                    "any"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              ],
                                              "description": "The asset this action spends: pinned to one token, or any token the agent wallet holds."
                                            },
                                            "quantity": {
                                              "oneOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Spend an exact amount of the input token.",
                                                      "enum": [
                                                        "exact_input_tokens"
                                                      ]
                                                    },
                                                    "amountRaw": {
                                                      "type": "string",
                                                      "pattern": "^(0|[1-9]\\d{0,38})$",
                                                      "description": "The exact input amount, in the input token's smallest unit."
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "amountRaw"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "An exact quantity of the input token, not its USD value: exactly 5 USDC at decimals 6 is amountRaw \"5000000\". No floating-point arithmetic or bash."
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Spend a USD-denominated value of the input token.",
                                                      "enum": [
                                                        "exact_input_value_usd"
                                                      ]
                                                    },
                                                    "value": {
                                                      "type": "string",
                                                      "pattern": "^(0|[1-9]\\d{0,38})(?:\\.\\d{1,18})?$",
                                                      "description": "The USD value to spend, as a decimal string."
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "value"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "A USD value of the input token: \"$5 worth of USDC\" is value \"5\", never exactly 5 USDC. The host converts it at live prices."
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Receive an exact amount of the output token.",
                                                      "enum": [
                                                        "exact_output_tokens"
                                                      ]
                                                    },
                                                    "amountRaw": {
                                                      "type": "string",
                                                      "pattern": "^(0|[1-9]\\d{0,38})$",
                                                      "description": "The exact output amount, in the output token's smallest unit."
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "amountRaw"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "An exact quantity of the output token, scaled by its verified decimals; the host calculates the input."
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Spend everything the agent wallet holds of the input asset.",
                                                      "enum": [
                                                        "all_of_input"
                                                      ]
                                                    }
                                                  },
                                                  "required": [
                                                    "kind"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Spend a fraction of the input asset.",
                                                      "enum": [
                                                        "fraction_of_input"
                                                      ]
                                                    },
                                                    "bps": {
                                                      "type": "string",
                                                      "pattern": "^(0|[1-9]\\d{0,4})$",
                                                      "description": "The fraction to spend, in basis points of the input asset."
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "bps"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Sell a fraction of this automation's own position in the input asset.",
                                                      "enum": [
                                                        "fraction_of_position"
                                                      ]
                                                    },
                                                    "bps": {
                                                      "type": "string",
                                                      "pattern": "^(0|[1-9]\\d{0,4})$",
                                                      "description": "The fraction to sell, in basis points of this automation's own position; 10000 is all of it."
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "bps"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "A fraction of what THIS automation's own settled fills still hold of the input asset, never of the wallet balance; only on an action with an `exit` guard."
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Sell only the gain on this automation's own position in the input asset.",
                                                      "enum": [
                                                        "gain_of_position"
                                                      ]
                                                    }
                                                  },
                                                  "required": [
                                                    "kind"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "Only the gain on THIS automation's own position, priced in the token its buys paid with; only with a take_profit or harvest_every `exit` guard and a pinned output other than that token."
                                                }
                                              ],
                                              "description": "How much moves: an exact token amount, an exact USD value, an exact output amount, all of the input, or a fraction of it."
                                            },
                                            "output": {
                                              "anyOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "pinned": {
                                                      "type": "object",
                                                      "properties": {
                                                        "tokenId": {
                                                          "type": "string",
                                                          "maxLength": 256,
                                                          "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                                          "description": "The exact ledger asset identifier, including its token standard namespace."
                                                        },
                                                        "decimals": {
                                                          "type": "integer",
                                                          "minimum": 0,
                                                          "maximum": 38,
                                                          "description": "How many decimal places the token's smallest unit represents."
                                                        }
                                                      },
                                                      "required": [
                                                        "tokenId",
                                                        "decimals"
                                                      ],
                                                      "additionalProperties": false,
                                                      "description": "The exact token this asset is pinned to."
                                                    }
                                                  },
                                                  "required": [
                                                    "pinned"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "any": {
                                                      "type": "boolean",
                                                      "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                                      "enum": [
                                                        true
                                                      ]
                                                    }
                                                  },
                                                  "required": [
                                                    "any"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              ],
                                              "description": "The asset this action produces: pinned to one token, or left open."
                                            },
                                            "exit": {
                                              "description": "Optional exit guard: this action sells only when the asset's price in its output token crosses the automation's own average cost by the approved amount.",
                                              "oneOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Sell when the asset is this far ABOVE the automation's average cost.",
                                                      "enum": [
                                                        "take_profit"
                                                      ]
                                                    },
                                                    "gainBps": {
                                                      "type": "string",
                                                      "pattern": "^(0|[1-9]\\d{0,4})$",
                                                      "description": "How far above the average cost the price must be, in basis points."
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "gainBps"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "A take-profit exit: sell once the price is up this much on average cost."
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Sell when the asset is this far BELOW the automation's average cost.",
                                                      "enum": [
                                                        "stop_loss"
                                                      ]
                                                    },
                                                    "lossBps": {
                                                      "type": "string",
                                                      "pattern": "^(0|[1-9]\\d{0,4})$",
                                                      "description": "How far below the average cost the price must be, in basis points."
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "lossBps"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "A stop-loss exit: sell once the price is down this much on average cost."
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Take profits on a schedule: sell only the gain every this many days, counted from the last harvest that settled, or from the first deposit that settled.",
                                                      "enum": [
                                                        "harvest_every"
                                                      ]
                                                    },
                                                    "days": {
                                                      "type": "string",
                                                      "pattern": "^[1-9]\\d{0,2}$",
                                                      "description": "How many days apart harvests are, 7 to 365, as a decimal string: \"7\" weekly, \"30\" monthly."
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "days"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "A scheduled harvest: only on a gain_of_position exit selling a curated yield vault's share token (earn_vaults). Every `days` days it sells only the gain, if there is any, and the automation keeps running."
                                                }
                                              ]
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "input",
                                            "quantity",
                                            "output"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "description": "Return an asset to the account that owns the agent wallet.",
                                              "enum": [
                                                "withdraw_to_owner"
                                              ]
                                            },
                                            "input": {
                                              "anyOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "pinned": {
                                                      "type": "object",
                                                      "properties": {
                                                        "tokenId": {
                                                          "type": "string",
                                                          "maxLength": 256,
                                                          "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                                          "description": "The exact ledger asset identifier, including its token standard namespace."
                                                        },
                                                        "decimals": {
                                                          "type": "integer",
                                                          "minimum": 0,
                                                          "maximum": 38,
                                                          "description": "How many decimal places the token's smallest unit represents."
                                                        }
                                                      },
                                                      "required": [
                                                        "tokenId",
                                                        "decimals"
                                                      ],
                                                      "additionalProperties": false,
                                                      "description": "The exact token this asset is pinned to."
                                                    }
                                                  },
                                                  "required": [
                                                    "pinned"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "any": {
                                                      "type": "boolean",
                                                      "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                                      "enum": [
                                                        true
                                                      ]
                                                    }
                                                  },
                                                  "required": [
                                                    "any"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              ],
                                              "description": "The asset this action spends: pinned to one token, or any token the agent wallet holds."
                                            },
                                            "quantity": {
                                              "oneOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Spend an exact amount of the input token.",
                                                      "enum": [
                                                        "exact_input_tokens"
                                                      ]
                                                    },
                                                    "amountRaw": {
                                                      "type": "string",
                                                      "pattern": "^(0|[1-9]\\d{0,38})$",
                                                      "description": "The exact input amount, in the input token's smallest unit."
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "amountRaw"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "An exact quantity of the input token, not its USD value: exactly 5 USDC at decimals 6 is amountRaw \"5000000\". No floating-point arithmetic or bash."
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Spend a USD-denominated value of the input token.",
                                                      "enum": [
                                                        "exact_input_value_usd"
                                                      ]
                                                    },
                                                    "value": {
                                                      "type": "string",
                                                      "pattern": "^(0|[1-9]\\d{0,38})(?:\\.\\d{1,18})?$",
                                                      "description": "The USD value to spend, as a decimal string."
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "value"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "A USD value of the input token: \"$5 worth of USDC\" is value \"5\", never exactly 5 USDC. The host converts it at live prices."
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Receive an exact amount of the output token.",
                                                      "enum": [
                                                        "exact_output_tokens"
                                                      ]
                                                    },
                                                    "amountRaw": {
                                                      "type": "string",
                                                      "pattern": "^(0|[1-9]\\d{0,38})$",
                                                      "description": "The exact output amount, in the output token's smallest unit."
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "amountRaw"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "An exact quantity of the output token, scaled by its verified decimals; the host calculates the input."
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Spend everything the agent wallet holds of the input asset.",
                                                      "enum": [
                                                        "all_of_input"
                                                      ]
                                                    }
                                                  },
                                                  "required": [
                                                    "kind"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Spend a fraction of the input asset.",
                                                      "enum": [
                                                        "fraction_of_input"
                                                      ]
                                                    },
                                                    "bps": {
                                                      "type": "string",
                                                      "pattern": "^(0|[1-9]\\d{0,4})$",
                                                      "description": "The fraction to spend, in basis points of the input asset."
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "bps"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Sell a fraction of this automation's own position in the input asset.",
                                                      "enum": [
                                                        "fraction_of_position"
                                                      ]
                                                    },
                                                    "bps": {
                                                      "type": "string",
                                                      "pattern": "^(0|[1-9]\\d{0,4})$",
                                                      "description": "The fraction to sell, in basis points of this automation's own position; 10000 is all of it."
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "bps"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "A fraction of what THIS automation's own settled fills still hold of the input asset, never of the wallet balance; only on an action with an `exit` guard."
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Sell only the gain on this automation's own position in the input asset.",
                                                      "enum": [
                                                        "gain_of_position"
                                                      ]
                                                    }
                                                  },
                                                  "required": [
                                                    "kind"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "Only the gain on THIS automation's own position, priced in the token its buys paid with; only with a take_profit or harvest_every `exit` guard and a pinned output other than that token."
                                                }
                                              ],
                                              "description": "How much moves: an exact token amount, an exact USD value, an exact output amount, all of the input, or a fraction of it."
                                            },
                                            "output": {
                                              "anyOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "pinned": {
                                                      "type": "object",
                                                      "properties": {
                                                        "tokenId": {
                                                          "type": "string",
                                                          "maxLength": 256,
                                                          "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                                          "description": "The exact ledger asset identifier, including its token standard namespace."
                                                        },
                                                        "decimals": {
                                                          "type": "integer",
                                                          "minimum": 0,
                                                          "maximum": 38,
                                                          "description": "How many decimal places the token's smallest unit represents."
                                                        }
                                                      },
                                                      "required": [
                                                        "tokenId",
                                                        "decimals"
                                                      ],
                                                      "additionalProperties": false,
                                                      "description": "The exact token this asset is pinned to."
                                                    }
                                                  },
                                                  "required": [
                                                    "pinned"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "any": {
                                                      "type": "boolean",
                                                      "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                                      "enum": [
                                                        true
                                                      ]
                                                    }
                                                  },
                                                  "required": [
                                                    "any"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              ],
                                              "description": "The asset this action produces: pinned to one token, or left open."
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "input",
                                            "quantity",
                                            "output"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "description": "Pay the exact approved destination through the provider’s chain or Intents transfer route.",
                                              "enum": [
                                                "withdraw_transfer"
                                              ]
                                            },
                                            "input": {
                                              "anyOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "pinned": {
                                                      "type": "object",
                                                      "properties": {
                                                        "tokenId": {
                                                          "type": "string",
                                                          "maxLength": 256,
                                                          "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                                          "description": "The exact ledger asset identifier, including its token standard namespace."
                                                        },
                                                        "decimals": {
                                                          "type": "integer",
                                                          "minimum": 0,
                                                          "maximum": 38,
                                                          "description": "How many decimal places the token's smallest unit represents."
                                                        }
                                                      },
                                                      "required": [
                                                        "tokenId",
                                                        "decimals"
                                                      ],
                                                      "additionalProperties": false,
                                                      "description": "The exact token this asset is pinned to."
                                                    }
                                                  },
                                                  "required": [
                                                    "pinned"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "any": {
                                                      "type": "boolean",
                                                      "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                                      "enum": [
                                                        true
                                                      ]
                                                    }
                                                  },
                                                  "required": [
                                                    "any"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              ],
                                              "description": "The asset this action spends: pinned to one token, or any token the agent wallet holds."
                                            },
                                            "quantity": {
                                              "oneOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Spend an exact amount of the input token.",
                                                      "enum": [
                                                        "exact_input_tokens"
                                                      ]
                                                    },
                                                    "amountRaw": {
                                                      "type": "string",
                                                      "pattern": "^(0|[1-9]\\d{0,38})$",
                                                      "description": "The exact input amount, in the input token's smallest unit."
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "amountRaw"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "An exact quantity of the input token, not its USD value: exactly 5 USDC at decimals 6 is amountRaw \"5000000\". No floating-point arithmetic or bash."
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Spend a USD-denominated value of the input token.",
                                                      "enum": [
                                                        "exact_input_value_usd"
                                                      ]
                                                    },
                                                    "value": {
                                                      "type": "string",
                                                      "pattern": "^(0|[1-9]\\d{0,38})(?:\\.\\d{1,18})?$",
                                                      "description": "The USD value to spend, as a decimal string."
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "value"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "A USD value of the input token: \"$5 worth of USDC\" is value \"5\", never exactly 5 USDC. The host converts it at live prices."
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Receive an exact amount of the output token.",
                                                      "enum": [
                                                        "exact_output_tokens"
                                                      ]
                                                    },
                                                    "amountRaw": {
                                                      "type": "string",
                                                      "pattern": "^(0|[1-9]\\d{0,38})$",
                                                      "description": "The exact output amount, in the output token's smallest unit."
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "amountRaw"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "An exact quantity of the output token, scaled by its verified decimals; the host calculates the input."
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Spend everything the agent wallet holds of the input asset.",
                                                      "enum": [
                                                        "all_of_input"
                                                      ]
                                                    }
                                                  },
                                                  "required": [
                                                    "kind"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Spend a fraction of the input asset.",
                                                      "enum": [
                                                        "fraction_of_input"
                                                      ]
                                                    },
                                                    "bps": {
                                                      "type": "string",
                                                      "pattern": "^(0|[1-9]\\d{0,4})$",
                                                      "description": "The fraction to spend, in basis points of the input asset."
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "bps"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Sell a fraction of this automation's own position in the input asset.",
                                                      "enum": [
                                                        "fraction_of_position"
                                                      ]
                                                    },
                                                    "bps": {
                                                      "type": "string",
                                                      "pattern": "^(0|[1-9]\\d{0,4})$",
                                                      "description": "The fraction to sell, in basis points of this automation's own position; 10000 is all of it."
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "bps"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "A fraction of what THIS automation's own settled fills still hold of the input asset, never of the wallet balance; only on an action with an `exit` guard."
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Sell only the gain on this automation's own position in the input asset.",
                                                      "enum": [
                                                        "gain_of_position"
                                                      ]
                                                    }
                                                  },
                                                  "required": [
                                                    "kind"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "Only the gain on THIS automation's own position, priced in the token its buys paid with; only with a take_profit or harvest_every `exit` guard and a pinned output other than that token."
                                                }
                                              ],
                                              "description": "How much moves: an exact token amount, an exact USD value, an exact output amount, all of the input, or a fraction of it."
                                            },
                                            "output": {
                                              "anyOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "pinned": {
                                                      "type": "object",
                                                      "properties": {
                                                        "tokenId": {
                                                          "type": "string",
                                                          "maxLength": 256,
                                                          "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                                          "description": "The exact ledger asset identifier, including its token standard namespace."
                                                        },
                                                        "decimals": {
                                                          "type": "integer",
                                                          "minimum": 0,
                                                          "maximum": 38,
                                                          "description": "How many decimal places the token's smallest unit represents."
                                                        }
                                                      },
                                                      "required": [
                                                        "tokenId",
                                                        "decimals"
                                                      ],
                                                      "additionalProperties": false,
                                                      "description": "The exact token this asset is pinned to."
                                                    }
                                                  },
                                                  "required": [
                                                    "pinned"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "any": {
                                                      "type": "boolean",
                                                      "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                                      "enum": [
                                                        true
                                                      ]
                                                    }
                                                  },
                                                  "required": [
                                                    "any"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              ],
                                              "description": "The asset this action produces: pinned to one token, or left open."
                                            },
                                            "recipient": {
                                              "type": "object",
                                              "properties": {
                                                "rail": {
                                                  "type": "string",
                                                  "enum": [
                                                    "chain",
                                                    "intents"
                                                  ],
                                                  "description": "A native blockchain transfer or a signed transfer within an Intents ledger."
                                                },
                                                "network": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9-]{0,63}$",
                                                  "description": "Exact network identifier from wallet capabilities; near-intents and near-intents-confidential are ledgers, not the NEAR blockchain."
                                                },
                                                "address": {
                                                  "type": "string",
                                                  "pattern": "^[\\x21-\\x7e]{1,256}$",
                                                  "description": "Exact network address, preserving case and any routing metadata encoded in its native address format. Names must be resolved before approval."
                                                },
                                                "memo": {
                                                  "type": "null",
                                                  "description": "Standalone routing memos are unsupported; routing must be encoded in the approved address."
                                                }
                                              },
                                              "required": [
                                                "rail",
                                                "network",
                                                "address",
                                                "memo"
                                              ],
                                              "additionalProperties": false,
                                              "description": "The exact approved payout rail, network and address."
                                            },
                                            "minimumReceivedRaw": {
                                              "anyOf": [
                                                {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9]\\d{0,38})$"
                                                },
                                                {
                                                  "type": "null"
                                                }
                                              ],
                                              "description": "Minimum acceptable payout in output-asset atomic units, or null when the approved all-in loss bound alone sets the floor."
                                            },
                                            "maxFeeRaw": {
                                              "anyOf": [
                                                {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9]\\d{0,38})$"
                                                },
                                                {
                                                  "type": "null"
                                                }
                                              ],
                                              "description": "Optional separate withdrawal fee cap in output-asset atomic units; null means undisclosed, while all-in loss and minimum receive remain enforced."
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "input",
                                            "quantity",
                                            "output",
                                            "recipient",
                                            "minimumReceivedRaw",
                                            "maxFeeRaw"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "description": "Not executable, and refused in new contracts: pay an address with withdraw_transfer.",
                                              "enum": [
                                                "send"
                                              ]
                                            },
                                            "input": {
                                              "anyOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "pinned": {
                                                      "type": "object",
                                                      "properties": {
                                                        "tokenId": {
                                                          "type": "string",
                                                          "maxLength": 256,
                                                          "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                                          "description": "The exact ledger asset identifier, including its token standard namespace."
                                                        },
                                                        "decimals": {
                                                          "type": "integer",
                                                          "minimum": 0,
                                                          "maximum": 38,
                                                          "description": "How many decimal places the token's smallest unit represents."
                                                        }
                                                      },
                                                      "required": [
                                                        "tokenId",
                                                        "decimals"
                                                      ],
                                                      "additionalProperties": false,
                                                      "description": "The exact token this asset is pinned to."
                                                    }
                                                  },
                                                  "required": [
                                                    "pinned"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "any": {
                                                      "type": "boolean",
                                                      "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                                      "enum": [
                                                        true
                                                      ]
                                                    }
                                                  },
                                                  "required": [
                                                    "any"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              ],
                                              "description": "The asset this action spends: pinned to one token, or any token the agent wallet holds."
                                            },
                                            "quantity": {
                                              "oneOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Spend an exact amount of the input token.",
                                                      "enum": [
                                                        "exact_input_tokens"
                                                      ]
                                                    },
                                                    "amountRaw": {
                                                      "type": "string",
                                                      "pattern": "^(0|[1-9]\\d{0,38})$",
                                                      "description": "The exact input amount, in the input token's smallest unit."
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "amountRaw"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "An exact quantity of the input token, not its USD value: exactly 5 USDC at decimals 6 is amountRaw \"5000000\". No floating-point arithmetic or bash."
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Spend a USD-denominated value of the input token.",
                                                      "enum": [
                                                        "exact_input_value_usd"
                                                      ]
                                                    },
                                                    "value": {
                                                      "type": "string",
                                                      "pattern": "^(0|[1-9]\\d{0,38})(?:\\.\\d{1,18})?$",
                                                      "description": "The USD value to spend, as a decimal string."
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "value"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "A USD value of the input token: \"$5 worth of USDC\" is value \"5\", never exactly 5 USDC. The host converts it at live prices."
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Receive an exact amount of the output token.",
                                                      "enum": [
                                                        "exact_output_tokens"
                                                      ]
                                                    },
                                                    "amountRaw": {
                                                      "type": "string",
                                                      "pattern": "^(0|[1-9]\\d{0,38})$",
                                                      "description": "The exact output amount, in the output token's smallest unit."
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "amountRaw"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "An exact quantity of the output token, scaled by its verified decimals; the host calculates the input."
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Spend everything the agent wallet holds of the input asset.",
                                                      "enum": [
                                                        "all_of_input"
                                                      ]
                                                    }
                                                  },
                                                  "required": [
                                                    "kind"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Spend a fraction of the input asset.",
                                                      "enum": [
                                                        "fraction_of_input"
                                                      ]
                                                    },
                                                    "bps": {
                                                      "type": "string",
                                                      "pattern": "^(0|[1-9]\\d{0,4})$",
                                                      "description": "The fraction to spend, in basis points of the input asset."
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "bps"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Sell a fraction of this automation's own position in the input asset.",
                                                      "enum": [
                                                        "fraction_of_position"
                                                      ]
                                                    },
                                                    "bps": {
                                                      "type": "string",
                                                      "pattern": "^(0|[1-9]\\d{0,4})$",
                                                      "description": "The fraction to sell, in basis points of this automation's own position; 10000 is all of it."
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "bps"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "A fraction of what THIS automation's own settled fills still hold of the input asset, never of the wallet balance; only on an action with an `exit` guard."
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "description": "Sell only the gain on this automation's own position in the input asset.",
                                                      "enum": [
                                                        "gain_of_position"
                                                      ]
                                                    }
                                                  },
                                                  "required": [
                                                    "kind"
                                                  ],
                                                  "additionalProperties": false,
                                                  "description": "Only the gain on THIS automation's own position, priced in the token its buys paid with; only with a take_profit or harvest_every `exit` guard and a pinned output other than that token."
                                                }
                                              ],
                                              "description": "How much moves: an exact token amount, an exact USD value, an exact output amount, all of the input, or a fraction of it."
                                            },
                                            "output": {
                                              "anyOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "pinned": {
                                                      "type": "object",
                                                      "properties": {
                                                        "tokenId": {
                                                          "type": "string",
                                                          "maxLength": 256,
                                                          "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                                          "description": "The exact ledger asset identifier, including its token standard namespace."
                                                        },
                                                        "decimals": {
                                                          "type": "integer",
                                                          "minimum": 0,
                                                          "maximum": 38,
                                                          "description": "How many decimal places the token's smallest unit represents."
                                                        }
                                                      },
                                                      "required": [
                                                        "tokenId",
                                                        "decimals"
                                                      ],
                                                      "additionalProperties": false,
                                                      "description": "The exact token this asset is pinned to."
                                                    }
                                                  },
                                                  "required": [
                                                    "pinned"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "any": {
                                                      "type": "boolean",
                                                      "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                                      "enum": [
                                                        true
                                                      ]
                                                    }
                                                  },
                                                  "required": [
                                                    "any"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              ],
                                              "description": "The asset this action produces: pinned to one token, or left open."
                                            },
                                            "recipient": {
                                              "type": "object",
                                              "properties": {
                                                "chain": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 32,
                                                  "description": "Which chain the destination address is on."
                                                },
                                                "address": {
                                                  "type": "string",
                                                  "pattern": "^[\\x21-\\x7e]{1,128}$",
                                                  "description": "The destination address on that chain."
                                                }
                                              },
                                              "required": [
                                                "chain",
                                                "address"
                                              ],
                                              "additionalProperties": false,
                                              "description": "The pinned destination this action pays."
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "input",
                                            "quantity",
                                            "output",
                                            "recipient"
                                          ],
                                          "additionalProperties": false
                                        }
                                      ]
                                    },
                                    "description": "The actions this contract authorizes, executed in order."
                                  },
                                  "validUntil": {
                                    "type": "string",
                                    "format": "date-time",
                                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                                    "description": "When this contract's authority expires."
                                  },
                                  "maxExecutions": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 10000,
                                    "description": "How many times this contract may be executed before it is exhausted."
                                  },
                                  "maxTotalInput": {
                                    "description": "Optional total cap on what all executions together may spend, per input token, in raw units. A $500 budget paid in USDC is 500 USDC. Every action input must be pinned and capped.",
                                    "minItems": 1,
                                    "maxItems": 16,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "tokenId": {
                                          "type": "string",
                                          "maxLength": 256,
                                          "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                          "description": "The exact ledger asset identifier, including its token standard namespace."
                                        },
                                        "decimals": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 38,
                                          "description": "How many decimal places the token's smallest unit represents."
                                        },
                                        "amountRaw": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9]\\d{0,38})$",
                                          "description": "The most this contract may spend of this token in total, across every execution, in the token's smallest unit."
                                        }
                                      },
                                      "required": [
                                        "tokenId",
                                        "decimals",
                                        "amountRaw"
                                      ],
                                      "additionalProperties": false,
                                      "description": "One capped input token and its total spend ceiling."
                                    }
                                  },
                                  "bounds": {
                                    "type": "object",
                                    "properties": {
                                      "maxValueLossBps": {
                                        "type": "string",
                                        "pattern": "^(0|[1-9]\\d{0,4})$",
                                        "description": "The most value an execution may give up to price movement and fees together, in basis points; 0 allows no loss."
                                      },
                                      "maxSignatureLifetimeSeconds": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 259500,
                                        "description": "Explicit maximum lifetime of each released transfer signature, in seconds. 1Click confidential swaps require up to 259500 seconds (72 hours 5 minutes). This does not extend the execution window or approval validity."
                                      }
                                    },
                                    "required": [
                                      "maxValueLossBps",
                                      "maxSignatureLifetimeSeconds"
                                    ],
                                    "additionalProperties": false,
                                    "description": "The value-loss and signature-lifetime limits every execution must respect."
                                  },
                                  "execution": {
                                    "description": "Optional explicit recovery authority, signed with these exact actions and bounds; omitted on historical approvals.",
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "mode": {
                                            "type": "string",
                                            "enum": [
                                              "ordered",
                                              "parallel_independent"
                                            ],
                                            "description": "Ordered actions run in approved order. Parallel-independent actions run up to four concurrently after the complete initially funded request is reserved."
                                          },
                                          "maxPreparationAttempts": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 3,
                                            "description": "The maximum unsigned preparation attempts for each approved action, including its first attempt."
                                          },
                                          "dispatchWindowSeconds": {
                                            "type": "integer",
                                            "minimum": 60,
                                            "maximum": 86400,
                                            "description": "The maximum dispatch window in seconds for this operation, from when its approval opened: exactly 1200 for a new chat request, and up to its signed deadline for an automation's grant. Closing dispatch never proves a submitted transfer did not move; observation continues."
                                          }
                                        },
                                        "required": [
                                          "mode",
                                          "maxPreparationAttempts",
                                          "dispatchWindowSeconds"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "mode": {
                                            "type": "string",
                                            "enum": [
                                              "dependency_graph"
                                            ]
                                          },
                                          "dependencies": {
                                            "minItems": 1,
                                            "maxItems": 16,
                                            "type": "array",
                                            "items": {
                                              "maxItems": 16,
                                              "type": "array",
                                              "items": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 15
                                              }
                                            },
                                            "description": "One row per requested action, listing its sorted unique predecessor action indices. A successor requires confirmed predecessor settlement. Every action must be funded from initial holdings."
                                          },
                                          "maxPreparationAttempts": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 3,
                                            "description": "The maximum unsigned preparation attempts for each approved action, including its first attempt."
                                          },
                                          "dispatchWindowSeconds": {
                                            "type": "integer",
                                            "minimum": 60,
                                            "maximum": 86400,
                                            "description": "The maximum dispatch window in seconds for this operation, from when its approval opened: exactly 1200 for a new chat request, and up to its signed deadline for an automation's grant. Closing dispatch never proves a submitted transfer did not move; observation continues."
                                          }
                                        },
                                        "required": [
                                          "mode",
                                          "dependencies",
                                          "maxPreparationAttempts",
                                          "dispatchWindowSeconds"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "type",
                                  "actions",
                                  "validUntil",
                                  "maxExecutions",
                                  "bounds"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "$ref": "#/components/schemas/PerpsAutomationContractInput"
                              },
                              {
                                "$ref": "#/components/schemas/PredictionAutomationContractInput"
                              },
                              {
                                "oneOf": [
                                  {
                                    "$ref": "#/components/schemas/SolanaBuyContractInput"
                                  },
                                  {
                                    "$ref": "#/components/schemas/SolanaSellContractInput"
                                  }
                                ],
                                "description": "A standing Solana grant: an exact buy, or a sale of a fraction of the holding for USDC, made exactly as approved each time the automation fires."
                              }
                            ],
                            "description": "Standing authority for the runs this automation fires: a NEAR Intents transfer contract, a perps automation that opens, reduces or adds margin to the agent's own Hyperliquid position, a Polymarket buy or sale of one outcome, or a Solana buy or sell made exactly as approved."
                          },
                          "maxSigningDelaySeconds": {
                            "description": "Required with a contract and omitted without one: the owner's approved maximum delay after a firing during which its run may obtain signatures, in seconds; separate from delivery lateness and signature lifetime.",
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 86400
                          },
                          "missedRun": {
                            "type": "string",
                            "enum": [
                              "skip",
                              "ask"
                            ],
                            "description": "What happens to a run that can't go through before its deadline: `skip` counts it and keeps the schedule, `ask` pauses the automation until its owner decides. A failure only the owner can fix pauses either way."
                          }
                        },
                        "required": [
                          "name",
                          "prompt",
                          "rule"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "kind",
                      "definition"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "saved"
                        ]
                      },
                      "automationId": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                        "description": "The automation's id."
                      },
                      "definitionVersion": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "kind",
                      "automationId"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "startAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "endAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "resolution": {
                "type": "string",
                "enum": [
                  "hourly",
                  "daily"
                ]
              },
              "timing": {
                "type": "string",
                "enum": [
                  "preserved",
                  "sampled"
                ]
              },
              "execution": {
                "type": "string",
                "enum": [
                  "contract_terms",
                  "triggers_only"
                ],
                "description": "Select triggers_only for a discretionary prompt whose concrete trades are unresolved. contract_terms hypothetically executes the fixed proposed trade terms; it does not simulate model decisions or discretionary instructions."
              },
              "initialHoldings": {
                "maxItems": 16,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "tokenId": {
                      "type": "string",
                      "maxLength": 256,
                      "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                      "description": "The exact ledger asset identifier, including its token standard namespace."
                    },
                    "decimals": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 38,
                      "description": "How many decimal places the token's smallest unit represents."
                    },
                    "amountRaw": {
                      "type": "string",
                      "pattern": "^(0|[1-9]\\d{0,38})$"
                    }
                  },
                  "required": [
                    "tokenId",
                    "decimals",
                    "amountRaw"
                  ],
                  "additionalProperties": false
                }
              },
              "funding": {
                "description": "Select strategy_budget to set aside a finite starting budget from entry sizes and run limits at opening historical prices. Requires empty initialHoldings and cannot be combined with contributeInputs: true. Omit both automatic options to use an explicitly supplied starting portfolio. No live wallet balance is read.",
                "type": "string",
                "enum": [
                  "strategy_budget"
                ]
              },
              "contributeInputs": {
                "description": "When true, start empty and hypothetically supply the input assets for each successfully modeled fixed purchase, valued at its fill time. Requires empty initialHoldings and omitted funding. Contributions are capital, not profit; exits receive no new capital. False or omission leaves the existing funding or explicit portfolio behavior unchanged.",
                "type": "boolean"
              },
              "costBps": {
                "type": "integer",
                "minimum": 0,
                "maximum": 300
              }
            },
            "required": [
              "target",
              "startAt",
              "endAt",
              "resolution",
              "timing",
              "execution",
              "initialHoldings",
              "costBps"
            ],
            "additionalProperties": false
          }
        }
      }
    },
    "parameters": [
      {
        "schema": {
          "type": "string",
          "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
        },
        "in": "path",
        "name": "userId",
        "required": true,
        "description": "Your id for the user: the `userId` you sent to Create a user. It must be the session's user."
      }
    ],
    "security": [
      {
        "apiKey": [],
        "userToken": []
      }
    ],
    "responses": {
      "200": {
        "description": "The historical estimate and its data limitations.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string",
                  "enum": [
                    "estimated",
                    "trigger_only",
                    "unavailable",
                    "incomplete"
                  ]
                },
                "reason": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 4096
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "metrics": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "startingValueUsdDecimal": {
                          "type": "string",
                          "pattern": "^-?(0|[1-9]\\d{0,77})(\\.\\d{1,36})?$"
                        },
                        "contributedValueUsdDecimal": {
                          "description": "Total external input contributions valued at their modeled fills; contributions are excluded from profit.",
                          "type": "string",
                          "pattern": "^-?(0|[1-9]\\d{0,77})(\\.\\d{1,36})?$"
                        },
                        "endingValueUsdDecimal": {
                          "type": "string",
                          "pattern": "^-?(0|[1-9]\\d{0,77})(\\.\\d{1,36})?$"
                        },
                        "pnlUsdDecimal": {
                          "type": "string",
                          "pattern": "^-?(0|[1-9]\\d{0,77})(\\.\\d{1,36})?$"
                        },
                        "returnPercentDecimal": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^-?(0|[1-9]\\d{0,77})(\\.\\d{1,36})?$"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "description": "Net profit divided by starting value plus total contributed value, times 100. Null when no capital was invested; this is not an annualized or time-weighted return."
                        },
                        "maxDrawdownPercentDecimal": {
                          "type": "string",
                          "pattern": "^-?(0|[1-9]\\d{0,77})(\\.\\d{1,36})?$",
                          "description": "Largest sampled peak-to-trough fall. Contribution-funded estimates use a flow-adjusted index rounded down at each mark to 36 decimal places; financial amounts and trade decisions remain exact."
                        },
                        "holdValueUsdDecimal": {
                          "type": "string",
                          "pattern": "^-?(0|[1-9]\\d{0,77})(\\.\\d{1,36})?$"
                        },
                        "totalCostUsdDecimal": {
                          "type": "string",
                          "pattern": "^-?(0|[1-9]\\d{0,77})(\\.\\d{1,36})?$"
                        }
                      },
                      "required": [
                        "startingValueUsdDecimal",
                        "endingValueUsdDecimal",
                        "pnlUsdDecimal",
                        "returnPercentDecimal",
                        "maxDrawdownPercentDecimal",
                        "holdValueUsdDecimal",
                        "totalCostUsdDecimal"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "counts": {
                  "type": "object",
                  "properties": {
                    "evaluations": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 250000
                    },
                    "firings": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 250000
                    },
                    "filledLegs": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 1000
                    },
                    "skipped": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 250000
                    },
                    "unknown": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 250000
                    }
                  },
                  "required": [
                    "evaluations",
                    "firings",
                    "filledLegs",
                    "skipped",
                    "unknown"
                  ]
                },
                "throughAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "limitations": {
                  "maxItems": 128,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4096
                  }
                },
                "scenario": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    },
                    "prompt": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 8192,
                      "description": "Only the user's instructions for each later run, preserved exactly with their constraints; monitoring conditions belong in rule."
                    },
                    "rule": {
                      "$ref": "#/components/schemas/AutomationRule"
                    },
                    "contract": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "description": "Which contract template this is.",
                              "enum": [
                                "near_intents_transfer"
                              ]
                            },
                            "actions": {
                              "minItems": 1,
                              "maxItems": 16,
                              "type": "array",
                              "items": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "description": "Exchange one asset for another; custody never leaves the agent wallet.",
                                        "enum": [
                                          "swap"
                                        ]
                                      },
                                      "input": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "pinned": {
                                                "type": "object",
                                                "properties": {
                                                  "tokenId": {
                                                    "type": "string",
                                                    "maxLength": 256,
                                                    "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                                    "description": "The exact ledger asset identifier, including its token standard namespace."
                                                  },
                                                  "decimals": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 38,
                                                    "description": "How many decimal places the token's smallest unit represents."
                                                  }
                                                },
                                                "required": [
                                                  "tokenId",
                                                  "decimals"
                                                ],
                                                "description": "The exact token this asset is pinned to."
                                              }
                                            },
                                            "required": [
                                              "pinned"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "any": {
                                                "type": "boolean",
                                                "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                                "enum": [
                                                  true
                                                ]
                                              }
                                            },
                                            "required": [
                                              "any"
                                            ]
                                          }
                                        ],
                                        "description": "The asset this action spends: pinned to one token, or any token the agent wallet holds."
                                      },
                                      "quantity": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Spend an exact amount of the input token.",
                                                "enum": [
                                                  "exact_input_tokens"
                                                ]
                                              },
                                              "amountRaw": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9]\\d{0,38})$",
                                                "description": "The exact input amount, in the input token's smallest unit."
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "amountRaw"
                                            ],
                                            "description": "An exact quantity of the input token, not its USD value: exactly 5 USDC at decimals 6 is amountRaw \"5000000\". No floating-point arithmetic or bash."
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Spend a USD-denominated value of the input token.",
                                                "enum": [
                                                  "exact_input_value_usd"
                                                ]
                                              },
                                              "value": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9]\\d{0,38})(?:\\.\\d{1,18})?$",
                                                "description": "The USD value to spend, as a decimal string."
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "value"
                                            ],
                                            "description": "A USD value of the input token: \"$5 worth of USDC\" is value \"5\", never exactly 5 USDC. The host converts it at live prices."
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Receive an exact amount of the output token.",
                                                "enum": [
                                                  "exact_output_tokens"
                                                ]
                                              },
                                              "amountRaw": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9]\\d{0,38})$",
                                                "description": "The exact output amount, in the output token's smallest unit."
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "amountRaw"
                                            ],
                                            "description": "An exact quantity of the output token, scaled by its verified decimals; the host calculates the input."
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Spend everything the agent wallet holds of the input asset.",
                                                "enum": [
                                                  "all_of_input"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "kind"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Spend a fraction of the input asset.",
                                                "enum": [
                                                  "fraction_of_input"
                                                ]
                                              },
                                              "bps": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9]\\d{0,4})$",
                                                "description": "The fraction to spend, in basis points of the input asset."
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "bps"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Sell a fraction of this automation's own position in the input asset.",
                                                "enum": [
                                                  "fraction_of_position"
                                                ]
                                              },
                                              "bps": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9]\\d{0,4})$",
                                                "description": "The fraction to sell, in basis points of this automation's own position; 10000 is all of it."
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "bps"
                                            ],
                                            "description": "A fraction of what THIS automation's own settled fills still hold of the input asset, never of the wallet balance; only on an action with an `exit` guard."
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Sell only the gain on this automation's own position in the input asset.",
                                                "enum": [
                                                  "gain_of_position"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "kind"
                                            ],
                                            "description": "Only the gain on THIS automation's own position, priced in the token its buys paid with; only with a take_profit or harvest_every `exit` guard and a pinned output other than that token."
                                          }
                                        ],
                                        "description": "How much moves: an exact token amount, an exact USD value, an exact output amount, all of the input, or a fraction of it."
                                      },
                                      "output": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "pinned": {
                                                "type": "object",
                                                "properties": {
                                                  "tokenId": {
                                                    "type": "string",
                                                    "maxLength": 256,
                                                    "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                                    "description": "The exact ledger asset identifier, including its token standard namespace."
                                                  },
                                                  "decimals": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 38,
                                                    "description": "How many decimal places the token's smallest unit represents."
                                                  }
                                                },
                                                "required": [
                                                  "tokenId",
                                                  "decimals"
                                                ],
                                                "description": "The exact token this asset is pinned to."
                                              }
                                            },
                                            "required": [
                                              "pinned"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "any": {
                                                "type": "boolean",
                                                "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                                "enum": [
                                                  true
                                                ]
                                              }
                                            },
                                            "required": [
                                              "any"
                                            ]
                                          }
                                        ],
                                        "description": "The asset this action produces: pinned to one token, or left open."
                                      },
                                      "exit": {
                                        "description": "Optional exit guard: this action sells only when the asset's price in its output token crosses the automation's own average cost by the approved amount.",
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Sell when the asset is this far ABOVE the automation's average cost.",
                                                "enum": [
                                                  "take_profit"
                                                ]
                                              },
                                              "gainBps": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9]\\d{0,4})$",
                                                "description": "How far above the average cost the price must be, in basis points."
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "gainBps"
                                            ],
                                            "description": "A take-profit exit: sell once the price is up this much on average cost."
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Sell when the asset is this far BELOW the automation's average cost.",
                                                "enum": [
                                                  "stop_loss"
                                                ]
                                              },
                                              "lossBps": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9]\\d{0,4})$",
                                                "description": "How far below the average cost the price must be, in basis points."
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "lossBps"
                                            ],
                                            "description": "A stop-loss exit: sell once the price is down this much on average cost."
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Take profits on a schedule: sell only the gain every this many days, counted from the last harvest that settled, or from the first deposit that settled.",
                                                "enum": [
                                                  "harvest_every"
                                                ]
                                              },
                                              "days": {
                                                "type": "string",
                                                "pattern": "^[1-9]\\d{0,2}$",
                                                "description": "How many days apart harvests are, 7 to 365, as a decimal string: \"7\" weekly, \"30\" monthly."
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "days"
                                            ],
                                            "description": "A scheduled harvest: only on a gain_of_position exit selling a curated yield vault's share token (earn_vaults). Every `days` days it sells only the gain, if there is any, and the automation keeps running."
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "input",
                                      "quantity",
                                      "output"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "description": "Return an asset to the account that owns the agent wallet.",
                                        "enum": [
                                          "withdraw_to_owner"
                                        ]
                                      },
                                      "input": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "pinned": {
                                                "type": "object",
                                                "properties": {
                                                  "tokenId": {
                                                    "type": "string",
                                                    "maxLength": 256,
                                                    "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                                    "description": "The exact ledger asset identifier, including its token standard namespace."
                                                  },
                                                  "decimals": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 38,
                                                    "description": "How many decimal places the token's smallest unit represents."
                                                  }
                                                },
                                                "required": [
                                                  "tokenId",
                                                  "decimals"
                                                ],
                                                "description": "The exact token this asset is pinned to."
                                              }
                                            },
                                            "required": [
                                              "pinned"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "any": {
                                                "type": "boolean",
                                                "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                                "enum": [
                                                  true
                                                ]
                                              }
                                            },
                                            "required": [
                                              "any"
                                            ]
                                          }
                                        ],
                                        "description": "The asset this action spends: pinned to one token, or any token the agent wallet holds."
                                      },
                                      "quantity": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Spend an exact amount of the input token.",
                                                "enum": [
                                                  "exact_input_tokens"
                                                ]
                                              },
                                              "amountRaw": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9]\\d{0,38})$",
                                                "description": "The exact input amount, in the input token's smallest unit."
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "amountRaw"
                                            ],
                                            "description": "An exact quantity of the input token, not its USD value: exactly 5 USDC at decimals 6 is amountRaw \"5000000\". No floating-point arithmetic or bash."
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Spend a USD-denominated value of the input token.",
                                                "enum": [
                                                  "exact_input_value_usd"
                                                ]
                                              },
                                              "value": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9]\\d{0,38})(?:\\.\\d{1,18})?$",
                                                "description": "The USD value to spend, as a decimal string."
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "value"
                                            ],
                                            "description": "A USD value of the input token: \"$5 worth of USDC\" is value \"5\", never exactly 5 USDC. The host converts it at live prices."
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Receive an exact amount of the output token.",
                                                "enum": [
                                                  "exact_output_tokens"
                                                ]
                                              },
                                              "amountRaw": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9]\\d{0,38})$",
                                                "description": "The exact output amount, in the output token's smallest unit."
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "amountRaw"
                                            ],
                                            "description": "An exact quantity of the output token, scaled by its verified decimals; the host calculates the input."
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Spend everything the agent wallet holds of the input asset.",
                                                "enum": [
                                                  "all_of_input"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "kind"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Spend a fraction of the input asset.",
                                                "enum": [
                                                  "fraction_of_input"
                                                ]
                                              },
                                              "bps": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9]\\d{0,4})$",
                                                "description": "The fraction to spend, in basis points of the input asset."
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "bps"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Sell a fraction of this automation's own position in the input asset.",
                                                "enum": [
                                                  "fraction_of_position"
                                                ]
                                              },
                                              "bps": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9]\\d{0,4})$",
                                                "description": "The fraction to sell, in basis points of this automation's own position; 10000 is all of it."
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "bps"
                                            ],
                                            "description": "A fraction of what THIS automation's own settled fills still hold of the input asset, never of the wallet balance; only on an action with an `exit` guard."
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Sell only the gain on this automation's own position in the input asset.",
                                                "enum": [
                                                  "gain_of_position"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "kind"
                                            ],
                                            "description": "Only the gain on THIS automation's own position, priced in the token its buys paid with; only with a take_profit or harvest_every `exit` guard and a pinned output other than that token."
                                          }
                                        ],
                                        "description": "How much moves: an exact token amount, an exact USD value, an exact output amount, all of the input, or a fraction of it."
                                      },
                                      "output": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "pinned": {
                                                "type": "object",
                                                "properties": {
                                                  "tokenId": {
                                                    "type": "string",
                                                    "maxLength": 256,
                                                    "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                                    "description": "The exact ledger asset identifier, including its token standard namespace."
                                                  },
                                                  "decimals": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 38,
                                                    "description": "How many decimal places the token's smallest unit represents."
                                                  }
                                                },
                                                "required": [
                                                  "tokenId",
                                                  "decimals"
                                                ],
                                                "description": "The exact token this asset is pinned to."
                                              }
                                            },
                                            "required": [
                                              "pinned"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "any": {
                                                "type": "boolean",
                                                "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                                "enum": [
                                                  true
                                                ]
                                              }
                                            },
                                            "required": [
                                              "any"
                                            ]
                                          }
                                        ],
                                        "description": "The asset this action produces: pinned to one token, or left open."
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "input",
                                      "quantity",
                                      "output"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "description": "Pay the exact approved destination through the provider’s chain or Intents transfer route.",
                                        "enum": [
                                          "withdraw_transfer"
                                        ]
                                      },
                                      "input": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "pinned": {
                                                "type": "object",
                                                "properties": {
                                                  "tokenId": {
                                                    "type": "string",
                                                    "maxLength": 256,
                                                    "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                                    "description": "The exact ledger asset identifier, including its token standard namespace."
                                                  },
                                                  "decimals": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 38,
                                                    "description": "How many decimal places the token's smallest unit represents."
                                                  }
                                                },
                                                "required": [
                                                  "tokenId",
                                                  "decimals"
                                                ],
                                                "description": "The exact token this asset is pinned to."
                                              }
                                            },
                                            "required": [
                                              "pinned"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "any": {
                                                "type": "boolean",
                                                "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                                "enum": [
                                                  true
                                                ]
                                              }
                                            },
                                            "required": [
                                              "any"
                                            ]
                                          }
                                        ],
                                        "description": "The asset this action spends: pinned to one token, or any token the agent wallet holds."
                                      },
                                      "quantity": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Spend an exact amount of the input token.",
                                                "enum": [
                                                  "exact_input_tokens"
                                                ]
                                              },
                                              "amountRaw": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9]\\d{0,38})$",
                                                "description": "The exact input amount, in the input token's smallest unit."
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "amountRaw"
                                            ],
                                            "description": "An exact quantity of the input token, not its USD value: exactly 5 USDC at decimals 6 is amountRaw \"5000000\". No floating-point arithmetic or bash."
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Spend a USD-denominated value of the input token.",
                                                "enum": [
                                                  "exact_input_value_usd"
                                                ]
                                              },
                                              "value": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9]\\d{0,38})(?:\\.\\d{1,18})?$",
                                                "description": "The USD value to spend, as a decimal string."
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "value"
                                            ],
                                            "description": "A USD value of the input token: \"$5 worth of USDC\" is value \"5\", never exactly 5 USDC. The host converts it at live prices."
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Receive an exact amount of the output token.",
                                                "enum": [
                                                  "exact_output_tokens"
                                                ]
                                              },
                                              "amountRaw": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9]\\d{0,38})$",
                                                "description": "The exact output amount, in the output token's smallest unit."
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "amountRaw"
                                            ],
                                            "description": "An exact quantity of the output token, scaled by its verified decimals; the host calculates the input."
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Spend everything the agent wallet holds of the input asset.",
                                                "enum": [
                                                  "all_of_input"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "kind"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Spend a fraction of the input asset.",
                                                "enum": [
                                                  "fraction_of_input"
                                                ]
                                              },
                                              "bps": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9]\\d{0,4})$",
                                                "description": "The fraction to spend, in basis points of the input asset."
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "bps"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Sell a fraction of this automation's own position in the input asset.",
                                                "enum": [
                                                  "fraction_of_position"
                                                ]
                                              },
                                              "bps": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9]\\d{0,4})$",
                                                "description": "The fraction to sell, in basis points of this automation's own position; 10000 is all of it."
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "bps"
                                            ],
                                            "description": "A fraction of what THIS automation's own settled fills still hold of the input asset, never of the wallet balance; only on an action with an `exit` guard."
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Sell only the gain on this automation's own position in the input asset.",
                                                "enum": [
                                                  "gain_of_position"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "kind"
                                            ],
                                            "description": "Only the gain on THIS automation's own position, priced in the token its buys paid with; only with a take_profit or harvest_every `exit` guard and a pinned output other than that token."
                                          }
                                        ],
                                        "description": "How much moves: an exact token amount, an exact USD value, an exact output amount, all of the input, or a fraction of it."
                                      },
                                      "output": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "pinned": {
                                                "type": "object",
                                                "properties": {
                                                  "tokenId": {
                                                    "type": "string",
                                                    "maxLength": 256,
                                                    "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                                    "description": "The exact ledger asset identifier, including its token standard namespace."
                                                  },
                                                  "decimals": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 38,
                                                    "description": "How many decimal places the token's smallest unit represents."
                                                  }
                                                },
                                                "required": [
                                                  "tokenId",
                                                  "decimals"
                                                ],
                                                "description": "The exact token this asset is pinned to."
                                              }
                                            },
                                            "required": [
                                              "pinned"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "any": {
                                                "type": "boolean",
                                                "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                                "enum": [
                                                  true
                                                ]
                                              }
                                            },
                                            "required": [
                                              "any"
                                            ]
                                          }
                                        ],
                                        "description": "The asset this action produces: pinned to one token, or left open."
                                      },
                                      "recipient": {
                                        "type": "object",
                                        "properties": {
                                          "rail": {
                                            "type": "string",
                                            "enum": [
                                              "chain",
                                              "intents"
                                            ],
                                            "description": "A native blockchain transfer or a signed transfer within an Intents ledger."
                                          },
                                          "network": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9-]{0,63}$",
                                            "description": "Exact network identifier from wallet capabilities; near-intents and near-intents-confidential are ledgers, not the NEAR blockchain."
                                          },
                                          "address": {
                                            "type": "string",
                                            "pattern": "^[\\x21-\\x7e]{1,256}$",
                                            "description": "Exact network address, preserving case and any routing metadata encoded in its native address format. Names must be resolved before approval."
                                          },
                                          "memo": {
                                            "type": "null",
                                            "description": "Standalone routing memos are unsupported; routing must be encoded in the approved address."
                                          }
                                        },
                                        "required": [
                                          "rail",
                                          "network",
                                          "address",
                                          "memo"
                                        ],
                                        "description": "The exact approved payout rail, network and address."
                                      },
                                      "minimumReceivedRaw": {
                                        "anyOf": [
                                          {
                                            "type": "string",
                                            "pattern": "^(0|[1-9]\\d{0,38})$"
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ],
                                        "description": "Minimum acceptable payout in output-asset atomic units, or null when the approved all-in loss bound alone sets the floor."
                                      },
                                      "maxFeeRaw": {
                                        "anyOf": [
                                          {
                                            "type": "string",
                                            "pattern": "^(0|[1-9]\\d{0,38})$"
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ],
                                        "description": "Optional separate withdrawal fee cap in output-asset atomic units; null means undisclosed, while all-in loss and minimum receive remain enforced."
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "input",
                                      "quantity",
                                      "output",
                                      "recipient",
                                      "minimumReceivedRaw",
                                      "maxFeeRaw"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "description": "Not executable, and refused in new contracts: pay an address with withdraw_transfer.",
                                        "enum": [
                                          "send"
                                        ]
                                      },
                                      "input": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "pinned": {
                                                "type": "object",
                                                "properties": {
                                                  "tokenId": {
                                                    "type": "string",
                                                    "maxLength": 256,
                                                    "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                                    "description": "The exact ledger asset identifier, including its token standard namespace."
                                                  },
                                                  "decimals": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 38,
                                                    "description": "How many decimal places the token's smallest unit represents."
                                                  }
                                                },
                                                "required": [
                                                  "tokenId",
                                                  "decimals"
                                                ],
                                                "description": "The exact token this asset is pinned to."
                                              }
                                            },
                                            "required": [
                                              "pinned"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "any": {
                                                "type": "boolean",
                                                "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                                "enum": [
                                                  true
                                                ]
                                              }
                                            },
                                            "required": [
                                              "any"
                                            ]
                                          }
                                        ],
                                        "description": "The asset this action spends: pinned to one token, or any token the agent wallet holds."
                                      },
                                      "quantity": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Spend an exact amount of the input token.",
                                                "enum": [
                                                  "exact_input_tokens"
                                                ]
                                              },
                                              "amountRaw": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9]\\d{0,38})$",
                                                "description": "The exact input amount, in the input token's smallest unit."
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "amountRaw"
                                            ],
                                            "description": "An exact quantity of the input token, not its USD value: exactly 5 USDC at decimals 6 is amountRaw \"5000000\". No floating-point arithmetic or bash."
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Spend a USD-denominated value of the input token.",
                                                "enum": [
                                                  "exact_input_value_usd"
                                                ]
                                              },
                                              "value": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9]\\d{0,38})(?:\\.\\d{1,18})?$",
                                                "description": "The USD value to spend, as a decimal string."
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "value"
                                            ],
                                            "description": "A USD value of the input token: \"$5 worth of USDC\" is value \"5\", never exactly 5 USDC. The host converts it at live prices."
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Receive an exact amount of the output token.",
                                                "enum": [
                                                  "exact_output_tokens"
                                                ]
                                              },
                                              "amountRaw": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9]\\d{0,38})$",
                                                "description": "The exact output amount, in the output token's smallest unit."
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "amountRaw"
                                            ],
                                            "description": "An exact quantity of the output token, scaled by its verified decimals; the host calculates the input."
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Spend everything the agent wallet holds of the input asset.",
                                                "enum": [
                                                  "all_of_input"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "kind"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Spend a fraction of the input asset.",
                                                "enum": [
                                                  "fraction_of_input"
                                                ]
                                              },
                                              "bps": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9]\\d{0,4})$",
                                                "description": "The fraction to spend, in basis points of the input asset."
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "bps"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Sell a fraction of this automation's own position in the input asset.",
                                                "enum": [
                                                  "fraction_of_position"
                                                ]
                                              },
                                              "bps": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9]\\d{0,4})$",
                                                "description": "The fraction to sell, in basis points of this automation's own position; 10000 is all of it."
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "bps"
                                            ],
                                            "description": "A fraction of what THIS automation's own settled fills still hold of the input asset, never of the wallet balance; only on an action with an `exit` guard."
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "description": "Sell only the gain on this automation's own position in the input asset.",
                                                "enum": [
                                                  "gain_of_position"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "kind"
                                            ],
                                            "description": "Only the gain on THIS automation's own position, priced in the token its buys paid with; only with a take_profit or harvest_every `exit` guard and a pinned output other than that token."
                                          }
                                        ],
                                        "description": "How much moves: an exact token amount, an exact USD value, an exact output amount, all of the input, or a fraction of it."
                                      },
                                      "output": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "pinned": {
                                                "type": "object",
                                                "properties": {
                                                  "tokenId": {
                                                    "type": "string",
                                                    "maxLength": 256,
                                                    "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                                    "description": "The exact ledger asset identifier, including its token standard namespace."
                                                  },
                                                  "decimals": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 38,
                                                    "description": "How many decimal places the token's smallest unit represents."
                                                  }
                                                },
                                                "required": [
                                                  "tokenId",
                                                  "decimals"
                                                ],
                                                "description": "The exact token this asset is pinned to."
                                              }
                                            },
                                            "required": [
                                              "pinned"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "any": {
                                                "type": "boolean",
                                                "description": "Any token the agent wallet holds; the executor picks one at execution.",
                                                "enum": [
                                                  true
                                                ]
                                              }
                                            },
                                            "required": [
                                              "any"
                                            ]
                                          }
                                        ],
                                        "description": "The asset this action produces: pinned to one token, or left open."
                                      },
                                      "recipient": {
                                        "type": "object",
                                        "properties": {
                                          "chain": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 32,
                                            "description": "Which chain the destination address is on."
                                          },
                                          "address": {
                                            "type": "string",
                                            "pattern": "^[\\x21-\\x7e]{1,128}$",
                                            "description": "The destination address on that chain."
                                          }
                                        },
                                        "required": [
                                          "chain",
                                          "address"
                                        ],
                                        "description": "The pinned destination this action pays."
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "input",
                                      "quantity",
                                      "output",
                                      "recipient"
                                    ]
                                  }
                                ]
                              },
                              "description": "The actions this contract authorizes, executed in order."
                            },
                            "validUntil": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
                              "description": "When this contract's authority expires."
                            },
                            "maxExecutions": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 10000,
                              "description": "How many times this contract may be executed before it is exhausted."
                            },
                            "maxTotalInput": {
                              "description": "Optional total cap on what all executions together may spend, per input token, in raw units. A $500 budget paid in USDC is 500 USDC. Every action input must be pinned and capped.",
                              "minItems": 1,
                              "maxItems": 16,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "tokenId": {
                                    "type": "string",
                                    "maxLength": 256,
                                    "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                                    "description": "The exact ledger asset identifier, including its token standard namespace."
                                  },
                                  "decimals": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 38,
                                    "description": "How many decimal places the token's smallest unit represents."
                                  },
                                  "amountRaw": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9]\\d{0,38})$",
                                    "description": "The most this contract may spend of this token in total, across every execution, in the token's smallest unit."
                                  }
                                },
                                "required": [
                                  "tokenId",
                                  "decimals",
                                  "amountRaw"
                                ],
                                "description": "One capped input token and its total spend ceiling."
                              }
                            },
                            "bounds": {
                              "type": "object",
                              "properties": {
                                "maxValueLossBps": {
                                  "type": "string",
                                  "pattern": "^(0|[1-9]\\d{0,4})$",
                                  "description": "The most value an execution may give up to price movement and fees together, in basis points; 0 allows no loss."
                                },
                                "maxSignatureLifetimeSeconds": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 259500,
                                  "description": "Explicit maximum lifetime of each released transfer signature, in seconds. 1Click confidential swaps require up to 259500 seconds (72 hours 5 minutes). This does not extend the execution window or approval validity."
                                }
                              },
                              "required": [
                                "maxValueLossBps",
                                "maxSignatureLifetimeSeconds"
                              ],
                              "description": "The value-loss and signature-lifetime limits every execution must respect."
                            },
                            "execution": {
                              "description": "Optional explicit recovery authority, signed with these exact actions and bounds; omitted on historical approvals.",
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "mode": {
                                      "type": "string",
                                      "enum": [
                                        "ordered",
                                        "parallel_independent"
                                      ],
                                      "description": "Ordered actions run in approved order. Parallel-independent actions run up to four concurrently after the complete initially funded request is reserved."
                                    },
                                    "maxPreparationAttempts": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 3,
                                      "description": "The maximum unsigned preparation attempts for each approved action, including its first attempt."
                                    },
                                    "dispatchWindowSeconds": {
                                      "type": "integer",
                                      "minimum": 60,
                                      "maximum": 86400,
                                      "description": "The maximum dispatch window in seconds for this operation, from when its approval opened: exactly 1200 for a new chat request, and up to its signed deadline for an automation's grant. Closing dispatch never proves a submitted transfer did not move; observation continues."
                                    }
                                  },
                                  "required": [
                                    "mode",
                                    "maxPreparationAttempts",
                                    "dispatchWindowSeconds"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "mode": {
                                      "type": "string",
                                      "enum": [
                                        "dependency_graph"
                                      ]
                                    },
                                    "dependencies": {
                                      "minItems": 1,
                                      "maxItems": 16,
                                      "type": "array",
                                      "items": {
                                        "maxItems": 16,
                                        "type": "array",
                                        "items": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 15
                                        }
                                      },
                                      "description": "One row per requested action, listing its sorted unique predecessor action indices. A successor requires confirmed predecessor settlement. Every action must be funded from initial holdings."
                                    },
                                    "maxPreparationAttempts": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 3,
                                      "description": "The maximum unsigned preparation attempts for each approved action, including its first attempt."
                                    },
                                    "dispatchWindowSeconds": {
                                      "type": "integer",
                                      "minimum": 60,
                                      "maximum": 86400,
                                      "description": "The maximum dispatch window in seconds for this operation, from when its approval opened: exactly 1200 for a new chat request, and up to its signed deadline for an automation's grant. Closing dispatch never proves a submitted transfer did not move; observation continues."
                                    }
                                  },
                                  "required": [
                                    "mode",
                                    "dependencies",
                                    "maxPreparationAttempts",
                                    "dispatchWindowSeconds"
                                  ]
                                }
                              ]
                            }
                          },
                          "required": [
                            "type",
                            "actions",
                            "validUntil",
                            "maxExecutions",
                            "bounds"
                          ]
                        },
                        {
                          "$ref": "#/components/schemas/PerpsAutomationContract"
                        },
                        {
                          "$ref": "#/components/schemas/PredictionAutomationContract"
                        },
                        {
                          "oneOf": [
                            {
                              "$ref": "#/components/schemas/SolanaBuyContract"
                            },
                            {
                              "$ref": "#/components/schemas/SolanaSellContract"
                            }
                          ],
                          "description": "A standing Solana grant: an exact buy, or a sale of a fraction of the holding for USDC, made exactly as approved each time the automation fires."
                        }
                      ],
                      "description": "Standing authority for the runs this automation fires: a NEAR Intents transfer contract, a perps automation that opens, reduces or adds margin to the agent's own Hyperliquid position, a Polymarket buy or sale of one outcome, or a Solana buy or sell made exactly as approved."
                    },
                    "maxSigningDelaySeconds": {
                      "description": "Required with a contract and omitted without one: the owner's approved maximum delay after a firing during which its run may obtain signatures, in seconds; separate from delivery lateness and signature lifetime.",
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 86400
                    },
                    "missedRun": {
                      "type": "string",
                      "enum": [
                        "skip",
                        "ask"
                      ],
                      "description": "What happens to a run that can't go through before its deadline: `skip` counts it and keeps the schedule, `ask` pauses the automation until its owner decides. A failure only the owner can fix pauses either way."
                    },
                    "startAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                    },
                    "endAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                    },
                    "resolution": {
                      "type": "string",
                      "enum": [
                        "hourly",
                        "daily"
                      ]
                    },
                    "timing": {
                      "type": "string",
                      "enum": [
                        "preserved",
                        "sampled"
                      ]
                    },
                    "execution": {
                      "type": "string",
                      "enum": [
                        "contract_terms",
                        "triggers_only"
                      ],
                      "description": "Select triggers_only for a discretionary prompt whose concrete trades are unresolved. contract_terms hypothetically executes the fixed proposed trade terms; it does not simulate model decisions or discretionary instructions."
                    },
                    "initialHoldings": {
                      "maxItems": 16,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "tokenId": {
                            "type": "string",
                            "maxLength": 256,
                            "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                            "description": "The exact ledger asset identifier, including its token standard namespace."
                          },
                          "decimals": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 38,
                            "description": "How many decimal places the token's smallest unit represents."
                          },
                          "amountRaw": {
                            "type": "string",
                            "pattern": "^(0|[1-9]\\d{0,38})$"
                          }
                        },
                        "required": [
                          "tokenId",
                          "decimals",
                          "amountRaw"
                        ]
                      }
                    },
                    "funding": {
                      "description": "Select strategy_budget to set aside a finite starting budget from entry sizes and run limits at opening historical prices. Requires empty initialHoldings and cannot be combined with contributeInputs: true. Omit both automatic options to use an explicitly supplied starting portfolio. No live wallet balance is read.",
                      "type": "string",
                      "enum": [
                        "strategy_budget"
                      ]
                    },
                    "contributeInputs": {
                      "description": "When true, start empty and hypothetically supply the input assets for each successfully modeled fixed purchase, valued at its fill time. Requires empty initialHoldings and omitted funding. Contributions are capital, not profit; exits receive no new capital. False or omission leaves the existing funding or explicit portfolio behavior unchanged.",
                      "type": "boolean"
                    },
                    "costBps": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 300
                    },
                    "automationId": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                      "description": "The automation's id."
                    },
                    "definitionVersion": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "name",
                    "prompt",
                    "rule",
                    "startAt",
                    "endAt",
                    "resolution",
                    "timing",
                    "execution",
                    "initialHoldings",
                    "costBps"
                  ]
                },
                "scenarioHash": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{64}$"
                },
                "dataHash": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "engineVersion": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "timingChanges": {
                  "maxItems": 128,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "path": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 512
                      },
                      "before": {
                        "type": "string",
                        "maxLength": 4096
                      },
                      "after": {
                        "type": "string",
                        "maxLength": 4096
                      }
                    },
                    "required": [
                      "path",
                      "before",
                      "after"
                    ]
                  }
                },
                "manifest": {
                  "type": "object",
                  "properties": {
                    "source": {
                      "type": "string",
                      "enum": [
                        "coingecko"
                      ]
                    },
                    "resolution": {
                      "type": "string",
                      "enum": [
                        "hourly",
                        "daily"
                      ]
                    },
                    "availabilityAssumption": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 4096
                    },
                    "assetIds": {
                      "maxItems": 16,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 128,
                        "pattern": "^(?!(?:constructor|prototype|__proto__)$)[a-z0-9][a-z0-9._-]*$"
                      }
                    },
                    "tokenMappings": {
                      "maxItems": 16,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "tokenId": {
                            "type": "string",
                            "maxLength": 256,
                            "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                            "description": "The exact ledger asset identifier, including its token standard namespace."
                          },
                          "decimals": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 38,
                            "description": "How many decimal places the token's smallest unit represents."
                          },
                          "assetId": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 128,
                            "pattern": "^(?!(?:constructor|prototype|__proto__)$)[a-z0-9][a-z0-9._-]*$"
                          }
                        },
                        "required": [
                          "tokenId",
                          "decimals",
                          "assetId"
                        ]
                      }
                    },
                    "firstAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "lastAt": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "source",
                    "resolution",
                    "availabilityAssumption",
                    "assetIds",
                    "tokenMappings",
                    "firstAt",
                    "lastAt"
                  ]
                },
                "skippedByReason": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "additionalProperties": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "holdings": {
                  "maxItems": 16,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "tokenId": {
                        "type": "string",
                        "maxLength": 256,
                        "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                        "description": "The exact ledger asset identifier, including its token standard namespace."
                      },
                      "decimals": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 38,
                        "description": "How many decimal places the token's smallest unit represents."
                      },
                      "amountRaw": {
                        "type": "string",
                        "pattern": "^(0|[1-9]\\d{0,38})$"
                      }
                    },
                    "required": [
                      "tokenId",
                      "decimals",
                      "amountRaw"
                    ]
                  }
                },
                "trades": {
                  "maxItems": 1000,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "plannedAt": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                      },
                      "filledAt": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                      },
                      "actionIndex": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 15
                      },
                      "input": {
                        "type": "object",
                        "properties": {
                          "tokenId": {
                            "type": "string",
                            "maxLength": 256,
                            "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                            "description": "The exact ledger asset identifier, including its token standard namespace."
                          },
                          "decimals": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 38,
                            "description": "How many decimal places the token's smallest unit represents."
                          },
                          "amountRaw": {
                            "type": "string",
                            "pattern": "^(0|[1-9]\\d{0,38})$"
                          }
                        },
                        "required": [
                          "tokenId",
                          "decimals",
                          "amountRaw"
                        ]
                      },
                      "output": {
                        "type": "object",
                        "properties": {
                          "tokenId": {
                            "type": "string",
                            "maxLength": 256,
                            "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                            "description": "The exact ledger asset identifier, including its token standard namespace."
                          },
                          "decimals": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 38,
                            "description": "How many decimal places the token's smallest unit represents."
                          },
                          "amountRaw": {
                            "type": "string",
                            "pattern": "^(0|[1-9]\\d{0,38})$"
                          }
                        },
                        "required": [
                          "tokenId",
                          "decimals",
                          "amountRaw"
                        ]
                      },
                      "costUsdDecimal": {
                        "type": "string",
                        "pattern": "^-?(0|[1-9]\\d{0,77})(\\.\\d{1,36})?$"
                      }
                    },
                    "required": [
                      "plannedAt",
                      "filledAt",
                      "actionIndex",
                      "input",
                      "output",
                      "costUsdDecimal"
                    ]
                  }
                },
                "contributions": {
                  "maxItems": 1000,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "tokenId": {
                        "type": "string",
                        "maxLength": 256,
                        "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
                        "description": "The exact ledger asset identifier, including its token standard namespace."
                      },
                      "decimals": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 38,
                        "description": "How many decimal places the token's smallest unit represents."
                      },
                      "amountRaw": {
                        "type": "string",
                        "pattern": "^(0|[1-9]\\d{0,38})$"
                      },
                      "at": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                        "description": "When the modeled input contribution and purchase settle together."
                      },
                      "actionIndex": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 15
                      },
                      "valueUsdDecimal": {
                        "type": "string",
                        "pattern": "^-?(0|[1-9]\\d{0,77})(\\.\\d{1,36})?$",
                        "description": "Historical USD value of the contributed input tokens at the modeled fill, before trading costs."
                      }
                    },
                    "required": [
                      "tokenId",
                      "decimals",
                      "amountRaw",
                      "at",
                      "actionIndex",
                      "valueUsdDecimal"
                    ]
                  }
                },
                "equity": {
                  "maxItems": 1000,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "at": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                      },
                      "valueUsdDecimal": {
                        "type": "string",
                        "pattern": "^-?(0|[1-9]\\d{0,77})(\\.\\d{1,36})?$"
                      },
                      "contributedValueUsdDecimal": {
                        "description": "Cumulative external contributions through this point, present for contribution-funded estimates. Subtract it and the starting value from portfolio value to chart profit.",
                        "type": "string",
                        "pattern": "^-?(0|[1-9]\\d{0,77})(\\.\\d{1,36})?$"
                      }
                    },
                    "required": [
                      "at",
                      "valueUsdDecimal"
                    ]
                  }
                }
              },
              "required": [
                "status",
                "reason",
                "metrics",
                "counts",
                "throughAt",
                "limitations",
                "scenario",
                "scenarioHash",
                "dataHash",
                "engineVersion",
                "timingChanges",
                "manifest",
                "skippedByReason",
                "holdings",
                "trades",
                "equity"
              ]
            }
          }
        }
      },
      "400": {
        "$ref": "#/components/responses/InvalidInput"
      },
      "401": {
        "$ref": "#/components/responses/Unauthorized"
      },
      "403": {
        "$ref": "#/components/responses/Forbidden"
      },
      "404": {
        "$ref": "#/components/responses/NotFound"
      },
      "409": {
        "description": "The operation lost to the current state.\n\n- `automation_changed` — the automation changed while this request was handled; read it again and retry",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "413": {
        "$ref": "#/components/responses/PayloadTooLarge"
      },
      "429": {
        "$ref": "#/components/responses/TooManyRequests"
      },
      "500": {
        "$ref": "#/components/responses/Internal"
      },
      "503": {
        "$ref": "#/components/responses/Unavailable"
      }
    }
  },
  "components": {
    "schemas": {
      "AutomationRuleInput": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "number",
            "const": 1,
            "description": "The rule schema's version; always `1`."
          },
          "delivery": {
            "default": {
              "overlap": "queue",
              "maxPendingOccurrences": 100
            },
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "overlap": {
                    "type": "string",
                    "const": "queue",
                    "description": "Queue a new occurrence and run it once the active one finishes."
                  },
                  "maxPendingOccurrences": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "description": "How many occurrences may wait in the queue, not counting the one currently active, including one whose run is itself waiting on an approval."
                  }
                },
                "required": [
                  "overlap",
                  "maxPendingOccurrences"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "overlap": {
                    "type": "string",
                    "const": "coalesce",
                    "description": "Close the occurrence already pending as `coalesced` and record the new match as a fresh occurrence, rather than queuing a second."
                  }
                },
                "required": [
                  "overlap"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "overlap": {
                    "type": "string",
                    "const": "skip",
                    "description": "Drop a new match while an occurrence is already active."
                  }
                },
                "required": [
                  "overlap"
                ],
                "additionalProperties": false
              }
            ],
            "description": "What happens when a new occurrence is ready before the previous one has finished."
          },
          "maxDeliveryLatenessSeconds": {
            "default": 86400,
            "description": "How long a new occurrence may wait to be delivered before its deadline passes and it is refused, in seconds.",
            "type": "integer",
            "minimum": 1,
            "maximum": 86400
          },
          "maxEvaluationGapSeconds": {
            "default": 600,
            "description": "The longest gap allowed between evaluations before `firing.mode: rising_edge` treats its history as broken and waits for a fresh baseline, in seconds.",
            "type": "integer",
            "minimum": 1,
            "maximum": 2678400
          },
          "wakes": {
            "minItems": 1,
            "maxItems": 7,
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "at",
                      "description": "A one-time wake at an exact moment; exhausted after that check, even if its condition is false."
                    },
                    "runAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                      "description": "The exact moment this wake fires, as an ISO 8601 timestamp with an offset."
                    },
                    "misfire": {
                      "default": {
                        "mode": "latest",
                        "maxLatenessSeconds": null
                      },
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "mode": {
                              "type": "string",
                              "const": "skip",
                              "description": "Drop a wake the engine could not evaluate in time; wait for the next one."
                            },
                            "graceSeconds": {
                              "default": 5,
                              "description": "How late this wake may still run before it counts as missed, in seconds.",
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 60
                            }
                          },
                          "required": [
                            "mode"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "mode": {
                              "type": "string",
                              "const": "latest",
                              "description": "Run once for the most recently missed wake, dropping any earlier ones."
                            },
                            "maxLatenessSeconds": {
                              "default": null,
                              "description": "How late a missed wake may still run, in seconds; null for no limit.",
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 2678400
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "mode"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "mode": {
                              "type": "string",
                              "const": "all",
                              "description": "Run once for every missed wake, oldest first."
                            },
                            "maxLatenessSeconds": {
                              "default": null,
                              "description": "How late a missed wake may still run, in seconds; null for no limit.",
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 2678400
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "mode"
                          ],
                          "additionalProperties": false
                        }
                      ],
                      "description": "What happens when the engine could not evaluate this wake on time."
                    },
                    "evaluationTime": {
                      "default": "detection_time",
                      "description": "Which moment this wake is evaluated as of: `scheduled_time` the time it was due, `detection_time` when the engine actually ran it.",
                      "type": "string",
                      "enum": [
                        "scheduled_time",
                        "detection_time"
                      ]
                    }
                  },
                  "required": [
                    "kind",
                    "runAt"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "interval",
                      "description": "A wake that repeats on a fixed elapsed interval."
                    },
                    "intervalMinutes": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 44640,
                      "description": "How often this wake repeats, in minutes."
                    },
                    "misfire": {
                      "default": {
                        "mode": "latest",
                        "maxLatenessSeconds": null
                      },
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "mode": {
                              "type": "string",
                              "const": "skip",
                              "description": "Drop a wake the engine could not evaluate in time; wait for the next one."
                            },
                            "graceSeconds": {
                              "default": 5,
                              "description": "How late this wake may still run before it counts as missed, in seconds.",
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 60
                            }
                          },
                          "required": [
                            "mode"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "mode": {
                              "type": "string",
                              "const": "latest",
                              "description": "Run once for the most recently missed wake, dropping any earlier ones."
                            },
                            "maxLatenessSeconds": {
                              "default": null,
                              "description": "How late a missed wake may still run, in seconds; null for no limit.",
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 2678400
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "mode"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "mode": {
                              "type": "string",
                              "const": "all",
                              "description": "Run once for every missed wake, oldest first."
                            },
                            "maxLatenessSeconds": {
                              "default": null,
                              "description": "How late a missed wake may still run, in seconds; null for no limit.",
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 2678400
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "mode"
                          ],
                          "additionalProperties": false
                        }
                      ],
                      "description": "What happens when the engine could not evaluate this wake on time."
                    },
                    "evaluationTime": {
                      "default": "detection_time",
                      "description": "Which moment this wake is evaluated as of: `scheduled_time` the time it was due, `detection_time` when the engine actually ran it.",
                      "type": "string",
                      "enum": [
                        "scheduled_time",
                        "detection_time"
                      ]
                    }
                  },
                  "required": [
                    "kind",
                    "intervalMinutes"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "calendar",
                      "description": "A wake on a recurring calendar schedule: local times, weekdays, months and days of the month."
                    },
                    "timeZone": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80,
                      "description": "The IANA time zone a calendar wake's local times are interpreted in."
                    },
                    "localTimes": {
                      "minItems": 1,
                      "maxItems": 24,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
                      },
                      "description": "The times of day this wake fires, each in 24-hour `HH:MM` form, in `timeZone`."
                    },
                    "weekdays": {
                      "default": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7
                      ],
                      "description": "Which ISO weekdays this wake fires on, 1 (Monday) through 7 (Sunday). Defaults to every day.",
                      "minItems": 1,
                      "maxItems": 7,
                      "type": "array",
                      "items": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 7
                      }
                    },
                    "months": {
                      "default": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12
                      ],
                      "description": "Which months this wake fires in, 1 (January) through 12 (December). Defaults to every month.",
                      "minItems": 1,
                      "maxItems": 12,
                      "type": "array",
                      "items": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 12
                      }
                    },
                    "monthDays": {
                      "default": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25,
                        26,
                        27,
                        28,
                        29,
                        30,
                        31
                      ],
                      "description": "Which days of the month this wake fires on, 1 through 31. Defaults to every day.",
                      "minItems": 1,
                      "maxItems": 31,
                      "type": "array",
                      "items": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 31
                      }
                    },
                    "misfire": {
                      "default": {
                        "mode": "latest",
                        "maxLatenessSeconds": null
                      },
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "mode": {
                              "type": "string",
                              "const": "skip",
                              "description": "Drop a wake the engine could not evaluate in time; wait for the next one."
                            },
                            "graceSeconds": {
                              "default": 5,
                              "description": "How late this wake may still run before it counts as missed, in seconds.",
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 60
                            }
                          },
                          "required": [
                            "mode"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "mode": {
                              "type": "string",
                              "const": "latest",
                              "description": "Run once for the most recently missed wake, dropping any earlier ones."
                            },
                            "maxLatenessSeconds": {
                              "default": null,
                              "description": "How late a missed wake may still run, in seconds; null for no limit.",
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 2678400
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "mode"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "mode": {
                              "type": "string",
                              "const": "all",
                              "description": "Run once for every missed wake, oldest first."
                            },
                            "maxLatenessSeconds": {
                              "default": null,
                              "description": "How late a missed wake may still run, in seconds; null for no limit.",
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 2678400
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "mode"
                          ],
                          "additionalProperties": false
                        }
                      ],
                      "description": "What happens when the engine could not evaluate this wake on time."
                    },
                    "evaluationTime": {
                      "default": "detection_time",
                      "description": "Which moment this wake is evaluated as of: `scheduled_time` the time it was due, `detection_time` when the engine actually ran it.",
                      "type": "string",
                      "enum": [
                        "scheduled_time",
                        "detection_time"
                      ]
                    }
                  },
                  "required": [
                    "kind",
                    "timeZone",
                    "localTimes"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "event",
                      "description": "A wake evaluated each time a matching custom webhook event arrives."
                    },
                    "eventType": {
                      "type": "string",
                      "pattern": "^[A-Za-z][A-Za-z0-9_.:-]{0,79}$",
                      "description": "The event `type` this wake matches; a live webhook delivery of a different type is ignored before it reaches the condition."
                    },
                    "fields": {
                      "maxItems": 32,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "path": {
                            "minItems": 1,
                            "maxItems": 8,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "pattern": "^[A-Za-z_][A-Za-z0-9_-]{0,63}$"
                            },
                            "description": "The keys to walk, in order, from an observation's top level down to this field."
                          },
                          "valueType": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "boolean",
                                    "description": "A true/false value."
                                  }
                                },
                                "required": [
                                  "type"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "string",
                                    "description": "A text value."
                                  }
                                },
                                "required": [
                                  "type"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "integer",
                                    "description": "A whole-number value, compared exactly."
                                  },
                                  "unit": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 64,
                                    "description": "The unit an integer or decimal value is measured in, as the source or literal declares it."
                                  }
                                },
                                "required": [
                                  "type",
                                  "unit"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "decimal",
                                    "description": "An exact decimal value, as text, compared exactly."
                                  },
                                  "unit": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 64,
                                    "description": "The unit an integer or decimal value is measured in, as the source or literal declares it."
                                  }
                                },
                                "required": [
                                  "type",
                                  "unit"
                                ],
                                "additionalProperties": false
                              }
                            ],
                            "description": "What type this field's value has, and the unit it carries when it has one."
                          },
                          "optional": {
                            "description": "Whether the provider may genuinely not observe this field, rather than fail to read it. When true, a missing value resolves a condition over it to `missing_field` and the rule's verdict to `unknown`, rather than zero, null or false.",
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "path",
                          "valueType"
                        ],
                        "additionalProperties": false,
                        "description": "One data field an event or a source's observation carries: where it lives, and its type."
                      },
                      "description": "The data fields an event of this type is declared to carry."
                    }
                  },
                  "required": [
                    "kind",
                    "eventType",
                    "fields"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "reader_update",
                      "description": "A wake evaluated each time the named reader delivers a fresh observation."
                    },
                    "binding": {
                      "type": "string",
                      "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,31}$",
                      "description": "The binding name a rule or a plan gives one configured source."
                    }
                  },
                  "required": [
                    "kind",
                    "binding"
                  ],
                  "additionalProperties": false
                }
              ]
            },
            "description": "Occasions to evaluate the rule's condition: alternatives, not an AND of conditions. At most one clock and one event stream."
          },
          "readers": {
            "maxItems": 4,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,31}$",
                  "description": "The binding name a rule or a plan gives one configured source."
                },
                "readerId": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_.-]{0,79}$",
                  "description": "The installed source operation's id, as listed by List automation data sources."
                },
                "config": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "$ref": "#/components/schemas/AutomationJsonValueInput"
                  },
                  "description": "Arbitrary JSON data: an event's data, a reader's configuration, or a source plan's configuration. Bounded to 16 KiB, 8 levels of nesting and 256 entries."
                },
                "delivery": {
                  "description": "Use reviewed push updates; omit for periodic snapshots.",
                  "type": "string",
                  "const": "push"
                },
                "pollIntervalSeconds": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 2147483,
                  "description": "Polling cadence, or subscription lease/reconciliation cadence for push delivery, in seconds."
                },
                "maxAgeSeconds": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 86400,
                  "description": "Maximum retained input age at evaluation, matching requirement.maxAgeSeconds when present. Snapshots use observation time; events use trusted receipt time. Collection separately enforces the provider's acquisition-age guarantee."
                },
                "requirement": {
                  "type": "object",
                  "properties": {
                    "maxLatencySeconds": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The target delay between an observation and its delivery, in seconds; null when delivery has no target deadline."
                    },
                    "maxAgeSeconds": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 86400,
                      "description": "Maximum acceptable input age at evaluation, matching the reader's maxAgeSeconds, measured from the provider's own observation time. The selected provider's acquisition guarantee must fit within this limit and does not reduce this evaluation window."
                    },
                    "allowDegradedLatency": {
                      "type": "boolean",
                      "description": "Whether delivery slower than the target delay is still accepted."
                    },
                    "maxAcceptedLatencySeconds": {
                      "description": "The slowest delivery still accepted, in seconds, when `allowDegradedLatency` is set.",
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483
                    }
                  },
                  "required": [
                    "maxLatencySeconds",
                    "maxAgeSeconds",
                    "allowDegradedLatency"
                  ],
                  "additionalProperties": false,
                  "description": "What a reader needs from its source: how fresh an answer must be, and whether a slower one is still acceptable."
                }
              },
              "required": [
                "name",
                "readerId",
                "config",
                "pollIntervalSeconds",
                "maxAgeSeconds"
              ],
              "additionalProperties": false
            },
            "description": "The named source bindings this rule reads from, referenced by `condition` and by each `reader_update` wake's `binding`."
          },
          "condition": {
            "description": "The rule's condition tree, up to 8 levels deep and 128 nodes total, built from five node kinds: `{op:\"bool\", value}` a fixed true/false leaf; `{op:\"compare\", comparator, left, right}` one of `eq`/`ne`/`lt`/`lte`/`gt`/`gte` between two operands — `lt`/`lte`/`gt`/`gte` require both operands to be `integer` or `decimal`, and both sides must share the same type and, for `integer`/`decimal`, the same unit; `{op:\"all\", args}` / `{op:\"any\", args}` AND/OR over one or more child nodes; `{op:\"not\", arg}` negates one child node. An operand is either `{kind:\"field\", binding, path}` — a bound reader's name and the key path into its data — or `{kind:\"literal\", type, value, unit?}` with `type` one of `boolean`/`string`/`integer`/`decimal` (`integer`/`decimal` values are exact decimal strings and carry `unit`)."
          },
          "exit": {
            "description": "The exit watch, when this rule's automation has exit actions on its contract. Present exactly when the contract has an exit action.",
            "type": "object",
            "properties": {
              "intervalSeconds": {
                "type": "integer",
                "minimum": 60,
                "maximum": 2678400,
                "description": "How often this automation re-checks its exit guards, in seconds; at least 60 and at most 2678400 (31 days), the same span an interval wake may cover. Recommend 300."
              },
              "readers": {
                "type": "object",
                "properties": {
                  "asset": {
                    "type": "string",
                    "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,31}$",
                    "description": "The binding in `readers` that prices the asset this automation bought, in USD."
                  },
                  "quote": {
                    "type": "string",
                    "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,31}$",
                    "description": "The binding in `readers` that prices the token this automation pays with, in USD."
                  }
                },
                "required": [
                  "asset",
                  "quote"
                ],
                "additionalProperties": false,
                "description": "The two price bindings each exit guard is measured against; both must be the reviewed USD token-price operation."
              },
              "push": {
                "description": "Additional push-delivered USD prices that may check exits between periodic 1Click checks.",
                "type": "object",
                "properties": {
                  "readers": {
                    "type": "object",
                    "properties": {
                      "asset": {
                        "type": "string",
                        "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,31}$",
                        "description": "The binding name a rule or a plan gives one configured source."
                      },
                      "quote": {
                        "type": "string",
                        "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,31}$",
                        "description": "The binding name a rule or a plan gives one configured source."
                      }
                    },
                    "required": [
                      "asset",
                      "quote"
                    ],
                    "additionalProperties": false,
                    "description": "The supplementary price bindings for the bought asset and its paying token."
                  }
                },
                "required": [
                  "readers"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "intervalSeconds",
              "readers"
            ],
            "additionalProperties": false
          },
          "firing": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "each_match",
                  "rising_edge"
                ],
                "description": "When a qualifying evaluation fires: `each_match` fires on every qualifying evaluation, including the first; `rising_edge` fires only on a known false-to-true transition."
              },
              "repeat": {
                "type": "string",
                "enum": [
                  "once",
                  "repeating"
                ],
                "description": "Whether this rule fires at most once, or keeps watching after it fires."
              },
              "maxRuns": {
                "description": "Maximum deliverable runs recorded for this automation across pauses and resumes. Missed or refused deliveries do not count; recorded runs count even if later canceled, coalesced or failed. Omit for no finite limit beyond repeat=once.",
                "type": "integer",
                "minimum": 1,
                "maximum": 1000000
              },
              "initial": {
                "type": "string",
                "enum": [
                  "baseline",
                  "fire_if_true"
                ],
                "description": "How `rising_edge` treats the first known state: `baseline` records it without firing, `fire_if_true` fires immediately if it is already true."
              },
              "cooldownSeconds": {
                "type": "integer",
                "minimum": 0,
                "maximum": 2678400,
                "description": "The minimum time between firings, in seconds; it does not require the condition to stay true that whole time. For `rising_edge`, a false-to-true edge that lands inside cooldown is discarded, not queued: it is not replayed once cooldown ends, so the rule needs an entirely fresh edge after cooldown lapses before it fires again — simply remaining true past the cooldown boundary does not trigger a firing."
              }
            },
            "required": [
              "mode",
              "repeat",
              "initial",
              "cooldownSeconds"
            ],
            "additionalProperties": false,
            "description": "How this rule turns a qualifying evaluation into a firing: which ones count, how often, and how many."
          },
          "news": {
            "description": "Present only on a news exit: the owner's own words, which Fin's news judge reads new stories against. Its rule is fixed: one `news.judged` event wake, no readers, the judged condition and one firing, over a reduce-only perps contract.",
            "type": "object",
            "properties": {
              "condition": {
                "type": "string",
                "minLength": 3,
                "maxLength": 500,
                "description": "The owner's condition in their own words, exactly as they said it, such as `right before Anthropic's IPO`. Never paraphrased: the judge reads the news against these words."
              },
              "match": {
                "type": "string",
                "minLength": 2,
                "maxLength": 80,
                "pattern": "^[\\p{L}\\p{N} .'&-]+$",
                "description": "A few words every story the judge reads must contain in its headline or summary, such as `Anthropic IPO`: a broad filter, not the condition. The judge decides from the condition."
              }
            },
            "required": [
              "condition",
              "match"
            ],
            "additionalProperties": false
          },
          "maxSnapshotSkewSeconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400,
            "description": "The most that bound readers' observation times may disagree before evaluation reports `snapshot_skew`, in seconds."
          }
        },
        "required": [
          "schemaVersion",
          "wakes",
          "readers",
          "condition",
          "firing",
          "maxSnapshotSkewSeconds"
        ],
        "additionalProperties": false,
        "description": "One automation's rule: when it wakes, what condition it evaluates, and how it fires."
      },
      "AutomationJsonValueInput": {
        "description": "Any JSON value: a string, number, boolean, null, array or object, nested to any depth.",
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "number"
          },
          {
            "type": "boolean"
          },
          {
            "type": "null"
          },
          {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutomationJsonValueInput"
            }
          },
          {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/AutomationJsonValueInput"
            }
          }
        ]
      },
      "PerpsAutomationContractInput": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "perps_automation",
            "description": "Which authorization contract this is."
          },
          "coin": {
            "type": "string",
            "pattern": "^(?:xyz:)?[A-Za-z0-9]{1,20}$",
            "description": "The market's coin name exactly as perps_markets lists it, such as `BTC` or `xyz:TSLA`."
          },
          "asset": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1099999,
            "description": "The market's asset id exactly as perps_markets lists it for that coin."
          },
          "position": {
            "type": "string",
            "enum": [
              "long",
              "short"
            ],
            "description": "The position the action is for. `open` acts only while the agent holds nothing on this coin; `reduce` and `add_margin` act only while it holds this side, and nothing happens otherwise."
          },
          "action": {
            "$ref": "#/components/schemas/PerpsAutomationActionInput"
          },
          "maxExecutions": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "description": "How many firings may act under this approval."
          },
          "validUntil": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "The deadline after which this approval authorizes nothing."
          }
        },
        "required": [
          "type",
          "coin",
          "asset",
          "position",
          "action",
          "maxExecutions",
          "validUntil"
        ],
        "additionalProperties": false,
        "description": "A standing approval for one perps automation: open the agent's own position while it holds nothing on the coin, reduce or close it, or add margin to its own account, each time its rule fires, up to its limits."
      },
      "PerpsAutomationActionInput": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "reduce",
                "description": "Reduce or close the position."
              },
              "fractionBps": {
                "type": "integer",
                "minimum": 1,
                "maximum": 10000,
                "description": "How much of the position to close, in basis points: 10000 closes it all."
              },
              "maxSlippageBps": {
                "type": "integer",
                "minimum": 1,
                "maximum": 500,
                "description": "The worst fill allowed, in basis points from the mark when it fires."
              }
            },
            "required": [
              "kind",
              "fractionBps",
              "maxSlippageBps"
            ],
            "additionalProperties": false,
            "description": "Close part or all of the position with a reduce-only market order."
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "add_margin",
                "description": "Add margin to the perps account."
              },
              "amountRaw": {
                "type": "string",
                "pattern": "^(0|[1-9]\\d{0,38})$",
                "description": "Exact USDC moved from the agent wallet into the perps account, six decimals: 5 USDC is \"5000000\"."
              },
              "maxValueLossBps": {
                "type": "integer",
                "minimum": 0,
                "maximum": 300,
                "description": "Maximum value lost to fees moving it, in basis points."
              }
            },
            "required": [
              "kind",
              "amountRaw",
              "maxValueLossBps"
            ],
            "additionalProperties": false,
            "description": "Fund the agent's own perps account from its agent wallet."
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "open",
                "description": "Open the position at market."
              },
              "notionalUsd": {
                "type": "string",
                "pattern": "^(0|[1-9][0-9]{0,6})(\\.[0-9]{1,2})?$",
                "description": "The position's size in US dollars at the mark when it fires, at most two places: a $200 position is \"200\". The size in the coin is this over the mark, rounded down to the market's size precision."
              },
              "leverage": {
                "type": "integer",
                "minimum": 1,
                "maximum": 100,
                "description": "Leverage the user chose for this market, at most the market's maximum. Never assume it: ask the user."
              },
              "marginMode": {
                "type": "string",
                "enum": [
                  "cross",
                  "isolated"
                ],
                "description": "How the position is margined, which the user chose with the leverage: `cross` shares the account's margin, `isolated` risks only this position's own. An isolated-only market takes `isolated`. Never assume it: ask the user."
              },
              "maxSlippageBps": {
                "type": "integer",
                "minimum": 1,
                "maximum": 500,
                "description": "The worst fill allowed, in basis points from the mark when it fires; the take-profit and stop-loss fill within the same bound of their trigger."
              },
              "takeProfitPercent": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^(0|[1-9][0-9]?)(\\.[0-9]{0,3}[1-9])?$"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "A native take-profit this far from the mark when it opens, in percent of price in the position's favour (\"10\" is 10%), or null for none."
              },
              "stopLossPercent": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^(0|[1-9][0-9]?)(\\.[0-9]{0,3}[1-9])?$"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "A native stop-loss this far from the mark when it opens, in percent of price against the position (\"5\" is 5%), or null for none."
              }
            },
            "required": [
              "kind",
              "notionalUsd",
              "leverage",
              "marginMode",
              "maxSlippageBps",
              "takeProfitPercent",
              "stopLossPercent"
            ],
            "additionalProperties": false,
            "description": "Open the position with a market order, only while the agent holds nothing on this coin, optionally protected by a native take-profit and stop-loss."
          }
        ],
        "description": "What a perps automation does each time its rule fires: open the named position while the agent holds nothing on its coin, reduce the named position, or add margin to the agent's own perps account."
      },
      "PredictionAutomationContractInput": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "prediction_automation",
            "description": "Which authorization contract this is."
          },
          "market": {
            "type": "object",
            "properties": {
              "marketId": {
                "type": "string",
                "pattern": "^[1-9][0-9]{0,19}$",
                "description": "The market's id exactly as prediction_market returns it."
              },
              "conditionId": {
                "type": "string",
                "pattern": "^0x[0-9a-fA-F]{64}$",
                "description": "The market's conditionId exactly as prediction_market returns it."
              },
              "assetId": {
                "type": "string",
                "pattern": "^[1-9][0-9]{0,77}$",
                "description": "The outcome's CLOB token id, exactly the assetId prediction_market lists for that outcome. Yes and No are different tokens."
              },
              "marketQuestion": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1000,
                "description": "The market's question exactly as prediction_market returns it."
              },
              "outcome": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256,
                "description": "The outcome's name exactly as prediction_market returns it."
              }
            },
            "required": [
              "marketId",
              "conditionId",
              "assetId",
              "marketQuestion",
              "outcome"
            ],
            "additionalProperties": false,
            "description": "The one Polymarket outcome this automation trades."
          },
          "action": {
            "$ref": "#/components/schemas/PredictionAutomationActionInput"
          },
          "maxExecutions": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "description": "How many firings may trade under this approval; a buy spends at most maxExecutions × amountUsdDecimal in all."
          },
          "validUntil": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "The deadline after which this approval authorizes nothing."
          }
        },
        "required": [
          "type",
          "market",
          "action",
          "maxExecutions",
          "validUntil"
        ],
        "additionalProperties": false,
        "description": "A standing approval for one Polymarket automation: buy one outcome with a USD budget at no more than a maximum price, or sell a share of the agent's holding of it at no less than a minimum price, each time its rule fires, up to its limits."
      },
      "PredictionAutomationActionInput": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "buy",
                "description": "Buy shares of the outcome."
              },
              "amountUsdDecimal": {
                "type": "string",
                "pattern": "^(0|[1-9][0-9]{0,6})(\\.[0-9]{1,2})?$",
                "description": "The USD each firing spends before fees, to the cent: \"50\" is $50. Each buy is an immediate order that fills what it can at once and cancels the rest."
              },
              "maxPriceUsdDecimal": {
                "type": "string",
                "pattern": "^0\\.[0-9]{1,4}$",
                "description": "The most a share may cost, as the market's chance: \"0.32\" never pays more than 32¢ a share. Use a price on the market's tick."
              },
              "maxFeeUsdDecimal": {
                "type": "string",
                "pattern": "^(0|[1-9][0-9]{0,6})(\\.[0-9]{1,6})?$",
                "description": "The most each firing may pay Polymarket in fees, in USD: \"1\" is $1."
              }
            },
            "required": [
              "kind",
              "amountUsdDecimal",
              "maxPriceUsdDecimal",
              "maxFeeUsdDecimal"
            ],
            "additionalProperties": false,
            "description": "Buy the outcome with a USD budget at no more than a maximum price."
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "sell",
                "description": "Sell shares of the outcome."
              },
              "fractionBps": {
                "type": "integer",
                "minimum": 1,
                "maximum": 10000,
                "description": "How much of the agent's holding of the outcome each firing sells, in basis points: 10000 sells it all."
              },
              "minPriceUsdDecimal": {
                "type": "string",
                "pattern": "^0\\.[0-9]{1,4}$",
                "description": "The least a share may sell for, as the market's chance: \"0.7\" never sells below 70¢ a share. Use a price on the market's tick."
              },
              "maxFeeUsdDecimal": {
                "type": "string",
                "pattern": "^(0|[1-9][0-9]{0,6})(\\.[0-9]{1,6})?$",
                "description": "The most each firing may pay Polymarket in fees, in USD: \"1\" is $1."
              }
            },
            "required": [
              "kind",
              "fractionBps",
              "minPriceUsdDecimal",
              "maxFeeUsdDecimal"
            ],
            "additionalProperties": false,
            "description": "Sell a share of the agent's holding of the outcome at no less than a minimum price."
          }
        ],
        "description": "What a Polymarket automation does each time its rule fires: buy the outcome with a USD budget at no more than a maximum price, or sell a share of the agent's holding of it at no less than a minimum price."
      },
      "SolanaBuyContractInput": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "solana_buy",
            "description": "Which authorization contract this is."
          },
          "buy": {
            "description": "The exact approved token, payment, all-in loss bound and SOL top-up cap, and, for a buy whose funding pays with a coin, that coin and the most of it it may spend.",
            "$ref": "#/components/schemas/SolanaBuyInputInput"
          },
          "maxExecutions": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000,
            "description": "How many times this grant may execute: 1 for a one-shot approval."
          },
          "validUntil": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "When this grant's authority expires; for a one-shot approval, the approval's own expiry."
          }
        },
        "required": [
          "type",
          "buy",
          "maxExecutions",
          "validUntil"
        ],
        "additionalProperties": false,
        "description": "An approved Solana buy, executed only exactly as approved."
      },
      "SolanaBuyInputInput": {
        "type": "object",
        "properties": {
          "token": {
            "description": "The exact token to buy.",
            "$ref": "#/components/schemas/SolanaTokenInput"
          },
          "pay": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "usdc",
                    "description": "Pay from one USDC or USDT holding of the agent wallet (USDC on NEAR, Base, Arbitrum, Ethereum or Solana, or USDT on NEAR; any USDC that covers it before USDT), moved to Solana as SOL first."
                  },
                  "amountRaw": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,38})$",
                    "description": "Exact USDC or USDT to spend, in six-decimal atomic units: $50 is \"50000000\". At least 5 (\"5000000\"); a smaller buy is refused."
                  }
                },
                "required": [
                  "kind",
                  "amountRaw"
                ],
                "additionalProperties": false,
                "description": "Spend an exact amount of USDC or USDT from the agent wallet."
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "sol",
                    "description": "Pay with SOL already in the agent's Solana account."
                  },
                  "lamports": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,38})$",
                    "description": "Exact SOL to spend, in lamports (nine decimals): 0.5 SOL is \"500000000\"."
                  }
                },
                "required": [
                  "kind",
                  "lamports"
                ],
                "additionalProperties": false,
                "description": "Spend an exact amount of SOL the agent's Solana account already holds."
              }
            ],
            "description": "What the buy spends, as an exact input amount. Buying an exact number of tokens is not supported."
          },
          "maxValueLossBps": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1500,
            "description": "Explicit all-in maximum value loss in basis points, from the value paid to the value received, fees and price impact included: at least 1, at most 1500. Required; no default."
          },
          "maxSolTopUpUsdcRaw": {
            "type": "string",
            "pattern": "^(0|[1-9]\\d{0,38})$",
            "description": "The most extra USDC or USDT the funding may add to keep SOL in the Solana account for network fees, in six-decimal atomic units: \"0\" for none, at most \"1000000\" (1 USDC). Must be \"0\" when paying with SOL."
          },
          "payWith": {
            "description": "A buy paid in dollars and approved in chat as one call: the coin its funding pays with instead of a USDC or USDT holding, and the most of it it may spend, the SOL top-up included. Never SOL. A buy from a token's page refuses it.",
            "$ref": "#/components/schemas/VenueFundingPaymentInput"
          }
        },
        "required": [
          "token",
          "pay",
          "maxValueLossBps",
          "maxSolTopUpUsdcRaw"
        ],
        "additionalProperties": false,
        "description": "One exact-input buy of a Solana token through the agent's own Solana account."
      },
      "SolanaTokenInput": {
        "type": "object",
        "properties": {
          "mint": {
            "type": "string",
            "minLength": 32,
            "maxLength": 44,
            "pattern": "^[1-9A-HJ-NP-Za-km-z]+$",
            "description": "The token's mint address, exactly as solana_token_search or solana_token returned it. Never a ticker."
          },
          "decimals": {
            "type": "integer",
            "minimum": 0,
            "maximum": 18,
            "description": "The mint's decimals, exactly as returned with the mint."
          },
          "tokenProgram": {
            "type": "string",
            "enum": [
              "spl_token",
              "token_2022"
            ],
            "description": "The program that owns the mint, exactly as returned with the mint: `spl_token` or `token_2022`."
          }
        },
        "required": [
          "mint",
          "decimals",
          "tokenProgram"
        ],
        "additionalProperties": false,
        "description": "One Solana token, pinned by its mint, its decimals and its token program."
      },
      "VenueFundingPaymentInput": {
        "type": "object",
        "properties": {
          "tokenId": {
            "type": "string",
            "maxLength": 256,
            "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
            "description": "The exact ledger asset identifier, including its token standard namespace."
          },
          "decimals": {
            "type": "integer",
            "minimum": 0,
            "maximum": 38,
            "description": "How many decimal places the token's smallest unit represents."
          },
          "maxInputRaw": {
            "type": "string",
            "pattern": "^(0|[1-9]\\d{0,38})$",
            "description": "The most of the coin this funding may spend, in its smallest unit: the approved dollars at the price read when the approval opened, plus 5%."
          }
        },
        "required": [
          "tokenId",
          "decimals",
          "maxInputRaw"
        ],
        "additionalProperties": false,
        "description": "The coin this funding pays with and the most of it it may spend, as the owner approved them. Absent: the funding spends one USDC or USDT holding."
      },
      "SolanaSellContractInput": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "solana_sell",
            "description": "Which authorization contract this is."
          },
          "sell": {
            "description": "The exact approved token, amount, proceeds and all-in loss bound.",
            "$ref": "#/components/schemas/SolanaSellInputInput"
          },
          "maxExecutions": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000,
            "description": "How many times this grant may execute: 1 for a one-shot approval."
          },
          "validUntil": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "When this grant's authority expires; for a one-shot approval, the approval's own expiry."
          }
        },
        "required": [
          "type",
          "sell",
          "maxExecutions",
          "validUntil"
        ],
        "additionalProperties": false,
        "description": "An approved Solana sell, executed only exactly as approved."
      },
      "SolanaSellInputInput": {
        "type": "object",
        "properties": {
          "token": {
            "description": "The exact token to sell.",
            "$ref": "#/components/schemas/SolanaTokenInput"
          },
          "amount": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "exact",
                    "description": "Sell an exact amount of the token."
                  },
                  "amountRaw": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,38})$",
                    "description": "Exact amount of the token to sell, in its smallest unit (scaled by the token's decimals)."
                  }
                },
                "required": [
                  "kind",
                  "amountRaw"
                ],
                "additionalProperties": false,
                "description": "Sell an exact amount of the token."
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "fraction",
                    "description": "Sell a share of what the Solana account holds of the token."
                  },
                  "bps": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10000,
                    "description": "The share to sell, in basis points of the account's balance of the token: all of it is 10000, half is 5000."
                  }
                },
                "required": [
                  "kind",
                  "bps"
                ],
                "additionalProperties": false,
                "description": "Sell a share of the account's balance of the token."
              }
            ],
            "description": "How much of the token to sell."
          },
          "receive": {
            "type": "string",
            "enum": [
              "usdc",
              "sol"
            ],
            "description": "`usdc` returns the proceeds to the agent wallet as USDC on NEAR, which is what selling means; `sol` keeps them as SOL in the agent's Solana account."
          },
          "maxValueLossBps": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1500,
            "description": "Explicit all-in maximum value loss in basis points, from the value paid to the value received, fees and price impact included: at least 1, at most 1500. Required; no default."
          }
        },
        "required": [
          "token",
          "amount",
          "receive",
          "maxValueLossBps"
        ],
        "additionalProperties": false,
        "description": "One sell of a Solana token held in the agent's own Solana account."
      },
      "AutomationRule": {
        "type": "object",
        "properties": {
          "schemaVersion": {
            "type": "number",
            "const": 1,
            "description": "The rule schema's version; always `1`."
          },
          "delivery": {
            "default": {
              "overlap": "queue",
              "maxPendingOccurrences": 100
            },
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "overlap": {
                    "type": "string",
                    "const": "queue",
                    "description": "Queue a new occurrence and run it once the active one finishes."
                  },
                  "maxPendingOccurrences": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "description": "How many occurrences may wait in the queue, not counting the one currently active, including one whose run is itself waiting on an approval."
                  }
                },
                "required": [
                  "overlap",
                  "maxPendingOccurrences"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "overlap": {
                    "type": "string",
                    "const": "coalesce",
                    "description": "Close the occurrence already pending as `coalesced` and record the new match as a fresh occurrence, rather than queuing a second."
                  }
                },
                "required": [
                  "overlap"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "overlap": {
                    "type": "string",
                    "const": "skip",
                    "description": "Drop a new match while an occurrence is already active."
                  }
                },
                "required": [
                  "overlap"
                ]
              }
            ],
            "description": "What happens when a new occurrence is ready before the previous one has finished."
          },
          "maxDeliveryLatenessSeconds": {
            "default": 86400,
            "description": "How long a new occurrence may wait to be delivered before its deadline passes and it is refused, in seconds.",
            "type": "integer",
            "minimum": 1,
            "maximum": 86400
          },
          "maxEvaluationGapSeconds": {
            "default": 600,
            "description": "The longest gap allowed between evaluations before `firing.mode: rising_edge` treats its history as broken and waits for a fresh baseline, in seconds.",
            "type": "integer",
            "minimum": 1,
            "maximum": 2678400
          },
          "wakes": {
            "minItems": 1,
            "maxItems": 7,
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "at",
                      "description": "A one-time wake at an exact moment; exhausted after that check, even if its condition is false."
                    },
                    "runAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                      "description": "The exact moment this wake fires, as an ISO 8601 timestamp with an offset."
                    },
                    "misfire": {
                      "default": {
                        "mode": "latest",
                        "maxLatenessSeconds": null
                      },
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "mode": {
                              "type": "string",
                              "const": "skip",
                              "description": "Drop a wake the engine could not evaluate in time; wait for the next one."
                            },
                            "graceSeconds": {
                              "default": 5,
                              "description": "How late this wake may still run before it counts as missed, in seconds.",
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 60
                            }
                          },
                          "required": [
                            "mode",
                            "graceSeconds"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "mode": {
                              "type": "string",
                              "const": "latest",
                              "description": "Run once for the most recently missed wake, dropping any earlier ones."
                            },
                            "maxLatenessSeconds": {
                              "default": null,
                              "description": "How late a missed wake may still run, in seconds; null for no limit.",
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 2678400
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "mode",
                            "maxLatenessSeconds"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "mode": {
                              "type": "string",
                              "const": "all",
                              "description": "Run once for every missed wake, oldest first."
                            },
                            "maxLatenessSeconds": {
                              "default": null,
                              "description": "How late a missed wake may still run, in seconds; null for no limit.",
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 2678400
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "mode",
                            "maxLatenessSeconds"
                          ]
                        }
                      ],
                      "description": "What happens when the engine could not evaluate this wake on time."
                    },
                    "evaluationTime": {
                      "default": "detection_time",
                      "description": "Which moment this wake is evaluated as of: `scheduled_time` the time it was due, `detection_time` when the engine actually ran it.",
                      "type": "string",
                      "enum": [
                        "scheduled_time",
                        "detection_time"
                      ]
                    }
                  },
                  "required": [
                    "kind",
                    "runAt",
                    "misfire",
                    "evaluationTime"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "interval",
                      "description": "A wake that repeats on a fixed elapsed interval."
                    },
                    "intervalMinutes": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 44640,
                      "description": "How often this wake repeats, in minutes."
                    },
                    "misfire": {
                      "default": {
                        "mode": "latest",
                        "maxLatenessSeconds": null
                      },
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "mode": {
                              "type": "string",
                              "const": "skip",
                              "description": "Drop a wake the engine could not evaluate in time; wait for the next one."
                            },
                            "graceSeconds": {
                              "default": 5,
                              "description": "How late this wake may still run before it counts as missed, in seconds.",
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 60
                            }
                          },
                          "required": [
                            "mode",
                            "graceSeconds"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "mode": {
                              "type": "string",
                              "const": "latest",
                              "description": "Run once for the most recently missed wake, dropping any earlier ones."
                            },
                            "maxLatenessSeconds": {
                              "default": null,
                              "description": "How late a missed wake may still run, in seconds; null for no limit.",
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 2678400
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "mode",
                            "maxLatenessSeconds"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "mode": {
                              "type": "string",
                              "const": "all",
                              "description": "Run once for every missed wake, oldest first."
                            },
                            "maxLatenessSeconds": {
                              "default": null,
                              "description": "How late a missed wake may still run, in seconds; null for no limit.",
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 2678400
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "mode",
                            "maxLatenessSeconds"
                          ]
                        }
                      ],
                      "description": "What happens when the engine could not evaluate this wake on time."
                    },
                    "evaluationTime": {
                      "default": "detection_time",
                      "description": "Which moment this wake is evaluated as of: `scheduled_time` the time it was due, `detection_time` when the engine actually ran it.",
                      "type": "string",
                      "enum": [
                        "scheduled_time",
                        "detection_time"
                      ]
                    }
                  },
                  "required": [
                    "kind",
                    "intervalMinutes",
                    "misfire",
                    "evaluationTime"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "calendar",
                      "description": "A wake on a recurring calendar schedule: local times, weekdays, months and days of the month."
                    },
                    "timeZone": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 80,
                      "description": "The IANA time zone a calendar wake's local times are interpreted in."
                    },
                    "localTimes": {
                      "minItems": 1,
                      "maxItems": 24,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
                      },
                      "description": "The times of day this wake fires, each in 24-hour `HH:MM` form, in `timeZone`."
                    },
                    "weekdays": {
                      "default": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7
                      ],
                      "description": "Which ISO weekdays this wake fires on, 1 (Monday) through 7 (Sunday). Defaults to every day.",
                      "minItems": 1,
                      "maxItems": 7,
                      "type": "array",
                      "items": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 7
                      }
                    },
                    "months": {
                      "default": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12
                      ],
                      "description": "Which months this wake fires in, 1 (January) through 12 (December). Defaults to every month.",
                      "minItems": 1,
                      "maxItems": 12,
                      "type": "array",
                      "items": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 12
                      }
                    },
                    "monthDays": {
                      "default": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25,
                        26,
                        27,
                        28,
                        29,
                        30,
                        31
                      ],
                      "description": "Which days of the month this wake fires on, 1 through 31. Defaults to every day.",
                      "minItems": 1,
                      "maxItems": 31,
                      "type": "array",
                      "items": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 31
                      }
                    },
                    "misfire": {
                      "default": {
                        "mode": "latest",
                        "maxLatenessSeconds": null
                      },
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "mode": {
                              "type": "string",
                              "const": "skip",
                              "description": "Drop a wake the engine could not evaluate in time; wait for the next one."
                            },
                            "graceSeconds": {
                              "default": 5,
                              "description": "How late this wake may still run before it counts as missed, in seconds.",
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 60
                            }
                          },
                          "required": [
                            "mode",
                            "graceSeconds"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "mode": {
                              "type": "string",
                              "const": "latest",
                              "description": "Run once for the most recently missed wake, dropping any earlier ones."
                            },
                            "maxLatenessSeconds": {
                              "default": null,
                              "description": "How late a missed wake may still run, in seconds; null for no limit.",
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 2678400
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "mode",
                            "maxLatenessSeconds"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "mode": {
                              "type": "string",
                              "const": "all",
                              "description": "Run once for every missed wake, oldest first."
                            },
                            "maxLatenessSeconds": {
                              "default": null,
                              "description": "How late a missed wake may still run, in seconds; null for no limit.",
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 2678400
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "mode",
                            "maxLatenessSeconds"
                          ]
                        }
                      ],
                      "description": "What happens when the engine could not evaluate this wake on time."
                    },
                    "evaluationTime": {
                      "default": "detection_time",
                      "description": "Which moment this wake is evaluated as of: `scheduled_time` the time it was due, `detection_time` when the engine actually ran it.",
                      "type": "string",
                      "enum": [
                        "scheduled_time",
                        "detection_time"
                      ]
                    }
                  },
                  "required": [
                    "kind",
                    "timeZone",
                    "localTimes",
                    "weekdays",
                    "months",
                    "monthDays",
                    "misfire",
                    "evaluationTime"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "event",
                      "description": "A wake evaluated each time a matching custom webhook event arrives."
                    },
                    "eventType": {
                      "type": "string",
                      "pattern": "^[A-Za-z][A-Za-z0-9_.:-]{0,79}$",
                      "description": "The event `type` this wake matches; a live webhook delivery of a different type is ignored before it reaches the condition."
                    },
                    "fields": {
                      "maxItems": 32,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "path": {
                            "minItems": 1,
                            "maxItems": 8,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "pattern": "^[A-Za-z_][A-Za-z0-9_-]{0,63}$"
                            },
                            "description": "The keys to walk, in order, from an observation's top level down to this field."
                          },
                          "valueType": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "boolean",
                                    "description": "A true/false value."
                                  }
                                },
                                "required": [
                                  "type"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "string",
                                    "description": "A text value."
                                  }
                                },
                                "required": [
                                  "type"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "integer",
                                    "description": "A whole-number value, compared exactly."
                                  },
                                  "unit": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 64,
                                    "description": "The unit an integer or decimal value is measured in, as the source or literal declares it."
                                  }
                                },
                                "required": [
                                  "type",
                                  "unit"
                                ]
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "decimal",
                                    "description": "An exact decimal value, as text, compared exactly."
                                  },
                                  "unit": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 64,
                                    "description": "The unit an integer or decimal value is measured in, as the source or literal declares it."
                                  }
                                },
                                "required": [
                                  "type",
                                  "unit"
                                ]
                              }
                            ],
                            "description": "What type this field's value has, and the unit it carries when it has one."
                          },
                          "optional": {
                            "description": "Whether the provider may genuinely not observe this field, rather than fail to read it. When true, a missing value resolves a condition over it to `missing_field` and the rule's verdict to `unknown`, rather than zero, null or false.",
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "path",
                          "valueType"
                        ],
                        "description": "One data field an event or a source's observation carries: where it lives, and its type."
                      },
                      "description": "The data fields an event of this type is declared to carry."
                    }
                  },
                  "required": [
                    "kind",
                    "eventType",
                    "fields"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "reader_update",
                      "description": "A wake evaluated each time the named reader delivers a fresh observation."
                    },
                    "binding": {
                      "type": "string",
                      "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,31}$",
                      "description": "The binding name a rule or a plan gives one configured source."
                    }
                  },
                  "required": [
                    "kind",
                    "binding"
                  ]
                }
              ]
            },
            "description": "Occasions to evaluate the rule's condition: alternatives, not an AND of conditions. At most one clock and one event stream."
          },
          "readers": {
            "maxItems": 4,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,31}$",
                  "description": "The binding name a rule or a plan gives one configured source."
                },
                "readerId": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_.-]{0,79}$",
                  "description": "The installed source operation's id, as listed by List automation data sources."
                },
                "config": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string"
                  },
                  "additionalProperties": {
                    "$ref": "#/components/schemas/AutomationJsonValue"
                  },
                  "description": "Arbitrary JSON data: an event's data, a reader's configuration, or a source plan's configuration. Bounded to 16 KiB, 8 levels of nesting and 256 entries."
                },
                "delivery": {
                  "description": "Use reviewed push updates; omit for periodic snapshots.",
                  "type": "string",
                  "const": "push"
                },
                "pollIntervalSeconds": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 2147483,
                  "description": "Polling cadence, or subscription lease/reconciliation cadence for push delivery, in seconds."
                },
                "maxAgeSeconds": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 86400,
                  "description": "Maximum retained input age at evaluation, matching requirement.maxAgeSeconds when present. Snapshots use observation time; events use trusted receipt time. Collection separately enforces the provider's acquisition-age guarantee."
                },
                "requirement": {
                  "type": "object",
                  "properties": {
                    "maxLatencySeconds": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 2147483
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The target delay between an observation and its delivery, in seconds; null when delivery has no target deadline."
                    },
                    "maxAgeSeconds": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 86400,
                      "description": "Maximum acceptable input age at evaluation, matching the reader's maxAgeSeconds, measured from the provider's own observation time. The selected provider's acquisition guarantee must fit within this limit and does not reduce this evaluation window."
                    },
                    "allowDegradedLatency": {
                      "type": "boolean",
                      "description": "Whether delivery slower than the target delay is still accepted."
                    },
                    "maxAcceptedLatencySeconds": {
                      "description": "The slowest delivery still accepted, in seconds, when `allowDegradedLatency` is set.",
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 2147483
                    }
                  },
                  "required": [
                    "maxLatencySeconds",
                    "maxAgeSeconds",
                    "allowDegradedLatency"
                  ],
                  "description": "What a reader needs from its source: how fresh an answer must be, and whether a slower one is still acceptable."
                }
              },
              "required": [
                "name",
                "readerId",
                "config",
                "pollIntervalSeconds",
                "maxAgeSeconds"
              ]
            },
            "description": "The named source bindings this rule reads from, referenced by `condition` and by each `reader_update` wake's `binding`."
          },
          "condition": {
            "description": "The rule's condition tree, up to 8 levels deep and 128 nodes total, built from five node kinds: `{op:\"bool\", value}` a fixed true/false leaf; `{op:\"compare\", comparator, left, right}` one of `eq`/`ne`/`lt`/`lte`/`gt`/`gte` between two operands — `lt`/`lte`/`gt`/`gte` require both operands to be `integer` or `decimal`, and both sides must share the same type and, for `integer`/`decimal`, the same unit; `{op:\"all\", args}` / `{op:\"any\", args}` AND/OR over one or more child nodes; `{op:\"not\", arg}` negates one child node. An operand is either `{kind:\"field\", binding, path}` — a bound reader's name and the key path into its data — or `{kind:\"literal\", type, value, unit?}` with `type` one of `boolean`/`string`/`integer`/`decimal` (`integer`/`decimal` values are exact decimal strings and carry `unit`)."
          },
          "exit": {
            "description": "The exit watch, when this rule's automation has exit actions on its contract. Present exactly when the contract has an exit action.",
            "type": "object",
            "properties": {
              "intervalSeconds": {
                "type": "integer",
                "minimum": 60,
                "maximum": 2678400,
                "description": "How often this automation re-checks its exit guards, in seconds; at least 60 and at most 2678400 (31 days), the same span an interval wake may cover. Recommend 300."
              },
              "readers": {
                "type": "object",
                "properties": {
                  "asset": {
                    "type": "string",
                    "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,31}$",
                    "description": "The binding in `readers` that prices the asset this automation bought, in USD."
                  },
                  "quote": {
                    "type": "string",
                    "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,31}$",
                    "description": "The binding in `readers` that prices the token this automation pays with, in USD."
                  }
                },
                "required": [
                  "asset",
                  "quote"
                ],
                "description": "The two price bindings each exit guard is measured against; both must be the reviewed USD token-price operation."
              },
              "push": {
                "description": "Additional push-delivered USD prices that may check exits between periodic 1Click checks.",
                "type": "object",
                "properties": {
                  "readers": {
                    "type": "object",
                    "properties": {
                      "asset": {
                        "type": "string",
                        "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,31}$",
                        "description": "The binding name a rule or a plan gives one configured source."
                      },
                      "quote": {
                        "type": "string",
                        "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,31}$",
                        "description": "The binding name a rule or a plan gives one configured source."
                      }
                    },
                    "required": [
                      "asset",
                      "quote"
                    ],
                    "description": "The supplementary price bindings for the bought asset and its paying token."
                  }
                },
                "required": [
                  "readers"
                ]
              }
            },
            "required": [
              "intervalSeconds",
              "readers"
            ]
          },
          "firing": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "each_match",
                  "rising_edge"
                ],
                "description": "When a qualifying evaluation fires: `each_match` fires on every qualifying evaluation, including the first; `rising_edge` fires only on a known false-to-true transition."
              },
              "repeat": {
                "type": "string",
                "enum": [
                  "once",
                  "repeating"
                ],
                "description": "Whether this rule fires at most once, or keeps watching after it fires."
              },
              "maxRuns": {
                "description": "Maximum deliverable runs recorded for this automation across pauses and resumes. Missed or refused deliveries do not count; recorded runs count even if later canceled, coalesced or failed. Omit for no finite limit beyond repeat=once.",
                "type": "integer",
                "minimum": 1,
                "maximum": 1000000
              },
              "initial": {
                "type": "string",
                "enum": [
                  "baseline",
                  "fire_if_true"
                ],
                "description": "How `rising_edge` treats the first known state: `baseline` records it without firing, `fire_if_true` fires immediately if it is already true."
              },
              "cooldownSeconds": {
                "type": "integer",
                "minimum": 0,
                "maximum": 2678400,
                "description": "The minimum time between firings, in seconds; it does not require the condition to stay true that whole time. For `rising_edge`, a false-to-true edge that lands inside cooldown is discarded, not queued: it is not replayed once cooldown ends, so the rule needs an entirely fresh edge after cooldown lapses before it fires again — simply remaining true past the cooldown boundary does not trigger a firing."
              }
            },
            "required": [
              "mode",
              "repeat",
              "initial",
              "cooldownSeconds"
            ],
            "description": "How this rule turns a qualifying evaluation into a firing: which ones count, how often, and how many."
          },
          "news": {
            "description": "Present only on a news exit: the owner's own words, which Fin's news judge reads new stories against. Its rule is fixed: one `news.judged` event wake, no readers, the judged condition and one firing, over a reduce-only perps contract.",
            "type": "object",
            "properties": {
              "condition": {
                "type": "string",
                "minLength": 3,
                "maxLength": 500,
                "description": "The owner's condition in their own words, exactly as they said it, such as `right before Anthropic's IPO`. Never paraphrased: the judge reads the news against these words."
              },
              "match": {
                "type": "string",
                "minLength": 2,
                "maxLength": 80,
                "pattern": "^[\\p{L}\\p{N} .'&-]+$",
                "description": "A few words every story the judge reads must contain in its headline or summary, such as `Anthropic IPO`: a broad filter, not the condition. The judge decides from the condition."
              }
            },
            "required": [
              "condition",
              "match"
            ]
          },
          "maxSnapshotSkewSeconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 86400,
            "description": "The most that bound readers' observation times may disagree before evaluation reports `snapshot_skew`, in seconds."
          }
        },
        "required": [
          "schemaVersion",
          "delivery",
          "maxDeliveryLatenessSeconds",
          "maxEvaluationGapSeconds",
          "wakes",
          "readers",
          "condition",
          "firing",
          "maxSnapshotSkewSeconds"
        ],
        "description": "One automation's rule: when it wakes, what condition it evaluates, and how it fires."
      },
      "AutomationJsonValue": {
        "description": "Any JSON value: a string, number, boolean, null, array or object, nested to any depth.",
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "number"
          },
          {
            "type": "boolean"
          },
          {
            "type": "null"
          },
          {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AutomationJsonValue"
            }
          },
          {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/AutomationJsonValue"
            }
          }
        ]
      },
      "PerpsAutomationContract": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "perps_automation",
            "description": "Which authorization contract this is."
          },
          "coin": {
            "type": "string",
            "pattern": "^(?:xyz:)?[A-Za-z0-9]{1,20}$",
            "description": "The market's coin name exactly as perps_markets lists it, such as `BTC` or `xyz:TSLA`."
          },
          "asset": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1099999,
            "description": "The market's asset id exactly as perps_markets lists it for that coin."
          },
          "position": {
            "type": "string",
            "enum": [
              "long",
              "short"
            ],
            "description": "The position the action is for. `open` acts only while the agent holds nothing on this coin; `reduce` and `add_margin` act only while it holds this side, and nothing happens otherwise."
          },
          "action": {
            "$ref": "#/components/schemas/PerpsAutomationAction"
          },
          "maxExecutions": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "description": "How many firings may act under this approval."
          },
          "validUntil": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "The deadline after which this approval authorizes nothing."
          }
        },
        "required": [
          "type",
          "coin",
          "asset",
          "position",
          "action",
          "maxExecutions",
          "validUntil"
        ],
        "description": "A standing approval for one perps automation: open the agent's own position while it holds nothing on the coin, reduce or close it, or add margin to its own account, each time its rule fires, up to its limits."
      },
      "PerpsAutomationAction": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "reduce",
                "description": "Reduce or close the position."
              },
              "fractionBps": {
                "type": "integer",
                "minimum": 1,
                "maximum": 10000,
                "description": "How much of the position to close, in basis points: 10000 closes it all."
              },
              "maxSlippageBps": {
                "type": "integer",
                "minimum": 1,
                "maximum": 500,
                "description": "The worst fill allowed, in basis points from the mark when it fires."
              }
            },
            "required": [
              "kind",
              "fractionBps",
              "maxSlippageBps"
            ],
            "description": "Close part or all of the position with a reduce-only market order."
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "add_margin",
                "description": "Add margin to the perps account."
              },
              "amountRaw": {
                "type": "string",
                "pattern": "^(0|[1-9]\\d{0,38})$",
                "description": "Exact USDC moved from the agent wallet into the perps account, six decimals: 5 USDC is \"5000000\"."
              },
              "maxValueLossBps": {
                "type": "integer",
                "minimum": 0,
                "maximum": 300,
                "description": "Maximum value lost to fees moving it, in basis points."
              }
            },
            "required": [
              "kind",
              "amountRaw",
              "maxValueLossBps"
            ],
            "description": "Fund the agent's own perps account from its agent wallet."
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "open",
                "description": "Open the position at market."
              },
              "notionalUsd": {
                "type": "string",
                "pattern": "^(0|[1-9][0-9]{0,6})(\\.[0-9]{1,2})?$",
                "description": "The position's size in US dollars at the mark when it fires, at most two places: a $200 position is \"200\". The size in the coin is this over the mark, rounded down to the market's size precision."
              },
              "leverage": {
                "type": "integer",
                "minimum": 1,
                "maximum": 100,
                "description": "Leverage the user chose for this market, at most the market's maximum. Never assume it: ask the user."
              },
              "marginMode": {
                "type": "string",
                "enum": [
                  "cross",
                  "isolated"
                ],
                "description": "How the position is margined, which the user chose with the leverage: `cross` shares the account's margin, `isolated` risks only this position's own. An isolated-only market takes `isolated`. Never assume it: ask the user."
              },
              "maxSlippageBps": {
                "type": "integer",
                "minimum": 1,
                "maximum": 500,
                "description": "The worst fill allowed, in basis points from the mark when it fires; the take-profit and stop-loss fill within the same bound of their trigger."
              },
              "takeProfitPercent": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^(0|[1-9][0-9]?)(\\.[0-9]{0,3}[1-9])?$"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "A native take-profit this far from the mark when it opens, in percent of price in the position's favour (\"10\" is 10%), or null for none."
              },
              "stopLossPercent": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^(0|[1-9][0-9]?)(\\.[0-9]{0,3}[1-9])?$"
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "A native stop-loss this far from the mark when it opens, in percent of price against the position (\"5\" is 5%), or null for none."
              }
            },
            "required": [
              "kind",
              "notionalUsd",
              "leverage",
              "marginMode",
              "maxSlippageBps",
              "takeProfitPercent",
              "stopLossPercent"
            ],
            "description": "Open the position with a market order, only while the agent holds nothing on this coin, optionally protected by a native take-profit and stop-loss."
          }
        ],
        "description": "What a perps automation does each time its rule fires: open the named position while the agent holds nothing on its coin, reduce the named position, or add margin to the agent's own perps account."
      },
      "PredictionAutomationContract": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "prediction_automation",
            "description": "Which authorization contract this is."
          },
          "market": {
            "type": "object",
            "properties": {
              "marketId": {
                "type": "string",
                "pattern": "^[1-9][0-9]{0,19}$",
                "description": "The market's id exactly as prediction_market returns it."
              },
              "conditionId": {
                "type": "string",
                "pattern": "^0x[0-9a-fA-F]{64}$",
                "description": "The market's conditionId exactly as prediction_market returns it."
              },
              "assetId": {
                "type": "string",
                "pattern": "^[1-9][0-9]{0,77}$",
                "description": "The outcome's CLOB token id, exactly the assetId prediction_market lists for that outcome. Yes and No are different tokens."
              },
              "marketQuestion": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1000,
                "description": "The market's question exactly as prediction_market returns it."
              },
              "outcome": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256,
                "description": "The outcome's name exactly as prediction_market returns it."
              }
            },
            "required": [
              "marketId",
              "conditionId",
              "assetId",
              "marketQuestion",
              "outcome"
            ],
            "description": "The one Polymarket outcome this automation trades."
          },
          "action": {
            "$ref": "#/components/schemas/PredictionAutomationAction"
          },
          "maxExecutions": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "description": "How many firings may trade under this approval; a buy spends at most maxExecutions × amountUsdDecimal in all."
          },
          "validUntil": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "The deadline after which this approval authorizes nothing."
          }
        },
        "required": [
          "type",
          "market",
          "action",
          "maxExecutions",
          "validUntil"
        ],
        "description": "A standing approval for one Polymarket automation: buy one outcome with a USD budget at no more than a maximum price, or sell a share of the agent's holding of it at no less than a minimum price, each time its rule fires, up to its limits."
      },
      "PredictionAutomationAction": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "buy",
                "description": "Buy shares of the outcome."
              },
              "amountUsdDecimal": {
                "type": "string",
                "pattern": "^(0|[1-9][0-9]{0,6})(\\.[0-9]{1,2})?$",
                "description": "The USD each firing spends before fees, to the cent: \"50\" is $50. Each buy is an immediate order that fills what it can at once and cancels the rest."
              },
              "maxPriceUsdDecimal": {
                "type": "string",
                "pattern": "^0\\.[0-9]{1,4}$",
                "description": "The most a share may cost, as the market's chance: \"0.32\" never pays more than 32¢ a share. Use a price on the market's tick."
              },
              "maxFeeUsdDecimal": {
                "type": "string",
                "pattern": "^(0|[1-9][0-9]{0,6})(\\.[0-9]{1,6})?$",
                "description": "The most each firing may pay Polymarket in fees, in USD: \"1\" is $1."
              }
            },
            "required": [
              "kind",
              "amountUsdDecimal",
              "maxPriceUsdDecimal",
              "maxFeeUsdDecimal"
            ],
            "description": "Buy the outcome with a USD budget at no more than a maximum price."
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "sell",
                "description": "Sell shares of the outcome."
              },
              "fractionBps": {
                "type": "integer",
                "minimum": 1,
                "maximum": 10000,
                "description": "How much of the agent's holding of the outcome each firing sells, in basis points: 10000 sells it all."
              },
              "minPriceUsdDecimal": {
                "type": "string",
                "pattern": "^0\\.[0-9]{1,4}$",
                "description": "The least a share may sell for, as the market's chance: \"0.7\" never sells below 70¢ a share. Use a price on the market's tick."
              },
              "maxFeeUsdDecimal": {
                "type": "string",
                "pattern": "^(0|[1-9][0-9]{0,6})(\\.[0-9]{1,6})?$",
                "description": "The most each firing may pay Polymarket in fees, in USD: \"1\" is $1."
              }
            },
            "required": [
              "kind",
              "fractionBps",
              "minPriceUsdDecimal",
              "maxFeeUsdDecimal"
            ],
            "description": "Sell a share of the agent's holding of the outcome at no less than a minimum price."
          }
        ],
        "description": "What a Polymarket automation does each time its rule fires: buy the outcome with a USD budget at no more than a maximum price, or sell a share of the agent's holding of it at no less than a minimum price."
      },
      "SolanaBuyContract": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "solana_buy",
            "description": "Which authorization contract this is."
          },
          "buy": {
            "description": "The exact approved token, payment, all-in loss bound and SOL top-up cap, and, for a buy whose funding pays with a coin, that coin and the most of it it may spend.",
            "$ref": "#/components/schemas/SolanaBuyInput"
          },
          "maxExecutions": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000,
            "description": "How many times this grant may execute: 1 for a one-shot approval."
          },
          "validUntil": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "When this grant's authority expires; for a one-shot approval, the approval's own expiry."
          }
        },
        "required": [
          "type",
          "buy",
          "maxExecutions",
          "validUntil"
        ],
        "description": "An approved Solana buy, executed only exactly as approved."
      },
      "SolanaBuyInput": {
        "type": "object",
        "properties": {
          "token": {
            "description": "The exact token to buy.",
            "$ref": "#/components/schemas/SolanaToken"
          },
          "pay": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "usdc",
                    "description": "Pay from one USDC or USDT holding of the agent wallet (USDC on NEAR, Base, Arbitrum, Ethereum or Solana, or USDT on NEAR; any USDC that covers it before USDT), moved to Solana as SOL first."
                  },
                  "amountRaw": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,38})$",
                    "description": "Exact USDC or USDT to spend, in six-decimal atomic units: $50 is \"50000000\". At least 5 (\"5000000\"); a smaller buy is refused."
                  }
                },
                "required": [
                  "kind",
                  "amountRaw"
                ],
                "description": "Spend an exact amount of USDC or USDT from the agent wallet."
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "sol",
                    "description": "Pay with SOL already in the agent's Solana account."
                  },
                  "lamports": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,38})$",
                    "description": "Exact SOL to spend, in lamports (nine decimals): 0.5 SOL is \"500000000\"."
                  }
                },
                "required": [
                  "kind",
                  "lamports"
                ],
                "description": "Spend an exact amount of SOL the agent's Solana account already holds."
              }
            ],
            "description": "What the buy spends, as an exact input amount. Buying an exact number of tokens is not supported."
          },
          "maxValueLossBps": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1500,
            "description": "Explicit all-in maximum value loss in basis points, from the value paid to the value received, fees and price impact included: at least 1, at most 1500. Required; no default."
          },
          "maxSolTopUpUsdcRaw": {
            "type": "string",
            "pattern": "^(0|[1-9]\\d{0,38})$",
            "description": "The most extra USDC or USDT the funding may add to keep SOL in the Solana account for network fees, in six-decimal atomic units: \"0\" for none, at most \"1000000\" (1 USDC). Must be \"0\" when paying with SOL."
          },
          "payWith": {
            "description": "A buy paid in dollars and approved in chat as one call: the coin its funding pays with instead of a USDC or USDT holding, and the most of it it may spend, the SOL top-up included. Never SOL. A buy from a token's page refuses it.",
            "$ref": "#/components/schemas/VenueFundingPayment"
          }
        },
        "required": [
          "token",
          "pay",
          "maxValueLossBps",
          "maxSolTopUpUsdcRaw"
        ],
        "description": "One exact-input buy of a Solana token through the agent's own Solana account."
      },
      "SolanaToken": {
        "type": "object",
        "properties": {
          "mint": {
            "type": "string",
            "minLength": 32,
            "maxLength": 44,
            "pattern": "^[1-9A-HJ-NP-Za-km-z]+$",
            "description": "The token's mint address, exactly as solana_token_search or solana_token returned it. Never a ticker."
          },
          "decimals": {
            "type": "integer",
            "minimum": 0,
            "maximum": 18,
            "description": "The mint's decimals, exactly as returned with the mint."
          },
          "tokenProgram": {
            "type": "string",
            "enum": [
              "spl_token",
              "token_2022"
            ],
            "description": "The program that owns the mint, exactly as returned with the mint: `spl_token` or `token_2022`."
          }
        },
        "required": [
          "mint",
          "decimals",
          "tokenProgram"
        ],
        "description": "One Solana token, pinned by its mint, its decimals and its token program."
      },
      "VenueFundingPayment": {
        "type": "object",
        "properties": {
          "tokenId": {
            "type": "string",
            "maxLength": 256,
            "pattern": "^(?:nep141|nep245|1cs_v1):[\\x21-\\x7e]+$",
            "description": "The exact ledger asset identifier, including its token standard namespace."
          },
          "decimals": {
            "type": "integer",
            "minimum": 0,
            "maximum": 38,
            "description": "How many decimal places the token's smallest unit represents."
          },
          "maxInputRaw": {
            "type": "string",
            "pattern": "^(0|[1-9]\\d{0,38})$",
            "description": "The most of the coin this funding may spend, in its smallest unit: the approved dollars at the price read when the approval opened, plus 5%."
          }
        },
        "required": [
          "tokenId",
          "decimals",
          "maxInputRaw"
        ],
        "description": "The coin this funding pays with and the most of it it may spend, as the owner approved them. Absent: the funding spends one USDC or USDT holding."
      },
      "SolanaSellContract": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "solana_sell",
            "description": "Which authorization contract this is."
          },
          "sell": {
            "description": "The exact approved token, amount, proceeds and all-in loss bound.",
            "$ref": "#/components/schemas/SolanaSellInput"
          },
          "maxExecutions": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000,
            "description": "How many times this grant may execute: 1 for a one-shot approval."
          },
          "validUntil": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
            "description": "When this grant's authority expires; for a one-shot approval, the approval's own expiry."
          }
        },
        "required": [
          "type",
          "sell",
          "maxExecutions",
          "validUntil"
        ],
        "description": "An approved Solana sell, executed only exactly as approved."
      },
      "SolanaSellInput": {
        "type": "object",
        "properties": {
          "token": {
            "description": "The exact token to sell.",
            "$ref": "#/components/schemas/SolanaToken"
          },
          "amount": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "exact",
                    "description": "Sell an exact amount of the token."
                  },
                  "amountRaw": {
                    "type": "string",
                    "pattern": "^(0|[1-9]\\d{0,38})$",
                    "description": "Exact amount of the token to sell, in its smallest unit (scaled by the token's decimals)."
                  }
                },
                "required": [
                  "kind",
                  "amountRaw"
                ],
                "description": "Sell an exact amount of the token."
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "fraction",
                    "description": "Sell a share of what the Solana account holds of the token."
                  },
                  "bps": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10000,
                    "description": "The share to sell, in basis points of the account's balance of the token: all of it is 10000, half is 5000."
                  }
                },
                "required": [
                  "kind",
                  "bps"
                ],
                "description": "Sell a share of the account's balance of the token."
              }
            ],
            "description": "How much of the token to sell."
          },
          "receive": {
            "type": "string",
            "enum": [
              "usdc",
              "sol"
            ],
            "description": "`usdc` returns the proceeds to the agent wallet as USDC on NEAR, which is what selling means; `sol` keeps them as SOL in the agent's Solana account."
          },
          "maxValueLossBps": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1500,
            "description": "Explicit all-in maximum value loss in basis points, from the value paid to the value received, fees and price impact included: at least 1, at most 1500. Required; no default."
          }
        },
        "required": [
          "token",
          "amount",
          "receive",
          "maxValueLossBps"
        ],
        "description": "One sell of a Solana token held in the agent's own Solana account."
      },
      "ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "The kind of problem as a URN, `urn:fin:error:<kind>`; stable, compare against it"
          },
          "title": {
            "type": "string",
            "description": "The kind's human title, for logs; never parse it"
          },
          "status": {
            "type": "integer",
            "minimum": 400,
            "maximum": 599,
            "description": "The HTTP status, repeated in the body"
          },
          "reason": {
            "description": "The machine-readable why. One of:\n\n- `run_active` (409) — a run already holds this conversation\n- `budget_exhausted` (429) — the user's AI usage budget, or your partner account's AI spend limit, is used up until the next day or month, or an operator froze it\n- `approval_not_pending` (409) — the approval was already decided or has expired, or its id does not exist or belongs to a different conversation\n- `execution_capacity` (429) — no capacity is free to run this right now; honour `Retry-After`\n- `execution_unavailable` (503) — the service that runs the agent could not take the work; `retryable` says whether to try again\n- `stop_pending` (409) — a stop is already in progress and its cleanup is not yet confirmed\n- `automation_changed` (409) — the automation changed while this request was handled; read it again and retry\n- `automation_held` (409) — an operator holds the automation; it fires again when released\n- `automation_invalid` (409) — the automation's definition cannot run as written\n- `automation_paused` (409) — the automation is paused; resume it first\n- `automation_has_no_webhook` (409) — the automation does not run on incoming events, so it has no webhook\n- `automation_limit` (409) — the user already has as many automations as the deployment allows\n- `profile_unknown_tool` (400) — `profile.tools` names a tool this deployment does not have\n- `deployment_paused` (503) — an operator paused this kind of work for the deployment; try again later\n- `run_not_active` (409) — the run named in the path is not the conversation's live run\n- `withdrawal_changed` (409) — the request key already binds different withdrawal terms, or the current balance cannot cover the requested amount\n- `swap_changed` (409) — the swap cannot be made as asked: an asset is no longer available or the current balance cannot cover the amount; get a new quote\n- `order_changed` (409) — the order can no longer be placed as prepared: the agent wallet no longer holds the amount, an asset is no longer offered, or its minimum no longer matches the assets' precision; prepare it again\n- `prediction_order_changed` (409) — the Polymarket order can no longer be placed as signed: the market closed or stopped taking orders, its price is off the market's tick or its size off Polymarket's minimum, its fee or cost would exceed the signed caps, the Polymarket account cannot cover it, or the signature lapsed before it was placed. Nothing was placed; prepare it again\n- `solana_trade_changed` (409) — the Solana trade can no longer run as signed: the token's decimals or program changed, the agent's Solana account or holdings no longer fit it, another Solana trade is running, or the signature lapsed before it started. Nothing moved; prepare it again\n- `trade_not_recoverable` (409) — the original trade or a recovery attempt remains active or uncertain, its unfinished actions lack conclusive recovery proof, or its remaining proposal can no longer be used\n- `order_not_cancelable` (409) — the limit order can no longer be cancelled: it filled or expired, or the swap provider never took it. Read the order for where it stands\n- `grid_not_active` (409) — the grid is not running, so it cannot be paused: it is already paused, stopping or ended. Read the grid for where it stands\n- `grid_not_paused` (409) — the grid is not paused, so there is nothing to resume. Read the grid for where it stands\n- `suggestion_changed` (409) — the suggestion no longer holds: the account or the market moved since fin made it, the user set it aside, or it cannot be made where the user is now. Say it changed, and read the page's suggestions again\n- `request_key_conflict` (409) — the request identity already binds different terms; retrieve the original resource or use a new identity for a new request\n- `question_not_pending` (409) — the questionnaire has already been answered, closed, or is not awaiting this submission\n- `flag_changed` (409) — the flag's targeting changed since you read it; read it again and retry\n- `group_changed` (409) — the group changed or was deleted since you read it; read it again and retry\n- `group_in_use` (409) — a flag's rules still name this group; take it out of those rules first\n- `group_name_taken` (409) — another group already has this name\n- `agent_wallet_required` (409) — create the agent wallet before opening a perps, prediction-market or Solana account\n- `wallet_account_unsupported` (409) — the user's wallet is an Agent API wallet, whose Intents account is a 0x address this route cannot name; read it with Get wallet account, Get wallet account balances and Open a wallet account session instead\n- `conversation_deleted` (410) — the conversation was deleted; its history stays readable\n- `automation_deleted` (410) — the automation was deleted\n- `grid_ended` (410) — the grid stopped, expired or failed; it stays readable but takes no command. A new grid needs the user's approval in chat\n- `credential_expired` (401) — the user token has expired; obtain a fresh one\n- `account_disabled` (403) — an operator disabled the account\n- `perps_disabled` (403) — perps is not enabled for this user\n- `prediction_disabled` (403) — prediction-market trading is not enabled for this user\n- `solana_disabled` (403) — Solana trading is not enabled for this user\n- `no_account` (404) — the user has not opened the account this call reads; open it first\n- `not_available_in_region` (403) — perps funding is unavailable in the user's region for this request; withdrawals remain available\n- `steering_disabled` (403) — steering a working run is not turned on for this user; send the message with Start a run once the run ends\n- `baskets_disabled` (403) — idea baskets are not turned on for this user; hide the Ideas pages and their baskets\n- `basket_buying` (409) — the basket is still buying, so it cannot be deleted yet; try again once its result is in\n- `basket_awaiting_approval` (409) — an approval to buy this basket is still open; decline it in the chat, then delete the basket\n- `basket_step_not_failed` (409) — the step bought, or the basket is not partly bought, so no order can be linked to it; read the basket again\n- `basket_step_linked` (409) — another order is already linked to this step; a link is permanent, so read the basket again\n- `basket_order_not_linkable` (400) — the order cannot stand in for this step: it is not one of the step's `failures[].linkable` orders, or another basket step already holds it\n- `voice_disabled` (403) — voice input is not turned on for this user; let them type instead\n- `voice_unavailable` (503) — this deployment has no speech model, so it cannot transcribe recordings; let the user type instead\n- `provider_unavailable` (503) — an external provider the call depends on did not answer\n- `quote_refused` (400) — 1Click would not quote this request, usually an amount below what it routes or a pair it does not offer; nothing was reserved. Change the amount or the assets and quote again; for a deposit address, no address was issued, so offer another network\n- `invalid_input` (400) — the body or query failed validation; `issues` names each field\n- `internal` (500) — a fault on our side; quote `requestId` when reporting it\n- `partner_key_required` (401) — no `X-Api-Key` header was sent\n- `partner_key_invalid` (401) — the `X-Api-Key` is unknown or revoked\n- `subject_mismatch` (403) — the `{userId}` in the path is not the token's user\n- `origin_rejected` (403) — a browser `Origin` other than the configured web origin\n- `permission_required` (403) — the verified credential is not permitted to make this call\n- `signature_required` (403) — creating the agent wallet needs the user's signature: send the user's signature of `creation.message` from Get the agent wallet as `authorization`\n- `asset_not_withdrawable` (403) — tokenized stocks cannot be withdrawn; sell them first\n- `asset_not_swappable` (403) — the swap names an asset this user cannot buy or trade with this request: a tokenized stock with no `context.country`, or one where tokenized stocks are not available, or bought while buying them is not enabled for the user; or a yield vault's share token bought while the user's `earn` flag is off\n- `asset_not_tradable` (403) — the order names an asset this user cannot buy or trade with this request: a tokenized stock with no `context.country`, or one where tokenized stocks are not available, or bought while buying them is not enabled for the user; or a yield vault's share token bought while the user's `earn` flag is off\n- `solana_token_not_tradable` (403) — Fin won't trade this token: its mint lets someone freeze, move or charge for holdings or pause transfers, it can't be sold back, Fin couldn't read its mint, it has no reliable price, or it is wrapped SOL. A sale is refused only for what would stop it landing\n- `limit_orders_disabled` (403) — limit orders are not enabled for this user\n- `grid_trading_disabled` (403) — grid trading is not enabled for this user, so a paused grid cannot be resumed; pausing and cancelling a grid are never gated\n- `deposit_limit_exceeded` (429) — the deposit would take the agent wallet past the user's deposit limit, or, for a deposit address, the wallet has no room left under it; nothing was recorded. Read `depositLimit.availableCents` from Get balances for how much fits now, and deposit no more than that\n- `policy_change_throttled` (429) — the user's Agent API wallet changed what it allows a few minutes ago, and the NEAR Intents Agent API lets it change again only after a cooldown; nothing was asked or signed, so call again once `Retry-After` has passed\n- `agent_slippage_exceeded` (403) — the user's wallet is an Agent API wallet whose agent signs only trades that lose at most the share of their value its owner allowed (`max_slippage_bps`): fees, price and slippage together, by 1Click's own USD values at the quote's minimum output. This trade's quote loses more, states no USD value, or, before there is a quote, its loss bound is already quoted with more slippage than that (half the bound, plus 1Click's fee at the most it has been seen to take, 20 basis points, before an approval). Very small trades lose more to fixed fees; nothing was signed, so ask again with a larger amount or a smaller loss bound\n- `agent_api_orders_unavailable` (403) — the user's Agent API wallet needs wallet setup to enable limit orders, or the order exceeds this wallet's 168-hour maximum; finish wallet setup or choose at most 168 hours before trying again; nothing was approved or signed\n- `destination_not_allowed` (403) — the user's wallet is an Agent API wallet, whose agent pays a deposit only to itself, to a NEAR Intents account its owner listed (on the confidential ledger) or to an address on a chain its owner listed; allow this one with Add a withdrawal destination (one owner signature), then ask again. A public NEAR Intents account, or an address with no valid spelling on its chain, cannot be paid at all; nothing was signed\n- `rate_limited` (429) — the per-key or per-user limit is spent; honour `Retry-After`\n- `partner_request_capacity` (429) — this partner's request quota across all keys and replicas is spent; honour Retry-After\n- `partner_run_capacity` (429) — this partner's active run quota is full; honour Retry-After and reuse the same request identity\n- `stream_capacity` (429) — the partner, user or replica has no free stream capacity; honour `Retry-After`\n- `invalid_cursor` (400) — the `cursor` is not one this list minted\n- `invalid_question_answer` (400) — the questionnaire answer does not match its questions or allowed choices\n- `question_closed` (410) — the questionnaire expired or was cancelled\n- `unknown_target` (400) — a rule names a partner, group or user that does not exist, or a user outside the partners the same rule names\n- `scope_invalid` (400) — a subject in the scope is not a subject id, or appears twice\n- `subject_unsupported` (404) — a subject in the scope is not one market briefs cover; list them with List market subjects\n- `brief_not_found` (404) — no market brief job with this id was created with your partner key\n- `briefs_busy` (429) — your market briefs are at their limit of briefs generating at once; retry after `Retry-After`\n- `market_briefs_disabled` (403) — market briefs are not turned on for your partner key\n- `story_not_found` (404) — no market story with this id is current: it never was one, or Fin no longer shows it because its sources were withdrawn or its figures can no longer be read",
            "type": "string",
            "enum": [
              "run_active",
              "budget_exhausted",
              "approval_not_pending",
              "execution_capacity",
              "execution_unavailable",
              "stop_pending",
              "automation_changed",
              "automation_held",
              "automation_invalid",
              "automation_paused",
              "automation_has_no_webhook",
              "automation_limit",
              "profile_unknown_tool",
              "deployment_paused",
              "run_not_active",
              "withdrawal_changed",
              "swap_changed",
              "order_changed",
              "prediction_order_changed",
              "solana_trade_changed",
              "trade_not_recoverable",
              "order_not_cancelable",
              "grid_not_active",
              "grid_not_paused",
              "suggestion_changed",
              "request_key_conflict",
              "question_not_pending",
              "flag_changed",
              "group_changed",
              "group_in_use",
              "group_name_taken",
              "agent_wallet_required",
              "wallet_account_unsupported",
              "conversation_deleted",
              "automation_deleted",
              "grid_ended",
              "credential_expired",
              "account_disabled",
              "perps_disabled",
              "prediction_disabled",
              "solana_disabled",
              "no_account",
              "not_available_in_region",
              "steering_disabled",
              "baskets_disabled",
              "basket_buying",
              "basket_awaiting_approval",
              "basket_step_not_failed",
              "basket_step_linked",
              "basket_order_not_linkable",
              "voice_disabled",
              "voice_unavailable",
              "provider_unavailable",
              "quote_refused",
              "invalid_input",
              "internal",
              "partner_key_required",
              "partner_key_invalid",
              "subject_mismatch",
              "origin_rejected",
              "permission_required",
              "signature_required",
              "asset_not_withdrawable",
              "asset_not_swappable",
              "asset_not_tradable",
              "solana_token_not_tradable",
              "limit_orders_disabled",
              "grid_trading_disabled",
              "deposit_limit_exceeded",
              "policy_change_throttled",
              "agent_slippage_exceeded",
              "agent_api_orders_unavailable",
              "destination_not_allowed",
              "rate_limited",
              "partner_request_capacity",
              "partner_run_capacity",
              "stream_capacity",
              "invalid_cursor",
              "invalid_question_answer",
              "question_closed",
              "unknown_target",
              "scope_invalid",
              "subject_unsupported",
              "brief_not_found",
              "briefs_busy",
              "market_briefs_disabled",
              "story_not_found"
            ]
          },
          "requestId": {
            "type": "string",
            "description": "The id Fin used for this request; quote it when reporting a problem"
          },
          "retryable": {
            "type": "boolean",
            "description": "Whether repeating the same request later can succeed without changing it"
          },
          "detail": {
            "description": "Only on `invalid_input`: which part of the request failed validation",
            "type": "string"
          },
          "issues": {
            "description": "Only on `invalid_input`: one entry per failing field",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string",
                  "description": "The JSON pointer of the failing field; empty for the root object"
                },
                "message": {
                  "type": "string",
                  "description": "Why the field failed"
                }
              },
              "required": [
                "path",
                "message"
              ]
            }
          }
        },
        "required": [
          "type",
          "title",
          "status",
          "requestId",
          "retryable"
        ],
        "description": "RFC 9457 problem details: what every error response carries. Never a provider's message, a query or a stack."
      }
    },
    "responses": {
      "InvalidInput": {
        "description": "The request could not be read as this operation expects.\n\n- `invalid_input` — the body or query failed validation; `issues` names each field\n- `invalid_cursor` — the `cursor` is not one this list minted",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "A credential is missing, invalid or expired.\n\n- `partner_key_required` — no `X-Api-Key` header was sent\n- `partner_key_invalid` — the `X-Api-Key` is unknown or revoked\n- `credential_expired` — the user token has expired; obtain a fresh one",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "Forbidden": {
        "description": "The credentials are valid but may not do this.\n\n- `subject_mismatch` — the `{userId}` in the path is not the token's user\n- `account_disabled` — an operator disabled the account\n- `origin_rejected` — a browser `Origin` other than the configured web origin\n- `permission_required` — the verified credential is not permitted to make this call",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "NotFound": {
        "description": "The resource is missing, belongs to someone else, or its id is malformed: all three answer alike.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "PayloadTooLarge": {
        "description": "The body exceeds the size this deployment accepts.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "A limit refused the request; wait for `Retry-After` when it is sent.\n\n- `rate_limited` — the per-key or per-user limit is spent; honour `Retry-After`\n- `partner_request_capacity` — this partner's request quota across all keys and replicas is spent; honour Retry-After",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "Internal": {
        "description": "A fault on our side; quote `requestId` when reporting it.\n\n- `internal` — a fault on our side; quote `requestId` when reporting it",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      },
      "Unavailable": {
        "description": "The service cannot take this right now (draining, a dependency did not answer, or an operator paused the work); `retryable` says whether to try again.\n\n- `internal` — a fault on our side; quote `requestId` when reporting it",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Key"
      },
      "userToken": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "fin_session_<opaque>",
        "description": "A user's session token, from Create a session."
      }
    }
  }
}
```

