TypeScript SDK
@addrova/sdk is the official client for Node 18 or later, browsers, Deno and Bun. It uses the native fetch, has no runtime dependency, ships ESM and CommonJS builds, and its types are generated from the OpenAPI specification.
Install
The package is private and is not published on npm yet; build it from the repository. [À VÉRIFIER : publication sur npm]
cd sdk/js && npm ci && npm run build
Geocode, reverse, autocomplete, repair
import { Addrova } from "@addrova/sdk";
const client = new Addrova(); // key: process.env.ADDROVA_API_KEY (or { apiKey })
const r = await client.geocode("4 place d'Armes, Belfort", { country: "FR" });
console.log(r.results[0].label, r.results[0].location, r.attribution);
await client.reverse(47.6376, 6.8626);
await client.autocomplete("4 place d'ar", { focus: [47.64, 6.86], session: "checkout-123" });
await client.repair({ address: "4 pl darmes belfor", country: "FR" });
await client.usage();
await client.coverage(); // covered countries, sources, licences
Batch files
import { Addrova } from "@addrova/sdk";
const client = new Addrova();
const csvText = "adresse\n4 place d'Armes Belfort\n";
const job = await client.submitBatch(csvText, { addressColumn: "adresse" });
await client.waitBatch(job.id);
const csv = await client.batchResult(job.id);
await client.deleteBatch(job.id);
Errors and retries
- Retries on
429 rate_limited(honouringRetry-After), 5xx errors and network errors, with exponential backoff and jitter;maxRetriesis 3 by default. A batch upload is not replayed after a server error. - Typed errors:
AuthenticationError,InvalidRequestError,NotFoundError,ConflictError,RateLimitError,QuotaExceededError,ServerErrorandTransportError, withstatus,codeandrequestId.
Privacy and browsers
geocode sends the address in the body of a POST; the SDK logs nothing. In a browser, do not expose a live key in a public page: use a key restricted by origin or a server-side relay.