Skip to content

πŸ”₯ A secure, high-performance REST API built with FastAPI to automate your TikTok streak messages, manage contact lists, and receive real-time Telegram notifications.

Notifications You must be signed in to change notification settings

dewhush/TikTok-Streak-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TikTok Streak API

Created by dewhush Python FastAPI

REST API for automating TikTok streak messages. Control your TikTok Streak Bot via API endpoints.

✨ Features

  • FastAPI: Modern, fast (high-performance) web framework
  • Secure: All configurations via environment variables - no hardcoded secrets
  • API Key Auth: Protected endpoints with X-API-Key header
  • Telegram Notifications: Get notified when streaks are sent
  • Auto Documentation: Swagger UI and ReDoc included

πŸ› οΈ Setup

1. Clone Repository

git clone https://github.com/dewhush/TikTok-Streak-API.git
cd TikTok-Streak-API

2. Install Dependencies

pip install -r requirements.txt

3. Configure Environment

Copy the example environment file:

# Linux/Mac
cp .env.example .env

# Windows
copy .env.example .env

Edit .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

4. Setup TikTok Cookies

  1. Login to TikTok in your browser
  2. Export cookies as cookies.json in the project root
  3. The bot will use these cookies to authenticate

5. Add Contacts

Create contacts.json:

{
    "contacts": ["username1", "username2"]
}

πŸš€ Running the API

Windows (Batch Script):

run_api.bat

Manual:

uvicorn api:app --host 0.0.0.0 --port 8000 --reload

Python:

python api.py

πŸ“š API Documentation

Once running, access:

Endpoints

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

Authentication

Protected endpoints require X-API-Key header:

curl -X GET "http://localhost:8000/v1/contacts" \
  -H "X-API-Key: your-api-key-here"

Example Requests

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"

πŸ“ Project Structure

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

⚠️ Security Notes

  • 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

πŸ“„ License

MIT License - See LICENSE file for details.


πŸ‘€ Credits

Created by dewhush

About

πŸ”₯ A secure, high-performance REST API built with FastAPI to automate your TikTok streak messages, manage contact lists, and receive real-time Telegram notifications.

Topics

Resources

Stars

Watchers

Forks