Skip to main content

1. Users Management API

Version 1.0.0

API for managing users in an application.

Users API details
openapi: 3.0.3
info:
title: Users Management API
description: API for managing users in an application.
version: 1.0.0

servers:
- url: https://api.example.com/v1

paths:
/users:
get:
summary: List users
responses:
"200":
description: A list of users
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/User"

post:
summary: Create a user
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/UserCreate"
responses:
"201":
description: User created
content:
application/json:
schema:
$ref: "#/components/schemas/User"

/users/{id}:
parameters:
- name: id
in: path
required: true
schema:
type: string

get:
summary: Get a user by ID
responses:
"200":
description: User found
content:
application/json:
schema:
$ref: "#/components/schemas/User"
"404":
description: User not found

put:
summary: Update a user
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/UserUpdate"
responses:
"200":
description: User updated
content:
application/json:
schema:
$ref: "#/components/schemas/User"
"404":
description: User not found

delete:
summary: Delete a user
responses:
"204":
description: User deleted
"404":
description: User not found

components:
schemas:
User:
type: object
properties:
id:
type: string
example: "123"
name:
type: string
example: "Username"
email:
type: string
format: email
example: "username@example.com"

UserCreate:
type: object
required:
- name
- email
properties:
name:
type: string
email:
type: string
format: email

UserUpdate:
type: object
properties:
name:
type: string
email:
type: string
format: email

Path Table

MethodPathDescription
GET/usersList users
POST/usersCreate a user
GET/users/{id}Get a user by ID
PUT/users/{id}Update a user
DELETE/users/{id}Delete a user

Reference Table

NamePathDescription
User#/components/schemas/User
UserCreate#/components/schemas/UserCreate
UserUpdate#/components/schemas/UserUpdate

Path Details


GET /users

  • Summary
    List users

Responses

  • 200 A list of users

POST /users

  • Summary
    Create a user

RequestBody

  • application/json
{
name: string
email: string
}

Responses

  • 201 User created

application/json

{
id?: string
name?: string
email?: string
}

GET /users/{id}

  • Summary
    Get a user by ID

Responses

  • 200 User found

application/json

{
id?: string
name?: string
email?: string
}
  • 404 User not found

PUT /users/{id}

  • Summary
    Update a user

RequestBody

  • application/json
{
name?: string
email?: string
}

Responses

  • 200 User updated

application/json

{
id?: string
name?: string
email?: string
}
  • 404 User not found

DELETE /users/{id}

  • Summary
    Delete a user

Responses

  • 204 User deleted

  • 404 User not found

References

#/components/schemas/User

{
id?: string
name?: string
email?: string
}

#/components/schemas/UserCreate

{
name: string
email: string
}

#/components/schemas/UserUpdate

{
name?: string
email?: string
}