REST / OpenAPI Schema Generator & Validator
OpenAPI 3.0 templates in JSON or YAML with an endpoint summary, plus a JSON / XML payload validator.
openapi: "3.0.3"info: title: User Authentication API version: "1.0.0" description: Session-based login and user lookup.servers: - url: "https://api.example.com/v1"paths: /auth/login: post: summary: Authenticate a user and create a session requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/LoginRequest" responses: "200": description: Session created content: application/json: schema: $ref: "#/components/schemas/Session" "401": description: Error response content: application/json: schema: $ref: "#/components/schemas/Error" /auth/logout: post: summary: Revoke the current session responses: "204": description: Session revoked /users: get: summary: List users parameters: - name: page in: query schema: type: integer minimum: 1 default: 1 - name: limit in: query schema: type: integer minimum: 1 maximum: 100 default: 20 - name: role in: query schema: type: string enum: - admin - member - viewer responses: "200": description: A page of users content: application/json: schema: type: array items: $ref: "#/components/schemas/User" /users/{userId}: get: summary: Get a user by ID parameters: - name: userId in: path required: true schema: type: string responses: "200": description: The user content: application/json: schema: $ref: "#/components/schemas/User" "404": description: Error response content: application/json: schema: $ref: "#/components/schemas/Error"components: schemas: LoginRequest: type: object required: - email - password properties: email: type: string format: email password: type: string format: password minLength: 8 method: type: string enum: - password - totp - webauthn Session: type: object properties: token: type: string expiresAt: type: string format: date-time user: $ref: "#/components/schemas/User" User: type: object properties: id: type: string format: uuid email: type: string format: email role: type: string enum: - admin - member - viewer Error: type: object required: - code - message properties: code: type: string example: invalid_request message: type: stringEndpoints
- POST/auth/loginAuthenticate a user and create a sessionParametersNoneRequest bodyLoginRequestResponses
- 200Session
- 401Error
- POST/auth/logoutRevoke the current sessionParametersNoneRequest bodyNoneResponses
- 204Session revoked
- GET/usersList usersParameters
- pagequery · integer
- limitquery · integer
- rolequery · string (admin | member | viewer)
Request bodyNoneResponses- 200User[]
- GET/users/{userId}Get a user by IDParameters
- userId*path · string
Request bodyNoneResponses- 200User
- 404Error
Payload syntax validator
Paste a request or response body to check that it is well-formed.
Valid JSON · object with 3 keys
How the REST / OpenAPI Generator works
Templates follow the OpenAPI 3.0 specification with paths, operations, request bodies, responses and reusable component schemas, and can be viewed as JSON or YAML.
The payload validator parses JSON or XML and pinpoints syntax errors by line and column, so malformed request bodies are caught before they reach your API.
How to use the REST / OpenAPI Generator in 3 steps
Step 1
Choose a REST template and switch between JSON and YAML output.
Step 2
Review the endpoints table for methods, paths and response codes.
Step 3
Validate a sample payload, then press Copy Full Schema to copy the spec.
Frequently asked questions
What is the difference between OpenAPI and Swagger?
Swagger was the original name of the specification. Since version 3.0 it is called OpenAPI, while Swagger now refers to the tooling built around it.
Should I write OpenAPI specs in JSON or YAML?
Both are equivalent. YAML is easier to read and edit by hand, while JSON is easier to generate and parse programmatically.