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 → 401invalid_key; a read-only key → 403insufficient_scope. - Writes have their own quota per key: 300 a day and 30 a minute, apart from the read quota.
POSTacceptsIdempotency-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 → 422idempotency_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, withreason) 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 }withfavorite,dismissedornone.
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: trueto save a draft). Up to 5 published at a time. Optionaltext(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.
| Endpoint | What it does |
|---|---|
GET /account | Whose key it is, plan, limits and scopes (read, write, realtime). |
GET, POST /radars | List and create radars (active right away; 3 active at a time on the free plan). |
GET, PATCH, DELETE /radars/{id} | See, edit (partial), pause/resume/close (status: active, paused, found, closed, with reason) and delete. |
GET /radars/{id}/matches | What it found, newest first (paginated). Same content rules and delay as the public API. |
POST /marks | { id, mark } with favorite, dismissed or none. |
GET, POST /favorites · DELETE /favorites/{id} | Favorites. |
GET, POST /me/listings | 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 | Upload a photo (multipart photo, JPEG up to 6 MB; metadata removed). Up to 15 per listing. |
GET, PATCH, DELETE /me/listings/{id} | See, edit (partial), publish/pause/close (status: published, paused, closed) and delete. |
GET /channels | Where your alerts arrive (read-only; connecting Telegram or push is done in the app). |
GET /agency · /agency/listings · /agency/history | Your agency, its listings and its team history. |
POST /agency/removals · /agency/removals/{event}/undo | 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}'const r = await fetch("https://lonjaradar.com/api/v1/radars", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.LONJA_RADAR_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": crypto.randomUUID(),
},
body: JSON.stringify({
"name": "Apto en Cabecera",
"operation": "rent",
"types": [
"apartment"
],
"cities": [
"Bucaramanga"
],
"neighborhoods": [
"Cabecera del Llano"
],
"max_price": 2500000,
"min_bedrooms": 2
}),
});
const d = await r.json();
if (!r.ok) throw new Error(d.error.message); // d.error.code: limit_reached…
console.log(d.radar.id, d.radar.url);import os, uuid, requests
r = requests.post("https://lonjaradar.com/api/v1/radars", timeout=20,
headers={"Authorization": f"Bearer {os.environ['LONJA_RADAR_KEY']}",
"Idempotency-Key": str(uuid.uuid4())},
json={"name":"Apto en Cabecera","operation":"rent","types":["apartment"],"cities":["Bucaramanga"],"neighborhoods":["Cabecera del Llano"],"max_price":2500000,"min_bedrooms":2})
d = r.json()
if not r.ok:
raise RuntimeError(d["error"]["message"])
print(d["radar"]["id"], d["radar"]["url"])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"const h = { Authorization: `Bearer ${process.env.LONJA_RADAR_KEY}` };
const { matches } = await (await fetch("https://lonjaradar.com/api/v1/radars/123/matches", { headers: h })).json();
for (const m of matches) {
console.log(m.listing.title, m.listing.price, m.listing.lonjaradar_url);
// Save it to favorites:
await fetch("https://lonjaradar.com/api/v1/favorites", { method: "POST", headers: { ...h, "Content-Type": "application/json" }, body: JSON.stringify({ id: m.listing.id }) });
}import os, requests
h = {"Authorization": f"Bearer {os.environ['LONJA_RADAR_KEY']}"}
d = requests.get("https://lonjaradar.com/api/v1/radars/123/matches", headers=h, timeout=20).json()
for m in d["matches"]:
print(m["listing"]["title"], m["listing"]["price"], m["listing"]["lonjaradar_url"])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"}'import { readFile } from "node:fs/promises";
const h = { Authorization: `Bearer ${process.env.LONJA_RADAR_KEY}` };
const form = new FormData();
form.set("photo", new Blob([await readFile("sala.jpg")], { type: "image/jpeg" }), "sala.jpg");
const { key } = await (await fetch("https://lonjaradar.com/api/v1/me/listings/photos", { method: "POST", headers: h, body: form })).json();
const r = await fetch("https://lonjaradar.com/api/v1/me/listings", {
method: "POST",
headers: { ...h, "Content-Type": "application/json", "Idempotency-Key": crypto.randomUUID() },
body: JSON.stringify({ ...{"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: [key] }),
});
const { listing, warnings } = await r.json();
console.log(listing.status, listing.url, warnings);import os, uuid, requests
h = {"Authorization": f"Bearer {os.environ['LONJA_RADAR_KEY']}"}
with open("sala.jpg", "rb") as f:
key = requests.post("https://lonjaradar.com/api/v1/me/listings/photos", headers=h, timeout=60,
files={"photo": ("sala.jpg", f, "image/jpeg")}).json()["key"]
r = requests.post("https://lonjaradar.com/api/v1/me/listings", timeout=20,
headers={**h, "Idempotency-Key": str(uuid.uuid4())},
json={**{"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": [key]})
print(r.json()["listing"]["url"])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.