{
  "x402Version": 2,
  "id": 201,
  "slug": "201",
  "resource": "https://x402.ottoai.services/close-position",
  "description": "Close an open perpetual position on Hyperliquid (full or partial). Cancels all attached TP/SL trigger orders automatically.",
  "type": "http",
  "accepts": [
    {
      "scheme": "exact",
      "network": "eip155:8453",
      "payTo": "0x5bB4B0C766E0D5D791d9403Fc275c22064709F68",
      "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "amount": "10000",
      "maxTimeoutSeconds": 300
    },
    {
      "scheme": "exact",
      "network": "eip155:8453",
      "payTo": "0x5bB4B0C766E0D5D791d9403Fc275c22064709F68",
      "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "amount": "10000",
      "maxTimeoutSeconds": 300
    }
  ],
  "outputSchema": {
    "bazaar": {
      "info": {
        "input": {
          "body": {
            "asset": "BTC",
            "partialClosePercentage": 100
          },
          "bodyType": "json",
          "method": "POST",
          "type": "http"
        },
        "output": {
          "example": {
            "asset": "BTC",
            "closedPercentage": 100,
            "closedSize": 250,
            "exitPrice": 67500,
            "realizedPnl": "15.23",
            "status": "success"
          },
          "type": "json"
        }
      },
      "schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "properties": {
          "input": {
            "additionalProperties": false,
            "properties": {
              "body": {
                "additionalProperties": false,
                "properties": {
                  "asset": {
                    "description": "Asset ticker of the open position",
                    "type": "string"
                  },
                  "closePercent": {
                    "description": "Alias for partialClosePercentage. Accepted; sending both with different values is rejected.",
                    "type": "number"
                  },
                  "partialClosePercentage": {
                    "description": "Percentage of the position to close (1-100). 100 closes it fully. Required — an omitted percentage is rejected, never treated as a full close.",
                    "type": "number"
                  }
                },
                "required": [
                  "asset",
                  "partialClosePercentage"
                ],
                "type": "object"
              },
              "bodyType": {
                "enum": [
                  "json",
                  "form-data",
                  "text"
                ],
                "type": "string"
              },
              "method": {
                "enum": [
                  "POST"
                ],
                "type": "string"
              },
              "type": {
                "const": "http",
                "type": "string"
              }
            },
            "required": [
              "type",
              "method",
              "bodyType",
              "body"
            ],
            "type": "object"
          },
          "output": {
            "properties": {
              "example": {
                "properties": {
                  "action_required": {
                    "description": "Present on the non-success outcomes: this position needs you to look at it.",
                    "type": "boolean"
                  },
                  "amountConfirmed": {
                    "description": "Did the venue state HOW MUCH closed? When false the close is confirmed and its size is not, so closedPercentage, closedSize, closedSizeActual and realizedPnl are ALL ABSENT — there is no amount to publish and the request's own figures are not a stand-in. Read requestedPercentage/requestedSize for what was asked, and check the position on Hyperliquid for what remains.",
                    "type": "boolean"
                  },
                  "as_of": {
                    "description": "ISO-8601 time the reported venue state was read.",
                    "type": "string"
                  },
                  "asset": {
                    "type": "string"
                  },
                  "close": {
                    "description": "Present on the non-success outcomes: the close as it was submitted, so you can check it without a second call.",
                    "properties": {
                      "accepted": {
                        "description": "Present and false when the venue explicitly refused the close.",
                        "type": "boolean"
                      },
                      "asset": {
                        "type": "string"
                      },
                      "requestedPercentage": {
                        "type": "number"
                      },
                      "side": {
                        "type": "string"
                      },
                      "sizeRequested": {
                        "description": "Size submitted to the venue, in contracts.",
                        "type": "number"
                      },
                      "submitted": {
                        "description": "Whether the close order reached the venue at all.",
                        "type": "boolean"
                      }
                    },
                    "type": "object"
                  },
                  "closedPercentage": {
                    "description": "The percentage ACTUALLY closed, derived from the venue's filled size — never an echo of what you sent. ABSENT when amountConfirmed is false.",
                    "type": "number"
                  },
                  "closedPercentageVerified": {
                    "description": "Mirrors amountConfirmed: false when the venue confirmed a fill without stating its size.",
                    "type": "boolean"
                  },
                  "closedSize": {
                    "description": "Contracts the venue reported closing. ABSENT when amountConfirmed is false — it is never defaulted to the size you requested.",
                    "type": "number"
                  },
                  "closedSizeActual": {
                    "description": "Contracts the venue reported closing. ABSENT when it did not state an amount.",
                    "type": "number"
                  },
                  "error": {
                    "type": "string"
                  },
                  "estimatedPnlAtMark": {
                    "description": "An ESTIMATE of what this close was worth: (mark price read just after the close - your entry price) x the venue's CONFIRMED closed size. Not a realised result — it is not the price the close filled at, and it excludes fees and funding. ABSENT when amountConfirmed is false or the mark-price read failed.",
                    "type": "string"
                  },
                  "exitPrice": {
                    "description": "Mark price read just after the close, not the venue fill price.",
                    "type": "number"
                  },
                  "fullyClosedAsRequested": {
                    "description": "Present only when the venue's own size proves it either way.",
                    "type": "boolean"
                  },
                  "message": {
                    "description": "Buyer-facing sentence describing the outcome and what, if anything, to do.",
                    "type": "string"
                  },
                  "requestedPercentage": {
                    "description": "The percentage you asked to close. A request, never a result.",
                    "type": "number"
                  },
                  "requestedSize": {
                    "description": "Contracts submitted to close, for comparison with closedSizeActual. A request, never a result.",
                    "type": "number"
                  },
                  "shortfall": {
                    "description": "Present on a proven short close: contracts of your request that did NOT close and remain open.",
                    "type": "number"
                  },
                  "status": {
                    "description": "'partial' when the venue's own size shows the close filled SHORT — the remainder of your position is still open and still carrying risk. 'success' when the venue confirmed the close filled — it is the only outcome that is charged for. 'failed' when the venue refused the close: NOTHING WAS CLOSED by this request and you are not charged. That is a statement about this order, not about your position — a trigger or a liquidation may have moved it, so check it rather than assuming it is untouched. 'unknown' when the close was submitted and its outcome could not be confirmed: check your position before retrying, because a retry may close more than you intended. You are not charged for that either.",
                    "enum": [
                      "success",
                      "partial",
                      "failed",
                      "unknown"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "status"
                ],
                "type": "object"
              },
              "type": {
                "type": "string"
              }
            },
            "required": [
              "type"
            ],
            "type": "object"
          }
        },
        "required": [
          "input"
        ],
        "type": "object"
      }
    },
    "builder-code": {
      "info": {
        "a": "bc_hc2dhq09"
      },
      "schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "additionalProperties": false,
        "properties": {
          "a": {
            "description": "App builder code",
            "pattern": "^[a-z0-9_]{1,32}$",
            "type": "string"
          },
          "s": {
            "description": "Service builder codes",
            "items": {
              "pattern": "^[a-z0-9_]{1,32}$",
              "type": "string"
            },
            "type": "array"
          },
          "w": {
            "description": "Wallet builder code",
            "pattern": "^[a-z0-9_]{1,32}$",
            "type": "string"
          }
        },
        "type": "object"
      }
    },
    "offer-receipt": {
      "info": {
        "offers": [
          {
            "acceptIndex": 0,
            "format": "eip712",
            "payload": {
              "amount": "10000",
              "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
              "network": "eip155:8453",
              "payTo": "0x5bB4B0C766E0D5D791d9403Fc275c22064709F68",
              "resourceUrl": "https://x402.ottoai.services/close-position",
              "scheme": "exact",
              "validUntil": 1787958425,
              "version": 1
            },
            "signature": "0xa12e9f7b3d95e608e322e3ec703386e5c19b7c96d91e566576a231256230533a37b040b44610e9443df73dfb7db7ec3123a7d09f56b763cf05303254a36641ea1c"
          },
          {
            "acceptIndex": 1,
            "format": "eip712",
            "payload": {
              "amount": "10000",
              "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
              "network": "eip155:8453",
              "payTo": "0x5bB4B0C766E0D5D791d9403Fc275c22064709F68",
              "resourceUrl": "https://x402.ottoai.services/close-position",
              "scheme": "exact",
              "validUntil": 1787958425,
              "version": 1
            },
            "signature": "0xa12e9f7b3d95e608e322e3ec703386e5c19b7c96d91e566576a231256230533a37b040b44610e9443df73dfb7db7ec3123a7d09f56b763cf05303254a36641ea1c"
          }
        ]
      },
      "schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "properties": {
          "offers": {
            "items": {
              "properties": {
                "acceptIndex": {
                  "type": "integer"
                },
                "format": {
                  "type": "string"
                },
                "payload": {
                  "properties": {
                    "amount": {
                      "type": "string"
                    },
                    "asset": {
                      "type": "string"
                    },
                    "network": {
                      "type": "string"
                    },
                    "payTo": {
                      "type": "string"
                    },
                    "resourceUrl": {
                      "type": "string"
                    },
                    "scheme": {
                      "type": "string"
                    },
                    "validUntil": {
                      "type": "integer"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "version",
                    "resourceUrl",
                    "scheme",
                    "network",
                    "asset",
                    "payTo",
                    "amount"
                  ],
                  "type": "object"
                },
                "signature": {
                  "type": "string"
                }
              },
              "required": [
                "format",
                "signature"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "offers"
        ],
        "type": "object"
      }
    },
    "payment-identifier": {
      "info": {
        "required": false
      },
      "schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "properties": {
          "id": {
            "maxLength": 128,
            "minLength": 16,
            "pattern": "^[a-zA-Z0-9_-]+$",
            "type": "string"
          },
          "required": {
            "type": "boolean"
          }
        },
        "required": [
          "required"
        ],
        "type": "object"
      }
    }
  },
  "tags": [
    "bazaar",
    "builder-code",
    "offer-receipt",
    "payment-identifier"
  ],
  "sourceHost": "x402.ottoai.services",
  "lastUpdated": "2026-08-28T23:02:05.67Z",
  "quality": {
    "calls30d": 2,
    "uniquePayers30d": 1,
    "lastCalledAt": "2026-08-28T23:02:13.676Z"
  },
  "liveness": {},
  "verified": false,
  "featured": false,
  "provider": {
    "host": "x402.ottoai.services",
    "manifest_name": "x402.ottoai.services",
    "source": "cdp-mirror",
    "source_manifest_url": "https://api.cdp.coinbase.com/platform/v2/x402/discovery/resources",
    "submitted_at": "2026-09-18T22:00:31.484Z"
  }
}