APIs & Integrations

graemep1
Member

Robust identification of Pipeline stages

When creating deals with a pipeline stage through the API, what is the most robust way to identify the stage ID desired?
It looks to me as though the stage ID may change depending on the pipeline edit history. There is no way of specifying the stage ID when adding a new stage, so what is the most robust way of doing this, that will, for example, work on a test hub and a production hub, and survive pipeline edits.
For the moment I am getting the pipeline data, and using heuristics to identity the right stages, but that looks fragile. 

0 Upvotes
2 Replies 2
cbarley
HubSpot Alumni
HubSpot Alumni

Robust identification of Pipeline stages

Hi @graemep1 , I'd start by recommending you make a GET call to get all pipelines for deals objects, then using the ids returned from that call inside your POST request to create a new deal. That said, to my knowledge, the stageID should not change regardless of edits to the pipeline, unless you explicitly change the IDs yourself via the API. When you create a pipeline, you can create your own unique stageIDs inside the stages array: https://developers.hubspot.com/docs/methods/pipelines/create_new_pipeline. 

 

I could not replicate the stageID changing that you mentioned by adding stages or editing them in app, but let me know if there were specific steps you took so I can reproduce.

0 Upvotes
graemep1
Member

Robust identification of Pipeline stages

I do use the call to get the stages, and then find the correct stage.

Stage IDs will not change, there is no guarantee they will be the same between test and production environments, is there? I am dealing with manually created and edited Pipelines and manually added stages seem to have some kind of UID as the label.

For example, suppose you want to change the name of the final stage. On a test hub you edit it, on production someone deletes the current final stage and adds a new one. They will look the same in the app, but they will have different labels.

0 Upvotes