POST /api/token/regenerate Bearer

Regenerate Access Token

Generate a new PocketPaw access token and invalidate all existing session tokens. Use this to rotate credentials or revoke access after a security incident or personnel change.

Overview

Generates a new master access token and invalidates all existing session tokens. Use this if you suspect the token has been compromised.

Warning

This invalidates all active sessions. Every connected client will need to re-authenticate with the new token.

Response

token string
The newly generated access token
Terminal window
curl -X POST "http://localhost:8000/api/token/regenerate" \
-H "Authorization: Bearer <token>"
const response = await fetch("http://localhost:8000/api/token/regenerate", {
method: "POST",
headers: { "Authorization": "Bearer <token>" }
});
const data = await response.json();
console.log(data);
import requests
response = requests.post(
"http://localhost:8000/api/token/regenerate",
headers={"Authorization": "Bearer <token>"}
)
print(response.json())
{
"token": "pk_a1b2c3d4e5f6g7h8i9j0..."
}
Request
curl -X POST "http://localhost:8000/api/token/regenerate" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <token>"
const response = await fetch("http://localhost:8000/api/token/regenerate", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
},
});

const data = await response.json();
console.log(data);
import requests

response = requests.post(
    "http://localhost:8000/api/token/regenerate",
    headers={'Content-Type':'application/json','Authorization':'Bearer <token>'},
)

print(response.json())
package main

import (
    "fmt"
    "net/http"
    "io"
)

func main() {
    req, _ := http.NewRequest("POST", "http://localhost:8000/api/token/regenerate", nil)
    req.Header.Set("Content-Type", "application/json")
    req.Header.Set("Authorization", "Bearer <token>")

    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()

    body, _ := io.ReadAll(resp.Body)
    fmt.Println(string(body))
}
Response
Send a request to see the response