SDK
GetSeoHit TypeScript SDK
A typed client for the REST API with no dependencies. It runs on Node.js 18+, Deno, Bun and in the browser; response and error types are defined.
Status
The SDK’s npm package is being prepared for release. Until it’s published you can do the same things with the REST API; the endpoints and responses are exactly the same.
Usage
Start a crawl, wait for it to finish and read the score and findings:
import { GetSeoHit } from '@getseohit/sdk';
const api = new GetSeoHit({ apiKey: process.env.GETSEOHIT_API_KEY! });
const [asset] = await api.assets();
await api.startScan(asset.id);
const report = await api.waitForScan(asset.id, { lang: 'en' });
console.info(report.scan?.score, report.findings.length);Release gate in a CI job
Check the latest crawl against your policy before deploying, and stop the job if there’s a violation:
const result = await api.gate(assetId, { minScore: 80, failOn: ['critical'] });
if (!result.pass) {
console.error(result.violations);
process.exit(1);
}Errors
Failed requests throw GetSeoHitError: the code field is the API error code (for example credits_out, limit, rate_limited) and status is the HTTP status.
import { GetSeoHit, GetSeoHitError } from '@getseohit/sdk';
try {
await api.startScan(assetId);
} catch (e) {
if (e instanceof GetSeoHitError && e.code === 'credits_out') {
// ...
}
}Methods
| Method | What it does |
|---|---|
| me() | User, organization and role. |
| usage() | Plan, limits and this month’s usage. |
| assets() | Lists assets. |
| asset() | An asset’s latest crawl and findings. |
| createAsset() | Creates a new asset. |
| startScan() | Starts a crawl. |
| waitForScan() | Waits until the crawl finishes and returns the report. |
| seoMd() | Open issues as Markdown. |
| asoMd() | Store checks as Markdown. |
| tasks() | Lists tasks. |
| updateTask() | Changes a task’s status. |
| importTasks() | Imports tasks from CSV. |
| fixes() | Lists fix proposals. |
| decideFix() | Approves, rejects or rolls back a proposal. |
| gate() | Evaluates the latest crawl against a policy. |
| prompts() | Prompt Lab prompts and results. |
| uptime() | Uptime status, rates, response time and SSL. |
| keywords() | Tracked keywords and their positions. |
| addKeywords() | Adds keywords. |
| pageSpeed() | Latest PageSpeed Insights measurements and failed audits. |
| runPageSpeed() | Measures a page with PageSpeed Insights now. |
| keywordResearch() | Keyword research (overview or ideas). |
| domainResearch() | Domain research. |
| verifyOwnership() | Verifies site ownership. |
| setStatusPage() | Turns the status page on or off. |
| addPrompt() | Adds a Prompt Lab question. |
| copilot() | Copilot chat (user session). |
| graph() | Knowledge graph. |
| events() | Event stream. |
| notifications() | Notifications. |
| markAllRead() | Marks all notifications as read. |
| sendLogs() | Sends a server log. |
| botLogs() | Bot visits over the last 30 days. |
| manifest() | Signed release manifest. |
| login() | Gets a session token with email and password (static method). |
| logout() | Ends the session. |
| deleteAccount() | Permanently deletes the account. |