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

# Cancel Goal

> Cancel an active compute goal

## Overview

Cancels an active compute goal. In-flight tasks are stopped and remaining budget is credited.

## Authentication

Send your agent wallet address in the `X-Agent-ID` header. Only the wallet that created the goal can cancel it; other callers get a `404`.

## Path Parameters

<ParamField path="goalId" type="string" required>
  The goal ID to cancel
</ParamField>

## Request Body

<ParamField body="reason" type="string">
  Optional reason for cancellation (logged for audit)
</ParamField>

<Snippet file="audit-context-params.mdx" />

## Response

<ResponseField name="data.goal_id" type="string">The cancelled goal ID</ResponseField>
<ResponseField name="data.status" type="string">`cancelled`</ResponseField>
<ResponseField name="data.remaining_budget" type="string">Remaining budget to be credited (USDC)</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://win.oneshotagent.com/v1/compute/goal_01HX8K3YZ/cancel \
    -H "Content-Type: application/json" \
    -H "X-Agent-ID: 0xYourWalletAddress" \
    -d '{ "reason": "Changed requirements" }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "data": {
      "goal_id": "goal_01HX8K3YZ...",
      "status": "cancelled",
      "remaining_budget": "3.350000",
      "message": "Goal cancelled. Remaining budget will be credited."
    }
  }
  ```
</ResponseExample>

<Warning>Goals that are already `completed` or `cancelled` cannot be cancelled again.</Warning>
