Admin refresh tokens
curl --request POST \
--url https://api.example.com/api/v1/admin/auth/refreshimport requests
url = "https://api.example.com/api/v1/admin/auth/refresh"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/api/v1/admin/auth/refresh', 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/admin/auth/refresh",
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/admin/auth/refresh"
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/admin/auth/refresh")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/admin/auth/refresh")
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
Admin refresh tokens
Rotate the admin refresh token. Returns a fresh access + refresh pair and revokes the presented token.
POST
/
api
/
v1
/
admin
/
auth
/
refresh
Admin refresh tokens
curl --request POST \
--url https://api.example.com/api/v1/admin/auth/refreshimport requests
url = "https://api.example.com/api/v1/admin/auth/refresh"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/api/v1/admin/auth/refresh', 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/admin/auth/refresh",
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/admin/auth/refresh"
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/admin/auth/refresh")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/admin/auth/refresh")
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
Rotates the admin refresh token. Present a valid, non-revoked, non-expired refresh token; receive a freshaccessToken + refreshToken pair. The presented refresh token is revoked as part of the rotation, so each refresh token is single-use.
Tokens live in the dedicated admin_refresh_tokens collection (separate from the user refresh surface — see Admin auth and MFA).
No authentication header — the refresh token in the body is the credential. There is no burst limiter on this route (unlike
/login and /mfa-verify).Authentication
None. TherefreshToken authenticates the request.
Path parameters
None.Query parameters
None.Request body
| Field | Type | Required | Notes | Example |
|---|---|---|---|---|
refreshToken | string | yes | 1..2048 chars. The opaque refresh token from /admin/auth/mfa-verify or a prior /admin/auth/refresh. | rt_a1b2c3… |
deviceFingerprint | string | no | Max 512 chars. If omitted, the new token inherits the fingerprint of the rotated one. | fp_9a3c… |
Example payload
{
"refreshToken": "rt_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0"
}
Response — 200 OK
| Field | Type | Notes | Example |
|---|---|---|---|
accessToken | string | RS256 JWT, scope: 'admin', 15-minute TTL. | eyJhbGciOiJSUzI1NiI… |
refreshToken | string | New opaque 7-day refresh token. The old one is now revoked. | rt_f9e8d7… |
{
"accessToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9…",
"refreshToken": "rt_f9e8d7c6b5a4039281706f5e4d3c2b1a09f8e7d6"
}
Error responses
| Status | Code | Meaning |
|---|---|---|
| 400 | VALIDATION_FAILED | refreshToken missing or out of length bounds. |
| 401 | ADMIN_REFRESH_TOKEN_INVALID | Token malformed (< 32 chars), not found, already revoked, or expired. The client must re-run the full two-step login. |
Example error — 401 ADMIN_REFRESH_TOKEN_INVALID
{
"type": "https://api.swappr.co.uk/errors/admin-refresh-token-invalid",
"title": "Admin refresh token invalid",
"status": 401,
"code": "ADMIN_REFRESH_TOKEN_INVALID",
"detail": "Refresh token revoked",
"instance": "/api/v1/admin/auth/refresh",
"requestId": "01HZQ7K3M4N5P6Q7R8S9T0V1W2"
}
See also
- Verify MFA — where the first refresh token is issued.
- Admin logout — explicitly revoke a refresh token.
curl
curl -X POST https://api.swappr.co.uk/api/v1/admin/auth/refresh \
-H "Content-Type: application/json" \
-d '{ "refreshToken": "'"$ADMIN_REFRESH_TOKEN"'" }'
Postman
Seedocs/postman/swappr.postman_collection.json → Admin Auth → Refresh.