Introduction

Welcome to the Developer API for our platform. This API allows you to interact with our user data, manage user accounts, and retrieve relevant information programmatically.

The API follows RESTful principles and uses JSON for request and response bodies. All requests should be made over HTTPS.

Base URL: https://api.example.com/developer/api/v1

Authentication

All requests to the API must be authenticated. Authentication is handled via API keys passed in the Authorization header.

Provide your API key in the following format:

Authorization: Bearer YOUR_API_KEY

If authentication fails, you will receive a 401 Unauthorized response.

Endpoints

GET /users

List All Users

Retrieves a list of all users on the platform.

Query Parameters

Name Type Description Required
limit integer Maximum number of users to return. No
offset integer Number of users to skip before starting to collect the result set. No
sort string Field to sort by (e.g., createdAt, name). No

Response (200 OK)

[
  {
    "id": "user_abc123",
    "name": "Alice Wonderland",
    "email": "alice@example.com",
    "createdAt": "2023-10-27T10:00:00Z",
    "updatedAt": "2023-10-27T10:00:00Z"
  },
  {
    "id": "user_def456",
    "name": "Bob The Builder",
    "email": "bob@example.com",
    "createdAt": "2023-10-27T10:05:00Z",
    "updatedAt": "2023-10-27T10:05:00Z"
  }
]
POST /users

Create a New User

Creates a new user account.

Request Body

Requires a JSON object with the following properties:

Name Type Description Required
name string The full name of the user. Yes
email string The email address of the user. Must be unique. Yes
password string The user's password. Min 8 characters. Yes

Response (201 Created)

{
  "id": "user_ghi789",
  "name": "Charlie Chaplin",
  "email": "charlie@example.com",
  "createdAt": "2023-10-27T10:10:00Z",
  "updatedAt": "2023-10-27T10:10:00Z"
}

Response (400 Bad Request)

If required fields are missing or invalid.

{
  "error": "Validation Error",
  "message": "Email is required and must be a valid format."
}
GET /users/{id}

Get User by ID

Retrieves details for a specific user by their unique ID.

Path Parameters

Name Type Description
id string The unique identifier of the user.

Response (200 OK)

{
  "id": "user_abc123",
  "name": "Alice Wonderland",
  "email": "alice@example.com",
  "createdAt": "2023-10-27T10:00:00Z",
  "updatedAt": "2023-10-27T10:00:00Z"
}

Response (404 Not Found)

If no user exists with the provided ID.

{
  "error": "Not Found",
  "message": "User with ID user_xyz999 not found."
}
PUT /users/{id}

Update User by ID

Updates an existing user's information.

Path Parameters

Name Type Description
id string The unique identifier of the user to update.

Request Body

Requires a JSON object with the properties you wish to update:

Name Type Description Required
name string The updated full name of the user. No
email string The updated email address. Must be unique. No

Response (200 OK)

Returns the updated user object.

{
  "id": "user_abc123",
  "name": "Alice Wonderland Smith",
  "email": "alice.smith@example.com",
  "createdAt": "2023-10-27T10:00:00Z",
  "updatedAt": "2023-10-27T10:15:00Z"
}

Response (404 Not Found)

If no user exists with the provided ID.

{
  "error": "Not Found",
  "message": "User with ID user_xyz999 not found."
}
DELETE /users/{id}

Delete User by ID

Deletes a user account.

Path Parameters

Name Type Description
id string The unique identifier of the user to delete.

Response (204 No Content)

Indicates successful deletion. No response body is returned.

Response (404 Not Found)

If no user exists with the provided ID.

{
  "error": "Not Found",
  "message": "User with ID user_xyz999 not found."
}

Error Handling

The API uses standard HTTP status codes to indicate the success or failure of a request. Error responses will typically be in JSON format, containing an error type and a descriptive message.

Common Error Codes:

  • 200 OK: Request successful.
  • 201 Created: Resource successfully created.
  • 204 No Content: Request successful, but no response body to return (e.g., DELETE).
  • 400 Bad Request: The request was invalid (e.g., missing parameters, invalid data format).
  • 401 Unauthorized: Authentication failed. Ensure your API key is valid and included correctly.
  • 403 Forbidden: You do not have permission to access this resource.
  • 404 Not Found: The requested resource could not be found.
  • 409 Conflict: The request could not be completed due to a conflict with the current state of the resource (e.g., creating a user with an existing email).
  • 500 Internal Server Error: An unexpected error occurred on the server.

Example of a validation error:

{
  "error": "Validation Error",
  "message": "Email address is not valid."
}

Changelog

v1.0.0 (2023-10-27)

  • Initial release of the Developer API.
  • Added endpoints for managing users (CRUD operations).
  • Implemented API key authentication.
  • Established standard error handling and response formats.