Input
You must provide an input so we can load your OpenAPI specification.
The input can be a string path, URL, API registry, an object containing any of these, or an object representing an OpenAPI specification. Hey API supports all valid OpenAPI versions and file formats.
export default { input: './path/to/openapi.json',};export default { input: 'https://get.heyapi.dev/hey-api/backend', // sign up at app.heyapi.dev};export default { input: 'hey-api/backend', // sign up at app.heyapi.dev};export default { input: { path: 'hey-api/backend', // sign up at app.heyapi.dev // ...other options },};export default { input: { openapi: '3.1.1', // ...rest of your spec },};You can learn more about complex use cases in the Advanced section.
Request options
Section titled “Request options”You can pass any valid Fetch API options to the request for fetching your specification. This is useful if your file is behind auth for example.
export default { input: { path: 'https://secret.com/protected-spec', fetch: { headers: { Authorization: 'Bearer xxx', }, }, },};API Registry
Section titled “API Registry”You can store your specifications in an API registry to serve as a single source of truth. This helps prevent drift, improves discoverability, enables version tracking, and more.
Hey API
Section titled “Hey API”You can learn more about Hey API Platform on the Integrations page.
export default { input: 'hey-api/backend', // sign up at app.heyapi.dev};The input object lets you provide additional options to construct the correct URL.
export default { input: { path: 'hey-api/backend', // sign up at app.heyapi.dev branch: 'main', },};We also provide shorthands for other registries:
Scalar
Prefix your input with scalar: to use the Scalar API Registry.
export default { input: 'scalar:@scalar/access-service',};ReadMe
Prefix your input with readme: to use the ReadMe API Registry.
export default { input: 'readme:nysezql0wwo236',};export default { input: 'readme:@developers/v2.0#nysezql0wwo236',};Watch Mode
Section titled “Watch Mode”If your schema changes frequently, you may want to automatically regenerate the output during development. To watch your input file for changes, enable input.watch mode in your configuration or pass the --watch flag to the CLI.
export default { input: { path: 'hey-api/backend', // sign up at app.heyapi.dev watch: true, },};npx @hey-api/openapi-ts -i hey-api/backend -o src/client -wExamples
You can view live examples on StackBlitz or on GitHub.