---
updatedAt: 2026-06-02T19:44:59.000Z
agentTools:
  projectIndex: https://docs.zerohash.com/llms.txt
---

# Cancel a stake

Cancel a pending stake request before it is fully processed.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "zerohash API",
    "description": "\n### Authentication\n\nzerohash Uses HMAC SHA-256 verification to ensure the authenticity of API requests, follow instructions by link [https://docs.zerohash.com/reference/api-authentication](https://docs.zerohash.com/reference/api-authentication)\n\n<a href=\"/zh-swagger.json\">Download zerohash OpenAPI Schema as JSON</a>\n",
    "version": "1.7.0"
  },
  "servers": [
    {
      "url": "https://api.cert.zerohash.com",
      "description": "Certification API server"
    }
  ],
  "x-readme": {
    "proxy-enabled": false
  },
  "tags": [
    {
      "name": "Staking",
      "description": "Staking, Unstaking and associated Rewards Services"
    }
  ],
  "paths": {
    "/stakes/{stake_id}/cancel": {
      "post": {
        "tags": [
          "Staking"
        ],
        "summary": "Cancel a stake",
        "description": "Cancel a pending stake request before it is fully processed.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Signature"
          },
          {
            "$ref": "#/components/parameters/Timestamp"
          },
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "name": "stake_id",
            "in": "path",
            "description": "The unique identifier of the stake to cancel",
            "required": true,
            "schema": {
              "type": "string",
              "example": "c761fc96-5c44-40d4-8eb2-3fcd5d06754e"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Stake cancellation submitted, or the stake was already canceled. Canceling an already-canceled stake is idempotent and returns the same 200.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PostCancelStakeResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StakingValidationErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Code403"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Code404"
                }
              }
            }
          },
          "409": {
            "description": "The stake can no longer be canceled (`error_code: NOT_CANCELLABLE`, permanent), or a concurrent cancel for the same stake has not settled yet (`error_code: CANCEL_IN_PROGRESS`, check its status before retrying). Never returned as 503.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StakingValidationErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Code500"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Code503"
                }
              }
            }
          }
        }
      }
    }
  },
  "security": [
    {
      "apiKey": [],
      "apiPassphrase": []
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "apiKey",
        "description": "Your API public key. See the [Authentication guide](https://docs.zerohash.com/reference/api-authentication) for how to obtain keys.",
        "in": "header",
        "name": "X-SCX-API-KEY"
      },
      "apiPassphrase": {
        "type": "apiKey",
        "description": "The passphrase associated with your API key, set when the key was created.",
        "in": "header",
        "name": "X-SCX-PASSPHRASE"
      }
    },
    "parameters": {
      "Signature": {
        "name": "X-SCX-SIGNED",
        "in": "header",
        "description": "HMAC-SHA256 signature of the request, base64-encoded. See the [Authentication guide](https://docs.zerohash.com/reference/api-authentication) for the exact signing formula.",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "Timestamp": {
        "name": "X-SCX-TIMESTAMP",
        "in": "header",
        "description": "Current Unix timestamp in seconds. Must be within 60 seconds of server time or the request is rejected.",
        "required": true,
        "schema": {
          "type": "string",
          "example": "1678901234"
        }
      },
      "RequestId": {
        "name": "X-Request-Id",
        "in": "header",
        "description": "Optional client-supplied request ID used for tracing and idempotency. Must be a [UUID v4](https://www.uuidtools.com/uuid-versions-explained#version-4). When omitted, zerohash generates one and returns it in the response `X-Request-Id` header.",
        "required": false,
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      }
    },
    "schemas": {
      "Code403": {
        "type": "object",
        "description": "Authentication or authorization failed. `error` is always `true`; `message` explains which check failed (missing API key, bad signature, insufficient permission, etc.).",
        "required": [
          "error",
          "message"
        ],
        "properties": {
          "error": {
            "type": "boolean",
            "example": true
          },
          "message": {
            "type": "string",
            "example": "This api key does not have write permission to this endpoint"
          }
        }
      },
      "Code404": {
        "type": "object",
        "description": "The requested resource does not exist or is not visible to the caller.",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "example": "Not Found"
          }
        }
      },
      "Code500": {
        "type": "object",
        "description": "An unexpected error occurred on the server. The request can be retried after a short delay, but the same inputs may reproduce the error.",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "example": "Internal Server Error"
          }
        }
      },
      "Code503": {
        "type": "object",
        "description": "A downstream dependency was unavailable, timed out, or returned a retryable error. Safe to retry; the response carries a `zh-allow-retry: true` header.",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "example": "Service Unavailable"
          }
        }
      },
      "PostCancelStakeResponse": {
        "type": "object",
        "properties": {
          "request_id": {
            "type": "string",
            "description": "Request identifier",
            "example": "8bb7e203-13e0-4208-80bc-e9fdb7faa13e"
          },
          "message": {
            "type": "object",
            "properties": {
              "stake_id": {
                "type": "string",
                "description": "The stake ID being cancelled",
                "example": "c761fc96-5c44-40d4-8eb2-3fcd5d06754e"
              }
            }
          }
        }
      },
      "StakingValidationErrorResponse": {
        "type": "object",
        "properties": {
          "error_code": {
            "type": "string",
            "description": "Error code",
            "example": "VALIDATION_FAILED"
          },
          "message": {
            "type": "string",
            "description": "Error message",
            "example": "Staking validation failed"
          },
          "details": {
            "type": "object",
            "properties": {
              "participant_code": {
                "type": "string",
                "example": "XXXXXX"
              },
              "stake_id": {
                "type": "string",
                "example": "c761fc96-5c44-40d4-8eb2-3fcd5d06754e"
              },
              "asset": {
                "type": "string",
                "example": "ETH"
              },
              "validation_checks": {
                "type": "object",
                "properties": {
                  "jurisdiction_allowed": {
                    "type": "boolean",
                    "example": true
                  },
                  "terms_accepted": {
                    "type": "boolean",
                    "example": false
                  },
                  "platform_restrictions": {
                    "type": "string",
                    "example": "none"
                  },
                  "sufficient_balance": {
                    "type": "boolean",
                    "example": true
                  }
                }
              }
            }
          },
          "user_message": {
            "type": "string",
            "description": "User-friendly error message",
            "example": "Please accept terms and conditions to proceed"
          },
          "request_id": {
            "type": "string",
            "format": "uuid",
            "description": "Request identifier, echoes the X-Request-Id request header",
            "example": "8bb7e203-13e0-4208-80bc-e9fdb7faa13e"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the error occurred",
            "example": "2026-09-22T16:00:00Z"
          }
        }
      }
    }
  }
}
```