Update an Opportunity
PATCH https://api.chartmogul.com/v1/opportunities/{OPPORTUNITY_UUID}
Updates an opportunity object in your ChartMogul account.
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},
],
},
)
{
"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(16) "[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=16) "[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"
}>
Access to the Opportunities endpoints. To use the Opportunities endpoints, you need an API key created by a user with a CRM seat.
Path parameters
opportunity_uuid
string required- The ChartMogul UUID of the
opportunity
you’re updating.
Body parameters
owner
string-
The email address of the ChartMogul user with a CRM seat who is the primary salesperson responsible for this opportunity.
pipeline
string-
The sales pipeline name. The pipeline must already exist in ChartMogul. Use one of the default sales pipelines or set up a new one.
pipeline_stage
string-
The name of the current deal stage within the sales pipeline. If a stage is not present in ChartMogul, first add it in the app.
estimated_close_date
string-
The date when the opportunity is expected to close. Must be an ISO 8601-formatted date.
amount_in_cents
integer-
The amount in cents (or pence for GBP, etc.) of the expected close value of this opportunity.
currency
string-
The three-letter currency code for the expected close value, e.g.
USD
,EUR
, orGBP
. Read the full list of supported currencies. type
string-
The opportunity type:
recurring
for opportunities expected to convert into a subscription orone-time
for opportunities expected to convert into one-time upsells. forecast_category
string-
The opportunity’s grouping based on its likelihood of closing. One of five pre-defined categories:
pipeline
,best_case
,committed
,lost
, orwon
. If not provided, it is set to the default forecast category for a given pipeline stage. win_likelihood
integer-
An integer between 0 and 100 representing the likelihood (as a percentage) that the opportunity will successfully close. If not provided, it is set to the default win likelihood for a given pipeline stage.
custom
array(object)-
A list of custom attributes (as
key
andvalue
pairs) you’re adding to the opportunity. The key must match one of the attribute names listed under Settings & Data > Custom Attributes > Opportunities. To add a custom attribute outside of this list, first create it in ChartMogul.key
string required- The name of the custom attribute assigned to this opportunity. Only accepts alphanumeric characters and underscores.
value
string required- The value of the custom attribute assigned to this opportunity. Must match one of the five types specified for this custom attribute key when creating the custom attribute.
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.
Response
uuid
- The ChartMogul UUID of the opportunity.
customer_uuid
- The ChartMogul UUID of the customer associated with the opportunity.
owner
- The email address of the ChartMogul user with a CRM seat who is the primary salesperson responsible for this opportunity.
pipeline
- The sales pipeline name.
pipeline_stage
- The sales pipeline deal stage name.
estimated_close_date
- The 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_cents
- The amount in cents (or pence for GBP, etc.) of the expected close value of this opportunity.
currency
- The three-letter currency code for the expected close value, e.g.
USD
,EUR
, orGBP
. Read the full list of supported currencies. type
- The opportunity type, either
recurring
orone-time
. forecast_category
- The forecast category. One of
pipeline
,best_case
,committed
,lost
, orwon
. win_likelihood
- A percentage (from 0 to 100) representing the likelihood that the opportunity will successfully close.
custom
- A list of
key
/value
pairs of custom attributes assigned to this opportunity. created_at
- The 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_at
- The 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.