---
title: "Cancel Asynchronous Blockchain SQL Job"
method: DELETE
path: "/gateway/v1/onchain/sql/jobs/{job_id}"
tags: ["Onchain"]
---

# Cancel Asynchronous Blockchain SQL Job

`DELETE /gateway/v1/onchain/sql/jobs/{job_id}`

## Request

- Base URL: `https://api.asksurf.ai`
- URL: `https://api.asksurf.ai/gateway/v1/onchain/sql/jobs/{job_id}`
- Auth: HTTP bearer

Durably requests cancellation and returns the current job state. Queued jobs become canceled immediately. Task workers asynchronously stop and verify running ClickHouse queries; poll the job until it reaches canceled or failed.

## Path parameters

- `job_id` string, uuid, required: Asynchronous SQL job identifier

## Response `200`

OK

- DataObjectResponseAsyncSQLJobResponse
  - `$schema` string, uri: A URL to the JSON Schema for this object.
  - `data` AsyncSQLJobResponse, required
    - `cancellation_requested` boolean, required: Whether cancellation has been durably requested and is awaiting worker confirmation
    - `created_at` integer, required: Unix timestamp in seconds
    - `csv_url` string
    - `elapsed_ms` integer, required
    - `error` AsyncSQLJobError
      - `code` string, required: Stable machine-readable error code
      - `message` string, required: Human-readable failure detail
    - `estimated_bytes` integer: Approximate total bytes derived from ClickHouse progress
    - `estimated_rows` integer: Approximate total rows ClickHouse expects to read
    - `executed_sql` string, required: Final SQL executed after server row and scan limits are applied
    - `expires_at` integer, required: Unix timestamp in seconds
    - `external_request_id` string: Optional caller-supplied correlation identifier
    - `finished_at` integer: Unix timestamp in seconds
    - `job_id` string, uuid, required
    - `max_rows` integer, required
    - `parameters` object, required: ClickHouse bind parameters; empty because this endpoint accepts complete SQL text
    - `poll_url` string
    - `processed_bytes` integer, required
    - `processed_rows` integer, required
    - `progress_percent` number, double: Approximate completion percentage when ClickHouse reports a total-row estimate
    - `query_id` string, uuid, required
    - `recommended_action` string, required
    - `request_id` string, required: Caller-visible request correlation identifier
    - `result_url` string
    - `retry_after_ms` integer
    - `retryable` boolean, required
    - `row_count` integer
    - `sql` string, required: Exact submitted SQL
    - `started_at` integer: Unix timestamp in seconds
    - `status` 'queued' | 'running' | 'succeeded' | 'failed' | 'canceled', required
  - `meta` ObjectResponseMeta, required
    - `cached` boolean, required: Whether this response was served from cache
    - `credits_used` integer, required: Credits deducted for this request
    - `empty_reason` string: Hint explaining why the data array is empty, when applicable

## Other responses

- `default`: Error

---

[API](https://skmtc.dev/asksurf/apis/asksurf-public-rest-api.md) - [All operations](https://skmtc.dev/asksurf/apis/asksurf-public-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/asksurf/apis/asksurf-public-rest-api/revisions/91774fdd5302?raw)
