Base URL
The TelegrmBot API is built with Spring Boot and runs on:localhost:8080 with your deployed server URL.
Authentication
The API uses JWT (JSON Web Token) authentication for protected endpoints:- Public endpoints:
/auth/registerand/auth/logindo not require authentication - Protected endpoints: All
/api/*endpoints require a valid JWT token in the Authorization header
Authorization Header Format
- Register a new user via
POST /auth/register - Login with your credentials via
POST /auth/login - Use the returned token in subsequent requests
The JWT token expires after 24 hours (86400000 milliseconds).
API Structure
The API is organized into two main sections:Authentication (/auth)
- User registration and login
- JWT token generation
- No authentication required
Conversations (/api/conversations)
- List all Telegram conversations
- Retrieve messages from specific conversations
- Send messages to Telegram chats
- Requires authentication
Response Format
All API responses use JSON format with consistent structures.Success Response
Successful requests return the appropriate HTTP status code with a JSON body:Error Response
Errors follow a standardized format:details contains a map of field names to error messages:
HTTP Status Codes
The API uses standard HTTP status codes:| Status Code | Meaning | Description |
|---|---|---|
| 200 | OK | Request succeeded |
| 201 | Created | Resource created successfully |
| 400 | Bad Request | Invalid input data or malformed JSON |
| 401 | Unauthorized | Missing or invalid authentication token |
| 404 | Not Found | Resource not found |
| 409 | Conflict | Resource already exists (e.g., duplicate email) |
| 500 | Internal Server Error | Unexpected server error |
Common Error Scenarios
Authentication Errors
Missing TokenValidation Errors
Invalid InputInteractive API Documentation
The API includes Swagger UI for interactive documentation and testing:Rate Limiting
Currently, the API does not enforce rate limiting. This may change in future versions.Versioning
The current API version isv1. The API does not use explicit versioning in the URL path at this time.
Content Type
All requests and responses useapplication/json content type:
Next Steps
Authentication
Learn how to register users and obtain JWT tokens
Conversations
Manage Telegram conversations and retrieve messages
Messages
Send messages to Telegram chats