oslew docs
Console
Menu

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
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.csv
Python
from 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",
)
TypeScript
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" });
Response
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

NameTypeDescription
format
query
string
jsonl | csv
default jsonl

Body

application/x-ndjson, required.

string

text/csv, required.

string

Responses

202 — Accepted; poll the job.

  • created_atintegerrequired
  • doneintegerrequired
    Rows attempted so far.
  • foundintegerrequired
    Rows that resolved to a position.
  • idstringrequired
  • rowsintegerrequired
  • rpsnumberrequired
    The sustained rate the job is paced at, which is the key's own.
  • statestringrequired
    queued | running | done | failed | cancelled
  • updated_atintegerrequired
    Stops moving if the pod running the job is gone.
  • epochinteger
    Which claim on the job is current; a job taken over by another pod has a higher one.
  • errorstring | null
  • formatstring
    How the input was sent; on submit only.
    jsonl | csv
  • heartbeat_atinteger
    Unix seconds of the owner's last heartbeat; on submit only.
  • ownerstring | null
    The pod working on it.
  • partsinteger
    Output parts of 50,000 rows written so far.
  • remaining_sinteger
    Seconds the rest of the rows should take at that rate.
  • tenantstring
    The 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.

400Not a readable file, no rows, or too many.
401No key, or one that is unknown, revoked or suspended.
403The 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.
413Too large.
429This 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.
503The 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
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.jsonl
Python
from 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")
TypeScript
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" });
Response
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.