Skip to main content
POST
/
auth
/
revoke
Revoke Access Token
curl --request POST \
  --url https://api.fyatu.com/api/v3/auth/revoke \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.fyatu.com/api/v3/auth/revoke"

headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, headers=headers)

print(response.text)
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.fyatu.com/api/v3/auth/revoke', 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.fyatu.com/api/v3/auth/revoke",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$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.fyatu.com/api/v3/auth/revoke"

req, _ := http.NewRequest("POST", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

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.fyatu.com/api/v3/auth/revoke")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.fyatu.com/api/v3/auth/revoke")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "success": true,
  "status": 200,
  "message": "Token revoked successfully",
  "data": {
    "revoked": true
  },
  "meta": {
    "requestId": "req_abc123def456",
    "timestamp": "2026-01-05T10:30:00+00:00"
  }
}
{
"success": false,
"status": 401,
"message": "Invalid or expired token",
"error": {
"code": "AUTH_TOKEN_INVALID"
},
"meta": {
"requestId": "req_abc123def456",
"timestamp": "2026-01-05T10:30:00+00:00"
}
}

Overview

Invalidate an access token before it naturally expires. Use this when:
  • User logs out of your application
  • You detect suspicious activity
  • Credentials may have been compromised
  • Token is no longer needed

When to Revoke Tokens

When a user explicitly logs out, revoke their token to prevent unauthorized access.
async function logout() {
  await fetch('https://api.fyatu.com/api/v3/auth/revoke', {
    method: 'POST',
    headers: { 'Authorization': `Bearer ${currentToken}` }
  });
  localStorage.removeItem('fyatu_token');
}
If you suspect a token has been compromised, revoke it immediately.
async function handleSecurityIncident(compromisedToken) {
  await fetch('https://api.fyatu.com/api/v3/auth/revoke', {
    method: 'POST',
    headers: { 'Authorization': `Bearer ${compromisedToken}` }
  });
  // Get a fresh token with new credentials
}
When rotating API credentials, revoke existing tokens first.

Error Codes

CodeDescription
AUTH_TOKEN_MISSINGNo Authorization header provided
AUTH_TOKEN_INVALIDToken is malformed or already expired
Once a token is revoked, it cannot be used for any API requests. Any in-flight requests using the revoked token may fail.
After revoking a token, immediately clear it from your application’s storage to prevent accidental reuse.

Authorizations

Authorization
string
header
required

JWT access token obtained from /auth/token

Response

Token revoked successfully

success
boolean
Example:

true

status
integer
Example:

200

message
string
Example:

"Token revoked successfully"

data
object
meta
object