Configure your environment
Create a
.env file in the project root with the following variables:.env
| Variable | Required | Default | Description |
|---|---|---|---|
DATABASE_URL | Yes | — | PostgreSQL connection string. The server will not start without this. |
SECRET_KEY | Yes | CHANGE_ME | Secret used to sign JWT tokens. Use a long random string in production. |
ALGORITHM | No | HS256 | JWT signing algorithm. |
ACCESS_TOKEN_EXPIRE_MINUTES | No | 120 | Token lifetime in minutes. |
Install dependencies
Install the Python packages listed in Key packages installed:
requirements.txt:- FastAPI — web framework
- Uvicorn — ASGI server
- SQLAlchemy + psycopg2-binary — database ORM and PostgreSQL driver
- python-jose — JWT encoding and decoding
- passlib[bcrypt] — password hashing
Run the development server
Start the API with Uvicorn:The server starts at
http://localhost:8000. The --reload flag restarts the server automatically when you change source files.Obtain a JWT token
Send your credentials to the login endpoint to receive an access token:A successful response returns your token and user details:Save the
access_token value — you will include it in the Authorization header for all subsequent requests.Create your first ticket
The ticket creation endpoint is public — no token required. Send a A successful response returns the ticket reference and SLA deadline:
POST to /api/tickets/crear with the requester’s details and ticket information:Save the
ticketLabel value. Anyone can look up ticket status later using the label and the requester’s email via POST /api/tickets/consultar.Complete end-to-end example
The following script demonstrates the full flow: authenticate as an agent, capture the token, then check the dashboard.Next steps
Authentication
Learn about JWT Bearer tokens, roles, and how to handle 401 and 403 errors.
API Reference
Browse all available endpoints with request and response schemas.