Pular para o conteúdo

Quick Start

Create a User

Terminal window
curl -X POST https://auth.redecasas.com.br/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "joao@email.com",
"password": "senha123",
"name": "João Silva",
"phone": "11999999999"
}'

Response includes a Set-Cookie header with the session token.


Login

Terminal window
curl -X POST https://auth.redecasas.com.br/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "joao@email.com",
"password": "senha123"
}'

Get Current User

Terminal window
curl https://auth.redecasas.com.br/api/auth/me \
-H "Cookie: session=<token>"

Upload a Listing Image

Terminal window
curl -X POST https://listing.redecasas.com.br/api/listings/upload-image \
-H "Cookie: session=<token>" \
-F "image=@foto1.jpg"

Save the returned url for the next step.


Create a Real Estate Listing

Terminal window
curl -X POST https://listing.redecasas.com.br/api/listings \
-H "Cookie: session=<token>" \
-H "Content-Type: application/json" \
-d '{
"title": "Casa em Florianópolis",
"description": "Ótima casa com 3 quartos, piscina e vista para o mar.",
"price": 850000,
"property_type": "casa",
"city": "Florianópolis",
"state_code": "SC",
"bedrooms": 3,
"bathrooms": 2,
"area_m2": 180,
"whatsapp": "48999999999",
"images": [
"https://{r2}/listings/temp/{userId}/{uuid}.jpg"
]
}'

Note: 1 free listing per user. Additional listings require an active subscription.


List My Listings

Terminal window
curl https://listing.redecasas.com.br/api/listings/me \
-H "Cookie: session=<token>"

Register as a Real Estate Agent

Terminal window
curl -X POST https://corretores.redecasas.com.br/api/corretores \
-H "Content-Type: application/json" \
-d '{
"name": "Maria Souza",
"email": "maria@corretora.com",
"whatsapp": "11999999999",
"creci_estado": "SP",
"creci_numero": "123456",
"cidade": "São Paulo",
"estado": "SP",
"especializacao": "Imóveis Residenciais"
}'

Registration is stored as pending and requires admin approval.


List Approved Agents

Terminal window
curl "https://corretores.redecasas.com.br/api/corretores?state=SP&city=São+Paulo"

Check Subscription Status

Terminal window
curl https://billing.redecasas.com.br/api/billing/status \
-H "Cookie: session=<token>"

Create Stripe Checkout

Terminal window
curl -X POST https://billing.redecasas.com.br/api/billing/checkout \
-H "Cookie: session=<token>"

Response contains a Stripe checkout URL. Redirect the user to complete payment.


Open Customer Portal

Terminal window
curl -X POST https://billing.redecasas.com.br/api/billing/portal \
-H "Cookie: session=<token>"

Logout

Terminal window
curl -X POST https://auth.redecasas.com.br/api/auth/logout \
-H "Cookie: session=<token>"