> ## Documentation Index
> Fetch the complete documentation index at: https://docs.affinda.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate TypeScript interfaces

> Auto-generate TypeScript interfaces from your Affinda document types for type-safe consumption of API responses in JavaScript and TypeScript projects.

Users of our [Typescript client library](https://www.npmjs.com/package/@affinda/affinda) can generate typescript interfaces to help with consuming the API response in a type-safe way.

Use the `affinda-generate-interfaces` command to auto-generate typescript interfaces from your document type configuration.

For example, this will generate typescript interfaces for your Recruitment workspace:

```shell theme={null}
# Assuming your Recruitment workspace ID is "rLERIsHk"
npm exec affinda-generate-interfaces -- --workspace-id=rLERIsHk
```

You will be prompted for your API key, unless you already have the `AFFINDA_API_KEY` environment variable set.

The generated typescript interfaces will be in `./affinda-interfaces` by default.

For the list of options available, run:

```shell theme={null}
npm exec affinda-generate-interfaces -- --help
```
