Delete API key
curl --request DELETE \
--url https://api-v2.forager.ai/api/api_keys/{prefix}/ \
--header 'X-API-KEY: <api-key>'import requests
url = "https://api-v2.forager.ai/api/api_keys/{prefix}/"
headers = {"X-API-KEY": "<api-key>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {'X-API-KEY': '<api-key>'}};
fetch('https://api-v2.forager.ai/api/api_keys/{prefix}/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {method: 'DELETE', headers: {'X-API-KEY': '<api-key>'}};
fetch('https://api-v2.forager.ai/api/api_keys/{prefix}/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-v2.forager.ai/api/api_keys/{prefix}/"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("X-API-KEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api-v2.forager.ai/api/api_keys/{prefix}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["X-API-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-v2.forager.ai/api/api_keys/{prefix}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.delete("https://api-v2.forager.ai/api/api_keys/{prefix}/")
.header("X-API-KEY", "<api-key>")
.asString();{
"detail": "Authentication credentials were not provided."
}Delete API key
Delete a Forager API key.
DELETE
https://api-v2.forager.ai
/
api
/
api_keys
/
{prefix}
/
Delete API key
curl --request DELETE \
--url https://api-v2.forager.ai/api/api_keys/{prefix}/ \
--header 'X-API-KEY: <api-key>'import requests
url = "https://api-v2.forager.ai/api/api_keys/{prefix}/"
headers = {"X-API-KEY": "<api-key>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {'X-API-KEY': '<api-key>'}};
fetch('https://api-v2.forager.ai/api/api_keys/{prefix}/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {method: 'DELETE', headers: {'X-API-KEY': '<api-key>'}};
fetch('https://api-v2.forager.ai/api/api_keys/{prefix}/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-v2.forager.ai/api/api_keys/{prefix}/"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("X-API-KEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api-v2.forager.ai/api/api_keys/{prefix}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["X-API-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-v2.forager.ai/api/api_keys/{prefix}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.delete("https://api-v2.forager.ai/api/api_keys/{prefix}/")
.header("X-API-KEY", "<api-key>")
.asString();{
"detail": "Authentication credentials were not provided."
}When to use this endpoint
You want to revoke an API key, for example after a rotation or a suspected leak. Requests that still send the deleted key get403 from then on.
Example request
cURL
curl -X DELETE "https://api-v2.forager.ai/api/api_keys/$KEY_PREFIX/" \
-H "X-API-KEY: $FORAGER_API_KEY"
KEY_PREFIX to the prefix of the key, and FORAGER_API_KEY and FORAGER_ACCOUNT_ID as in the quickstart.
Example response
204 with no body.
Credits
The credit cost of this operation is not documented yet. See API credits and pricing.Last modified on November 1, 2026