Skip to content

API Reference

This section contains the complete API reference documentation generated from the OpenAPI specification.

A sample API to demonstrate vitepress-openapi

Contact

Servers

https://api.example.com/v1Production server
https://staging-api.example.com/v1Staging server

Users


Get all users

GET
/users

Retrieve a list of all users

Authorizations

bearerAuth

Enter your bearer token in the format: Bearer {token}

Type
HTTP (bearer)

Parameters

Query Parameters

page

Page number

Type
integer
Default
1
limit

Number of items per page

Type
integer
Default
10
Maximum
100

Responses

Successful response

application/json
JSON
{
"data": [
{
"id": "string",
"name": "string",
"email": "string",
"role": "string",
"createdAt": "string",
"updatedAt": "string"
}
],
"pagination": {
"page": 0,
"limit": 0,
"total": 0,
"totalPages": 0
}
}

Playground

Server
Authorization
Variables
Key
Value

Samples


Create a user

POST
/users

Create a new user

Authorizations

bearerAuth

Enter your bearer token in the format: Bearer {token}

Type
HTTP (bearer)

Request Body

application/json
JSON
{
"name": "string",
"email": "string",
"role": "user"
}

Responses

User created successfully

application/json
JSON
{
"id": "string",
"name": "string",
"email": "string",
"role": "string",
"createdAt": "string",
"updatedAt": "string"
}

Playground

Server
Authorization
Body

Samples


Get user by ID

GET
/users/{userId}

Retrieve a specific user by their ID

Authorizations

bearerAuth

Enter your bearer token in the format: Bearer {token}

Type
HTTP (bearer)

Parameters

Path Parameters

userId*

User ID

Type
string
Required

Responses

Successful response

application/json
JSON
{
"id": "string",
"name": "string",
"email": "string",
"role": "string",
"createdAt": "string",
"updatedAt": "string"
}

Playground

Server
Authorization
Variables
Key
Value

Samples


Update user

PUT
/users/{userId}

Update an existing user

Authorizations

bearerAuth

Enter your bearer token in the format: Bearer {token}

Type
HTTP (bearer)

Parameters

Path Parameters

userId*

User ID

Type
string
Required

Request Body

application/json
JSON
{
"name": "string",
"email": "string",
"role": "user"
}

Responses

User updated successfully

application/json
JSON
{
"id": "string",
"name": "string",
"email": "string",
"role": "string",
"createdAt": "string",
"updatedAt": "string"
}

Playground

Server
Authorization
Variables
Key
Value
Body

Samples


Delete user

DELETE
/users/{userId}

Delete a user by ID

Authorizations

bearerAuth

Enter your bearer token in the format: Bearer {token}

Type
HTTP (bearer)

Parameters

Path Parameters

userId*

User ID

Type
string
Required

Responses

User deleted successfully

Playground

Server
Authorization
Variables
Key
Value

Samples


Posts

Post management endpoints


Get all posts

GET
/posts

Retrieve a list of all posts

Authorizations

bearerAuth

Enter your bearer token in the format: Bearer {token}

Type
HTTP (bearer)

Parameters

Query Parameters

page

Page number

Type
integer
Default
1
limit

Number of items per page

Type
integer
Default
10
Maximum
100

Responses

Successful response

application/json
JSON
{
"data": [
{
"id": "string",
"title": "string",
"content": "string",
"authorId": "string",
"published": true,
"createdAt": "string",
"updatedAt": "string"
}
],
"pagination": {
"page": 0,
"limit": 0,
"total": 0,
"totalPages": 0
}
}

Playground

Server
Authorization
Variables
Key
Value

Samples


Create a post

POST
/posts

Create a new post

Authorizations

bearerAuth

Enter your bearer token in the format: Bearer {token}

Type
HTTP (bearer)

Request Body

application/json
JSON
{
"title": "string",
"content": "string",
"published": false
}

Responses

Post created successfully

application/json
JSON
{
"id": "string",
"title": "string",
"content": "string",
"authorId": "string",
"published": true,
"createdAt": "string",
"updatedAt": "string"
}

Playground

Server
Authorization
Body

Samples


Powered by VitePress OpenAPI