Revoke API key
curl --request DELETE \
--url https://api.natural.com/api-keys/{keyId} \
--header 'Authorization: Bearer <token>' \
--header 'Idempotency-Key: <idempotency-key>'import requests
url = "https://api.natural.com/api-keys/{keyId}"
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>"
}
response = requests.delete(url, headers=headers)
print(response.text)const options = {
method: 'DELETE',
headers: {'Idempotency-Key': '<idempotency-key>', Authorization: 'Bearer <token>'}
};
fetch('https://api.natural.com/api-keys/{keyId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.natural.com/api-keys/{keyId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.natural.com/api-keys/{keyId}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.natural.com/api-keys/{keyId}")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.natural.com/api-keys/{keyId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"type": "apiKey",
"id": "apy_019cd1798d6f4fd542f897a4115d917c",
"attributes": {
"apiKeyPrefix": "sk_ntl_prod_sxHp_FRoRTnDEmEH",
"name": "Production Backend",
"scopes": [
"payments.read",
"payments.create"
],
"environment": "prod",
"status": "REVOKED",
"createdAt": "2026-01-04T15:30:00.000Z",
"lastUsedAt": null,
"revokedAt": "2026-01-05T10:00:00.000Z",
"createdBy": "usr_019cd1798d657de5b5fed4198cb9fac0",
"revokedBy": "usr_019cd1798d657de5b5fed4198cb9fac0",
"tags": {
"service": "checkout"
}
},
"relationships": {
"party": {
"data": {
"type": "party",
"id": "pty_019cd1798d617f65a79cb965dda9eac3"
}
}
}
},
"meta": {
"deleted": true
}
}API Keys
Revoke API key
Revoke an API key of your party. Only a user session can revoke a key; a call made with an API key gets 403. Returns the API Key object.
DELETE
/
api-keys
/
{keyId}
Revoke API key
curl --request DELETE \
--url https://api.natural.com/api-keys/{keyId} \
--header 'Authorization: Bearer <token>' \
--header 'Idempotency-Key: <idempotency-key>'import requests
url = "https://api.natural.com/api-keys/{keyId}"
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>"
}
response = requests.delete(url, headers=headers)
print(response.text)const options = {
method: 'DELETE',
headers: {'Idempotency-Key': '<idempotency-key>', Authorization: 'Bearer <token>'}
};
fetch('https://api.natural.com/api-keys/{keyId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.natural.com/api-keys/{keyId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.natural.com/api-keys/{keyId}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.natural.com/api-keys/{keyId}")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.natural.com/api-keys/{keyId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"type": "apiKey",
"id": "apy_019cd1798d6f4fd542f897a4115d917c",
"attributes": {
"apiKeyPrefix": "sk_ntl_prod_sxHp_FRoRTnDEmEH",
"name": "Production Backend",
"scopes": [
"payments.read",
"payments.create"
],
"environment": "prod",
"status": "REVOKED",
"createdAt": "2026-01-04T15:30:00.000Z",
"lastUsedAt": null,
"revokedAt": "2026-01-05T10:00:00.000Z",
"createdBy": "usr_019cd1798d657de5b5fed4198cb9fac0",
"revokedBy": "usr_019cd1798d657de5b5fed4198cb9fac0",
"tags": {
"service": "checkout"
}
},
"relationships": {
"party": {
"data": {
"type": "party",
"id": "pty_019cd1798d617f65a79cb965dda9eac3"
}
}
}
},
"meta": {
"deleted": true
}
}Authorizations
Headers
Was this page helpful?