# Update a Deal Pipeline (PUT request)

**URL:** <https://community.hubspot.com/t/update-a-deal-pipeline-put-request/11870>\
**Category:** APIs & Integrations\
**Tags:** developer-preview\
**Created:** [November 13, 2018, 12:38pm UTC](https://community.hubspot.com/t/update-a-deal-pipeline-put-request/11870 "2018-11-13T12:38:23Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Geri1985](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/geri1985/32/78108_2.png) [@Geri1985](https://community.hubspot.com/u/Geri1985)\
**Post date:** [November 13, 2018, 12:38pm UTC](https://community.hubspot.com/t/update-a-deal-pipeline-put-request/11870/1 "2018-11-13T12:38:23Z")

</div>

Hi Everyone,

Just trying to use API to change the pipeline in HubSpot.

I keep getting an error using this API put call: $data = '{  
“pipelineId”: “default”,  
“stages”: [  
{  
“stageId”: “49fafda2-f166-4650-956a-1dc5f5514357”,  
“label”: “Initial Qualification”,  
“probability”: 0.1,  
“active”: true,  
“displayOrder”: 0,  
“closedWon”: false  
},  
{  
“stageId”: “customclosedwonstage”,  
“label”: “Success! Closed Won”,  
“probability”: 1,  
“active”: true,  
“displayOrder”: 1,  
“closedWon”: true  
},  
{  
“label”: “A new dealstage”,  
“probability”: 1,  
“active”: true,  
“displayOrder”: 2,  
“closedWon”: true  
},  
{  
“stageId”: “newcustomdealstage”,  
“label”: “Another new dealstage”,  
“probability”: 1,  
“active”: true,  
“displayOrder”: 3,  
“closedWon”: true  
}  
],  
“label”: “New Custom Business Pipeline”,  
“active”: true,  
“displayOrder”: 10  
}  
';

$ch = curl\_init(‘[http://api.hubapi.com/deals/v1/pipelines/default?hapikey=eda09c2e-2029-49bd-b8d9-XXXX](http://api.hubapi.com/deals/v1/pipelines/default?hapikey=eda09c2e-2029-49bd-b8d9-XXXX)’);  
curl\_setopt($ch, CURLOPT\_PUT, true);  
curl\_setopt($ch, CURLOPT\_POSTFIELDS, json\_encode($data));  
curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, true);  
//curl\_setopt($ch, CURLOPT\_SSL\_VERIFYPEER, false);  
$res = curl\_exec($ch);  
$error = curl\_error($ch);  
curl\_close($ch);  
var\_dump($res, $error);

error: string(34) “Recv failure: Connection was reset”

Api call doesn’t change anything in my pipeline. However, it is supposed to change the pipeline stage.

I used this example: [Accounts Dashboard | HubSpot](https://developers.hubspot.com/docs/methods/deal-pipelines/update-deal-pipeline)  
This doesn’t work as well.

Anybody knows why this is happening or how to do it right?

Thanks,

Geri

---

<div class="post-metadata">

**Author:** ![cbarley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cbarley/32/82559_2.png) [@cbarley](https://community.hubspot.com/u/cbarley)\
**Post date:** [November 14, 2018, 6:46pm UTC](https://community.hubspot.com/t/update-a-deal-pipeline-put-request/11870/2 "2018-11-14T18:46:05Z")

</div>

Hi @geri1985, happy to help here! Can you reply with your HubID so I can take a closer look at this and try to reproduce the issue you’re seeing? Make sure the pipelineID is correct in your call. Are you able to reproduce this in a REST client like Postman?

---

<div class="post-metadata">

**Author:** ![Geri1985](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/geri1985/32/78108_2.png) [@Geri1985](https://community.hubspot.com/u/Geri1985)\
**Post date:** [November 15, 2018, 7:35am UTC](https://community.hubspot.com/t/update-a-deal-pipeline-put-request/11870/3 "2018-11-15T07:35:10Z")

</div>

Hi Connor,

My HubID is 5038421.

Many thanks,

Geri

---

<div class="post-metadata">

**Author:** ![Geri1985](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/geri1985/32/78108_2.png) [@Geri1985](https://community.hubspot.com/u/Geri1985)\
**Post date:** [November 15, 2018, 7:56am UTC](https://community.hubspot.com/t/update-a-deal-pipeline-put-request/11870/4 "2018-11-15T07:56:07Z")

</div>

Sorry, didn’t use Postman for this one but can do it there easily if you want. Please let me know if you need this.

Thanks

---

<div class="post-metadata">

**Author:** ![cbarley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cbarley/32/82559_2.png) [@cbarley](https://community.hubspot.com/u/cbarley)\
**Post date:** [November 15, 2018, 2:59pm UTC](https://community.hubspot.com/t/update-a-deal-pipeline-put-request/11870/5 "2018-11-15T14:59:28Z")

</div>

Hi @geri1985, thanks for that! I actually noticed that the [endpoint you’re using](https://developers.hubspot.com/docs/methods/deal-pipelines/update-deal-pipeline) is deprecated. You should instead use this endpoint: [https://developers.hubspot.com/docs/methods/pipelines/udpate\_pipeline](https://developers.hubspot.com/docs/methods/pipelines/udpate_pipeline).

Also, in your original post, you included your API key. Please refrain from posting sensitive information like this in the forums since these are public. I’d recommend deactivating your API key and generating a new one.

---

<div class="post-metadata">

**Author:** ![Geri1985](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/geri1985/32/78108_2.png) [@Geri1985](https://community.hubspot.com/u/Geri1985)\
**Post date:** [November 17, 2018, 12:36pm UTC](https://community.hubspot.com/t/update-a-deal-pipeline-put-request/11870/6 "2018-11-17T12:36:35Z")

</div>

Hi [@Connor\_Barley](https://community.hubspot.com/u/connor_barley), thanks for your answers, but when I send a PUT request, then if you go to link: [Loading...](https://app.hubspot.com/contacts/5038421/deals/list/view/all/)? the page does not load anything (screenshot attached)

[

 ![](https://d2qpr2jzcazej7.cloudfront.net/original/3X/6/9/694e5099bdc27c12c2d5e6488d463add37e7cc2d.png)

2018-11-17\_15-28-57.png1914x779 27.3 KB

]([https://community.hubspot.com/legacyfs/online/uploads/default/original/2X/0/04464fc8813659165e8b2bc0fc0352de7ee2fd60.png](https://community.hubspot.com/legacyfs/online/uploads/default/original/2X/0/04464fc8813659165e8b2bc0fc0352de7ee2fd60.png))

---

<div class="post-metadata">

**Author:** ![cbarley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cbarley/32/82559_2.png) [@cbarley](https://community.hubspot.com/u/cbarley)\
**Post date:** [November 19, 2018, 5:57pm UTC](https://community.hubspot.com/t/update-a-deal-pipeline-put-request/11870/7 "2018-11-19T17:57:10Z")

</div>

Hi @geri1985, that’s strange. I’m also able to reproduce the issue. I’m going to reach out to my team about this and get back to you when I have an answer.

---

<div class="post-metadata">

**Author:** ![Geri1985](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/geri1985/32/78108_2.png) [@Geri1985](https://community.hubspot.com/u/Geri1985)\
**Post date:** [November 20, 2018, 6:34am UTC](https://community.hubspot.com/t/update-a-deal-pipeline-put-request/11870/8 "2018-11-20T06:34:47Z")

</div>

Thank you, Connor. I’m looking forward to hearing back from you soon.

---

<div class="post-metadata">

**Author:** ![cbarley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cbarley/32/82559_2.png) [@cbarley](https://community.hubspot.com/u/cbarley)\
**Post date:** [November 20, 2018, 4:22pm UTC](https://community.hubspot.com/t/update-a-deal-pipeline-put-request/11870/9 "2018-11-20T16:22:23Z")

</div>

Hi @geri1985, just a quick update here. The team believes that the PUT request that you made may have deleted or altered it in a way that broke the Deal homepage. They’re working on a fix at the moment.

---

<div class="post-metadata">

**Author:** ![cbarley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cbarley/32/82559_2.png) [@cbarley](https://community.hubspot.com/u/cbarley)\
**Post date:** [November 21, 2018, 5:28am UTC](https://community.hubspot.com/t/update-a-deal-pipeline-put-request/11870/10 "2018-11-21T05:28:07Z")

</div>

Hi @geri1985, our CRM developers just pushed out a fix for this. We’re working on stronger validation that wouldn’t allow your Deals page to get into that state in the first place, but you should be good to go moving forward.

---

<div class="post-metadata">

**Author:** ![Geri1985](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/geri1985/32/78108_2.png) [@Geri1985](https://community.hubspot.com/u/Geri1985)\
**Post date:** [November 23, 2018, 7:12am UTC](https://community.hubspot.com/t/update-a-deal-pipeline-put-request/11870/11 "2018-11-23T07:12:05Z")

</div>

Thanks for this [@Connor\_Barley](https://community.hubspot.com/u/connor_barley) .

Yes, that worked. However, when I add new data or try something else with PUT request I keep getting the same error with broken Deals page and it’s not loading.  
Request:  
POST: [https://api.hubapi.com/crm-pipelines/v1/pipelines/deals?hapikey=XXXXXXXX-144f-45a3-aae3-865a454bfffc](https://api.hubapi.com/crm-pipelines/v1/pipelines/deals?hapikey=XXXXXXXX-144f-45a3-aae3-865a454bfffc)  
Body: {  
“pipelineId”: “api\_test\_pipeline4”,  
“label”: “API test deals pipeline”,  
“displayOrder”: 3,  
“active”: true,  
“stages”: [  
{  
“label”: “Initial Qualification”,  
“displayOrder”: 0,  
“probability”: 0.1  
},  
{  
“label”: “Negotiation”,  
“displayOrder”: 1,  
“probability”: 0.5  
},  
{  
“label”: “Success”,  
“displayOrder”: 2,  
“stageId”: “customclosedwonstag”,  
“probability”: 1  
}  
]  
}

How long do you think will it take to do a stronger validation? Is there anything I can help with?

Thank you

---

<div class="post-metadata">

**Author:** ![cbarley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cbarley/32/82559_2.png) [@cbarley](https://community.hubspot.com/u/cbarley)\
**Post date:** [November 26, 2018, 3:45pm UTC](https://community.hubspot.com/t/update-a-deal-pipeline-put-request/11870/12 "2018-11-26T15:45:31Z")

</div>

Hi @geri1985, taking a look at your POST data to create a new pipeline, I can see you have a probability field included which doesn’t appear in the [docs here](https://developers.hubspot.com/docs/methods/pipelines/create_new_pipeline). I can also see your displayOrder field starts at 0, when it should start at 1. That said, I was able to actually break my own deals page with a simple POST request based off of the docs. I’m in touch with the CRM team right now and will update when we’ve addressed the issue.

---

<div class="post-metadata">

**Author:** ![cbarley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cbarley/32/82559_2.png) [@cbarley](https://community.hubspot.com/u/cbarley)\
**Post date:** [November 28, 2018, 1:02am UTC](https://community.hubspot.com/t/update-a-deal-pipeline-put-request/11870/13 "2018-11-28T01:02:36Z")

</div>

Hi @geri1985, the team has added additional validation when creating/updating dealstages that will reject writes that don’t include a probability. You _should_ include the probability in all future requests. We’ll update the docs to match tomorrow. Your account has been “unstuck” from the consistently loading Deals screen as well.

---

<div class="post-metadata">

**Author:** ![Geri1985](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/geri1985/32/78108_2.png) [@Geri1985](https://community.hubspot.com/u/Geri1985)\
**Post date:** [November 28, 2018, 8:33pm UTC](https://community.hubspot.com/t/update-a-deal-pipeline-put-request/11870/14 "2018-11-28T20:33:42Z")

</div>

Thanks [@Connor\_Barley](https://community.hubspot.com/u/connor_barley). Requests for tickets pipelines do work now indeed. However, Deals keep returning an error : {  
“status”: “error”,  
“message”: “must specify probability when writing a dealstage”  
}  
POST:

[https://api.hubapi.com/crm-pipelines/v1/pipelines/deals?hapikey=\*\*\*\*\*\*\*\*ac6c-50d5f0b9170b](https://api.hubapi.com/crm-pipelines/v1/pipelines/deals?hapikey= ******** ac6c-50d5f0b9170b)

{  
“pipelineId”: “api\_test\_pipelineMS”,  
“label”: “API test deals pipeline”,  
“displayOrder”: 3,  
“active”: true,

“stages”: [  
{  
“label”: “Initial Qualification”,  
“displayOrder”: 1,  
“probability”: 0.1  
},  
{  
“label”: “Negotiation”,  
“displayOrder”: 2,  
“probability”: 0.5  
},  
{  
“label”: “Success”,  
“displayOrder”: 3,  
“stageId”: “customclosedwonstag”,  
“probability”: 1  
}  
]  
}

---

<div class="post-metadata">

**Author:** ![cbarley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cbarley/32/82559_2.png) [@cbarley](https://community.hubspot.com/u/cbarley)\
**Post date:** [November 28, 2018, 8:35pm UTC](https://community.hubspot.com/t/update-a-deal-pipeline-put-request/11870/15 "2018-11-28T20:35:03Z")

</div>

Hey @geri1985, we’re about to update the documentation, but your request should be formatted like this:

```auto
{
 "pipelineId": "pipeline_test",
 "label": "API test ticket pipeline",
 "displayOrder": 1,
 "active": true,
 "stages": [
 {
 "label": "Initial Qualification",
 "displayOrder": 1,
 "metadata":
 {
 "probability": 0.1
 }
 },
 {
 "label": "Negotiation",
 "displayOrder": 1,
 "metadata":
 {
 "probability": 0.5
 }
 }
 ]
}

```

probability should be in a `metadata` object
