Skip to content

Client libraries

Delivr has no official SDKs. The API is plain JSON over HTTPS, and the OpenAPI 3.1 document describes every route, field and webhook, so you can generate types and a client for your language. OpenAPI 3.1 support differs between generators; check that yours supports it.

openapi-typescript generates types, and openapi-fetch gives you a typed fetch:

npm install openapi-fetch
npx openapi-typescript https://docs.delivr.no/openapi.yaml -o src/delivr.d.ts
import createClient from "openapi-fetch";
import type { paths } from "./delivr";
const delivr = createClient<paths>({
baseUrl: process.env.DELIVR_API_URL,
headers: { Authorization: `Bearer ${process.env.DELIVR_API_KEY}` },
});
const { data, error } = await delivr.POST("/v1/merchant/quotes", {
body: {
pickupExternalStoreId: "oslo-sentrum",
delivery: { address: { street: "Karl Johans gate 22", postalCode: "0026", city: "Oslo" } },
parcels: [{ count: 1, weightKg: 4.5, lengthCm: 40, widthCm: 30, heightCm: 20 }],
},
});

Writes other than quotes also need an Idempotency-Key header; see Idempotency.

Language Generator Command
Python openapi-python-client openapi-python-client generate --url https://docs.delivr.no/openapi.yaml
Go ogen go run github.com/ogen-go/ogen/cmd/ogen@latest --target delivr --package delivr --clean openapi.yaml
Others OpenAPI Generator (PHP, Java, C#, Ruby and more) npx @openapitools/openapi-generator-cli generate -i https://docs.delivr.no/openapi.yaml -g php -o delivr-php

Generated clients do not verify webhook signatures. Use the code in Verifying signatures.

Import https://docs.delivr.no/openapi.yaml by URL (Postman: Import, then paste the link; Insomnia: Import, From URL). Then:

  • set the base URL to https://driver-staging-api.delivr.no,
  • set bearer auth on the collection with your sandbox key,
  • send a fresh UUID as Idempotency-Key on writes: {{$guid}} in Postman, the UUID template tag in Insomnia. Reuse the same value when you retry the same action.