Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/OluwagbeminiyiA/agro_pulse-API/llms.txt

Use this file to discover all available pages before exploring further.

The Users API is the entry point for all account management in AgroPulse. Every participant on the platform — whether a farmer, buyer, or transporter — begins as a User record. Registration is open without authentication, while all other operations (listing, retrieval, update, deletion) require a valid JWT Bearer token. Each user is assigned one of three roles (BUYER, SELLER, or TRANSPORTER) which controls access to the corresponding profile resources across the rest of the API.

Base path

/api/users/

Authentication

All endpoints except POST /api/users/ (registration) require a JWT Bearer token in the Authorization header.
Obtain a token by calling POST /api/users/login/ with your email and password. The response includes both access and refresh tokens.

Endpoints

MethodPathDescriptionAuth required
GET/api/users/List all user accountsYes
POST/api/users/Create / register a new userNo
GET/api/users/{id}/Retrieve a single user by UUIDYes
PUT/api/users/{id}/Full update of a user recordYes
PATCH/api/users/{id}/Partial update of a user recordYes
DELETE/api/users/{id}/Delete a user accountYes

Register a user

POST /api/users/ Creates a new user account. No token is required. The password and password_confirm fields must match; the API returns a 400 validation error if they do not. The password and password_confirm fields are write-only and are never included in any response.
email
string
required
Unique email address for the account. Used as the login identifier.
password
string
required
Account password. Write-only — never returned in responses.
password_confirm
string
required
Must exactly match the password field. Write-only — never returned in responses.
full_name
string
required
Full display name of the user (max 255 characters).
phone_number
string
required
Contact phone number for the user (max 20 characters).
role
string
required
Platform role assigned to this account. One of: BUYER, SELLER, TRANSPORTER.

Example request

curl --request POST \
  --url https://api.agropulse.example.com/api/users/ \
  --header 'Content-Type: application/json' \
  --data '{
    "email": "[email protected]",
    "password": "Secur3P@ssword",
    "password_confirm": "Secur3P@ssword",
    "full_name": "Amara Osei",
    "phone_number": "+233501234567",
    "role": "SELLER"
  }'

Example response

{
  "id": "a3f1c2e4-84b7-4d1e-b9a0-12c3d4e5f678",
  "full_name": "Amara Osei",
  "email": "[email protected]",
  "phone_number": "+233501234567",
  "role": "SELLER",
  "is_active": true,
  "farmer_profile": null,
  "buyer_profile": null,
  "transporter_profile": null,
  "created_at": "2026-05-13T10:22:00.000000Z",
  "updated_at": "2026-05-13T10:22:00.000000Z"
}
Registration returns a UserDetailSerializer response that includes nested farmer_profile, buyer_profile, and transporter_profile objects. These are null until the respective profile is created.

List users

GET /api/users/ Returns an array of all user accounts ordered by created_at descending. Requires authentication.

Query parameters

Filter results by a search term matched against user fields.
ordering
string
Sort results by a field name. Prefix with - for descending order (e.g., -created_at).

Example request

curl --request GET \
  --url 'https://api.agropulse.example.com/api/users/?ordering=-created_at' \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN'

User object

The fields returned on a standard user response.
id
string
required
UUID primary key. Auto-generated on creation, never editable.
email
string
required
Unique email address. Used as the login username.
full_name
string
required
Full display name of the user.
phone_number
string
required
Contact phone number.
role
string
required
Platform role. One of: BUYER, SELLER, TRANSPORTER.
is_active
boolean
required
Whether the account is active. Defaults to true.
created_at
string
required
ISO 8601 timestamp of when the account was created. Read-only.
updated_at
string
required
ISO 8601 timestamp of the last update to the account. Read-only.

Build docs developers (and LLMs) love