Skip to main content
GET
/
api
/
v1
/
users
/
{id}
Get User by ID
curl --request GET \
  --url https://api.example.com/api/v1/users/{id}
{
  "200": {},
  "404": {},
  "500": {},
  "id": "<string>",
  "username": "<string>",
  "email": "<string>",
  "firstName": "<string>",
  "lastName": "<string>",
  "role": "<string>",
  "createdAt": "<string>",
  "updatedAt": "<string>",
  "active": true
}

Endpoint

GET /api/v1/users/{id}
Returns the details of a specific user identified by their unique UUID.

Path Parameters

id
UUID
required
Unique user identifier.Example: 0f4df2de-fffb-4a24-9891-381ecf4f0f87

Response

id
UUID
Unique identifier for the user.Example: 0f4df2de-fffb-4a24-9891-381ecf4f0f87
username
string
The user’s username.Example: jdoe
email
string
The user’s email address.Example: jdoe@example.com
firstName
string
The user’s first name.Example: John
lastName
string
The user’s last name.Example: Doe
role
string
The user’s role.Example: USER
createdAt
string
ISO 8601 timestamp when the user was created.Example: 2024-01-15T10:30:00
updatedAt
string
ISO 8601 timestamp when the user was last updated.Example: 2024-01-15T10:30:00
active
boolean
Whether the user account is active.Example: true

Status Codes

200
OK
User retrieved successfully
404
Not Found
User with the specified ID does not exist
500
Internal Server Error
An unexpected error occurred

Example Request

curl http://localhost:8080/api/v1/users/0f4df2de-fffb-4a24-9891-381ecf4f0f87

Example Response

{
  "id": "0f4df2de-fffb-4a24-9891-381ecf4f0f87",
  "username": "jdoe",
  "email": "jdoe@example.com",
  "firstName": "John",
  "lastName": "Doe",
  "role": "USER",
  "createdAt": "2024-01-15T10:30:00",
  "updatedAt": "2024-01-15T10:30:00",
  "active": true
}

Error Response Example

User Not Found (404)

{
  "type": "about:blank",
  "title": "User Not Found",
  "status": 404,
  "detail": "User not found with id: 0f4df2de-fffb-4a24-9891-381ecf4f0f87",
  "userId": "0f4df2de-fffb-4a24-9891-381ecf4f0f87",
  "timestamp": "2024-01-15T10:30:00"
}

Build docs developers (and LLMs) love