OpenCage Geocoding API / request a GeoJSON geocoding response
OpenCage tool opencage-geojson on looot: input fields, $0.000167 per call, output shape, and code to run it with curl, JavaScript or Python.
Forward or reverse geocoding with OpenCage, answered as GeoJSON: send an address or place name for coordinates, or ‘lat,lng’ for an address. Same billed API and price as the JSON route.
- Tool id:
opencage-geojson - Provider: OpenCage
- Job: Turn coordinates into an address (
maps.geocode.reverse) - Price: $0.000167 per call. A call that fails at the provider costs $0.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
add_request |
boolean | no | |
address_only |
boolean | no | |
bounds |
string | no | decimal coordinates in min long, min lat, max long, max lat order. Example: “-0.563160,51.280430,0.278970,51.683979” |
countrycode |
string | no | Example: “de” |
language |
string | no | the preferred language of results. Example: “de” |
limit |
integer | no | Example: 1 |
no_annotations |
boolean | no | |
no_dedupe |
boolean | no | |
no_record |
boolean | no | |
pretty |
boolean | no | |
proximity |
string | no | Latitude and longitude decimal coordinates to bias results toward. Example: “52.3877830, 9.7334394” |
q |
string | yes | Location to geocode - can be an address, place name, or decimal coordinates in latitude, longitude order. Example: “52.5432379, 13.4142133” |
roadinfo |
boolean | no |
Output
The run’s result holds the provider’s answer. Signed in, looot inspect opencage-geojson prints its fields.
Run it
Every call needs your API token in LOOOT_TOKEN; Sign in shows how to get one. Each run also needs a new idempotency key, so a retry never pays twice. With wait: 30 the answer comes back inline when the run ends within 30 seconds. Otherwise you get the running run back: poll GET /v1/runs/<runId>.
Example input with placeholder values:
curl -X POST "https://api.looot.ai/v1/runs" \
-H "Authorization: Bearer $LOOOT_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"endpointId":"opencage-geojson","input":{"q":"52.5432379, 13.4142133","limit":1,"bounds":"-0.563160,51.280430,0.278970,51.683979","language":"de","proximity":"52.3877830, 9.7334394","countrycode":"de"},"wait":30}'const response = await fetch("https://api.looot.ai/v1/runs", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.LOOOT_TOKEN}`,
"Content-Type": "application/json",
"Idempotency-Key": crypto.randomUUID(),
},
body: JSON.stringify({
endpointId: "opencage-geojson",
input: {
q: "52.5432379, 13.4142133",
limit: 1,
bounds: "-0.563160,51.280430,0.278970,51.683979",
language: "de",
proximity: "52.3877830, 9.7334394",
countrycode: "de",
},
wait: 30,
}),
});
const run = await response.json();
console.log(run.status, run.result);import os
import uuid
import requests
response = requests.post(
"https://api.looot.ai/v1/runs",
headers={
"Authorization": f"Bearer {os.environ['LOOOT_TOKEN']}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"endpointId": "opencage-geojson",
"input": {
"q": "52.5432379, 13.4142133",
"limit": 1,
"bounds": "-0.563160,51.280430,0.278970,51.683979",
"language": "de",
"proximity": "52.3877830, 9.7334394",
"countrycode": "de",
},
"wait": 30,
},
timeout=90,
)
run = response.json()
print(run["status"], run.get("result"))To let looot pick among every provider of this job instead, send job:maps.geocode.reverse as endpointId; see the job page.