Rotacionar admin token

POST /admin/token/rotate

Gera um novo admintoken. Use o token atual no header e guarde o token retornado.

Só é permitida uma rotação a cada 24 horas.

Autenticação

[
  {
    "admintoken": []
  }
]
{
  "admintoken": {
    "name": "admintoken",
    "type": "apiKey",
    "in": "header",
    "description": "Token de administrador para endpoints administrativos"
  }
}

Respostas

{
  "200": {
    "description": "Admin token rotacionado com sucesso",
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "required": [
            "success",
            "message",
            "admin_token",
            "license_sync_triggered",
            "license_synced",
            "timestamp"
          ],
          "properties": {
            "success": {
              "type": "boolean",
              "example": true
            },
            "message": {
              "type": "string",
              "example": "Admin token rotated successfully"
            },
            "admin_token": {
              "type": "string",
              "minLength": 50,
              "maxLength": 50,
              "pattern": "^[A-Za-z0-9]{50}
quot;
, "description": "Novo admin token.", "example": "AbC123Def456GhI789JkL012MnO345PqR678StU901VwX234Yz" }, "license_sync_triggered": { "type": "boolean", "example": true }, "license_synced": { "type": "boolean", "example": true }, "timestamp": { "type": "integer", "format": "int64", "description": "Timestamp Unix em milissegundos.", "example": 1776892800000 } } } } } }, "401": { "description": "admintoken inválido ou ausente", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string", "example": "Unauthorized" } } } } } }, "403": { "description": "Rotação bloqueada para container gratuito/demo", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string", "example": "Admin token rotation is disabled for free containers" } } } } } }, "429": { "description": "Rotação bloqueada por cooldown de 24 horas", "content": { "application/json": { "schema": { "type": "object", "required": [ "error", "last_rotated_at", "next_rotation_at", "retry_after_ms" ], "properties": { "error": { "type": "string", "example": "Admin token rotation cooldown active" }, "last_rotated_at": { "type": "integer", "format": "int64", "description": "Timestamp Unix em milissegundos da última rotação concluída.", "example": 1776892800000 }, "next_rotation_at": { "type": "integer", "format": "int64", "description": "Timestamp Unix em milissegundos de quando uma nova rotação será permitida.", "example": 1776979200000 }, "retry_after_ms": { "type": "integer", "format": "int64", "description": "Tempo restante em milissegundos para liberar nova rotação.", "example": 86400000 } } } } } }, "500": { "description": "Erro interno ao rotacionar o token", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string", "example": "Failed to persist admin token" } } } } } }, "502": { "description": "Falha ao confirmar a rotação", "content": { "application/json": { "schema": { "type": "object", "required": [ "success", "error", "license_synced", "timestamp" ], "properties": { "success": { "type": "boolean", "example": false }, "error": { "type": "string", "example": "Failed to sync rotated admin token with license server" }, "license_synced": { "type": "boolean", "example": false }, "timestamp": { "type": "integer", "format": "int64", "example": 1776892800000 } } } } } } }

Guias relacionados

Autenticação · Erros e retries · Server URL