List Opportunities

Lists opportunity objects 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.

Examples

curl -X GET "https://api.chartmogul.com/v1/opportunities?per_page=20&cursor=aabbcc..." \
     -u YOUR_API_KEY: \
ChartMogul::Opportunity.all(
  per_page: 20,
  cursor: "aabbcc...",
  customer_uuid: "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
)
ChartMogul.Opportunity.all(config, {
  per_page: 20,
  cursor: "aabbccdd...",
  customer_uuid: "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
});
ChartMogul\Opportunity::all([
  "customer_uuid" => "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
  "cursor" => "aabbccdd...",
  "per_page" => "20"
]);
api.ListOpportunities(&cm.ListOpportunitiesParams{
  Cursor:       cm.Cursor{PerPage: 1},
  CustomerUUID: "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
})
chartmogul.Opportunity.all(
  config,
  cursor="aabbcc...",
  per_page=20,
  customer_uuid="cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
)

Result Format

{
  "entries": [
    {
      "uuid": "39351ba6-dea0-11ee-ac96-37b2b3de29af",
      "customer_uuid": "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
      "owner": "[email protected]",
      "pipeline": "New Business",
      "pipeline_stage": "Discovery",
      "estimated_close_date": "2024-03-30",
      "currency": "USD",
      "amount_in_cents": 100000,
      "type": "one-time",
      "forecast_category": "best_case",
      "win_likelihood": 30,
      "custom": { "seats": 3 }
    }
    // ...and more
  ],
  "cursor": "aabbcc...",
  "has_more": true
}
#<ChartMogul::Opportunity:0x00007f82834c9368 
@entries=[
  #<ChartMogul::Opportunity:0x00000001058a8210
    @uuid="39351ba6-dea0-11ee-ac96-37b2b3de29af", 
    @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-03-30", 
    @currency="USD", 
    @amount_in_cents=100000, 
    @type="one-time", 
    @forecast_category="best_case", 
    @win_likelihood=30, 
    @custom={:seats=>3}
  >,
  # ...and more
	],
	@has_more=true, 
	@cursor="aabbcc..."
>
{
  "entries: [
    {
      uuid: "39351ba6-dea0-11ee-ac96-37b2b3de29af",
      customer_uuid: "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
      owner: "[email protected]",
      pipeline: "New Business",
      pipeline_stage: "Discovery",
      estimated_close_date: "2024-03-30",
      currency: "USD",
      amount_in_cents: 100000,
      type: "one-time",
      forecast_category: "best_case",
      win_likelihood: 30,
      custom: { seats: 3 }
    }
    // ...and more
  ],
  cursor: "aabbcc...",
  has_more: true
}
<?php
class ChartMogul\Resource\CollectionWithCursor (3) {
  public $has_more => bool(true)
  public $cursor => string(96) "aabbcc..."
  private $elements => array(20) {
    [0] =>
    class ChartMogul\Opportunity (14) {
      protected $uuid => string(36) "39351ba6-dea0-11ee-ac96-37b2b3de29af"
      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) "2023-12-22"
      protected $currency => string(3) "USD"
      protected $amount_in_cents => int(100)
      protected $type => string(9) "recurring"
      protected $forecast_category => string(8) "pipeline"
      protected $win_likelihood => int(3)
      protected $custom => array(1) {
        ["seats"]=> int(3)
      }
      protected $created_at => string(24) "2024-03-13T07:33:28.356Z"
      protected $updated_at => string(24) "2024-03-13T07:33:28.356Z"
    }
	// ...and more
  }
}
?>
(*chartmogul.Opportunities)(0x14000486b10)({
 Entries: ([]*chartmogul.Opportunity) (len=1 cap=1) {
  (*chartmogul.Opportunity)(0x1400048e1a0)({
   UUID: (string) (len=36) "39351ba6-dea0-11ee-ac96-37b2b3de29af",
   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) "2023-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"
  })
 },
 Pagination: (chartmogul.Pagination) {
  Cursor: (string) (len=7) "88abf99",
  HasMore: (bool) false
 }
})
Opportunities(
  entries=[<Opportunity{
    "uuid": "39351ba6-dea0-11ee-ac96-37b2b3de29af",
    "customer_uuid": "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
    "owner": "[email protected]",
    "pipeline": "New Business",
    "pipeline_stage": "Discovery",
    "estimated_close_date": "2023-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"
  }>,
    // ...and more
]
has_more=True,
cursor='aabbcc...')

The response object contains the following data:

KeyDescription
entriesA list of opportunity entries.
cursorA reference to the next list of opportunities.
has_moreDetermines whether there are more opportunities to query after this request. Returns true if there are and false if there aren’t.
Language