3 min read Stable Intermediate
OpenApiEmbed turns a remote OpenAPI or Swagger URL into a full API reference
inside an MDX page. The fetch, the validation, and the rendering all run on the
server, so every endpoint ships as plain HTML that OwnDocs search and search
engines can read. Operations render through the same
API Blocks , ParamField, and ResponseField
components used on hand-written API reference
pages. There's no CLI step and no generated file to keep in sync.
Quick Start
One tag with a URL is the whole setup. The embed below reads the live
Swagger Petstore document, groups its
operations by tag, and keeps the fetch cached for an hour.
Swagger Petstore - OpenAPI 3.0 Version 1.0.27.
This is a sample Pet Store Server based on the OpenAPI 3.0 specification. You can find out more about
Swagger at https://swagger.io . In the third iteration of the pet store, we've switched to the design first approach!
You can now help us improve the API whether it's by making changes to the definition itself or to the code.
That way, with time, we can improve the API in general, and expose some of the new features in OAS3.
Some useful links:
Servers Compatibility: openapi-3-0 · Source paths: 13 · Rendered operations: 19 · Slug: swagger-petstore-openapi-3-0
Pet Add a new pet to the store. Add a new pet to the store.
Add a new pet to the store.
{
"id" : 10 ,
"name" : "doggie" ,
"category" : {
"id" : 1 ,
"name" : "Dogs"
} ,
"photoUrls" : [
"string"
] ,
"tags" : [
{
"id" : 0 ,
"name" : "string"
}
] ,
"status" : "available"
}
curl -X POST "/api/v3/pet" \
-H "Authorization: Bearer <oauth-token>" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"id":10,"name":"doggie","category":{"id":1,"name":"Dogs"},"photoUrls":["string"],"tags":[{"id":0,"name":"string"}],"status":"available"}'
{
"id" : 10 ,
"name" : "doggie" ,
"category" : {
"id" : 1 ,
"name" : "Dogs"
} ,
"photoUrls" : [
"string"
] ,
"tags" : [
{
"id" : 0 ,
"name" : "string"
}
] ,
"status" : "available"
}
Request Body idinteger body
No description provided.
namestring body required
No description provided.
categoryobject body
No description provided.
category.idinteger body
No description provided.
category.namestring body
No description provided.
photoUrlsstring[] body required
No description provided.
tagsobject[] body
No description provided.
tags[].idinteger body
No description provided.
tags[].namestring body
No description provided.
statusstring body
pet status in the store
Response Fields idinteger
No description provided.
namestring required
No description provided.
categoryobject
No description provided.
category.idinteger
No description provided.
category.namestring
No description provided.
photoUrlsstring[] required
No description provided.
tagsobject[]
No description provided.
tags[].idinteger
No description provided.
tags[].namestring
No description provided.
statusstring
pet status in the store
Update an existing pet. Update an existing pet by Id.
Update an existing pet.
{
"id" : 10 ,
"name" : "doggie" ,
"category" : {
"id" : 1 ,
"name" : "Dogs"
} ,
"photoUrls" : [
"string"
] ,
"tags" : [
{
"id" : 0 ,
"name" : "string"
}
] ,
"status" : "available"
}
curl -X PUT "/api/v3/pet" \
-H "Authorization: Bearer <oauth-token>" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"id":10,"name":"doggie","category":{"id":1,"name":"Dogs"},"photoUrls":["string"],"tags":[{"id":0,"name":"string"}],"status":"available"}'
Response 200 400 404 422 default
{
"id" : 10 ,
"name" : "doggie" ,
"category" : {
"id" : 1 ,
"name" : "Dogs"
} ,
"photoUrls" : [
"string"
] ,
"tags" : [
{
"id" : 0 ,
"name" : "string"
}
] ,
"status" : "available"
}
Request Body idinteger body
No description provided.
namestring body required
No description provided.
categoryobject body
No description provided.
category.idinteger body
No description provided.
category.namestring body
No description provided.
photoUrlsstring[] body required
No description provided.
tagsobject[] body
No description provided.
tags[].idinteger body
No description provided.
tags[].namestring body
No description provided.
statusstring body
pet status in the store
Response Fields idinteger
No description provided.
namestring required
No description provided.
categoryobject
No description provided.
category.idinteger
No description provided.
category.namestring
No description provided.
photoUrlsstring[] required
No description provided.
tagsobject[]
No description provided.
tags[].idinteger
No description provided.
tags[].namestring
No description provided.
statusstring
pet status in the store
Finds Pets by status. Multiple status values can be provided with comma separated strings.
GET /api/v3 /pet/findByStatus OAuth 2.0Finds Pets by status.
curl -X GET "/api/v3/pet/findByStatus?status=available" \
-H "Authorization: Bearer <oauth-token>" \
-H "Accept: application/json"
[
{
"id" : 10 ,
"name" : "doggie" ,
"category" : {
"id" : 1 ,
"name" : "Dogs"
} ,
"photoUrls" : [
"string"
] ,
"tags" : [
{
"id" : 0 ,
"name" : "string"
}
] ,
"status" : "available"
}
]
Query Parameters statusstring query Default: available required
Status values that need to be considered for filter
Response Fields items.idinteger
No description provided.
items.namestring required
No description provided.
items.categoryobject
No description provided.
items.category.idinteger
No description provided.
items.category.namestring
No description provided.
items.photoUrlsstring[] required
No description provided.
items.tagsobject[]
No description provided.
items.tags[].idinteger
No description provided.
items.tags[].namestring
No description provided.
items.statusstring
pet status in the store
Finds Pets by tags. Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
GET /api/v3 /pet/findByTags OAuth 2.0Finds Pets by tags.
curl -X GET "/api/v3/pet/findByTags?tags=%3Ctags%3E" \
-H "Authorization: Bearer <oauth-token>" \
-H "Accept: application/json"
[
{
"id" : 10 ,
"name" : "doggie" ,
"category" : {
"id" : 1 ,
"name" : "Dogs"
} ,
"photoUrls" : [
"string"
] ,
"tags" : [
{
"id" : 0 ,
"name" : "string"
}
] ,
"status" : "available"
}
]
Query Parameters tagsstring[] query required
Tags to filter by
Response Fields items.idinteger
No description provided.
items.namestring required
No description provided.
items.categoryobject
No description provided.
items.category.idinteger
No description provided.
items.category.namestring
No description provided.
items.photoUrlsstring[] required
No description provided.
items.tagsobject[]
No description provided.
items.tags[].idinteger
No description provided.
items.tags[].namestring
No description provided.
items.statusstring
pet status in the store
Find pet by ID. GET /api/v3 /pet/{petId} api_keyFind pet by ID.
curl -X GET "/api/v3/pet/{petId}" \
-H "X-API-Key: <api-key>" \
-H "Accept: application/json"
{
"id" : 10 ,
"name" : "doggie" ,
"category" : {
"id" : 1 ,
"name" : "Dogs"
} ,
"photoUrls" : [
"string"
] ,
"tags" : [
{
"id" : 0 ,
"name" : "string"
}
] ,
"status" : "available"
}
Path Parameters petIdinteger path required
ID of pet to return
Response Fields idinteger
No description provided.
namestring required
No description provided.
categoryobject
No description provided.
category.idinteger
No description provided.
category.namestring
No description provided.
photoUrlsstring[] required
No description provided.
tagsobject[]
No description provided.
tags[].idinteger
No description provided.
tags[].namestring
No description provided.
statusstring
pet status in the store
Updates a pet in the store with form data. Updates a pet resource based on the form data.
POST /api/v3 /pet/{petId} OAuth 2.0Updates a pet in the store with form data.
curl -X POST "/api/v3/pet/{petId}?name=%3Cname%3E&status=%3Cstatus%3E" \
-H "Authorization: Bearer <oauth-token>" \
-H "Accept: application/json"
{
"id" : 10 ,
"name" : "doggie" ,
"category" : {
"id" : 1 ,
"name" : "Dogs"
} ,
"photoUrls" : [
"string"
] ,
"tags" : [
{
"id" : 0 ,
"name" : "string"
}
] ,
"status" : "available"
}
Path Parameters petIdinteger path required
ID of pet that needs to be updated
Query Parameters namestring query
Name of pet that needs to be updated
statusstring query
Status of pet that needs to be updated
Response Fields idinteger
No description provided.
namestring required
No description provided.
categoryobject
No description provided.
category.idinteger
No description provided.
category.namestring
No description provided.
photoUrlsstring[] required
No description provided.
tagsobject[]
No description provided.
tags[].idinteger
No description provided.
tags[].namestring
No description provided.
statusstring
pet status in the store
Deletes a pet. DELETE /api/v3 /pet/{petId} OAuth 2.0Deletes a pet.
curl -X DELETE "/api/v3/pet/{petId}" \
-H "Authorization: Bearer <oauth-token>" \
-H "api_key: <api_key>"
Path Parameters petIdinteger path required
Pet id to delete
Header Parameters api_keystring header
No description provided.
Uploads an image. POST /api/v3 /pet/{petId}/uploadImage OAuth 2.0Uploads an image.
curl -X POST "/api/v3/pet/{petId}/uploadImage?additionalMetadata=%3CadditionalMetadata%3E" \
-H "Authorization: Bearer <oauth-token>" \
-H "Accept: application/json" \
-H "Content-Type: application/octet-stream" \
-d '"string"'
{
"code" : 0 ,
"type" : "string" ,
"message" : "string"
}
Path Parameters petIdinteger path required
ID of pet to update
Query Parameters additionalMetadatastring query
Additional Metadata
Response Fields codeinteger
No description provided.
typestring
No description provided.
messagestring
No description provided.
Store Returns pet inventories by status. Returns a map of status codes to quantities.
GET /api/v3 /store/inventory api_keyReturns pet inventories by status.
curl -X GET "/api/v3/store/inventory" \
-H "X-API-Key: <api-key>" \
-H "Accept: application/json"
Place an order for a pet. Place a new order in the store.
POST /api/v3 /store/order No auth requiredPlace an order for a pet.
{
"id" : 10 ,
"petId" : 198772 ,
"quantity" : 7 ,
"shipDate" : "2026-01-01T00:00:00Z" ,
"status" : "approved" ,
"complete" : false
}
curl -X POST "/api/v3/store/order" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"id":10,"petId":198772,"quantity":7,"shipDate":"2026-01-01T00:00:00Z","status":"approved","complete":false}'
{
"id" : 10 ,
"petId" : 198772 ,
"quantity" : 7 ,
"shipDate" : "2026-01-01T00:00:00Z" ,
"status" : "approved" ,
"complete" : false
}
Request Body idinteger body
No description provided.
petIdinteger body
No description provided.
quantityinteger body
No description provided.
shipDatestring body
No description provided.
statusstring body
Order Status
completeboolean body
No description provided.
Response Fields idinteger
No description provided.
petIdinteger
No description provided.
quantityinteger
No description provided.
shipDatestring
No description provided.
completeboolean
No description provided.
Find purchase order by ID. For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions.
GET /api/v3 /store/order/{orderId} No auth requiredFind purchase order by ID.
curl -X GET "/api/v3/store/order/{orderId}" \
-H "Accept: application/json"
{
"id" : 10 ,
"petId" : 198772 ,
"quantity" : 7 ,
"shipDate" : "2026-01-01T00:00:00Z" ,
"status" : "approved" ,
"complete" : false
}
Path Parameters orderIdinteger path required
ID of order that needs to be fetched
Response Fields idinteger
No description provided.
petIdinteger
No description provided.
quantityinteger
No description provided.
shipDatestring
No description provided.
completeboolean
No description provided.
Delete purchase order by identifier. For valid response try integer IDs with value < 1000. Anything above 1000 or non-integers will generate API errors.
DELETE /api/v3 /store/order/{orderId} No auth requiredDelete purchase order by identifier.
curl -X DELETE "/api/v3/store/order/{orderId}"
Path Parameters orderIdinteger path required
ID of the order that needs to be deleted
User Create user. This can only be done by the logged in user.
POST /api/v3 /user No auth requiredCreate user.
{
"id" : 10 ,
"username" : "theUser" ,
"firstName" : "John" ,
"lastName" : "James" ,
"email" : "john@email.com" ,
"password" : "12345" ,
"phone" : "12345" ,
"userStatus" : 1
}
curl -X POST "/api/v3/user" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"id":10,"username":"theUser","firstName":"John","lastName":"James","email":"john@email.com","password":"12345","phone":"12345","userStatus":1}'
{
"id" : 10 ,
"username" : "theUser" ,
"firstName" : "John" ,
"lastName" : "James" ,
"email" : "john@email.com" ,
"password" : "12345" ,
"phone" : "12345" ,
"userStatus" : 1
}
Request Body idinteger body
No description provided.
usernamestring body
No description provided.
firstNamestring body
No description provided.
lastNamestring body
No description provided.
emailstring body
No description provided.
passwordstring body
No description provided.
phonestring body
No description provided.
userStatusinteger body
User Status
Response Fields idinteger
No description provided.
usernamestring
No description provided.
firstNamestring
No description provided.
lastNamestring
No description provided.
emailstring
No description provided.
passwordstring
No description provided.
phonestring
No description provided.
userStatusinteger
User Status
Creates list of users with given input array. Creates list of users with given input array.
POST /api/v3 /user/createWithList No auth requiredCreates list of users with given input array.
[
{
"id" : 10 ,
"username" : "theUser" ,
"firstName" : "John" ,
"lastName" : "James" ,
"email" : "john@email.com" ,
"password" : "12345" ,
"phone" : "12345" ,
"userStatus" : 1
}
]
curl -X POST "/api/v3/user/createWithList" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '[{"id":10,"username":"theUser","firstName":"John","lastName":"James","email":"john@email.com","password":"12345","phone":"12345","userStatus":1}]'
{
"id" : 10 ,
"username" : "theUser" ,
"firstName" : "John" ,
"lastName" : "James" ,
"email" : "john@email.com" ,
"password" : "12345" ,
"phone" : "12345" ,
"userStatus" : 1
}
Request Body items.idinteger body
No description provided.
items.usernamestring body
No description provided.
items.firstNamestring body
No description provided.
items.lastNamestring body
No description provided.
items.emailstring body
No description provided.
items.passwordstring body
No description provided.
items.phonestring body
No description provided.
items.userStatusinteger body
User Status
Response Fields idinteger
No description provided.
usernamestring
No description provided.
firstNamestring
No description provided.
lastNamestring
No description provided.
emailstring
No description provided.
passwordstring
No description provided.
phonestring
No description provided.
userStatusinteger
User Status
Logs user into the system. GET /api/v3 /user/login No auth requiredLogs user into the system.
curl -X GET "/api/v3/user/login?username=%3Cusername%3E&password=%3Cpassword%3E" \
-H "Accept: application/json"
Query Parameters usernamestring query
The user name for login
passwordstring query
The password for login in clear text
Logs out current logged in user session. Log user out of the system.
GET /api/v3 /user/logout No auth requiredLogs out current logged in user session.
curl -X GET "/api/v3/user/logout"
Get user by user name. Get user detail based on username.
GET /api/v3 /user/{username} No auth requiredGet user by user name.
curl -X GET "/api/v3/user/{username}" \
-H "Accept: application/json"
{
"id" : 10 ,
"username" : "theUser" ,
"firstName" : "John" ,
"lastName" : "James" ,
"email" : "john@email.com" ,
"password" : "12345" ,
"phone" : "12345" ,
"userStatus" : 1
}
Path Parameters usernamestring path required
The name that needs to be fetched. Use user1 for testing
Response Fields idinteger
No description provided.
usernamestring
No description provided.
firstNamestring
No description provided.
lastNamestring
No description provided.
emailstring
No description provided.
passwordstring
No description provided.
phonestring
No description provided.
userStatusinteger
User Status
Update user resource. This can only be done by the logged in user.
PUT /api/v3 /user/{username} No auth requiredUpdate user resource.
{
"id" : 10 ,
"username" : "theUser" ,
"firstName" : "John" ,
"lastName" : "James" ,
"email" : "john@email.com" ,
"password" : "12345" ,
"phone" : "12345" ,
"userStatus" : 1
}
curl -X PUT "/api/v3/user/{username}" \
-H "Content-Type: application/json" \
-d '{"id":10,"username":"theUser","firstName":"John","lastName":"James","email":"john@email.com","password":"12345","phone":"12345","userStatus":1}'
Path Parameters usernamestring path required
name that need to be deleted
Request Body idinteger body
No description provided.
usernamestring body
No description provided.
firstNamestring body
No description provided.
lastNamestring body
No description provided.
emailstring body
No description provided.
passwordstring body
No description provided.
phonestring body
No description provided.
userStatusinteger body
User Status
Delete user resource. This can only be done by the logged in user.
DELETE /api/v3 /user/{username} No auth requiredDelete user resource.
curl -X DELETE "/api/v3/user/{username}"
Path Parameters usernamestring path required
The name that needs to be deleted
app/getting-started/openapi-embed.mdx <OpenApiEmbed url="https://petstore3.swagger.io/api/v3/openapi.json" />
Adding Options
Two props shape what readers get. revalidate sets the cache window in seconds,
and showOverview={false} drops the title, version, servers, Postman button,
and summary line so only the operation list remains. Combine them when the
surrounding page already introduces the API and the spec changes often.
app/getting-started/openapi-embed.mdx <OpenApiEmbed
url="https://api.example.com/openapi.yaml"
revalidate={300}
showOverview={false}
/>
Advanced
JSON and YAML both work. The component reads the response content type and falls
back to the URL file extension when the server sends none, so a plain .yaml
file served as text/plain still parses. Pass revalidate={0} while a spec is
still moving and every page render refetches it.
app/getting-started/openapi-embed.mdx <OpenApiEmbed
url="https://example.com/specs/internal-api.yaml"
revalidate={0}
/>
Grouping And Methods
Operations group by their first tag. Without tags, they group by the first
path segment, and a leading version segment such as /v1 falls through to the
next one.
GET, POST, PUT, PATCH, and DELETE render. HEAD, OPTIONS, and
TRACE are skipped.
Sample requests carry a placeholder auth header built from the spec's security
scheme, such as Authorization: Bearer <token> or X-API-Key: <api-key>. The
component stores no credentials and forwards nothing from the reader's
browser.
Source examples render as published. The upstream document decides what
readers see.
Failure Handling
The embed fails closed. When a source can't be loaded, an inline banner names
the URL and the cause, and the rest of the page still renders. These are the
cases it catches:
A URL that won't parse, or a protocol other than http and https
A host that stays silent past the 15-second timeout, or answers non-2xx
More than five redirect hops
A body that isn't valid JSON or YAML
A document that isn't OpenAPI 3.0, 3.1, 3.2, or Swagger 2.0
A document larger than 10 MB
Postman Export
The overview block renders a "Postman collection" download button. OwnDocs
converts the source spec to a Postman v2.1 collection on the server during
render and memoizes the result per resolved spec URL, so a repeat visit skips
the converter. The click streams the JSON as a Blob URL. That file imports into
Postman or feeds Newman for command-line testing. You'll find the button at the
top of the Petstore embed above.
Options
urlstring required
HTTP(S) URL of a JSON or YAML document written against OpenAPI 3.0, 3.1, 3.2,
or Swagger 2.0. The protocol is re-checked on every redirect hop.
revalidatenumber Default: 3600
Seconds the fetched spec stays in the Next.js fetch cache. Set it to 0 to
refetch on every render.
showOverviewboolean Default: true
Renders the API title, version, description, server list, Postman download
button, and the compatibility summary above the operations.
Was this page helpful? Yes No