API Reference
Welcome to the Project X API. This documentation provides detailed information on how to interact with our platform's data and functionalities.
GET
/users
Retrieves a list of all users.
Query Parameters
Name |
Type |
Description |
limit |
integer |
Maximum number of users to return. Defaults to 20. |
offset |
integer |
Number of users to skip. Defaults to 0. |
status |
string |
Filter users by their status (e.g., 'active', 'inactive'). |
Responses
Code |
Description |
Content |
200 OK |
Successfully retrieved users. |
Array of user objects. |
401 Unauthorized |
Authentication credentials are missing or invalid. |
Error object. |
500 Internal Server Error |
An unexpected error occurred on the server. |
Error object. |
[
{
"id": "usr_abc123",
"username": "johndoe",
"email": "john.doe@example.com",
"created_at": "2023-10-27T10:00:00Z",
"status": "active"
},
{
"id": "usr_def456",
"username": "janedoe",
"email": "jane.doe@example.com",
"created_at": "2023-10-26T15:30:00Z",
"status": "active"
}
]
POST
/users
Creates a new user.
Request Body
Field |
Type |
Required |
Description |
username |
string |
Yes |
The desired username for the new user. |
email |
string |
Yes |
The email address of the new user. |
password |
string |
Yes |
The password for the new user. |
Responses
Code |
Description |
Content |
201 Created |
User created successfully. |
The newly created user object. |
400 Bad Request |
Invalid input data in the request body. |
Error object detailing the validation issues. |
{
"id": "usr_ghi789",
"username": "testuser",
"email": "test@example.com",
"created_at": "2023-10-27T11:00:00Z",
"status": "pending_verification"
}
GET
/users/{user_id}
Retrieves details for a specific user.
Path Parameters
Name |
Type |
Description |
user_id |
string |
The unique identifier of the user. |
Responses
Code |
Description |
Content |
200 OK |
Successfully retrieved user details. |
User object. |
404 Not Found |
The specified user could not be found. |
Error object. |
{
"id": "usr_abc123",
"username": "johndoe",
"email": "john.doe@example.com",
"created_at": "2023-10-27T10:00:00Z",
"status": "active",
"last_login": "2023-10-27T12:00:00Z"
}
GET
/products
Retrieves a list of available products.
Query Parameters
Name |
Type |
Description |
category |
string |
Filter products by category. |
search |
string |
Search products by name or description. |
Responses
Code |
Description |
Content |
200 OK |
Successfully retrieved products. |
Array of product objects. |
GET
/orders
Retrieves a list of the authenticated user's orders.
Query Parameters
Name |
Type |
Description |
status |
string |
Filter orders by status (e.g., 'pending', 'shipped', 'delivered'). |
Responses
Code |
Description |
Content |
200 OK |
Successfully retrieved orders. |
Array of order objects. |
POST
/auth/login
Authenticates a user and returns an access token.
Request Body
Field |
Type |
Required |
Description |
email |
string |
Yes |
User's email address. |
password |
string |
Yes |
User's password. |
Responses
Code |
Description |
Content |
200 OK |
Authentication successful. |
Object containing access token and user info. |
401 Unauthorized |
Invalid credentials. |
Error object. |
{
"access_token": "ey...secret.token.here",
"token_type": "Bearer",
"expires_in": 3600,
"user": {
"id": "usr_abc123",
"username": "johndoe",
"email": "john.doe@example.com"
}
}
|