Create an opportunity
Supply the opportunity object in the request body and this API will create an opportunity with given details.
Note: 'type' parameter is required to use Sales Stage Rules.
Steps to create/edit Sales Stage Rules - Opportunities-> Sales Stage Rules.
Before you begin
- You need a valid API key or access token. See Set up API authentication.
Permission: Manage API Keys (on the Administrator security object) — Required to access Zenoti APIs.
Endpoint
POST /v1/opportunities
Base URL: https://api.zenoti.com
Request
Headers
| Header | Required | Description |
|---|---|---|
| Authorization | Yes | bearer {{access_token}} |
Query parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| center_id | string | Yes | — | Mandatory Unique identifier of the opportunity |
| opportunity_title | string | Yes | — | Mandatory Title of the opportunity. |
| opportunity_description | string | No | — | Optional Description of the opportunity. |
| opportunity_owner_id | string | No | — | Optional Unique Id of the owner of the opportunity. |
| guest_id | string | Yes | — | Mandatory Unique id of the guest. |
| created_by_id | string | Yes | — | Mandatory Unique is of the employee. |
| priority_type_id | string | No | — | Optional Unique id of the priority type of the opportunity |
| status_id | string | No | — | Optional Unique id the stage type (or) status type of the opportunity, |
| type | string | No | — | Optional Opportunity type Membership or Package or Others NOTE: This parameter is required to use Sales Stage Rules. Steps to create/edit opportunity type: Forms->Forms Creation->Custom List->Opportunity Type |
| followup_date | string (date) | Yes | — | Mandatory Date on which a followup call is planned(yyyy-mm-dd) in center time. |
| expected_close_date | string (date) | No | — | Optional Expected close date in center time. |
| listed_amount | number (double) | No | — | Optional Price listed in the catalog |
| offered_amount | number (double) | No | — | Optional Price offered for the opportunity |
| optional_field_1 | string | No | — | Optional User defined optional field. |
| optional_field_2 | string | No | — | Optional User defined optional field. |
| optional_field_3 | string | No | — | Optional User defined optional field. |
| ticket_id (guid) | string | No | — | Optional Unique id of the ticket. |
| change_guest_center | boolean | No | — | Optional Boolean which changes guest's center to the valid center_id passed if made true |
| disposition_id | string | No | — | Optional Unique id of the disposition |
| custom_fields | string | No | — | Optional Key(Guid) has the FieldId of the custom field and Value(String) has the value of the custom field. |
| lead_source | object | No | — | Optional Details of lead source |
| lead_source.id | string | No | — | Optional Unique id of the lead source |
| lead_source.code | string | No | — | Optional Code of the lead source |
Response
Success (201 Created)
{
"success": true,
"opportunity_id": "ae0df9db-908b-4169-aca0-756b879df4f2",
"message": "Opportunity Created Succesfully"
}
Response fields
| Field | Type | Description |
|---|---|---|
| success | boolean | |
| opportunity_id | string | |
| message | string |
Example
curl --request POST \
--url 'https://api.zenoti.com/v1/opportunities?center_id={{center_id}}&opportunity_title={{opportunity_title}}&guest_id={{guest_id}}&created_by_id={{created_by_id}}&followup_date={{followup_date}}' \
--header 'Authorization: bearer {{access_token}}'
const response = await fetch('https://api.zenoti.com/v1/opportunities', {
method: 'POST',
headers: {
'Authorization': 'bearer {{access_token}}'
},
});
const data = await response.json();
import requests
response = requests.post(
'https://api.zenoti.com/v1/opportunities',
headers={
'Authorization': 'bearer {{access_token}}',
},
)
data = response.json()
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "bearer {{access_token}}");
var response = await client.PostAsync(
"https://api.zenoti.com/v1/opportunities");
var data = await response.Content.ReadAsStringAsync();
require 'net/http'
require 'json'
uri = URI('https://api.zenoti.com/v1/opportunities')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'bearer {{access_token}}'
response = http.request(request)
data = JSON.parse(response.body)
Error codes
| Status | Description |
|---|---|
| 400 | 400 |
| 401 | Unauthorized -- invalid or expired access token |
| 429 | Too many requests -- rate limit exceeded |