Create an opportunity

View as Markdown
Create an opportunity, optionally linked to an existing lead. **custom.FIELD_ID** (optional): Set custom fields by setting `custom.FIELD_ID` to the field value, where FIELD_ID is the ID of the custom field, e.g.: ```json { "custom.cf_v6S011I6MqcbVvB2FA5Nk8dr5MkL8sWuCiG8cUleO9c": "value", "custom.cf_8wtBWsdRU2Fur7GDnEeXQ7ra2Vu7R4hG1SNYdiEhh0F": "other value" } ``` If a custom field has `accepts_multiple_values: true`, the entire value will be replaced. For example, given an Opportunity has a Custom Choice Field with value `["A", "B"]`, adding choice `"C"` would mean setting the value to `["A", "B", "C"]`. Note that using the `custom` field dict or the `custom.FIELD_NAME` syntax (instead of custom field IDs) is deprecated and will be removed from the API. See [Custom Fields](https://developer.close.com/api/resources/custom-fields) for more details.

Authentication

AuthorizationBasic
Use your API key as the username and leave the password empty.
OR
AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Request

This endpoint expects an object.
attachmentslist of objects or nullOptional
confidenceinteger or nullOptional
contact_idstring or nullOptional
created_bystring or nullOptional
date_createddatetime or nullOptional
date_wondatetime or nullOptional

If not set on the resource or in the request, date_won will be set automatically to today’s date when setting status_id to a status with type won. The x-tz-offset header, used to pass your timezone’s UTC offset, will be taken into account.

lead_idstring or nullOptional

Opportunities belong to exactly one Lead. If not provided, a new lead will be created (appearing as “Untitled” in the UI).

notestring or nullOptional
pipeline_idstring or nullOptional

Specify which pipeline this opportunity should belong to. When supplied without status_id, the opportunity will be created with the first available status of that pipeline. When supplied with status_id, the status must belong to the specified pipeline or a 400 error will be returned. If the pipeline does not exist, a 400 error will be returned. See the Pipelines API.

status_idstring or nullOptional

Post a status_id to create an opportunity with a specific status. If omitted, the organization’s default (first) status will be used (or the first status of the pipeline_id if provided). See the Opportunity Status API.

user_idstring or nullOptional
valueinteger or nullOptional
value_periodenum or nullOptional

Response

Successful response
annualized_expected_valueinteger or null
annualized_valueinteger or null
confidenceinteger
contact_idstring or null
created_bystring or null
date_createddatetime
date_lostdatetime or null
date_updateddatetime
date_wondate or null
expected_valueinteger or null
idstring
lead_idstring
notestring or null
organization_idstring
status_idstring
updated_bystring or null
user_idstring
valueinteger or null
value_periodenum
attachmentslist of objects
comment_summaryobject or null
contact_namestring or null
created_by_namestring or null
is_stalledboolean
lead_namestring or null
lead_primary_emailobject or null
lead_primary_phonelist of objects or null
pipeline_idstring or null
pipeline_namestring or null
stall_statusobject or null
status_display_namestring
status_labelstring
status_typeenum
suggested_actionobject or null
updated_by_namestring or null
user_namestring or null
value_currencystring or null
value_formattedstring or null

Errors

400
Bad Request Error
401
Unauthorized Error
404
Not Found Error