API Token'ları
Endpoint'ler
GET /api/v1/api-tokens listele
POST /api/v1/api-tokens oluştur { name, scopes? }
DELETE /api/v1/api-tokens/:id iptal etToken şekli
typescript
{
user: ObjectId,
team_id: ObjectId | null,
name: string,
hashed_token: string, // asla JSON'da dönülmez
prefix: string, // görsel tanımlama için kullanıcıya gösterilir
scopes: string[], // varsayılan []
last_used_at: Date | null,
revoked_at: Date | null,
}Önemli
Düz metin token yalnızca bir kez, POST /api-tokens yanıtında dönülür. Sosyabot salt'lı bir hash saklar; token'ı kaybedersen, iptal et ve yeniden ver.
Scope'lar
Scope'lar açtıkları public-API endpoint'leriyle eşleşir — posts:read, posts:write, accounts:read vb. Scope'suz bir token, oturum bearer olarak kullanılırsa hâlâ session-cookie-only endpoint'leri çağırabilir (yaygın değil).
Kullanım
curl -H "Authorization: Bearer sosya_..." https://app.sosyabot.com/api/v1/public/posts