跳转到内容
Host your specs. Generate from anywhere.

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.

openapi-ts.config.ts
export default {
input: './path/to/openapi.json',
};

You can learn more about complex use cases in the Advanced section.

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.

openapi-ts.config.ts
export default {
input: {
path: 'https://secret.com/protected-spec',
fetch: {
headers: {
Authorization: 'Bearer xxx',
},
},
},
};

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.

You can learn more about Hey API Platform on the Integrations page.

openapi-ts.config.ts
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.

openapi-ts.config.ts
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.

openapi-ts.config.ts
export default {
input: 'scalar:@scalar/access-service',
};

ReadMe Prefix your input with readme: to use the ReadMe API Registry.

openapi-ts.config.ts
export default {
input: 'readme:nysezql0wwo236',
};

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.

openapi-ts.config.ts
export default {
input: {
path: 'hey-api/backend', // sign up at app.heyapi.dev
watch: true,
},
};

Examples

You can view live examples on StackBlitz or on GitHub.