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 Buyers API manages BuyerProfile records for users with the BUYER role on the AgroPulse platform. A buyer profile extends a base User account with purchasing context — a buyer_type that classifies the buyer as an individual, restaurant, or wholesaler, an optional business_name, and a location used to match buyers with nearby produce. All endpoints require a valid JWT Bearer token. The user field on a buyer profile is automatically set to the authenticated user; you do not include it in the request body.

Base path

/api/buyers/

Authentication

All endpoints require a JWT Bearer token in the Authorization header.
The user field 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/buyers/List buyer profilesYes
POST/api/buyers/Create a new buyer profileYes
GET/api/buyers/{id}/Retrieve a single buyer profile by UUIDYes
PUT/api/buyers/{id}/Full update of a buyer profileYes
PATCH/api/buyers/{id}/Partial update of a buyer profileYes
DELETE/api/buyers/{id}/Delete a buyer profileYes

Create a buyer profile

POST /api/buyers/ Creates a BuyerProfile linked to the authenticated user. The user field is set automatically from the Bearer token and is read-only. Provide a buyer_type to classify the account and a location so the platform can surface relevant produce listings.
business_name
string
Trading or business name of the buyer (max 255 characters). Optional — leave blank for individual buyers.
buyer_type
string
required
Classification of the buyer. Must be one of INDIVIDUAL, RESTAURANT, or WHOLESALER.
location
string
required
Physical location or delivery area of the buyer (max 255 characters).

Example request

curl --request POST \
  --url https://api.agropulse.example.com/api/buyers/ \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "business_name": "Fresh Table Restaurant",
    "buyer_type": "RESTAURANT",
    "location": "Accra, Greater Accra Region, Ghana"
  }'

Example response

{
  "id": "c4e7a1b3-52d8-4f0e-9c2a-78d9e0f1b234",
  "user": "a3f1c2e4-84b7-4d1e-b9a0-12c3d4e5f678",
  "user_email": "[email protected]",
  "user_full_name": "Kezia Mensah",
  "business_name": "Fresh Table Restaurant",
  "buyer_type": "RESTAURANT",
  "location": "Accra, Greater Accra Region, Ghana",
  "created_at": "2026-05-13T11:20:00.000000Z",
  "updated_at": "2026-05-13T11:20:00.000000Z"
}

List buyers

GET /api/buyers/ Returns an array of buyer 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 buyer 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/buyers/?search=Accra&ordering=-created_at' \
  --header 'Authorization: Bearer YOUR_ACCESS_TOKEN'

BuyerProfile 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.
business_name
string
Trading or business name of the buyer. null when not provided.
buyer_type
string
required
Classification of the buyer. One of INDIVIDUAL, RESTAURANT, or WHOLESALER.
location
string
required
Physical location or delivery area of the buyer.
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