Skip to main content

Endpoint

GET /api/v1/users/{user_id}

Description

Retrieves detailed information about a specific user, including their notification preferences, contact details, and push notification token.

Authentication

This endpoint requires authentication. Include valid credentials in your request headers.

Path Parameters

user_id
string (UUID)
required
The unique identifier of the user to retrieve.Example: 123e4567-e89b-12d3-a456-426614174000Validation: Must be a valid UUID format

Response

success
boolean
Indicates whether the request was successfulValue: true
data
object
User data object
message
string
Human-readable message describing the resultExample: User retrieved successfully
meta
object
Pagination and metadata information

Error Responses

404 Not Found
error
Returned when the user with the specified ID does not exist.
{
  "success": false,
  "message": "User not found",
  "error": "No user exists with ID: 123e4567-e89b-12d3-a456-426614174000"
}
401 Unauthorized
error
Returned when authentication credentials are missing or invalid.
{
  "success": false,
  "message": "Unauthorized",
  "error": "Invalid or missing authentication token"
}
400 Bad Request
error
Returned when the user_id parameter is not a valid UUID.
{
  "success": false,
  "message": "Invalid user ID format",
  "error": "user_id must be a valid UUID"
}

Example Request

curl http://localhost:8001/api/v1/users/123e4567-e89b-12d3-a456-426614174000 \
  -H "Authorization: Bearer YOUR_TOKEN"

Example Response

200 Success
{
  "success": true,
  "data": {
    "user_id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "John Doe",
    "email": "[email protected]",
    "push_token": "fcm_token_abc123xyz789",
    "preferences": {
      "email": true,
      "push": true
    }
  },
  "message": "User retrieved successfully",
  "meta": {
    "total": 1,
    "limit": 10,
    "page": 1,
    "total_pages": 1,
    "has_next": false,
    "has_previous": false
  }
}

Notes

  • User preferences are cached in Redis for faster lookups
  • The push_token field is used by the Push Service to send notifications
  • User data is validated against the PostgreSQL database (users_db)
  • This endpoint is frequently called by the API Gateway when processing notification requests

Build docs developers (and LLMs) love