cURL
curl --request DELETE \
--url https://api.nekt.ai/api/v1/invitations/{token}/ \
--header 'x-api-key: <api-key>'import requests
url = "https://api.nekt.ai/api/v1/invitations/{token}/"
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.nekt.ai/api/v1/invitations/{token}/', 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.nekt.ai/api/v1/invitations/{token}/",
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;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.nekt.ai/api/v1/invitations/{token}/"
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))
}HttpResponse<String> response = Unirest.delete("https://api.nekt.ai/api/v1/invitations/{token}/")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nekt.ai/api/v1/invitations/{token}/")
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{
"detail": "<string>"
}Invitations
Revoke an Invitation
Cancel an invitation and take back everything it granted.
DELETE
/
api
/
v1
/
invitations
/
{token}
/
cURL
curl --request DELETE \
--url https://api.nekt.ai/api/v1/invitations/{token}/ \
--header 'x-api-key: <api-key>'import requests
url = "https://api.nekt.ai/api/v1/invitations/{token}/"
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.nekt.ai/api/v1/invitations/{token}/', 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.nekt.ai/api/v1/invitations/{token}/",
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;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.nekt.ai/api/v1/invitations/{token}/"
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))
}HttpResponse<String> response = Unirest.delete("https://api.nekt.ai/api/v1/invitations/{token}/")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nekt.ai/api/v1/invitations/{token}/")
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{
"detail": "<string>"
}Revoking is not just cancelling an email. Because an invitation provisions the person the moment it is sent, they may already be carrying groups and grants — so revoking takes all of it back.
An expired invitation is a pause — resend it and the person picks up exactly where you left them. A revoked one is a decision. Revoke when somebody is not joining; let one lapse when they are simply slow.
Revoking removes every grant on all three permission axes, and every group membership. If the invitation was the only reason that person existed in Nekt, the account is deleted too. This cannot be undone: re-inviting them starts from nothing.
The path parameter is the id
The URL segment is namedtoken, but the value is the invitation’s id — the field you get from List Invitations. Passing the invitation token instead returns 404.
curl --request DELETE \
--url https://api.nekt.ai/api/v1/invitations/c1f0a9d4-5b62-4e18-9a73-2d8e4f6b0c51/ \
--header "x-api-key: YOUR_API_KEY"
Response
200, with a confirmation body.
{ "detail": "The invitation has been revoked." }
Revoke versus letting it lapse
These are different, and the difference is the access:| Link works | Groups and grants | Appears in the member list | |
|---|---|---|---|
| Expired | No | Kept | Yes, as pending |
| Revoked | No | Removed | No |
Clean up invitations nobody answered
from datetime import datetime, timedelta, timezone
import requests
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.nekt.ai"
GIVE_UP_AFTER_DAYS = 90
headers = {"x-api-key": API_KEY, "Content-Type": "application/json"}
cutoff = datetime.now(timezone.utc) - timedelta(days=GIVE_UP_AFTER_DAYS)
for invitation in requests.get(f"{BASE_URL}/api/v1/invitations/", headers=headers).json():
sent_at = datetime.fromisoformat(invitation["sent_at"].replace("Z", "+00:00"))
if sent_at < cutoff:
# Takes back their groups and grants as well as the invitation.
requests.delete(f"{BASE_URL}/api/v1/invitations/{invitation['id']}/", headers=headers)
Errors
| Status | When |
|---|---|
400 | The invitation has already been accepted. Accepted people are members now — remove them from Members instead. |
403 | Your API key was created by a Member. Revoking requires an Owner’s or Admin’s key. |
404 | No invitation with that id in your organization — check you are not passing the token. |
Related
- Onboarding flow — what an invitation carries.
- List Invitations — where the
idcomes from.
Was this page helpful?