Overview
The Stakeholder Search endpoint provides a unified search interface to find customers and suppliers simultaneously. This is useful for POS systems, quick lookups, and reporting where you need to search across both stakeholder types. Endpoint:GET /api/v1/stakeholders/search
Authentication
Requires JWT authentication via Bearer token. Required Roles:admin, gestor, consultor
Query Parameters
Search query string. Searches across name, document number, email, and other text fields. Empty query returns recent records.
Filter by stakeholder type. Options:
all- Search both customers and suppliers (default)customer- Search only customerssupplier- Search only suppliers
Maximum number of results to return
Response
Returns an array of stakeholder objects with atype field indicating whether each result is a customer or supplier.
Response Fields
Unique identifier for the stakeholder
Stakeholder type:
customer or supplierStakeholder name
Document number
Document type (DNI, RUC, CE, etc.)
Email address (if provided)
Phone number (if provided)
Address (if provided)
Payment condition (customers only)
Delivery terms (suppliers only)
Examples
Search all stakeholders
cURL
Python
Response
Response
200 OK
Search only customers
cURL
Python
Search by document number
cURL
Get recent stakeholders
cURL
Use Cases
POS customer lookup
Quickly find customers during sales transactions without navigating between customer and supplier lists.
Unified reporting
Generate reports that include both customer and supplier data without multiple API calls.
Quick search UI
Implement autocomplete or type-ahead search boxes that search across all stakeholders.
Contact lookup
Find stakeholder contact information quickly by name, email, or document number.
Implementation Details
The search is implemented instakeholder_service.py and performs a case-insensitive search across multiple fields:
- Name (nombre)
- Document number (numero_documento)
- Other text fields
Error Responses
400 Bad Request
401 Unauthorized
403 Forbidden
Related Endpoints
Customers API
Full CRUD operations for customer records
Suppliers API
Full CRUD operations for supplier records