---
title: "OpenAPI"
description: "Serve oRPC procedures as a REST API, generate an OpenAPI 3.x document from the same code, call it with a typed client, and render interactive API docs."
seo:
  title: "OpenAPI: REST APIs and Generated Specs"
sidebar:
  hidden: true
---

The same router can serve the [RPC protocol](/docs/rpc) for oRPC clients and a REST API for everyone else. Add routing metadata, serve it with the OpenAPI Handler, and generate the OpenAPI document from the same code.

## Define Routes

- [Routing](/docs/openapi/routing): set methods, paths, path parameters, and prefixes.
- [Input and Output Mapping](/docs/openapi/input-and-output-mapping): map params, query, headers, and body to input and output.
- [Bracket Notation](/docs/openapi/bracket-notation): encode nested data in query strings and form data.

## Serve

- [OpenAPI Handler](/docs/openapi/handler): expose procedures as HTTP endpoints on any HTTP [adapter](/docs/adapters).
- [OpenAPI Serializer](/docs/openapi/serializer): how `Date`, `BigInt`, and files become JSON-friendly.

## Document

- [OpenAPI Specification](/docs/openapi/specification): generate an OpenAPI 3.0, 3.1, or 3.2 document.
- [Scalar (Swagger)](/docs/openapi/scalar): serve an interactive API reference, or use the [OpenAPI Reference Plugin](/docs/plugins/openapi-reference).

## Call

- [OpenAPI Link](/docs/openapi/link): a typed client for any OpenAPI-compliant server.
- [Expanding Type Support for OpenAPI Link](/docs/openapi/expanding-type-support-for-link): restore `Date`, `bigint`, and other native types on the client.
- [OpenAPI Link Without Runtime Imports](/docs/openapi/link-without-runtime-imports): embed the contract at build time.

To go the other way, [generate a contract from OpenAPI](/docs/contract/generate-from-openapi).
