Delete user
Remove the authenticated user within the network scope of their user access token.
Headers#
3Path parameters#
1Request body#
0Response#
6Before you delete a user#
- Obtain the customer's user access token through the authentication flow.
- Set the path user ID to the authenticated customer's UUID. A customer can delete only their own user.
- Confirm that the customer intends to remove their account from the network associated with that token.
Understand the deletion scope#
For a network-scoped token, deletion removes the user's membership and addresses in that network and requests removal of their cards in the same network. It does not imply deletion from every DEUNA network. A DEUNA-wide account token also removes the account and its network memberships. Successful deletion removes the user's active sessions.
Do not treat this operation as confirmation that every historical payment record or all personal data has been erased. Confirm the required account and data-removal scope with your DEUNA Technical Account Manager before building an account-closure flow.
Send the deletion request#
Use the sandbox base URL below for testing and https://api.deuna.io for production. Send the customer's Bearer token in the Authorization header. The endpoint has no query parameters or request body.
curl --request DELETE \
--url 'https://api.sandbox.deuna.io/users/USER_ID' \
--header 'Authorization: Bearer USER_ACCESS_TOKEN'const response = await fetch("https://api.sandbox.deuna.io/users/USER_ID", {
method: "DELETE",
headers: {
"Authorization": "Bearer USER_ACCESS_TOKEN"
}
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();import requests
response = requests.request(
"DELETE",
"https://api.sandbox.deuna.io/users/USER_ID",
headers={
"Authorization": "Bearer USER_ACCESS_TOKEN"
},
)
response.raise_for_status()
data = response.json()<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.deuna.io/users/USER_ID",
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer USER_ACCESS_TOKEN"
]
]);
$response = curl_exec($curl);
curl_close($curl);import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.sandbox.deuna.io/users/USER_ID"))
.header("Authorization", "Bearer USER_ACCESS_TOKEN")
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(
request, HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}package main
import (
"fmt"
"io"
"net/http"
)
func main() {
request, err := http.NewRequest("DELETE", "https://api.sandbox.deuna.io/users/USER_ID", nil)
if err != nil { panic(err) }
request.Header.Set("Authorization", "Bearer USER_ACCESS_TOKEN")
response, err := http.DefaultClient.Do(request)
if err != nil { panic(err) }
defer response.Body.Close()
body, _ := io.ReadAll(response.Body)
fmt.Println(string(body))
}Verify the result#
A successful request returns HTTP 204 No Content with an empty body. Clear the customer's local session and return them to your signed-out experience. Do not parse the response as JSON or wait for a payment webhook to confirm this operation.
Handle errors and uncertain results#
HTTP 400 can indicate that the path user differs from the token's user. HTTP 401 means the user token cannot authorize the request; HTTP 404 means the requested record was not found. Correct the request or authentication before retrying.
A timeout or server error can occur after part of the deletion has taken effect. HTTP 503 can occur during session cleanup after deletion. Do not assume that a retry will return the same response or automatically repeat the request. Check the account state with DEUNA support when the outcome is uncertain. No idempotency-key contract is defined for this operation.
See response codes and troubleshooting for general error handling.
Was this page helpful?