> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.definitely.live/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.definitely.live/_mcp/server.

# User Management & Session Guide

The User Management API enables registering new users, managing user credentials, handling authentication sessions, and retrieving user profiles.

---

## 1. Creating Users

### Single User Registration

Create a single user record via `POST /user`:

```json title="Request Payload (POST /v3/user)"
{
  "id": 1,
  "username": "johndoe",
  "firstName": "John",
  "lastName": "Doe",
  "email": "john.doe@example.com",
  "password": "SecurePassword123!",
  "phone": "+1-555-0199",
  "userStatus": 1
}
```

### Batch User Import

Import an array or list of users in a single atomic request using `POST /user/createWithList`:

```json title="Request Payload (POST /v3/user/createWithList)"
[
  {
    "id": 1,
    "username": "johndoe",
    "email": "john.doe@example.com"
  },
  {
    "id": 2,
    "username": "janesmith",
    "email": "jane.smith@example.com"
  }
]
```

---

## 2. User Authentication & Sessions

### User Login

Authenticate credentials and obtain an active session token:

```http
GET /v3/user/login?username=johndoe&password=SecurePassword123! HTTP/1.1
Host: api.plantstore.dev
Accept: application/json
```

```json title="Response Payload (200 OK)"
{
  "code": 200,
  "type": "SUCCESS",
  "message": "logged in user session: sess_98a7b6c5d4e3f210"
}
```

The returned session token should be stored securely and passed in subsequent calls.

### User Logout

Invalidate the active user session token:

```http
GET /v3/user/logout HTTP/1.1
Host: api.plantstore.dev
```

---

## 3. User Profile Operations

### Fetching User Details

Retrieve public user profile data by username:

```http
GET /v3/user/johndoe HTTP/1.1
Host: api.plantstore.dev
```

### Updating User Data

Modify account settings using `PUT /user/{username}`:

```json title="Request Payload (PUT /v3/user/johndoe)"
{
  "id": 1,
  "username": "johndoe",
  "firstName": "Johnathan",
  "lastName": "Doe",
  "email": "johnathan.doe@example.com",
  "phone": "+1-555-0200"
}
```

### Deleting a User

Remove a user record permanently:

```http
DELETE /v3/user/johndoe HTTP/1.1
Host: api.plantstore.dev
```

Deleting a user permanently clears their profile. Any open orders associated with the user account must be closed or transferred prior to deletion.