Writing with the APIDocumentation

Writing with the API

Updated on · API 1.0.0 · Español · Markdown

Everything you can do in the app you can also do with the API: create and manage radars (saved searches that alert you), see what they find, save favorites, publish your own listings and, if you work at a real-estate agency, take down its listings. These endpoints act on the account that owns the key, with the same rules as the web app.

A write key

Create it at /desarrolladores and choose «Leer y cambiar mi cuenta» (read and change my account). Existing keys stay read-only. A write key is a server secret: never put it in a web page or a mobile app. These endpoints have no open CORS. Up to 5 keys per account.

  • Send it as Authorization: Bearer lr_…. No key → 401 invalid_key; a read-only key → 403 insufficient_scope.
  • Writes have their own quota per key: 300 a day and 30 a minute, apart from the read quota.
  • POST accepts Idempotency-Key (8–100 chars, a UUID works): the same key and request within 24 h return the same response (Idempotent-Replayed: true) without doing it twice; the same key with a different request → 422 idempotency_key_reused.
  • Responses are Cache-Control: private, no-store. Errors have the same shape as the public API ({ "error": { "code", "message" } }); extra codes: insufficient_scope, limit_reached, conflict, idempotency_key_reused, unsupported_media_type, upstream_unavailable.
  • Every write is audited (key, action, resource, time).

Endpoints

  • GET /account

    What it does
    Whose key it is, plan, limits and scopes (read, write, realtime).
  • GET, POST /radars

    What it does
    List and create radars (active right away; 3 active at a time on the free plan).
  • GET, PATCH, DELETE /radars/{id}

    What it does
    See, edit (partial), pause/resume/close (status: active, paused, found, closed, with reason) and delete.
  • GET /radars/{id}/matches

    What it does
    What it found, newest first (paginated). Same content rules and delay as the public API.
  • POST /marks

    What it does
    { id, mark } with favorite, dismissed or none.
  • GET, POST /favorites · DELETE /favorites/{id}

    What it does
    Favorites.
  • GET, POST /me/listings

    What it does
    Your listings with views and WhatsApp taps; publish one (or draft: true to save a draft). Up to 5 published at a time. Optional text (in Spanish): AI fills in what is missing.
  • POST /me/listings/photos · POST /me/listings/{id}/photos

    What it does
    Upload a photo (multipart photo, JPEG up to 6 MB; metadata removed). Up to 15 per listing.
  • GET, PATCH, DELETE /me/listings/{id}

    What it does
    See, edit (partial), publish/pause/close (status: published, paused, closed) and delete.
  • GET /channels

    What it does
    Where your alerts arrive (read-only; connecting Telegram or push is done in the app).
  • GET /agency · /agency/listings · /agency/history

    What it does
    Your agency, its listings and its team history.
  • POST /agency/removals · /agency/removals/{event}/undo

    What it does
    Take a listing down (reason: sold, rented, unavailable; verified agencies only) and undo within 7 days.

Full schemas in the OpenAPI. Radar filters: operation, types, cities, neighborhoods, min_price, max_price, min_bedrooms, min_bathrooms, min_parking_spaces, min_area_m2, min_stratum, max_stratum, owner_only and exclude_pedestrian_only. With min_stratum or max_stratum (1 to 6) a listing without a stratum (neither its own nor the one we fill in from its neighborhood) does not reach the radar. Listing data: operation, type, city, neighborhood, price, admin_fee, area_m2, bedrooms, bathrooms, parking_spaces, stratum, floor, description, advertiser, company, condition, building_age, access and amenities. An unknown field is an error.

Create a radar

curl -s -X POST https://lonjaradar.com/api/v1/radars \
  -H "Authorization: Bearer $LONJA_RADAR_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"name":"Apto en Cabecera","operation":"rent","types":["apartment"],"cities":["Bucaramanga"],"neighborhoods":["Cabecera del Llano"],"max_price":2500000,"min_bedrooms":2}'

Read what it finds and save favorites

curl -s "https://lonjaradar.com/api/v1/radars/123/matches?limit=20" \
  -H "Authorization: Bearer $LONJA_RADAR_KEY"

Publish your own listing

# 1. The photo (JPEG, up to 6 MB): returns its key
curl -s -X POST https://lonjaradar.com/api/v1/me/listings/photos \
  -H "Authorization: Bearer $LONJA_RADAR_KEY" \
  -F "photo=@sala.jpg"

# 2. The listing, as a draft, with that key in photos
curl -s -X POST https://lonjaradar.com/api/v1/me/listings \
  -H "Authorization: Bearer $LONJA_RADAR_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"data":{"operation":"rent","type":"apartment","city":"Bucaramanga","neighborhood":"Cabecera del Llano","price":1800000,"area_m2":62,"bedrooms":2,"bathrooms":2},"whatsapp":"3001234567","draft":true,"photos":["u/123/borrador/…jpg"]}'

# 3. Publish it
curl -s -X PATCH https://lonjaradar.com/api/v1/me/listings/456 \
  -H "Authorization: Bearer $LONJA_RADAR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"status":"published"}'

MCP with your account

Send the write key to the MCP server (Authorization: Bearer lr_…) and create_radar, list_radars, list_radar_matches, save_favorite, draft_listing appear in tools/list. Without it they are not listed. draft_listing only saves a draft and returns a link: the person reviews it and publishes it herself.

Without copying a key: add https://lonjaradar.com/mcp/cuenta as a connector in Claude or ChatGPT. The assistant asks you to sign in with your Lonja Radar account (email code or Google) and to allow it; from then on it has these same tools on your account, with a quota per account of 5,000 calls a day (60 a minute) plus 300 changes a day. It is standard OAuth 2.1 with PKCE and dynamic client registration (metadata at https://lonjaradar.com/.well-known/oauth-authorization-server). You see and disconnect connected assistants in Connected assistants.