BatchaddressoperationId batch
POST/v1/batch
Geocode a file. A job id comes back at once; the rows are worked through at the rate the key's plan sustains.
Bulk geocoding is the same product at the same price, not a separate one: a job is paced by the key's own token bucket, so a bulk load and live traffic draw on one budget. JSON lines or CSV in; a bare address per line is accepted, and the address column may be called q, address, query or text. At most 2000000 rows and 64 MB.
Send Authorization: Bearer sk_live_…. The key's plan must include theaddress product; which plans do.
Explained in Batch jobs and Clean a customer CSV.
Example
A CSV of five addresses.
curl -X POST "https://api.oslew.com/v1/batch?format=csv" \
-H "Authorization: Bearer $GEO_API_KEY" \
-H "Content-Type: text/csv" \
--data-binary @addresses.csvfrom oslew import Client
# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")
answer = client.batch(
open("addresses.csv").read(),
format="csv",
content_type="text/csv",
)import { readFile } from "node:fs/promises";
import { Client } from "@oslew/client";
// The key is read from GEO_API_KEY.
const client = new Client({ baseUrl: "https://api.oslew.com" });
const answer = await client.batch(await readFile("addresses.csv", "utf8"), { format: "csv", contentType: "text/csv" });HTTP/1.1 202 Accepted
content-type: application/json
ratelimit-limit: 1
ratelimit-remaining: 1
ratelimit-reset: 1
{
"id": "KNBDU4TD1RrnARXRKn0jodCf",
"tenant": "docs-batch",
"state": "queued",
"rows": 5,
"done": 0,
"found": 0,
"rps": 1,
"format": "csv",
"created_at": 1795427402,
"updated_at": 1795427402,
"epoch": 1,
"owner": "docs-examples",
"heartbeat_at": 1795427402,
"parts": 0
}A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.
Query
| Name | Type | Description |
|---|---|---|
formatquery | string jsonl | csv default jsonl |
Body
application/x-ndjson, required.
string
text/csv, required.
string
Responses
202 — Accepted; poll the job.
created_atintegerrequireddoneintegerrequiredRows attempted so far.foundintegerrequiredRows that resolved to a position.idstringrequiredrowsintegerrequiredrpsnumberrequiredThe sustained rate the job is paced at, which is the key's own.statestringrequiredqueued | running | done | failed | cancelledupdated_atintegerrequiredStops moving if the pod running the job is gone.epochintegerWhich claim on the job is current; a job taken over by another pod has a higher one.errorstring | nullformatstringHow the input was sent; on submit only.jsonl | csvheartbeat_atintegerUnix seconds of the owner's last heartbeat; on submit only.ownerstring | nullThe pod working on it.partsintegerOutput parts of 50,000 rows written so far.remaining_sintegerSeconds the rest of the rows should take at that rate.tenantstringThe tenant that owns it; on submit only.
With RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset(and their X-RateLimit-* aliases); see rate limits.
Refusals
Every refusal is a JSON object with an error string, except where noted.
| 400 | Not a readable file, no rows, or too many. |
| 401 | No key, or one that is unknown, revoked or suspended. |
| 403 | The key's plan does not include this route's product, or the request is larger than the plan allows. The body names the plan that does. |
| 413 | Too large. |
| 429 | This product's bucket is empty: the key is going faster than its plan's sustained rate. Wait Retry-After seconds; nothing is used up. Carries Retry-After. |
| 503 | The pod cannot reach the control plane and its entitlements are too old to trust. Retry. |
A malformed query string or JSON body is refused by the framework before this route runs, in plain text rather than JSON; see errors.
More examples
JSON lines, with a near point on one row
curl -X POST "https://api.oslew.com/v1/batch?format=jsonl" \
-H "Authorization: Bearer $GEO_API_KEY" \
-H "Content-Type: application/x-ndjson" \
--data-binary @addresses.jsonlfrom oslew import Client
# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")
answer = client.batch(open("addresses.jsonl").read(), format="jsonl")import { readFile } from "node:fs/promises";
import { Client } from "@oslew/client";
// The key is read from GEO_API_KEY.
const client = new Client({ baseUrl: "https://api.oslew.com" });
const answer = await client.batch(await readFile("addresses.jsonl", "utf8"), { format: "jsonl" });HTTP/1.1 202 Accepted
content-type: application/json
ratelimit-limit: 1
ratelimit-remaining: 1
ratelimit-reset: 1
{
"id": "OnClPC2UT5EwVGsAwNp06sMK",
"tenant": "docs-batch",
"state": "queued",
"rows": 3,
"done": 0,
"found": 0,
"rps": 1,
"format": "jsonl",
"created_at": 1795427413,
"updated_at": 1795427413,
"epoch": 1,
"owner": "docs-examples",
"heartbeat_at": 1795427413,
"parts": 0
}A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.
Rendered from the OpenAPI document at commit b8f4bde-dirty; the same document is served at/v1/openapi.json and generates both clients.