Swagger & OpenAPI Editor
Edit an OpenAPI or Swagger YAML spec and watch the interactive API documentation redraw as you type — endpoints by tag, schemas, examples. All in your browser; nothing is uploaded.
openapi: 3.0.3
info:
title: Bookshelf API
version: 1.0.0
description: |
A small API for a reading list. Edit this file and the documentation beside it
changes as you type: add a path, rename a field, change a response.
servers:
- url: https://api.bookshelf.example/v1
tags:
- name: Books
description: The books on a reading list
paths:
/books:
get:
tags: [Books]
summary: List books
operationId: listBooks
parameters:
- name: status
in: query
description: Only books in this state
schema:
$ref: '#/components/schemas/Status'
- name: limit
in: query
description: How many books to return
schema:
type: integer
minimum: 1
maximum: 100
default: 20
responses:
'200':
description: The books, newest first
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Book'
post:
tags: [Books]
summary: Add a book
operationId: addBook
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewBook'
example:
title: The Pragmatic Programmer
author: Andrew Hunt
responses:
'201':
description: The book was added
content:
application/json:
schema:
$ref: '#/components/schemas/Book'
'400':
$ref: '#/components/responses/BadRequest'
/books/{bookId}:
parameters:
- name: bookId
in: path
required: true
description: The book's id
schema:
type: string
format: uuid
get:
tags: [Books]
summary: Get a book
operationId: getBook
responses:
'200':
description: The book
content:
application/json:
schema:
$ref: '#/components/schemas/Book'
'404':
description: There is no book with this id
delete:
tags: [Books]
summary: Remove a book
operationId: removeBook
responses:
'204':
description: The book was removed
'404':
description: There is no book with this id
components:
schemas:
Status:
type: string
enum: [to-read, reading, finished]
NewBook:
type: object
required: [title, author]
properties:
title:
type: string
author:
type: string
status:
allOf:
- $ref: '#/components/schemas/Status'
default: to-read
Book:
allOf:
- $ref: '#/components/schemas/NewBook'
- type: object
required: [id, addedAt]
properties:
id:
type: string
format: uuid
readOnly: true
addedAt:
type: string
format: date-time
readOnly: true
Error:
type: object
required: [message]
properties:
message:
type: string
responses:
BadRequest:
description: The book is missing its title or its author
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
Open it in Prisment to save it in a workspace or a folder on your computer, then keep it beside your documents or review it with your team.