Skip to main content
DELETE
/
job
/
{jobId}
Python SDK
from pulse import Pulse

client = Pulse(api_key="YOUR_API_KEY")
result = client.jobs.cancel_job(job_id="your-job-id")
print(result)
{
  "job_id": "<string>",
  "message": "<string>"
}

Documentation Index

Fetch the complete documentation index at: https://docs.runpulse.com/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Cancel an asynchronous job that is currently pending or processing. Jobs that have already completed, failed, or been canceled will remain unchanged.

Response

A successful cancellation returns a confirmation message:
{
  "job_id": "abc123-def456-ghi789",
  "message": "Job cancelled successfully"
}

Response Fields

FieldTypeDescription
job_idstringIdentifier of the job that was cancelled.
messagestringHuman-readable confirmation message.

When to Cancel Jobs

Cancel jobs when:
  • The extraction is no longer needed
  • You submitted a job with incorrect parameters
  • You want to stop processing to conserve page usage
Cancellation is best-effort. If a job is already mid-processing, it may complete before the cancellation takes effect. Pages used before cancellation are still counted toward your usage.

Example Usage

Cancel a Job

from pulse import Pulse

client = Pulse(api_key="YOUR_API_KEY")

job_id = "abc123-def456-ghi789"

try:
    response = client.jobs.cancel_job(job_id=job_id)
    print(f"Job {response.job_id} cancelled successfully")
    print(f"Message: {response.message}")
except Exception as e:
    print(f"Failed to cancel job: {e}")

Cancel with Error Handling

from pulse import Pulse
from pulse.core.api_error import ApiError

client = Pulse(api_key="YOUR_API_KEY")

def cancel_job_safely(job_id: str):
    """Cancel a job with comprehensive error handling."""
    try:
        response = client.jobs.cancel_job(job_id=job_id)
        print(f"✓ Job {job_id} cancelled successfully")
        return True
    except ApiError as e:
        if e.status_code == 404:
            print(f"✗ Job {job_id} not found")
        elif e.status_code == 403:
            print(f"✗ You don't have access to job {job_id}")
        elif e.status_code == 401:
            print(f"✗ Invalid or missing API key")
        else:
            print(f"✗ Failed to cancel job: {e}")
        return False
    except Exception as e:
        print(f"✗ Unexpected error: {e}")
        return False

# Example usage
cancel_job_safely("abc123-def456-ghi789")

Cancel Multiple Jobs

from pulse import Pulse

client = Pulse(api_key="YOUR_API_KEY")

job_ids = [
    "job-111-aaa",
    "job-222-bbb", 
    "job-333-ccc"
]

for job_id in job_ids:
    try:
        client.jobs.cancel_job(job_id=job_id)
        print(f"✓ Cancelled: {job_id}")
    except Exception as e:
        print(f"✗ Failed to cancel {job_id}: {e}")

Error Responses

StatusDescription
401Invalid or missing API key.
403You don’t have access to this job.
404Job not found.
500Job could not be cancelled or internal server error.

Authorizations

x-api-key
string
header
required

API key for authentication

Path Parameters

jobId
string
required

Identifier returned from an async job submission.

Response

Job cancellation accepted

Confirmation payload returned after successfully canceling a job.

job_id
string
required

Identifier of the job that was cancelled.

message
string
required

Human-readable confirmation message.