---
title: "Input"
description: "Configure @hey-api/openapi-ts."
url: "https://heyapi.dev/docs/openapi/typescript/configuration/input"
---

You must provide an input so we can load your OpenAPI specification.

## Input

[Section titled “Input”](#input)

The input can be a string path, URL, [API registry](#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.

* path

  openapi-ts.config.ts

  ```js
  export default {
    input: './path/to/openapi.json',
  };
  ```

* url

  openapi-ts.config.ts

  ```js
  export default {
    input: 'https://get.heyapi.dev/hey-api/backend', // sign up at app.heyapi.dev
  };
  ```

* registry

  openapi-ts.config.ts

  ```js
  export default {
    input: 'hey-api/backend', // sign up at app.heyapi.dev
  };
  ```

* object

  openapi-ts.config.ts

  ```js
  export default {
    input: {
      path: 'hey-api/backend', // sign up at app.heyapi.dev
      // ...other options
    },
  };
  ```

* spec

  openapi-ts.config.ts

  ```js
  export default {
    input: {
      openapi: '3.1.1',
      // ...rest of your spec
    },
  };
  ```

You can learn more about complex use cases in the [Advanced](https://heyapi.dev/openapi-ts/configuration#advanced) section.

Tip

If 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.

### Request options

[Section titled “Request options”](#request-options)

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.

openapi-ts.config.ts

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

## API Registry

[Section titled “API Registry”](#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”](#hey-api)

You can learn more about [Hey API Platform](https://app.heyapi.dev) on the [Integrations](https://heyapi.dev/openapi-ts/integrations) page.

openapi-ts.config.ts

```js
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

```js
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

```js
export default {
  input: 'scalar:@scalar/access-service',
};
```

ReadMe

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

* uuid

  openapi-ts.config.ts

  ```js
  export default {
    input: 'readme:nysezql0wwo236',
  };
  ```

* long

  openapi-ts.config.ts

  ```js
  export default {
    input: 'readme:@developers/v2.0#nysezql0wwo236',
  };
  ```

## Watch Mode

[Section titled “Watch Mode”](#watch-mode)

Caution

Watch mode currently supports only remote files via URL.

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.

* config

  openapi-ts.config.ts

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

* cli

  ```sh
  npx @hey-api/openapi-ts -i hey-api/backend -o src/client -w
  ```

## Examples

You can view live examples on [StackBlitz](https://stackblitz.com/orgs/github/hey-api/collections/openapi-ts-examples) or on [GitHub](https://github.com/hey-api/openapi-ts/tree/main/examples).
