Complete REST API documentation with request/response examples for all 19 endpoints.
TypeScript SDK quickstart, method reference, error handling, and webhook verification.
npm install @emithq/sdkSign up at app.emithq.com, create an organization, then generate an API key from the dashboard. Your key starts with emhq_.
import { EmitHQ } from '@emithq/sdk';
const emithq = new EmitHQ('emhq_your_api_key');
// Create an endpoint for your customer
const endpoint = await emithq.createEndpoint('app_123', {
url: 'https://customer.com/webhooks',
});
// Save endpoint.signingSecret — shown only once
// Send a webhook event
const message = await emithq.sendEvent('app_123', {
eventType: 'invoice.paid',
payload: { invoiceId: 'inv_456', amount: 9900 },
});
console.log('Event queued:', message.id);import { verifyWebhook } from '@emithq/sdk';
// In your webhook handler
const isValid = await verifyWebhook(rawBody, {
'webhook-id': req.headers['webhook-id'],
'webhook-timestamp': req.headers['webhook-timestamp'],
'webhook-signature': req.headers['webhook-signature'],
}, 'whsec_your_endpoint_secret');
// Throws if invalid — catch to return 401