--- title: "cancelJob" slug: "security-websecuritychecker-canceljob" tags: ["Web Security Checker"] updated: 2026-09-17T10:25:45Z published: 2026-09-17T10:25:45Z canonical: "api.ncloud-docs.com/security-websecuritychecker-canceljob" --- > ## Documentation Index > Fetch the complete documentation index at: https://api.ncloud-docs.com/llms.txt > Use this file to discover all available pages before exploring further. # cancelJob Available in Classic and VPC Cancel a diagnostic registered by a user in the NAVER Cloud Platform console before it starts. ## Request The following describes the request format for the endpoint. The request format is as follows: | Method | URI | | --- | --- | | PATCH | /api/v1/{instanceId}/cancel | ### Request headers For information about the headers common to all Web Security Checker APIs, see [Web Security Checker request headers](/docs/en/security-websecuritychecker#%EC%9A%94%EC%B2%AD%ED%97%A4%EB%8D%94). ### Request path parameters You can use the following path parameters with your request: | Field | Type | Required | Description | | --- | --- | --- | --- | | InstanceId | Integer | Required | Diagnostic identification number - See [getJobs](/docs/en/security-websecuritychecker-getjobs) or [searchJobs](/docs/en/security-websecuritychecker-searchjobs) | ### Request example The following is a sample request. ``` curl --location --request PATCH 'https://wsc.apigw.ntruss.com/api/v1/jobs/{instanceId}/cancel' \ --header 'x-ncp-apigw-timestamp: {Timestamp}' \ --header 'x-ncp-iam-access-key: {Access Key}' \ --header 'x-ncp-apigw-signature-v2: {API Gateway Signature}' \ --header 'Content-Type: application/json' ``` ## Response The following describes the response format. ### Response status codes For information about the HTTP status codes common to all Web Security Checker APIs, see [Web Security Checker response status codes](/docs/en/security-websecuritychecker#%EC%9D%91%EB%8B%B5%EC%83%81%ED%83%9C%EC%BD%94%EB%93%9C). ### Response example The following is a sample example. - Diagnostic job canceled ``` { "returnCode": "0", "returnDesc": "Request Success", "returnMessage": "Success", "resources": null } ``` - Diagnostic job cancellation error: Invalid `InstanceId` entered ``` { "error": { "errorCode": 901, "message": "API Call Fail" } } ``` ## Sample code To cancel a diagnostic, you need the Search diagnostics API and the Cancel diagnostics API. You need to extract the value of `instanceNo` of the diagnostic you want to cancel the job from among the diagnostics that are in the Pending status via the Search diagnostics API and use this value to call the Cancel diagnostics API. See [getJobs](/docs/en/security-websecuritychecker-getjobs) or [searchJobs](/docs/en/security-websecuritychecker-searchjobs) for more information on how to search for diagnostics and check `instanceNo`, as well as sample code for those APIs. Sample code from a search with the Search diagnostics API (searchJobs) is as follows. - Search type: `url` - Keyword: `target-domain.com` ``` # Request example $ python jobSearch.py "url target-domain.com" # Response example { "returnCode": "0", "returnDesc": "Request Success", "returnMessage": "Success", "resources": { "total_cnt": 1, "total_page_cnt": 1, "current_start_page": 1, "current_end_page": 1, "record_data": [ { "instanceNo": "1234567890", "start_date": "2024-07-31 00:00:00", "end_date": "", "status": "Scheduled", "progress": null, "start_url": "http://target-domain.com", "crawl_cnt": "", "scan_cnt": "", "memo": "Wsc Sample", "result_button": "cancel", "result_desc": "", "rescan_button": "", "slave_data": null } ] } } ``` The following is sample code that generates a signature with the make_signature function to create a request head and then cancel it before diagnosing based on the request parameters entered, outputting the result if the response code is 200. ``` import sys import os import hashlib import hmac import base64 import requests import time import json from pprint import pprint def make_signature(method, uri, timestamp): access_key = "{accessKey}" # access key id (from portal or sub account) secret_key = "{secretKey}" # secret key (from portal or sub account) secret_key = bytes(secret_key, 'UTF-8') method = method uri = uri message = method + " " + uri + "\n" + timestamp + "\n" + access_key message = bytes(message, 'UTF-8') signingKey = base64.b64encode(hmac.new(secret_key, message, digestmod=hashlib.sha256).digest()) return signingKey method = 'PATCH' instanceId = "{instanceId}" # instance id (from api) uri = f'/api/v1/jobs/{instanceId}/cancel' timestamp = str(int(time.time() * 1000)) signature = make_signature(method, uri, timestamp) headers = { 'x-ncp-apigw-signature-v2': signature.decode('utf-8'), 'x-ncp-apigw-timestamp': timestamp, 'x-ncp-iam-access-key': '{accessKey}', # access key id (from portal or sub account) 'Content-Type': 'application/json' } response = requests.request( method, f"https://wsc.apigw.ntruss.com{uri}", headers=headers ) if response.status_code == 200: pprint(json.loads(response.text)) else: pprint(json.loads(response.text)) ``` Note The sample code is written in Python 3. See [Call API](https://guide.ncloud-docs.com/docs/en/apigw-myproducts#API%ED%98%B8%EC%B6%9C) in the API Gateway user guide for sample code written in other languages, such as Java and Node.js.