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,
            "custom":[
              {"key": "seats","value": 4}
            ]
        }'
ChartMogul::Opportunity.update!(
  uuid = "4ee13ca4-e7fe-11ee-fa7f-f303abf41acc",
  amount_in_cents: 20000,
  custom: [
    { key: "seats", value: 4 },
  ],
)
ChartMogul.Opportunity.patch(config, "4ee13ca4-e7fe-11ee-fa7f-f303abf41acc", {
  amount_in_cents: 20000,
  custom: [{ key: "seats", value: 4 }],
});
ChartMogul\Opportunity::update("4ee13ca4-e7fe-11ee-fa7f-f303abf41acc", [
  "amount_in_cents" => 20000,
  "custom" => [
    ["key" => "seats", "value" => 4]
  ]
]);
api.UpdateOpportunity(&cm.UpdateOpportunity{
  AmountInCents: 20000,
  Custom: []Custom{
    {
      Key:   "seats",
      Value: 4,
    },
  },
}, "4ee13ca4-e7fe-11ee-fa7f-f303abf41acc")
chartmogul.Opportunity.patch(
  config,
  uuid="4ee13ca4-e7fe-11ee-fa7f-f303abf41acc",
  data={
    "amount-in-cents": 20000,
    "custom": [
      {"key": "seats", "value": 4},
    ],
  },
)

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,
  "custom": {
    "seats": 4
  },
  "created_at": "2024-03-22T01:55:50.156Z",
  "updated_at": "2024-03-26T15:08:19.807Z"
}
#<ChartMogul::Opportunity:0x00000001058a8210
  @uuid="4ee13ca4-e7fe-11ee-fa7f-f303abf41acc", 
  @created_at="2024-03-18T17:15:56.960Z", 
  @updated_at="2024-03-18T17:15:56.960Z",
  @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=20000, 
  @type="one-time", 
  @forecast_category="best_case", 
  @win_likelihood=30, 
  @custom={:seats=>4}
>
{
  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,
  custom: {
    seats: 4
  },
  created_at: "2024-03-22T01:55:50.156Z",
  updated_at: "2024-03-26T15:08:19.807Z"
}
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"
  protected $pipeline_stage => string(9) "Discovery"
  protected $estimated_close_date => string(10) "2024-12-22"
  protected $currency => string(3) "USD"
  protected $amount_in_cents => int(20000)
  protected $type => string(9) "recurring"
  protected $forecast_category => string(8) "pipeline"
  protected $win_likelihood => int(3)
  protected $custom =>
 	array(1) {
    ["seats"] => int(4)
  }
  protected $created_at => string(24) "2024-03-13T07:33:28.356Z"
  protected $updated_at => string(24) "2024-03-13T07:33:28.356Z"
}
(*chartmogul.Opportunity)(0x140004032b0)({
  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",
  PipelineStage: (string) (len=9) "Discovery",
  EstimatedCloseDate: (string) (len=10) "2024-12-22",
  Currency: (string) (len=3) "USD",
  AmountInCents: (int) 20000,
  Type: (string) (len=9) "recurring",
  ForecastCategory: (string) (len=8) "pipeline",
  WinLikelihood: (int) 3,
  Custom: (map[string]interface {}) (len=1) {
    (string) (len=13) "seats": (int) 4
  },
  CreatedAt: (string) (len=24) "2024-03-13T07:33:28.356Z",
  UpdatedAt: (string) (len=24) "2024-03-13T07:33:28.356Z"
})
<Opportunity{
  "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-12-22",
  "currency": "USD",
  "amount_in_cents": 2000,
  "type": "recurring",
  "forecast_category": "pipeline",
  "win_likelihood": 3,
  "custom": {"seats": 4},
  "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.

KeyDescription
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.
Language