Opportunities
Create an opportunity
Creates an opportunity in a pipeline stage.
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
Create an opportunity
curl --request POST \
--url https://backend.leadey.ai/v1/opportunities \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"pipelineId": "<string>",
"stageId": "<string>",
"value": 123,
"currency": "GBP",
"ownerId": "<string>",
"companyId": "<string>",
"contactId": "<string>",
"sourceLeadId": "<string>",
"expectedCloseDate": "2023-12-25",
"notes": "<string>"
}
'import requests
url = "https://backend.leadey.ai/v1/opportunities"
payload = {
"name": "<string>",
"pipelineId": "<string>",
"stageId": "<string>",
"value": 123,
"currency": "GBP",
"ownerId": "<string>",
"companyId": "<string>",
"contactId": "<string>",
"sourceLeadId": "<string>",
"expectedCloseDate": "2023-12-25",
"notes": "<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({
name: '<string>',
pipelineId: '<string>',
stageId: '<string>',
value: 123,
currency: 'GBP',
ownerId: '<string>',
companyId: '<string>',
contactId: '<string>',
sourceLeadId: '<string>',
expectedCloseDate: '2023-12-25',
notes: '<string>'
})
};
fetch('https://backend.leadey.ai/v1/opportunities', 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
}
}Authorizations
Your API key, created in the Leadey dashboard under Settings → API Keys. Send it as Authorization: Bearer leadey_sk_live_….
Body
application/json
Amount in major units.
Example:
"GBP"
Requires opportunities.editAll; otherwise the opportunity is owned by the key's member.
Response
Success
Show child attributes
Show child attributes
⌘I
Create an opportunity
curl --request POST \
--url https://backend.leadey.ai/v1/opportunities \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"pipelineId": "<string>",
"stageId": "<string>",
"value": 123,
"currency": "GBP",
"ownerId": "<string>",
"companyId": "<string>",
"contactId": "<string>",
"sourceLeadId": "<string>",
"expectedCloseDate": "2023-12-25",
"notes": "<string>"
}
'import requests
url = "https://backend.leadey.ai/v1/opportunities"
payload = {
"name": "<string>",
"pipelineId": "<string>",
"stageId": "<string>",
"value": 123,
"currency": "GBP",
"ownerId": "<string>",
"companyId": "<string>",
"contactId": "<string>",
"sourceLeadId": "<string>",
"expectedCloseDate": "2023-12-25",
"notes": "<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({
name: '<string>',
pipelineId: '<string>',
stageId: '<string>',
value: 123,
currency: 'GBP',
ownerId: '<string>',
companyId: '<string>',
contactId: '<string>',
sourceLeadId: '<string>',
expectedCloseDate: '2023-12-25',
notes: '<string>'
})
};
fetch('https://backend.leadey.ai/v1/opportunities', 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
}
}