Skip to documentation content
HintadataDocs

SDK overview

Generate a typed server-side client from the contract.

In this guide
  1. 1Generate a client from OpenAPI
  2. 2Plain JavaScript example
  3. 3Treat the contract as the source of truth
In this guide
  1. 1Generate a client from OpenAPI
  2. 2Plain JavaScript example
  3. 3Treat the contract as the source of truth

Generate a client from OpenAPI

Hintadata publishes one OpenAPI contract for request fields, response models, authentication, errors, and examples. Generate a typed client with your preferred OpenAPI tool or call the HTTP API directly. Keep the generated code server-side because it uses the same secret Bearer key.

Plain JavaScript example

javascript
const response = await fetch(
  'https://api.pricecompare.nordicdevhouse.com/v1/search?q=sony&limit=10',
  {
    headers: {
      Authorization: `Bearer ${process.env.HINTADATA_API_KEY}`
    }
  }
);

if (!response.ok) throw new Error(`Hintadata request failed: ${response.status}`);
const result = await response.json();
console.log(result.items);

Treat the contract as the source of truth

Regenerate clients when the contract version changes. Pin generated clients in your dependency lockfile and test the search, comparison, history, and watch flows your application actually uses.

Was this page helpful?
SDK overview – Docs | Hintadata