ERROR: stageId is a duplicate of a stageId in another pipeline

gotmike
Top Contributor

I’m getting this error when trying to create a deal pipeline via API.

In this case, I have already created this exact deal pipeline and then I deleted it, then tried again via API.

Perhaps it’s possible that the old one wasn’t really deleted?

It no longer shows up in the UI, nor when I get all pipelines via GET https://api.hubapi.com/deals/v1/pipelines

Alternately, if I then append a “1” to these stageId values, I get this error:

Error: all stages must reference pipelineId which must exist in the deals_pipelines table

But of course, I don’t have the pipelineId, nor do the API documents tell me to supply a pipelineId.

And if I try to set the pipelineId value when I add the pipeline, I get this:

Error: pipelineId must not be set when inserting new pipeline

Any ideas?

0 Upvotes
6 Replies 6
gotmike
Top Contributor

I was able to get this to work, but only if I DO NOT set the stageId for the individual stages.

Perhaps this has something to do with deleting the Pipelines? Maybe when you delete a Pipeline, the stages remain and are somehow just “unattached” or something like that?

Not sure, but would certainly like to be able to set the stageId values…

0 Upvotes
3PETE
HubSpot Employee

@cre We usually don’t perform a hard delete for 30 days or so. The reason for this is in the case someone accidentally deletes a pipeline or a deal,contact,company etc… they can call in to support and we can “un-delete” the object. It happens often that someone will delete something in the system by mistake and needs the object to be revised.

0 Upvotes
gotmike
Top Contributor

that makes sense. is that triggered by the DEAL STAGE NAME though, matching a string? seems like that is what’s going on here…

also, when i pull a list of all the deal stages, i don’t get the deleted ones with an isDeleted flag or anything.

now i have code that can add and also delete, and they don’t seem to be “sticking” anymore… so might be something with just that deal stage on this particular account.

0 Upvotes
3PETE
HubSpot Employee

@cre I’m not sure on your first question. On the second question, we would filter out the deleted and not return it to you.

0 Upvotes
eric1
Member

Sorry to rehash this topic but is there no way to a "hard delete" programmatically? I'm creating all my pipelines/stages programmatically anyways.

Also, the uniqueness of stage names across all pipelines has to be an oversight. It should only be unique per pipeline.

danhammari
Contributor

I'm getting a variation of the same message:

"status":"error"
"message":"There's another pipeline in this portal with one of the same stages"

My sales admin decided to change how the pipeline works and added new stages. Programmatically, it is easy to delete the whole pipeline and just rebuild it afresh an API call. Unfortunately, HubSpot is holding onto the ID values of the stages in the pipeline I just deleted and will not allow me to re-use those ID values in another pipeline. I can go ahead and come up with new ID values for the stages, but then I will need to update all the stage references in my API code. I would rather just be able to re-use the previous stage ID values.

 

I would like to be able to permanently delete a stage through the API. This would allow me to build a new stage that re-uses the deleted stage's ID value. If that is not possible, it would be nice if HubSpot could display which stages are unused and not yet permanently deleted. Perhaps HubSpot could then allow me to resurrect the ID values of the previously deleted stages for use in a new pipeline.