Opportunities

GET https://leads.qreq.com/api/opportunities
Parameters Details Description
searchOptionalStringSearch by name or description
account_idOptionalIntegerFilter by account ID
opportunity_stage_idOptionalIntegerFilter by opportunity stage ID
opportunity_source_idOptionalIntegerFilter by opportunity source ID
statusOptionalStringFilter by status (active/inactive)
assigned_toOptionalIntegerFilter by assigned user ID
sort_fieldOptionalStringField to sort by
sort_directionOptionalStringSort direction (asc/desc)
per_pageOptionalIntegerPagination limit
curl --request GET \
--url 'https://leads.qreq.com/api/opportunities?search=Test&status=active&per_page=10' \
--header 'Authorization: Bearer {api_key}'
{ "status": "success", "message": "Opportunities retrieved successfully.", "data": { "current_page": 1, "data": [ { "id": 1, "name": "Opportunity 1", "description": "Description", "amount": 5000, "close_date": "2025-12-31", "status": "active", "account": {"id": 1, "name": "Account 1"}, "contact": {"id": 2, "name": "Contact 1"}, "opportunityStage": {"id": 1, "name": "Qualification"}, "opportunitySource": {"id": 1, "name": "Referral"}, "assignedUser": {"id": 3, "name": "John Doe"}, "products": [] } ], "per_page": 10, "total": 1 } }
GET https://leads.qreq.com/api/opportunities/{opportunity_id}
curl --request GET \
--url 'https://leads.qreq.com/api/opportunities/{opportunity_id}' \
--header 'Authorization: Bearer {api_key}'
{ "status": "success", "message": "Opportunity retrieved successfully.", "data": { "opportunity": { "id": 1, "name": "Opportunity 1", "description": "Description", "amount": 5000, "close_date": "2025-12-31", "status": "active", "account": {"id": 1, "name": "Account 1"}, "contact": {"id": 2, "name": "Contact 1"}, "opportunityStage": {"id": 1, "name": "Qualification"}, "opportunitySource": {"id": 1, "name": "Referral"}, "assignedUser": {"id": 3, "name": "John Doe"}, "products": [] }, "meetings": [], "activities": [] } }
POST https://leads.qreq.com/api/opportunities
Parameters Details Description
nameRequiredStringOpportunity name
descriptionOptionalStringOpportunity description
amountOptionalIntegerOpportunity amount
close_dateOptionalStringClose date (YYYY-MM-DD)
notesOptionalStringAdditional notes
account_idRequiredIntegerRelated account ID
contact_idOptionalIntegerRelated contact ID
opportunity_stage_idRequiredIntegerStage ID
opportunity_source_idRequiredIntegerSource ID
statusOptionalStringStatus (active/inactive)
assigned_toOptionalIntegerAssign to user ID
productsOptionalArrayProducts array (product_id, quantity, unit_price)
curl --request POST \
--url 'https://leads.qreq.com/api/opportunities' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: application/json' \
--data-raw '{ "name": "New Opportunity", "description": "Description here", "amount": 5000, "close_date": "2025-12-31", "account_id": 1, "contact_id": 2, "opportunity_stage_id": 1, "opportunity_source_id": 1, "status": "active", "products": [ {"product_id": 1, "quantity": 2, "unit_price": 2500} ] }'
{ "status": "success", "message": "Opportunity created successfully.", "data": { "id": 1, "name": "New Opportunity", "description": "Description here", "amount": 5000, "close_date": "2025-12-31", "status": "active", "account_id": 1, "contact_id": 2, "opportunity_stage_id": 1, "opportunity_source_id": 1, "created_by": 33, "assigned_to": 33, "products": [] } }
PUT https://leads.qreq.com/api/opportunities/{opportunity_id}
curl --request PUT \
--url 'https://leads.qreq.com/api/opportunities/{opportunity_id}' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: application/json' \
--data-raw '{ "name": "Updated Opportunity", "description": "Updated description", "amount": 6000, "close_date": "2026-01-31", "account_id": 1, "contact_id": 2, "opportunity_stage_id": 2, "opportunity_source_id": 1, "status": "active", "products": [ {"product_id": 1, "quantity": 3, "unit_price": 2000} ] }'
{ "status": "success", "message": "Opportunity updated successfully.", "data": { "id": 1, "name": "Updated Opportunity", "description": "Updated description", "amount": 6000, "close_date": "2026-01-31", "status": "active", "account_id": 1, "contact_id": 2, "opportunity_stage_id": 2, "opportunity_source_id": 1, "created_by": 33, "assigned_to": 33, "products": [] } }
DELETE https://leads.qreq.com/api/opportunities/{opportunity_id}
curl --request DELETE \
--url 'https://leads.qreq.com/api/opportunities/{opportunity_id}' \
--header 'Authorization: Bearer {api_key}'
{ "status": "success", "message": "Opportunity deleted successfully." }
PATCH https://leads.qreq.com/api/opportunities/{opportunity_id}/toggle-status
curl --request PATCH \
--url 'https://leads.qreq.com/api/opportunities/{opportunity_id}/toggle-status' \
--header 'Authorization: Bearer {api_key}'
{ "status": "success", "message": "Opportunity status updated successfully.", "data": { "id": 1, "status": "inactive" } }
DELETE https://leads.qreq.com/api/opportunities/{opportunity_id}/activities
curl --request DELETE \
--url 'https://leads.qreq.com/api/opportunities/{opportunity_id}/activities' \
--header 'Authorization: Bearer {api_key}'
{ "status": "success", "message": "All activities deleted successfully." }
DELETE https://leads.qreq.com/api/opportunities/{opportunity_id}/activities/{activity_id}
curl --request DELETE \
--url 'https://leads.qreq.com/api/opportunities/{opportunity_id}/activities/{activity_id}' \
--header 'Authorization: Bearer {api_key}'
{ "status": "success", "message": "Activity deleted successfully." }
PATCH https://leads.qreq.com/api/opportunities/{opportunity_id}/update-status
curl --request PATCH \
--url 'https://leads.qreq.com/api/opportunities/{opportunity_id}/update-status' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: application/json' \
--data-raw '{ "opportunity_stage_id": 2 }'
{ "status": "success", "message": "Opportunity status updated successfully.", "data": { "id": 1, "opportunity_stage_id": 2 } }