Reactivate a pending-deletion account
curl --request POST \
--url https://api.example.com/api/v1/auth/reactivateimport requests
url = "https://api.example.com/api/v1/auth/reactivate"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/api/v1/auth/reactivate', 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.example.com/api/v1/auth/reactivate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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.example.com/api/v1/auth/reactivate"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/auth/reactivate")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/auth/reactivate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyAuth
Reactivate a pending-deletion account
Reverses a soft-delete inside the 30-day grace window and returns a fresh session
POST
/
api
/
v1
/
auth
/
reactivate
Reactivate a pending-deletion account
curl --request POST \
--url https://api.example.com/api/v1/auth/reactivateimport requests
url = "https://api.example.com/api/v1/auth/reactivate"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/api/v1/auth/reactivate', 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.example.com/api/v1/auth/reactivate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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.example.com/api/v1/auth/reactivate"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/auth/reactivate")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/auth/reactivate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyOverview
When a user callsDELETE /me their account is soft-deleted: it becomes invisible to login and matching immediately, and a background worker permanently erases it 30 days later. During that 30-day grace window the deletion is reversible.
POST /auth/reactivate is the only way to reverse it. It takes the same email + password as login; on success it clears the pending deletion and returns a fresh session — an identical body to POST /auth/login. The caller lands fully authenticated.
A successful login does NOT reactivate. While an account is pending deletion,
POST /auth/login returns 403 ACCOUNT_PENDING_DELETION (with meta.deletionScheduledAt) instead of a session. This is deliberate: a user who merely wants to check their status never un-deletes by accident. Reactivation is always an explicit, separate action.Authentication
None required — like login, this endpoint takes credentials in the body.Path parameters
None.Query parameters
None.Request body
| Field | Type | Required | Allowed values | Example |
|---|---|---|---|---|
email | string | yes | RFC 5322 valid, lowercased server-side, 5..254 chars | alice@example.com |
password | string | yes | 1..200 chars | correct horse battery staple |
Example payload
{
"email": "alice@example.com",
"password": "correct horse battery staple"
}
Response — 200 OK
Identical shape toPOST /auth/login: accessToken, refreshToken, and a lightweight user summary. The account’s deletedAt / deletedReason are cleared, so subsequent logins succeed normally.
Example response
{
"accessToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"refreshToken": "v8q3xZ0p6rW7sT4uV1nB2cX9yY8mK5jL6hG7fD3eA0c",
"user": {
"id": "6a22f1897f96f4bd18ab7168",
"email": "alice@example.com",
"firstName": "Alice",
"lastName": "Andersson",
"avatarUrl": null,
"onboardingStep": "complete",
"tenancyStatus": "approved",
"subscriptionStatus": "active"
}
}
Error responses
| Status | Code | Meaning |
|---|---|---|
| 400 | VALIDATION_FAILED | Email is malformed or password is missing. |
| 401 | UNAUTHENTICATED | Wrong credentials, no soft-deleted account for that email, or the 30-day grace window has already elapsed (nothing left to reactivate). All of these collapse to the same generic error — the endpoint is enumeration-safe and never reveals which case applied. |
| 429 | RATE_LIMITED | Too many attempts from this IP. Respect Retry-After. |
Once the grace window elapses, the erasure worker tombstones the row (PII nulled, child data hard-deleted). After that point reactivation is impossible and returns
401 — there is no longer an account to restore.Example error — 401
{
"type": "https://api.swappr.co.uk/errors/unauthenticated",
"title": "Authentication required",
"status": 401,
"code": "UNAUTHENTICATED",
"detail": "Invalid email or password",
"instance": "/api/v1/auth/reactivate",
"requestId": "01HZQ7K3M4N5P6Q7R8S9T0V1W2"
}
Side effects
- Clears
deletedAt+deletedReasonon the user document. - Issues a new session (creates a
refresh_tokensrow keyed by a new ULID session id). - Writes a
user.reactivatedaudit row (actorType: USER).
Typical client flow
- User logs in during the grace window →
403 ACCOUNT_PENDING_DELETIONwithmeta.deletionScheduledAt. - Client shows a reactivation screen (“Your account is scheduled for deletion on {date}”).
- User taps Reactivate → client calls
POST /auth/reactivatewith the same credentials →200+ fresh session → user is back in.
See also
- Login — returns
ACCOUNT_PENDING_DELETIONduring the grace window. - Delete account — starts the 30-day grace window.
- GDPR data lifecycle — soft-delete → grace window → erasure.
curl
curl -X POST https://api.swappr.co.uk/api/v1/auth/reactivate \
-H "Content-Type: application/json" \
-d '{
"email": "alice@example.com",
"password": "correct horse battery staple"
}'