Delete a user account
curl --request DELETE \
--url https://our-secret-api-url.com/user \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <x-api-key>' \
--data '
{
"code": "123456"
}
'import requests
url = "https://our-secret-api-url.com/user"
payload = { "code": "123456" }
headers = {
"X-API-KEY": "<x-api-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.delete(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'DELETE',
headers: {
'X-API-KEY': '<x-api-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({code: '123456'})
};
fetch('https://our-secret-api-url.com/user', 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://our-secret-api-url.com/user",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => json_encode([
'code' => '123456'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-API-KEY: <x-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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://our-secret-api-url.com/user"
payload := strings.NewReader("{\n \"code\": \"123456\"\n}")
req, _ := http.NewRequest("DELETE", url, payload)
req.Header.Add("X-API-KEY", "<x-api-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://our-secret-api-url.com/user")
.header("X-API-KEY", "<x-api-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"123456\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://our-secret-api-url.com/user")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["X-API-KEY"] = '<x-api-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"123456\"\n}"
response = http.request(request)
puts response.read_body{
"result": true
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authentication
Delete User
Deletes a user account, checks for suspension reports and OTP verification.
DELETE
/
user
Delete a user account
curl --request DELETE \
--url https://our-secret-api-url.com/user \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <x-api-key>' \
--data '
{
"code": "123456"
}
'import requests
url = "https://our-secret-api-url.com/user"
payload = { "code": "123456" }
headers = {
"X-API-KEY": "<x-api-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.delete(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'DELETE',
headers: {
'X-API-KEY': '<x-api-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({code: '123456'})
};
fetch('https://our-secret-api-url.com/user', 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://our-secret-api-url.com/user",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => json_encode([
'code' => '123456'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-API-KEY: <x-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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://our-secret-api-url.com/user"
payload := strings.NewReader("{\n \"code\": \"123456\"\n}")
req, _ := http.NewRequest("DELETE", url, payload)
req.Header.Add("X-API-KEY", "<x-api-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://our-secret-api-url.com/user")
.header("X-API-KEY", "<x-api-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"123456\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://our-secret-api-url.com/user")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["X-API-KEY"] = '<x-api-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"123456\"\n}"
response = http.request(request)
puts response.read_body{
"result": true
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}To request OTP, keep the
code empty. To verify the OTP and proceed to deletion, pass the
code in the body.Delete User User Flow
1
OTP Request
The user requests OTP to delete account.
2
Report Suspension Checking
If the user has any of the following, this process will fail and no OTP will be generated:
- A report marked with
reviewing/suspendedstatus; - The user
isSuspendedis true; - The user has a post with
isSuspendedis true.
3
OTP Creation
An OTP is sent to the user’s email or phone. If the user has both an email and a phone number, the OTP will be sent to the email.
4
OTP Verification
The OTP is verified, and the account with all linked data are deleted.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
API key required for authentication
Body
application/json
Optional OTP code for user account deletion.
OTP code for verifying the deletion request.
Example:
"123456"
Response
User account deleted successfully.
Indicates whether the deletion was successful.
