You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DATABASE_URL=postgresql+asyncpg://postgres:postgres@localhost:5432/dari_dbJWT_SECRET=your-secret-key-hereJWT_ALGORITHM=HS256AGENCY_TOKEN_EXPIRE_DAYS=7USER_TOKEN_EXPIRE_DAYS=30# Image storage — set USE_LOCAL_STORAGE=false to use CloudinaryUSE_LOCAL_STORAGE=trueUPLOAD_DIR=./uploads# Cloudinary (only required when USE_LOCAL_STORAGE=false)CLOUDINARY_CLOUD_NAME=CLOUDINARY_API_KEY=CLOUDINARY_API_SECRET=
6. Run database migrations
alembic upgrade head
7. (Optional) Seed the database
python seed.py
8. Start the server
uvicorn app.main:app --reload
The API will be available at http://localhost:8000.
Interactive docs: http://localhost:8000/docs
API Reference
Auth
Method
Endpoint
Description
POST
/auth/login
Agency login — returns JWT
POST
/users/register
User registration — returns JWT
POST
/users/login
User login — returns JWT
Listings
Method
Endpoint
Auth
Description
GET
/listings
—
Paginated listing search with filters
GET
/listings/recent
—
Latest N active listings
GET
/listings/promoted
—
Promoted listings
GET
/listings/markers
—
Map markers with coordinates
GET
/listings/by-ids
—
Fetch listings by comma-separated IDs
GET
/listings/{id}
—
Full listing detail
POST
/listings
Agency or User
Create a listing
PUT
/listings/{id}
Owner
Update a listing
DELETE
/listings/{id}
Owner
Delete a listing
POST
/listings/{id}/view
—
Increment view counter
POST
/listings/{id}/images
Owner
Upload images
Agencies
Method
Endpoint
Auth
Description
GET
/agencies
—
List all agencies
GET
/agencies/featured
—
Featured agencies
GET
/agencies/{id}
—
Agency detail
GET
/agencies/slug/{slug}
—
Agency by slug
PUT
/agencies/{id}
Agency
Update agency profile
POST
/agencies/{id}/logo
Agency
Upload logo
POST
/agencies/{id}/cover
Agency
Upload cover photo
Users
Method
Endpoint
Auth
Description
GET
/users/me
User
Current user profile
GET
/users/me/listings
User
Listings by current user
Query Parameters — GET /listings
Param
Type
Description
listing_type
string
vente or location
property_type
string
appartement, villa, terrain, etc.
publisher_type
string
agence or particulier
wilaya
string
Exact wilaya name
location_query
string
Partial match on city or wilaya
min_price
int
Minimum price
max_price
int
Maximum price
min_surface
int
Minimum surface in m²
page
int
Page number (default: 1)
per_page
int
Results per page (default: 12, max: 50)
Authentication
All protected endpoints require a Bearer token in the Authorization header:
Authorization: Bearer <token>
Tokens are obtained from the login endpoints. Agency tokens expire after 7 days, user tokens after 30 days.