···1313import { defineConfig } from '@hey-api/openapi-ts';
14141515export default defineConfig({
1616- input: 'https://get.heyapi.dev/hey-api/backend',
1616+ input: 'hey-api/backend', // sign up at app.heyapi.dev
1717 output: 'src/client',
1818});
1919```
···2121```js [openapi-ts.config.cjs]
2222/** @type {import('@hey-api/openapi-ts').UserConfig} */
2323module.exports = {
2424- input: 'https://get.heyapi.dev/hey-api/backend',
2424+ input: 'hey-api/backend', // sign up at app.heyapi.dev
2525 output: 'src/client',
2626};
2727```
···2929```js [openapi-ts.config.mjs]
3030/** @type {import('@hey-api/openapi-ts').UserConfig} */
3131export default {
3232- input: 'https://get.heyapi.dev/hey-api/backend',
3232+ input: 'hey-api/backend', // sign up at app.heyapi.dev
3333 output: 'src/client',
3434};
3535```
···65656666## Input
67676868-You must set the input so we can load your OpenAPI specification. It can be a path or URL, object containing a path or URL, or an object representing an OpenAPI specification. Hey API supports all valid OpenAPI versions and file formats.
6868+You must provide an input so we can load your OpenAPI specification.
6969+7070+The input can be a string path, URL, API registry shorthand, an object containing any of these, or an object representing an OpenAPI specification. Hey API supports all valid OpenAPI versions and file formats.
69717072You can learn more on the [Input](/openapi-ts/configuration/input) page.
7173···79818082```js [url]
8183export default {
8282- input: 'https://get.heyapi.dev/hey-api/backend', // [!code ++]
8484+ input: 'https://get.heyapi.dev/hey-api/backend', // sign up at app.heyapi.dev // [!code ++]
8585+};
8686+```
8787+8888+```js [registry]
8989+export default {
9090+ input: 'hey-api/backend', // sign up at app.heyapi.dev // [!code ++]
8391};
8492```
8593···8795```js [object]
8896export default {
8997 input: { // [!code ++]
9090- path: 'https://get.heyapi.dev/hey-api/backend', // [!code ++]
9898+ path: 'hey-api/backend', // sign up at app.heyapi.dev // [!code ++]
9199 // ...other options // [!code ++]
92100 }, // [!code ++]
93101};
···120128121129```js [path]
122130export default {
123123- input: 'https://get.heyapi.dev/hey-api/backend',
131131+ input: 'hey-api/backend', // sign up at app.heyapi.dev
124132 output: 'src/client', // [!code ++]
125133};
126134```
···128136<!-- prettier-ignore-start -->
129137```js [object]
130138export default {
131131- input: 'https://get.heyapi.dev/hey-api/backend',
139139+ input: 'hey-api/backend', // sign up at app.heyapi.dev
132140 output: { // [!code ++]
133141 path: 'src/client', // [!code ++]
134142 // ...other options // [!code ++]
+49-47
docs/openapi-ts/configuration/input.md
···5566# Input
7788-You must set the input so we can load your OpenAPI specification.
88+You must provide an input so we can load your OpenAPI specification.
991010## Input
11111212-Input can be a path or URL, object containing a path or URL, or an object representing an OpenAPI specification. Hey API supports all valid OpenAPI versions and file formats.
1212+The input can be a string path, URL, API registry shorthand, an object containing any of these, or an object representing an OpenAPI specification. Hey API supports all valid OpenAPI versions and file formats.
13131414::: code-group
1515···21212222```js [url]
2323export default {
2424- input: 'https://get.heyapi.dev/hey-api/backend', // [!code ++]
2424+ input: 'https://get.heyapi.dev/hey-api/backend', // sign up at app.heyapi.dev // [!code ++]
2525+};
2626+```
2727+2828+```js [registry]
2929+export default {
3030+ input: 'hey-api/backend', // sign up at app.heyapi.dev // [!code ++]
2531};
2632```
2733···2935```js [object]
3036export default {
3137 input: { // [!code ++]
3232- path: 'https://get.heyapi.dev/hey-api/backend', // [!code ++]
3838+ path: 'hey-api/backend', // sign up at app.heyapi.dev // [!code ++]
3339 // ...other options // [!code ++]
3440 }, // [!code ++]
3541};
···5258If you use an HTTPS URL with a self-signed certificate in development, you will need to set [`NODE_TLS_REJECT_UNAUTHORIZED=0`](https://github.com/hey-api/openapi-ts/issues/276#issuecomment-2043143501) in your environment.
5359:::
54605555-### ReadMe API Registry
5656-5757-You can use ReadMe API Registry UUIDs to fetch OpenAPI specifications directly from ReadMe's platform. This is useful when API providers use ReadMe as their source of truth for API documentation.
5858-5959-::: code-group
6060-6161-```js [simple format]
6262-export default {
6363- input: 'readme:abc123def456', // [!code ++]
6464-};
6565-```
6161+### Request options
66626767-```js [full format]
6868-export default {
6969- input: 'readme:@organization/project#abc123def456', // [!code ++]
7070-};
7171-```
6363+You can pass any valid Fetch API [options](https://developer.mozilla.org/docs/Web/API/RequestInit) to the request for fetching your specification. This is useful if your file is behind auth for example.
72647373-```js [object format]
6565+<!-- prettier-ignore-start -->
6666+```js
7467export default {
7568 input: {
7676- path: 'readme:abc123def456', // [!code ++]
7777- // ...other options
6969+ path: 'https://secret.com/protected-spec',
7070+ fetch: { // [!code ++]
7171+ headers: { // [!code ++]
7272+ Authorization: 'Bearer xxx', // [!code ++]
7373+ }, // [!code ++]
7474+ }, // [!code ++]
7875 },
7976};
8077```
7878+<!-- prettier-ignore-end -->
81798282-:::
8080+## API Registry
83818484-The ReadMe input formats are:
8282+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.
85838686-- `readme:uuid` - Simple format using only the UUID
8787-- `readme:@organization/project#uuid` - Full format including organization and project names
8484+### Hey API
88858989-Both formats will fetch the OpenAPI specification from `https://dash.readme.com/api/v1/api-registry/{uuid}`.
8686+You can learn more about [Hey API Platform](https://app.heyapi.dev) on the [Integrations](/openapi-ts/integrations) page.
90879191-### Hey API Platform options
8888+```js [uuid]
8989+export default {
9090+ input: 'hey-api/backend', // sign up at app.heyapi.dev // [!code ++]
9191+};
9292+```
92939393-You might want to use the [Hey API Platform](/openapi-ts/integrations) to store your specifications. If you do so, the `input` object provides options to help with constructing the correct URL.
9494+The `input` object lets you provide additional options to construct the correct URL.
94959596```js
9697export default {
9798 input: {
9898- path: 'https://get.heyapi.dev/',
9999+ path: 'hey-api/backend', // sign up at app.heyapi.dev
99100 branch: 'main', // [!code ++]
100100- project: 'backend', // [!code ++]
101101 },
102102};
103103```
104104105105-### Request options
105105+We also provide shorthands for other registries:
106106107107-You can pass any valid Fetch API [options](https://developer.mozilla.org/docs/Web/API/RequestInit) to the request for fetching your specification. This is useful if your file is behind auth for example.
107107+::: details ReadMe
108108+Prefix your input with `readme:` to use the ReadMe API Registry.
108109109109-<!-- prettier-ignore-start -->
110110-```js
110110+::: code-group
111111+112112+```js [uuid]
111113export default {
112112- input: {
113113- path: 'https://secret.com/protected-spec',
114114- fetch: { // [!code ++]
115115- headers: { // [!code ++]
116116- Authorization: 'Bearer xxx', // [!code ++]
117117- }, // [!code ++]
118118- }, // [!code ++]
119119- },
114114+ input: 'readme:nysezql0wwo236', // [!code ++]
120115};
121116```
122122-<!-- prettier-ignore-end -->
117117+118118+```js [long]
119119+export default {
120120+ input: 'readme:@developers/v2.0#nysezql0wwo236', // [!code ++]
121121+};
122122+```
123123+124124+:::
123125124126## Watch Mode
125127···134136```js [config]
135137export default {
136138 input: {
137137- path: 'https://get.heyapi.dev/hey-api/backend',
139139+ path: 'hey-api/backend', // sign up at app.heyapi.dev
138140 watch: true, // [!code ++]
139141 },
140142};
···142144143145```sh [cli]
144146npx @hey-api/openapi-ts \
145145- -i https://get.heyapi.dev/hey-api/backend \
147147+ -i hey-api/backend \
146148 -o src/client \
147149 -w # [!code ++]
148150```
···3232The fastest way to use `@hey-api/openapi-ts` is via npx
33333434```sh
3535-npx @hey-api/openapi-ts \
3636- -i https://get.heyapi.dev/hey-api/backend \
3737- -o src/client
3535+npx @hey-api/openapi-ts -i hey-api/backend -o src/client
3836```
39374038Congratulations on creating your first client! 🎉 You can learn more about the generated files on the [Output](/openapi-ts/output) page.
···9997import { createClient } from '@hey-api/openapi-ts';
1009810199createClient({
102102- input: 'https://get.heyapi.dev/hey-api/backend',
100100+ input: 'hey-api/backend', // sign up at app.heyapi.dev
103101 output: 'src/client',
104102});
105103```