Any way to pull a deal stage id by label?

In a Zapier automation I’m working on, I have a known pipeline id, and I would like to use the Hubspot API to pull just the stage that is labeled “Closed won”.
Is that feasible, or is there no search capabilities for deal stages?
I’m currently sending a GET to

https://api.hubapi.com/crm/v3/pipelines/deals/{myPipelineId}/stages/

which returns an array of all stages in that pipeline, but what I’d like to do is filter based on the label.

Hello @KStAngel
Make a GET request to the /crm/v3/pipelines/deals/{pipelineId}/stages/ endpoint, as you are currently doing. This will return an array of all stages in the specified pipeline. Iterate over the array of stages and check the label property of each stage. If the label property matches the desired stage label, then the id property of that stage is the deal stage ID you are looking for.
This is how to pull the deal stage ID for the “Closed won” stage using the Python programming language.

import requests

# Set the pipeline ID
pipeline_id = 123456

# Make a GET request to the deal stages endpoint
response = requests.get(
 f"https://api.hubapi.com/crm/v3/pipelines/deals/{pipeline_id}/stages/"
)

# Check the status code to make sure the request was successful
if response.status_code == 200:

 # Get the JSON response body
 json_response = response.json()

 # Iterate over the array of stages and find the stage with the label "Closed won"
 for stage in json_response:
 if stage["label"] == "Closed won":
 # Get the deal stage ID
 deal_stage_id = stage["id"]

 # Print the deal stage ID
 print(deal_stage_id)

else:
 # Handle the error
 print("An error occurred while retrieving the deal stages:")
 print(response.status_code)
 print(response.content)

Yeah. If I was doing this in code, looping through an array is the way to go. But I was hoping to get a clean return of just the Closed Won dealstage id since I’m using this in a Zap.

Zapier does have some looping capabilities, so that’s my backup plan if there’s no way to search for a specific deal stage. Was just hoping I was missing something and could filter the results with an API call. Hubspot seems to support that on it’s objects, but perhaps it doesn’t reach down to the pipeline/deal stage level.