Opportunities
Mark an opportunity lost
Moves it to the pipeline’s lost stage and fires opportunity.lost.
Permissions are the same as in the app, resolved from the member your API key acts as. Without opportunities.editAll you can only change opportunities you own — an API key is not a way around the rules a person has.
POST
/
opportunities
/
{id}
/
lose
Mark an opportunity lost
curl --request POST \
--url https://backend.leadey.ai/v1/opportunities/{id}/lose \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reason": "<string>"
}
'import requests
url = "https://backend.leadey.ai/v1/opportunities/{id}/lose"
payload = { "reason": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({reason: '<string>'})
};
fetch('https://backend.leadey.ai/v1/opportunities/{id}/lose', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": "<string>",
"name": "<string>",
"value": "15000.50",
"currency": "GBP",
"status": "open",
"probability": 40,
"pipelineId": "<string>",
"stageId": "<string>",
"stageLabel": "<string>",
"ownerId": "<string>",
"companyId": "<string>",
"contactId": "<string>",
"sourceLeadId": "<string>",
"expectedCloseDate": "2023-12-25",
"closedAt": "2023-11-07T05:31:56Z",
"lostReason": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"error": {
"message": "One of email, phone or linkedinUrl is required",
"details": null
}
}{
"error": {
"message": "Invalid or revoked API key.",
"details": null
}
}{
"error": {
"message": "This API key is read-only. Create a key with write access in Settings → API Keys.",
"details": null
}
}{
"error": {
"message": "Lead not found",
"details": null
}
}⌘I
Mark an opportunity lost
curl --request POST \
--url https://backend.leadey.ai/v1/opportunities/{id}/lose \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reason": "<string>"
}
'import requests
url = "https://backend.leadey.ai/v1/opportunities/{id}/lose"
payload = { "reason": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({reason: '<string>'})
};
fetch('https://backend.leadey.ai/v1/opportunities/{id}/lose', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": "<string>",
"name": "<string>",
"value": "15000.50",
"currency": "GBP",
"status": "open",
"probability": 40,
"pipelineId": "<string>",
"stageId": "<string>",
"stageLabel": "<string>",
"ownerId": "<string>",
"companyId": "<string>",
"contactId": "<string>",
"sourceLeadId": "<string>",
"expectedCloseDate": "2023-12-25",
"closedAt": "2023-11-07T05:31:56Z",
"lostReason": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"error": {
"message": "One of email, phone or linkedinUrl is required",
"details": null
}
}{
"error": {
"message": "Invalid or revoked API key.",
"details": null
}
}{
"error": {
"message": "This API key is read-only. Create a key with write access in Settings → API Keys.",
"details": null
}
}{
"error": {
"message": "Lead not found",
"details": null
}
}