GREMDocs

TypeScript SDK

Last updated: 2026-07-212 min read

A tiny, dependency-free client for the GREM API. It works in Node 18+ and modern browsers (uses the global fetch and Web Crypto).

Install

It is a single file — no build step, no dependencies. Download it and drop it into your project:

Download grem.ts

Quickstart

import { GremClient } from './grem';

const grem = new GremClient({ apiKey: process.env.GREM_API_KEY });

const { estimate } = await grem.valuation.express({
  propertyCategory: 'apartment',
  totalArea: 50,
});
console.log(estimate.pricePoint, estimate.currency);

The base URL defaults to https://developers.grem.capital/api/v1. Create a key in the cabinet: AI tools -> API -> Keys.

Async jobs

Long-running tools return a jobId. Poll for the result (polling is free):

const { jobId } = await grem.content.generate({ /* ... */ });
const result = await grem.jobs.wait('content/generate', jobId);

Errors

Non-2xx responses throw a GremError (RFC 7807):

import { GremError } from './grem';

try {
  await grem.valuation.express({ propertyCategory: 'apartment' }); // missing totalArea
} catch (e) {
  if (e instanceof GremError) console.error(e.status, e.detail, e.requestId);
}

Idempotency

Pass an idempotency key to safely retry a POST:

await grem.valuation.express(input, crypto.randomUUID());

Webhooks

Verify each delivery's signature against the raw body:

import { verifyWebhookSignature } from './grem';

app.post('/grem-hook', express.raw({ type: 'application/json' }), async (req, res) => {
  const raw = req.body.toString('utf8');
  const ok = await verifyWebhookSignature(process.env.GREM_WEBHOOK_SECRET, req.get('x-grem-signature'), raw);
  if (!ok) return res.status(400).send('invalid signature');
  const event = JSON.parse(raw);
  // handle event.type / event.data ...
  res.sendStatus(200);
});

Every method maps 1:1 to an endpoint in the interactive explorer. See Quickstart and Webhooks for the underlying requests.

Was this article helpful?