Submit a job and get a run_id immediately
curl --request POST \
--url https://api.example.com/v1/runs \
--header 'Content-Type: application/json' \
--data '
{
"kind": "fetch_batch",
"request": {
"locations": [
{
"lat": 123,
"lng": 123,
"address": "<string>"
}
],
"fields": [
"<string>"
]
}
}
'import requests
url = "https://api.example.com/v1/runs"
payload = {
"kind": "fetch_batch",
"request": {
"locations": [
{
"lat": 123,
"lng": 123,
"address": "<string>"
}
],
"fields": ["<string>"]
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
kind: 'fetch_batch',
request: {locations: [{lat: 123, lng: 123, address: '<string>'}], fields: ['<string>']}
})
};
fetch('https://api.example.com/v1/runs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/runs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'kind' => 'fetch_batch',
'request' => [
'locations' => [
[
'lat' => 123,
'lng' => 123,
'address' => '<string>'
]
],
'fields' => [
'<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/runs"
payload := strings.NewReader("{\n \"kind\": \"fetch_batch\",\n \"request\": {\n \"locations\": [\n {\n \"lat\": 123,\n \"lng\": 123,\n \"address\": \"<string>\"\n }\n ],\n \"fields\": [\n \"<string>\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/runs")
.header("Content-Type", "application/json")
.body("{\n \"kind\": \"fetch_batch\",\n \"request\": {\n \"locations\": [\n {\n \"lat\": 123,\n \"lng\": 123,\n \"address\": \"<string>\"\n }\n ],\n \"fields\": [\n \"<string>\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/runs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"kind\": \"fetch_batch\",\n \"request\": {\n \"locations\": [\n {\n \"lat\": 123,\n \"lng\": 123,\n \"address\": \"<string>\"\n }\n ],\n \"fields\": [\n \"<string>\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Runs
POST /v1/runs
Submit a job, get a run_id immediately, poll or stream its progress.
POST
/
v1
/
runs
Submit a job and get a run_id immediately
curl --request POST \
--url https://api.example.com/v1/runs \
--header 'Content-Type: application/json' \
--data '
{
"kind": "fetch_batch",
"request": {
"locations": [
{
"lat": 123,
"lng": 123,
"address": "<string>"
}
],
"fields": [
"<string>"
]
}
}
'import requests
url = "https://api.example.com/v1/runs"
payload = {
"kind": "fetch_batch",
"request": {
"locations": [
{
"lat": 123,
"lng": 123,
"address": "<string>"
}
],
"fields": ["<string>"]
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
kind: 'fetch_batch',
request: {locations: [{lat: 123, lng: 123, address: '<string>'}], fields: ['<string>']}
})
};
fetch('https://api.example.com/v1/runs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/runs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'kind' => 'fetch_batch',
'request' => [
'locations' => [
[
'lat' => 123,
'lng' => 123,
'address' => '<string>'
]
],
'fields' => [
'<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/runs"
payload := strings.NewReader("{\n \"kind\": \"fetch_batch\",\n \"request\": {\n \"locations\": [\n {\n \"lat\": 123,\n \"lng\": 123,\n \"address\": \"<string>\"\n }\n ],\n \"fields\": [\n \"<string>\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/runs")
.header("Content-Type", "application/json")
.body("{\n \"kind\": \"fetch_batch\",\n \"request\": {\n \"locations\": [\n {\n \"lat\": 123,\n \"lng\": 123,\n \"address\": \"<string>\"\n }\n ],\n \"fields\": [\n \"<string>\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/runs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"kind\": \"fetch_batch\",\n \"request\": {\n \"locations\": [\n {\n \"lat\": 123,\n \"lng\": 123,\n \"address\": \"<string>\"\n }\n ],\n \"fields\": [\n \"<string>\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}When to use this
When you don’t want to hold the connection open.POST /v1/runs accepts a
job, returns 202 with a run_id immediately, and executes in the
background — you read its state whenever you like:
- Poll:
GET /v1/runs/{run_id}— status, progress, and (once terminal) the result. This is the source of truth. - Stream:
GET /v1/runs/{run_id}/events— server-sent events; astatusframe on every change and a terminalfinalframe carrying the full run. A convenience over polling, not a second contract.
fetch_batch — the exact
/v1/fetch/batch request, same validation, same
limits, same result body. More kinds hang off this spine as they ship.
Submit
curl -s https://api.mireye.com/v1/runs \
-H "Authorization: Bearer $MIREYE_API_TOKEN" \
-H 'content-type: application/json' \
-d '{
"kind": "fetch_batch",
"request": {
"locations": [{"lat": 29.7604, "lng": -95.3698},
{"address": "350 5th Ave, New York, NY 10118"}],
"fields": ["elevation", "coast_distance_m"]
}
}' | jq
{
"run_id": "run_a1b2c3d4e5f6",
"status": "queued",
"poll": "/v1/runs/run_a1b2c3d4e5f6",
"events": "/v1/runs/run_a1b2c3d4e5f6/events"
}
400 fields_unknown, 422, …) on the POST
itself — a run never exists only to fail on something validation could have
caught.
Poll
curl -s https://api.mireye.com/v1/runs/run_a1b2c3d4e5f6 \
-H "Authorization: Bearer $MIREYE_API_TOKEN" | jq
{
"run_id": "run_a1b2c3d4e5f6",
"kind": "fetch_batch",
"status": "running",
"created_at": "2026-07-27T09:00:00+00:00",
"updated_at": "2026-07-27T09:00:04+00:00",
"expires_at": "2026-08-26T09:00:00+00:00",
"progress": {"done": 1, "total": 2},
"request": {"…": "as submitted"},
"result": null,
"error": null
}
status walks queued → running → done | failed. Once done, result
carries exactly the body the synchronous endpoint would have returned. Once
failed, error carries {error, message, retryable} — a
run_interrupted failure (the worker restarted mid-run, e.g. during a
deploy) is always retryable: resubmit the same request.
Stream
curl -sN https://api.mireye.com/v1/runs/run_a1b2c3d4e5f6/events \
-H "Authorization: Bearer $MIREYE_API_TOKEN"
event: status
data: {"status": "running", "progress": {"done": 1, "total": 2}}
event: final
data: {"run_id": "run_a1b2c3d4e5f6", "status": "done", "result": {…}, …}
final frame. A run that finished before you
connected skips straight to final. Streams are capped at 15 minutes
(events_timeout error frame) — past that, poll.
Artifacts: the result as a file
Once a run isdone, download its result instead of parsing it:
curl -sOJ https://api.mireye.com/v1/runs/run_a1b2c3d4e5f6/artifacts/csv \
-H "Authorization: Bearer $MIREYE_API_TOKEN"
/artifacts/csv— one row per location, index-aligned: identity columns (index, ok, lat, lng, source, error), one column per field carrying the value (empty when absent or failed), and afailed_fieldscolumn naming what to distrust. Spreadsheet-ready./artifacts/geojson— aFeatureCollection, onePointper location (GeoJSON[lng, lat]axis order), field values asproperties. A failed location keeps its slot as a null-geometry feature, so the collection stays index-aligned too.
queued/running
returns 409 run_not_ready (retryable); a failed run returns
409 run_failed (resubmit). PDF is deliberately not offered here: branded
report generation lives in the delivery tooling, not the serving API.
Ownership, retention, errors
- A run belongs to the account that submitted it. Anyone else’s
run_id— and any unknown id — reads as404 run_not_found: a run id does not leak whether someone else’s job exists. - Runs expire 30 days after submission and then read as
404. This is the same clock as every other address-holding store: afetch_batchrequest can contain street addresses, and the disclosed 30-day retention applies to run documents too. - A batch location’s failure is inside the result (
ok: falseentries), exactly as on the synchronous endpoint — a failed location never fails the run.
Body
application/json
Allowed value:
"fetch_batch"N locations, one field selection.
The field selection is deliberately batch-wide, not per-location: the batch exists for "the same screen over a list of candidate properties", and per-location field lists would make the response shape unpredictable for exactly the clients (agents, spreadsheets) the batch serves.
Show child attributes
Show child attributes
Response
Successful Response