REST API for automating TikTok streak messages. Control your TikTok Streak Bot via API endpoints.
- FastAPI: Modern, fast (high-performance) web framework
- Secure: All configurations via environment variables - no hardcoded secrets
- API Key Auth: Protected endpoints with
X-API-Keyheader - Telegram Notifications: Get notified when streaks are sent
- Auto Documentation: Swagger UI and ReDoc included
git clone https://github.com/dewhush/TikTok-Streak-API.git
cd TikTok-Streak-APIpip install -r requirements.txtCopy the example environment file:
# Linux/Mac
cp .env.example .env
# Windows
copy .env.example .envEdit .env and fill in your values:
# Required
API_KEY=your-secure-api-key-here
TELEGRAM_BOT_TOKEN=your-telegram-bot-token
TELEGRAM_CHAT_ID=your-telegram-chat-id- Login to TikTok in your browser
- Export cookies as
cookies.jsonin the project root - The bot will use these cookies to authenticate
Create contacts.json:
{
"contacts": ["username1", "username2"]
}Windows (Batch Script):
run_api.batManual:
uvicorn api:app --host 0.0.0.0 --port 8000 --reloadPython:
python api.pyOnce running, access:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
| Method | Endpoint | Auth | Description |
|---|---|---|---|
GET |
/ |
β | Welcome message |
GET |
/health |
β | Health check |
GET |
/status |
β | Server status |
POST |
/v1/streak |
β | Run streak bot |
GET |
/v1/contacts |
β | List contacts |
POST |
/v1/contacts |
β | Add contact |
DELETE |
/v1/contacts/{nickname} |
β | Remove contact |
Protected endpoints require X-API-Key header:
curl -X GET "http://localhost:8000/v1/contacts" \
-H "X-API-Key: your-api-key-here"Run Streak Bot:
curl -X POST "http://localhost:8000/v1/streak" \
-H "X-API-Key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"message": "Hey! Streak time π₯"}'Response:
{
"success": true,
"message": "Streak bot started in background",
"data": {
"custom_message": "Hey! Streak time π₯",
"started_at": "2026-01-17T01:30:00.000000"
}
}Add Contact:
curl -X POST "http://localhost:8000/v1/contacts" \
-H "X-API-Key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"nickname": "friend_username"}'List Contacts:
curl -X GET "http://localhost:8000/v1/contacts" \
-H "X-API-Key: your-api-key-here"Remove Contact:
curl -X DELETE "http://localhost:8000/v1/contacts/friend_username" \
-H "X-API-Key: your-api-key-here"TikTok-Streak-API/
βββ api.py # FastAPI app & routes
βββ config.py # Configuration (loads from .env)
βββ streak_bot.py # Main bot logic
βββ requirements.txt # Python dependencies
βββ .env.example # Environment template
βββ .gitignore # Git exclusions
βββ run_api.bat # Windows startup script
βββ README.md # This file
- Never commit
.env- Contains your secrets - Never commit
cookies.json- Contains session data - Never commit
contacts.json- Contains user data - Use strong API keys - Generate random secure keys
- Rotate Telegram tokens - If exposed, regenerate via @BotFather
MIT License - See LICENSE file for details.
Created by dewhush