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 Farmers API manages FarmerProfile records for users with the SELLER role on the AgroPulse platform. A farmer profile extends a base User account with farm-specific details — the name and location of the farm, and a platform-calculated trust_score that reflects the farmer’s reliability over time. All endpoints require a valid JWT Bearer token. Non-admin users can only access their own farmer profile; staff accounts see all profiles.

Base path

/api/farmers/

Authentication

All endpoints require a JWT Bearer token in the Authorization header.
The user field on a farmer profile is automatically set to the authenticated user when creating a record. You do not need to supply it in the request body.

Endpoints

MethodPathDescriptionAuth required
GET/api/farmers/List farmer profilesYes
POST/api/farmers/Create a new farmer profileYes
GET/api/farmers/{id}/Retrieve a single farmer profile by UUIDYes
PUT/api/farmers/{id}/Full update of a farmer profileYes
PATCH/api/farmers/{id}/Partial update of a farmer profileYes
DELETE/api/farmers/{id}/Delete a farmer profileYes

Create a farmer profile

POST /api/farmers/ Creates a FarmerProfile linked to the authenticated user. The user field is set automatically from the Bearer token — it is read-only and must not be included in the request body. The trust_score is platform-managed and always starts at 0.00.
farm_name
string
required
Name of the farm (max 255 characters).
farm_location
string
required
Physical location or address of the farm (max 255 characters).

Example request

curl --request POST \
  --url https://api.agropulse.example.com/api/farmers/ \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "farm_name": "Golden Harvest Farms",
    "farm_location": "Kumasi, Ashanti Region, Ghana"
  }'

Example response

{
  "id": "b7d2e4f6-91c3-4a2b-8d0e-56f7a8b9c012",
  "user": "a3f1c2e4-84b7-4d1e-b9a0-12c3d4e5f678",
  "user_email": "[email protected]",
  "user_full_name": "Amara Osei",
  "farm_name": "Golden Harvest Farms",
  "farm_location": "Kumasi, Ashanti Region, Ghana",
  "trust_score": "0.00",
  "created_at": "2026-05-13T10:35:00.000000Z",
  "updated_at": "2026-05-13T10:35:00.000000Z"
}
trust_score is a decimal value in the range 0.001.00. It is calculated and updated by the platform and is always read-only.

List farmers

GET /api/farmers/ Returns an array of farmer profiles ordered by created_at descending. Non-admin users receive only their own profile. Staff users receive all profiles.

Query parameters

Filter results by a search term matched against farmer profile 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/farmers/?search=Kumasi&ordering=-created_at' \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN'

FarmerProfile object

id
string
required
UUID primary key. Auto-generated on creation, never editable.
user
string
required
UUID of the linked User account. Set automatically from the authenticated user. Read-only.
user_email
string
required
Email address of the linked user. Read-only, derived from the User record.
user_full_name
string
required
Full name of the linked user. Read-only, derived from the User record.
farm_name
string
required
Name of the farm.
farm_location
string
required
Physical location or address of the farm.
trust_score
string
required
Platform-calculated reliability score in the range 0.001.00. Read-only. Defaults to 0.00 on creation.
created_at
string
required
ISO 8601 timestamp of profile creation. Read-only.
updated_at
string
required
ISO 8601 timestamp of the last update. Read-only.

Build docs developers (and LLMs) love