CLI — schemas
Usage
splithook schemas [--endpoint <slug>] [--event-type <type>] [--output <file>]
List available schemas
splithook schemas --endpoint ab3dkf7z
# Endpoint ab3dkf7z (Demo Webhook)
#
# charge.failed last seen 2h ago 47 observations
# charge.succeeded last seen 1d ago 12 observations
# customer.created last seen 5h ago 8 observations
# invoice.payment_failed last seen 3d ago 3 observations
Export a TypeScript interface
splithook schemas --endpoint ab3dkf7z --event-type charge.failed
Prints the TypeScript interface to stdout:
interface ChargeFailed {
id: string;
object: 'event';
type: 'charge.failed';
livemode: boolean;
created: number;
data: {
object: {
id: string;
amount: number;
currency: string;
status: 'failed';
failure_code: string | null;
failure_message: string | null;
customer: string | null;
metadata: Record<string, string>;
};
};
}
Write to a file
splithook schemas \
--endpoint ab3dkf7z \
--event-type charge.failed \
--output src/types/stripe-webhooks.ts
Appends the interface to the file (or creates it). Run periodically as new events arrive to keep types in sync.
All event types at once
Omit --event-type and pass --output to write all inferred interfaces to a single file:
splithook schemas --endpoint ab3dkf7z --output src/types/webhooks.ts
# Wrote 4 interfaces to src/types/webhooks.ts