GET /v1/users

Retrieves a list of users.

Query Parameters

Name Type Description Required
limit Integer The maximum number of users to return. No
offset Integer The number of users to skip before returning results. No
status String Filter users by their status (e.g., 'active', 'inactive'). No

Example Response

{
    "data": [
        {
            "id": "user_123",
            "name": "Alice Smith",
            "email": "alice.smith@example.com",
            "status": "active",
            "created_at": "2023-10-27T10:00:00Z"
        },
        {
            "id": "user_456",
            "name": "Bob Johnson",
            "email": "bob.johnson@example.com",
            "status": "inactive",
            "created_at": "2023-10-26T15:30:00Z"
        }
    ],
    "total": 2,
    "limit": 10,
    "offset": 0
}

GET /v1/users/{userId}

Retrieves details for a specific user.

Path Parameters

Name Type Description Required
userId String The unique identifier of the user. Yes

Example Response

{
    "id": "user_123",
    "name": "Alice Smith",
    "email": "alice.smith@example.com",
    "status": "active",
    "created_at": "2023-10-27T10:00:00Z",
    "updated_at": "2023-10-27T11:00:00Z",
    "roles": ["admin", "editor"]
}

POST /v1/users

Creates a new user.

Request Body

The request body should be a JSON object containing the user's details.

{
    "name": "New User",
    "email": "new.user@example.com",
    "password": "secure_password_here",
    "role": "viewer"
}

Example Response (201 Created)

{
    "id": "user_789",
    "name": "New User",
    "email": "new.user@example.com",
    "status": "pending",
    "created_at": "2023-10-27T12:00:00Z"
}

PUT /v1/users/{userId}

Updates an existing user.

Path Parameters

Name Type Description Required
userId String The unique identifier of the user to update. Yes

Request Body

The request body should be a JSON object containing the fields to update.

{
    "name": "Updated User Name",
    "status": "active"
}

Example Response

{
    "id": "user_123",
    "name": "Updated User Name",
    "email": "alice.smith@example.com",
    "status": "active",
    "created_at": "2023-10-27T10:00:00Z",
    "updated_at": "2023-10-27T13:00:00Z"
}

DELETE /v1/users/{userId}

Deletes a user.

Path Parameters

Name Type Description Required
userId String The unique identifier of the user to delete. Yes

Example Response (204 No Content)

A successful deletion returns no content.

© 2023 Your Company. All rights reserved.