Skip to main content

Endpoint

POST /api/v1/users
Creates a new user account with a unique user ID and initializes their balance in the exchange system.

Request

This endpoint does not require a request body. The user ID is automatically generated using UUID v4.
In the current implementation, the user ID is generated server-side. In a production environment, this would typically be extracted from authentication tokens (cookies or JWT).

Response

status
string
Status message indicating successful user creation
user_id
string
The unique identifier (UUID v4) assigned to the newly created user

Example request

curl -X POST \
  https://api.exchange.com/api/v1/users \
  -H 'Content-Type: application/json'

Example response

{
  "status": "Created User",
  "user_id": "550e8400-e29b-41d4-a716-446655440000"
}

Error responses

500
Internal Server Error
Returns when user creation fails or times out

Implementation details

The user creation process:
  1. Generates a new UUID v4 for the user
  2. Initializes the user’s balance in the exchange engine
  3. Returns the user ID upon successful creation
See: /home/daytona/workspace/source/crates/router/src/routes/user.rs:13

Build docs developers (and LLMs) love