POST /teams/{teamId}/integrations/{id}/tokens/{tokenId}/rotate
Rotaciona (novo token + encerra o antigo)
- Access: Team member
- Service:
https://api.axuz.net
Accepted authentication
sessionCookie— Sessão plena Axuz (cookie de sessão da casa). Sessão restrita é 403 enrollment_required.bearerSession— JWT de acesso da sessão em `Authorization: Bearer`.
Novo token com os mesmos escopos. grace_seconds=0 (default) revoga o antigo na hora; >0 (max 86400) o deixa valer so por essa janela para o bot trocar sem downtime. Token ja revogado/expirado = 409.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
teamId | path | string | yes | |
id | path | string | yes | |
tokenId | path | string | yes |
Request body
application/json
| Name | Type | Required | Description |
|---|---|---|---|
name | string | no | |
grace_seconds | integer | no | |
expires_in_days | integer | no | Omitido = 90 dias. |
no_expiry | boolean | no |
{
"name": "string",
"grace_seconds": 0,
"expires_in_days": 1,
"no_expiry": false
}Responses
201
Novo token (plaintext UMA vez) + o anterior.
| Name | Type | Required | Description |
|---|---|---|---|
id | string<uuid> | yes | |
integration_id | string<uuid> | yes | |
name | string | yes | |
prefix | string | yes | |
scopes | array<string> | yes | |
expires_at | string<date-time> | no | |
revoked_at | string<date-time> | no | |
last_used_at | string<date-time> | no | Atualizado no maximo 1x/min. |
rotated_from | string<uuid> | no | |
created_at | string<date-time> | yes | |
token | string | yes | Plaintext axz_bot_*. MOSTRADO UMA VEZ. |
previous | Token | no | |
previous.id | string<uuid> | yes | |
previous.integration_id | string<uuid> | yes | |
previous.name | string | yes | |
previous.prefix | string | yes | |
previous.scopes | array<string> | yes | |
previous.expires_at | string<date-time> | no | |
previous.revoked_at | string<date-time> | no | |
previous.last_used_at | string<date-time> | no | Atualizado no maximo 1x/min. |
previous.rotated_from | string<uuid> | no | |
previous.created_at | string<date-time> | yes |
400
Corpo/parametro invalido (invalid, invalid_body, invalid_cursor...)
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
401
Sem credencial valida
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
403
Sem permissao (nao e owner/admin; token sem escopo; token de integracao em rota nao permitida)
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
404
Nao existe NESTE time (404 uniforme: nao vaza existencia entre times)
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
409
duplicate | conflict | integration_revoked
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
429
Limite de requisições excedido.
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
500
Erro interno. Tente de novo com backoff; reporte o X-Request-Id.
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
Examples
"Try it" is turned off in this reference. Use the examples with your test credential.
curl
curl -sS -X POST 'https://api.axuz.net/teams/TEAM_ID/integrations/ID/tokens/TOKEN_ID/rotate' \
-H "Authorization: Bearer $AXUZ_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"string","grace_seconds":0,"expires_in_days":1,"no_expiry":false}'Node.js
const res = await fetch("https://api.axuz.net/teams/TEAM_ID/integrations/ID/tokens/TOKEN_ID/rotate", {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.AXUZ_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"name": "string",
"grace_seconds": 0,
"expires_in_days": 1,
"no_expiry": false
}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
console.log(await res.json());Python
import os
import requests
res = requests.request(
"POST",
"https://api.axuz.net/teams/TEAM_ID/integrations/ID/tokens/TOKEN_ID/rotate",
headers={
"Authorization": f"Bearer {os.environ['AXUZ_TOKEN']}",
},
json={
"name": "string",
"grace_seconds": 0,
"expires_in_days": 1,
"no_expiry": False,
},
timeout=30,
)
res.raise_for_status()
print(res.json())