Update an Opportunity

Updates an opportunity object in your ChartMogul account.


Access to the Opportunities endpoints

To use the Opportunities endpoints, you need an API key created by a user with a CRM seat.

curl -X PATCH "https://api.chartmogul.com/v1/opportunities/4ee13ca4-e7fe-11ee-fa7f-f303abf41acc" \
     -u YOUR_API_KEY: \
     -H "Content-Type: application/json" \
     -d '{
        "amount_in_cents": 20000,
          {"key": "NCS","value": 10}
  estimated_close_date: "2024-04-30",
  config, "4ee13ca4-e7fe-11ee-fa7f-f303abf41acc", {"estimated_close_date": "2024-04-30"}
ChartMogul\Opportunity::update("4ee13ca4-e7fe-11ee-fa7f-f303abf41acc", [
  "estimated_close_date" => "2024-12-22",
  EstimatedCloseDate: "2024-12-22",
}, "4ee13ca4-e7fe-11ee-fa7f-f303abf41acc")
chartmogul.Opportunity.patch(config, uuid="4ee13ca4-e7fe-11ee-fa7f-f303abf41acc", data={
  "estimated_close_date": "2024-12-22"

Result Format

    "uuid": "4ee13ca4-e7fe-11ee-fa7f-f303abf41acc",
    "customer_uuid": "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
    "owner": "[email protected]",
    "pipeline": "New Business",
    "pipeline_stage": "Discovery",
    "estimated_close_date": "2024-04-21",
    "currency": "USD",
    "amount_in_cents": 20000,
    "type": "recurring",
    "forecast_category": "best_case",
    "win_likelihood": 40,
        "NCS": 10
    "created_at": "2024-03-22T01:55:50.156Z",
    "updated_at": "2024-03-26T15:08:19.807Z"
  @owner="[email protected]",
  @pipeline="New Business", 
  "uuid": "4ee13ca4-e7fe-11ee-fa7f-f303abf41acc",
  "customer_uuid": "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
	"owner": "[email protected]",
	"pipeline": "New Business",
	"pipeline_stage": "Discovery",
	"estimated_close_date": "2024-04-30",
	"currency": "USD",
	"amount_in_cents": 100_000,
	"type": "one-time",
	"forecast_category": "best_case",
	"win_likelihood:: 30,
	"custom": {"custom_attribute": "custom_attribute_value" }
class ChartMogul\Opportunity (14) {
  protected $uuid =>
	string(36) "4ee13ca4-e7fe-11ee-fa7f-f303abf41acc"
  protected $customer_uuid =>
  string(40) "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7"
  protected $owner =>
  string(17) "[email protected]"
  protected $pipeline =>
  string(14) "New business 1"
  protected $pipeline_stage =>
  string(9) "Discovery"
  protected $estimated_close_date =>
  string(10) "2024-12-22"
  protected $currency =>
  string(3) "USD"
  protected $amount_in_cents =>
  protected $type =>
  string(9) "recurring"
  protected $forecast_category =>
  string(8) "pipeline"
  protected $win_likelihood =>
  protected $custom =>
 	array(1) {
  protected $created_at =>
  string(24) "2024-03-13T07:33:28.356Z"
  protected $updated_at =>
  string(24) "2024-03-13T07:33:28.356Z"
 UUID: (string) (len=36) "4ee13ca4-e7fe-11ee-fa7f-f303abf41acc",
 CustomerUUID: (string) (len=40) "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
 Owner: (string) (len=17) "[email protected]",
 Pipeline: (string) (len=14) "New business 1",
 PipelineStage: (string) (len=9) "Discovery",
 EstimatedCloseDate: (string) (len=10) "2024-12-22",
 Currency: (string) (len=3) "USD",
 AmountInCents: (int) 100,
 Type: (string) (len=9) "recurring",
 ForecastCategory: (string) (len=8) "pipeline",
 WinLikelihood: (int) 3,
 Custom: (map[string]interface {}) (len=1) {
  (string) (len=13) "from_campaign": (bool) true
 CreatedAt: (string) (len=24) "2024-03-13T07:33:28.356Z",
 UpdatedAt: (string) (len=24) "2024-03-13T07:33:28.356Z"
  "uuid": "4ee13ca4-e7fe-11ee-fa7f-f303abf41acc",
  "customer_uuid": "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
  "owner": "[email protected]",
  "pipeline": "New business 1",
  "pipeline_stage": "Discovery",
  "estimated_close_date": "2024-12-22",
  "currency": "USD",
  "amount_in_cents": 100,
  "type": "recurring",
  "forecast_category": "pipeline",
  "win_likelihood": 3,
  "custom": {"from_campaign": True},
  "created_at": "2024-03-13T07:33:28.356Z",
  "updated_at": "2024-03-13T07:33:28.356Z"


Updating custom attributes

When using the Update an Opportunity endpoint, the custom object in your query overwrites any existing custom attributes for this opportunity. To add custom attributes using this endpoint without deleting the existing ones, the custom object must contain key/value pairs for both the existing and new attributes.

uuidThe ChartMogul UUID of the opportunity.
customer_uuidThe ChartMogul UUID of the customer associated with the opportunity.
ownerThe email address of the ChartMogul user with a CRM seat who is the primary salesperson responsible for this opportunity.
pipelineThe sales pipeline name.
pipeline_stageThe sales pipeline deal stage name.
estimated_close_dateThe date when the opportunity is expected to close as an ISO 8601-formatted string or, in the case of the Ruby and Python libraries, a datetime object.
amount_in_centsThe amount in cents (or pence for GBP, etc.) of the expected close value of this opportunity.
currencyThe three-letter currency code for the expected close value, e.g. USD, EUR, or GBP. Read the full list of supported currencies.
typeThe opportunity type, either recurring or one-time.
forecast_categoryThe forecast category. One of pipeline, best_case, committed, lost, or won.
win_likelihoodA percentage (from 0 to 100) representing the likelihood that the opportunity will successfully close.
customA list of key/value pairs of custom attributes assigned to this opportunity.
created_atThe date and time when the opportunity was created as an ISO 8601-formatted string or, in the case of the Ruby and Python libraries, a datetime object.
updated_atThe date and time when the opportunity was last updated as an ISO 8601-formatted string or, in the case of the Ruby and Python libraries, a datetime object.