User Management API

Overview

This API provides endpoints for managing user accounts, authentication, and user data.

Authentication

All API requests require authentication using a bearer token in the Authorization header.

Authorization: Bearer YOUR_API_TOKEN

Endpoints

GET /api/users

Retrieve a list of all users.

Parameters

Response

{
    "users": [
        {
            "id": "123",
            "name": "John Doe",
            "email": "john@example.com"
        }
    ],
    "total": 100,
    "page": 1
}
    

POST /api/users

Create a new user account.

Request Body

{
    "name": "Jane Smith",
    "email": "jane@example.com",
    "password": "secure_password"
}
    

Response

{
    "id": "124",
    "name": "Jane Smith",
    "email": "jane@example.com",
    "created_at": "2024-01-01T00:00:00Z"
}
    

GET /api/users/:id

Retrieve a specific user by ID.

PUT /api/users/:id

Update user information.

DELETE /api/users/:id

Delete a user account.

Error Codes

Rate Limiting

API requests are limited to 1000 requests per hour per API key.

Examples

Creating a User

curl -X POST https://api.example.com/api/users \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"John Doe","email":"john@example.com","password":"secret"}'
    

Fetching Users

curl https://api.example.com/api/users?page=1&limit=10 \
  -H "Authorization: Bearer YOUR_TOKEN"