Delete a webhook
Removes the webhook of the account. Jobs created before keep sending their events to it; new jobs do not.
DELETE
https://api.switchfile.io/v2/webhooks/{id}Example
Request
curl -X DELETE "https://api.switchfile.io/v2/webhooks/1a7e3c5b-9d2f-4b6a-8e0c-5f3d1b7a9c24" \
-H "Authorization: Bearer $SWITCHFILE_API_KEY"const res = await fetch("https://api.switchfile.io/v2/webhooks/1a7e3c5b-9d2f-4b6a-8e0c-5f3d1b7a9c24", {
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.SWITCHFILE_API_KEY}`,
},
});
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
console.log(res.status);<?php
$ch = curl_init('https://api.switchfile.io/v2/webhooks/1a7e3c5b-9d2f-4b6a-8e0c-5f3d1b7a9c24');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SWITCHFILE_API_KEY'),
],
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
if ($status >= 400) {
throw new RuntimeException("HTTP $status: $response");
}
echo $status, PHP_EOL;import os
import requests
res = requests.delete(
"https://api.switchfile.io/v2/webhooks/1a7e3c5b-9d2f-4b6a-8e0c-5f3d1b7a9c24",
headers={"Authorization": f"Bearer {os.environ['SWITCHFILE_API_KEY']}"},
)
res.raise_for_status()
print(res.status_code)Parameters
Path parameters
idstring (uuid)requiredID of the webhook
Responses
- 204Deleted
401The API key is missing or not valid
UNAUTHENTICATED401 application/json{ "message": "Missing or invalid API key.", "code": "UNAUTHENTICATED" }404Does not exist for this account
NOT_FOUND404 application/json{ "message": "Webhook not found.", "code": "NOT_FOUND" }411The request has a body but no Content-Length header
LENGTH_REQUIRED411 application/json{ "message": "A Content-Length header is required for this request.", "code": "LENGTH_REQUIRED" }413The request or the file is too large
PAYLOAD_TOO_LARGE413 application/json{ "message": "The request body is larger than the allowed maximum.", "code": "PAYLOAD_TOO_LARGE" }422Invalid data. errors names the fields
INVALID_DATA422 application/json{ "message": "id: Expected string to match 'uuid' format", "code": "INVALID_DATA", "errors": { "id": [ "Expected string to match 'uuid' format" ] } }429Too many requests or a daily quota is used up. See Retry-After
RATE_LIMIT_EXCEEDED429 application/json{ "message": "Too many requests. Try again in 12 seconds.", "code": "RATE_LIMIT_EXCEEDED" }