Reiniciar a conexão da instância

POST /instance/reset

Solicita uma retomada controlada da conexão sem apagar a instância nem o pareamento existente. Use quando a sessão estiver presa ou os envios não estiverem progredindo.

Comportamentos possíveis:

  • inicia um novo reset quando a instância está apta
  • informa que um reset já está em andamento
  • informa que existe cooldown ativo entre resets
  • retorna erro quando a sessão não pode ser recuperada ou quando a política de reconexão bloqueia a operação

A resposta informa:

  • instanceId: ID da instância autenticada
  • resetting: se há reset em andamento no momento
  • queuedRecoveryAttempted: se mensagens pendentes também entraram na tentativa de recuperação

Autenticação

[
  {
    "token": []
  }
]
{
  "token": {
    "name": "token",
    "type": "apiKey",
    "in": "header"
  }
}

Respostas

{
  "200": {
    "description": "Reset aceito, já em andamento ou em cooldown",
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "response": {
              "type": "string",
              "example": "Instance reset started"
            },
            "resetting": {
              "type": "boolean",
              "example": true
            },
            "instanceId": {
              "type": "string",
              "example": "r183e2ef9597845"
            },
            "queuedRecoveryAttempted": {
              "type": "boolean",
              "example": true
            }
          }
        },
        "examples": {
          "started": {
            "summary": "Reset iniciado",
            "value": {
              "response": "Instance reset started",
              "resetting": true,
              "instanceId": "r183e2ef9597845",
              "queuedRecoveryAttempted": true
            }
          },
          "inProgress": {
            "summary": "Reset já em andamento",
            "value": {
              "response": "Instance reset already in progress",
              "resetting": true,
              "instanceId": "r183e2ef9597845",
              "queuedRecoveryAttempted": false
            }
          },
          "cooldown": {
            "summary": "Cooldown ativo",
            "value": {
              "response": "Instance reset cooldown active (8s remaining)",
              "resetting": false,
              "instanceId": "r183e2ef9597845",
              "queuedRecoveryAttempted": false
            }
          }
        }
      }
    }
  },
  "400": {
    "description": "Payload JSON inválido",
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "error": {
              "type": "string",
              "example": "invalid payload"
            }
          }
        }
      }
    }
  },
  "401": {
    "description": "Token inválido, ausente ou cliente não encontrado",
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "error": {
              "type": "string",
              "example": "client not found"
            }
          }
        }
      }
    }
  },
  "403": {
    "description": "Reset bloqueado pela política de reconexão",
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "error": {
              "type": "string"
            },
            "resetting": {
              "type": "boolean",
              "example": false
            },
            "instanceId": {
              "type": "string"
            },
            "queuedRecoveryAttempted": {
              "type": "boolean"
            }
          }
        }
      }
    }
  },
  "409": {
    "description": "Sessão atual não é reconectável por reset",
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "error": {
              "type": "string"
            },
            "resetting": {
              "type": "boolean",
              "example": false
            },
            "instanceId": {
              "type": "string"
            },
            "queuedRecoveryAttempted": {
              "type": "boolean"
            }
          }
        }
      }
    }
  },
  "500": {
    "description": "Erro interno ao solicitar o reset",
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "error": {
              "type": "string",
              "example": "server not available"
            },
            "resetting": {
              "type": "boolean",
              "example": false
            },
            "instanceId": {
              "type": "string"
            },
            "queuedRecoveryAttempted": {
              "type": "boolean"
            }
          }
        }
      }
    }
  }
}

Guias relacionados

Autenticação · Erros e retries · Server URL