> ## Documentation Index
> Fetch the complete documentation index at: https://docs.x402layer.cc/llms.txt
> Use this file to discover all available pages before exploring further.

# Unstake (begin cooldown)

> Begins the cooldown. After it elapses, call /api/agent/claim-unstake to withdraw.



## OpenAPI

````yaml POST /api/agent/unstake
openapi: 3.1.0
info:
  title: x402 Singularity Layer API
  description: >-
    OpenAPI-backed reference for marketplace discovery, payment routes,
    webhooks, wallet-first auth, agent endpoints, and ERC-8004 flows.
  version: 1.0.0
servers:
  - url: https://api.x402layer.cc
security: []
tags:
  - name: Marketplace
    description: Public discovery and listing lookup
  - name: Public Endpoints
    description: Public endpoint metadata and hosted checkout context
  - name: Public Payment Links
    description: Hosted public payment-link lookup
  - name: Payments
    description: Hosted x402 payment challenge routes
  - name: Receipts
    description: Signed receipt lookup and verification helpers
  - name: Ratings
    description: Public listing ratings and authenticated rating actions
  - name: Webhooks
    description: Seller webhook management API
  - name: Agent Auth
    description: Wallet-first challenge and verification routes
  - name: Agent Endpoints
    description: Create, read, top up, and delete agent endpoints
  - name: ERC-8004
    description: Agent registry and registration lifecycle routes
  - name: Marketplace Agents
    description: Public ERC-8004 marketplace discovery routes
  - name: Compute Catalog
    description: Compute plans, regions, and OS catalog
  - name: Compute Instances
    description: Provision, inspect, extend, and destroy compute instances
  - name: Compute API Keys
    description: API keys for compute agent access
  - name: Fundraiser Campaigns
    description: List, view, create, and edit fundraiser campaigns
  - name: Fundraiser Contributions
    description: Record and list campaign contributions
  - name: Fundraiser Comments
    description: Campaign comment threads
  - name: Fundraiser Media
    description: Campaign image uploads and OG images
  - name: Enterprise
    description: >-
      Enterprise partner configuration, endpoint listing, revenue stats, and
      transaction ledger
  - name: Staking
    description: Agentic $SGL staking
  - name: SGL Grid
    description: >-
      Decentralized, confidential, OpenAI-compatible inference served by
      attested TEE nodes.
  - name: Compute Credits
    description: Prepaid USDC credit balance shared across Machines and Grid.
paths:
  /api/agent/unstake:
    post:
      tags:
        - Staking
      summary: Prepare an unstake transaction (begin cooldown)
      description: >-
        Begins the cooldown. After it elapses, call /api/agent/claim-unstake to
        withdraw.
      operationId: prepareUnstake
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - wallet
                - role
              properties:
                wallet:
                  type: string
                role:
                  $ref: '#/components/schemas/StkStakeRole'
      responses:
        '200':
          $ref: '#/components/responses/StkPrepare'
        '400':
          $ref: '#/components/responses/StkError'
        '500':
          $ref: '#/components/responses/StkError'
      servers:
        - url: https://staking.x402layer.cc
components:
  schemas:
    StkStakeRole:
      type: string
      enum:
        - compute
        - validator
        - yield
      description: >-
        Stake type. compute = compute node operator, validator = marketplace
        validator, yield = yield enjoyer.
    StkPrepareResponse:
      type: object
      properties:
        action:
          type: string
          example: stake
        note:
          type: string
        transactions:
          type: array
          items:
            $ref: '#/components/schemas/StkPreparedTx'
        next:
          type: string
          example: >-
            Sign each transaction with your wallet keypair, then POST
            /api/agent/submit { transaction }.
    StkError:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
    StkPreparedTx:
      type: object
      properties:
        description:
          type: string
          example: Stake 50000 $SGL as compute
        transaction:
          type: string
          description: Base64-encoded UNSIGNED legacy transaction. Sign with your keypair.
        blockhash:
          type: string
        lastValidBlockHeight:
          type: integer
  responses:
    StkPrepare:
      description: Unsigned transaction(s) to sign and submit.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/StkPrepareResponse'
    StkError:
      description: Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/StkError'

````