
About TypeSpec
TypeSpec is a small language for describing APIs as code. You write the API shape once, and the compiler produces standard files such as OpenAPI documents and JSON Schema.
What it does
TypeSpec uses a syntax inspired by TypeScript to describe models, routes and interfaces. A file of TypeSpec code can be compiled into OpenAPI 3.0, JSON Schema or Protobuf, so one definition can serve several tools. The project also covers client and server code, documentation and other outputs through its ecosystem. You can start from an empty project or a REST API template, and an online playground lets you try the language in the browser before installing anything.
Key features
- Describe models, routes and interfaces in one file
- Emit OpenAPI 3.0, JSON Schema and Protobuf
- Use a syntax inspired by TypeScript
- Start from an empty project or a REST template
- Try the language in an online playground
Who it's for
API designers and backend teams that want a single source of truth for their API shapes will get the most from it. Teams already using OpenAPI tools can keep their existing pipelines, because the output is standard OpenAPI.
Pricing and good to know
TypeSpec is open source under the MIT license, so it is free to use. It is driven from the command line through a tsp init command. Its value depends on how much of your API work you want to keep in code rather than in hand-written YAML or JSON files.
Highlights
- Describe models, routes and interfaces in one file
- Emit OpenAPI 3.0, JSON Schema and Protobuf
- Use a syntax inspired by TypeScript
- Start from an empty project or a REST template
- Try the language in an online playground












