API para integração com mensagens seguras
A API permite criar links de mensagem segura e recuperá-los programaticamente.
curl -sS /api/v1/create.php \
-H 'Content-Type: application/json' \
-d '{"content":"Olá API","max_views":1}'
const res = await fetch('/api/v1/create.php', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({content: 'Olá API', max_views: 1})
});
const json = await res.json();
POST /api/v1/create
Corpo JSON:
content (string, obrigatório, máx. 50000)is_markdown (bool, opcional, padrão: false)max_views (int, 1-20, opcional, padrão: 1)password (string, opcional, 4-100)expire_minutes (int, 1-10080, opcional)Resposta (200):
{
"success": true,
"share_url": "https://.../view.php?token=...",
"token": "..."
}
curl -sS /api/v1/create.php \
-H 'Content-Type: application/json' \
-d '{"content":"segredo","password":"Secreta@123","max_views":5}'
curl -sS /api/v1/create.php \
-H 'Content-Type: application/json' \
-d '{"content":"# Título","is_markdown":true,"expire_minutes":60}'
POST /api/v1/view
Corpo JSON:
token (string, obrigatório)password (string, necessário se protegido)Resposta (200):
{
"success": true,
"content": "... plaintext ...",
"is_markdown": false,
"remaining_views": 0,
"expires_at": null
}
curl -sS /api/v1/view.php \
-H 'Content-Type: application/json' \
-d '{"token":"TOKEN","password":"Secreta@123"}'
{
"success": false,
"error": "password_required|invalid_token|not_found_or_expired"
}
※ Este endpoint consome uma visualização quando bem-sucedido.
POST /api/v1/status
Corpo JSON:
token (string, obrigatório)Resposta (200):
{
"success": true,
"status": "active|expired|not_found",
"requires_password": false,
"is_markdown": false,
"max_views": 1,
"remaining_views": 1,
"expires_at": null
}
curl -sS /api/v1/status.php \
-H 'Content-Type: application/json' \
-d '{"token":"TOKEN"}'
content_required — conteúdo vazioinvalid_max_views — fora do intervalo 1-20invalid_expire_minutes — fora do intervalo 1-10080password_required — faltando senhanot_found_or_expired — token não existe/expirado