---
title: "Pipelines | Jetstack AI Docs"
description: "Reference for importing and deploying HubSpot pipelines, including stage metadata, automation, unified handling across object types, and known edge cases."
url: "https://jetstack.ai/docs/implementations/asset-types/pipelines/"
---

# Pipelines

Pipelines define the stages that deals, tickets, and custom objects move through in HubSpot. Jetstack AI captures the full pipeline definition — including stages, probabilities, automation rules, and associated workflows — and either creates or maps them in the destination portal.

## What Jetstack AI Captures

During import, Jetstack AI retrieves:

- **Pipeline metadata** — label, display order, object type, and whether it is the default pipeline
- **Stages** — each stage’s label, internal ID, display order, and metadata
- **Stage metadata** — probability (deals), `isClosed` flag, `ticketState` (open/closed for tickets)
- **Stage automation** — workflows triggered on stage entry, email sends, owner assignments, and property sets configured at the stage level

## Pipeline Types and Object Type IDs

HubSpot uses numeric `objectTypeId` values to identify which object type a pipeline belongs to. Jetstack AI handles all three types with unified logic:

| Object Type        | objectTypeId | Description                               |
| ------------------ | ------------ | ----------------------------------------- |
| **Deals**          | `0-3`        | Sales deal pipelines                      |
| **Tickets**        | `0-5`        | Service ticket pipelines                  |
| **Custom objects** | `2-xxxxx`    | Custom object pipelines (e.g., `2-12345`) |

The `objectTypeId` is preserved during import and used to route the pipeline to the correct API endpoint during deploy. For custom objects, the `objectTypeId` is remapped to the destination custom object’s ID if it differs.

## Stage Metadata Details

### Probability

Deal pipeline stages include a `probability` value (0 to 100) representing the likelihood of closing. HubSpot’s API returns this as a string, but requires a number on create. Jetstack AI automatically handles the **string-to-number conversion** during deploy.

Probability values are validated to be within the 0-100 range. Stages with `isClosed: true` should have a probability of either `0` (lost) or `100` (won).

### Ticket State

Ticket pipeline stages include a `ticketState` property that indicates whether the stage represents an open or closed state. Valid values are `OPEN` and `CLOSED`. This property is preserved during deploy.

### isClosed Flag

Both deal and ticket stages use the `isClosed` boolean to indicate terminal stages. Jetstack AI preserves this flag and ensures it is correctly set during stage creation.

## Stage Automation

Pipeline stages can have automation rules that execute when a record enters the stage. Jetstack AI captures and remaps:

- **Workflow triggers** — workflows that are enrolled when a record enters the stage. The workflow ID is remapped to the destination workflow.
- **Email sends** — automated emails sent on stage entry. The email ID is remapped.
- **Owner assignments** — automatic owner rotation or assignment rules. Owner IDs are remapped.
- **Property sets** — automatic property value changes on stage entry. Property names and values are remapped.

## Deploy Behavior

### Auto-Detection of Existing Pipelines

Before creating a new pipeline, Jetstack AI checks whether a pipeline with the same label already exists in the destination portal. This comparison is **case-insensitive**. If a match is found:

- The existing pipeline is used instead of creating a new one
- Missing stages are auto-created within the existing pipeline
- Existing stages with matching labels are mapped and reused
- Stage metadata (probability, ticketState, isClosed) on existing stages is **not overwritten**

This behavior prevents duplicate pipelines when deploying to a portal that already has a similar sales or service process configured.

### Missing Stage Auto-Creation

If the destination pipeline exists but is missing stages that are present in the source, Jetstack AI automatically creates the missing stages. New stages are created with the correct:

- Label (from the source stage)
- Display order (appended after existing stages)
- Probability and metadata (from the source stage)

### Pipeline Mapping Configuration

Users can explicitly map source pipelines to destination pipelines in the deploy configuration. When a mapping is provided:

- The mapped destination pipeline is used regardless of label matching
- Stages are matched by label within the mapped pipeline
- Unmapped stages are auto-created

See the [Pipeline Mapping](https://jetstack.ai/docs/implementations/deploying/pipeline-mapping) guide for configuration details.

## Dependencies

Pipelines can reference other asset types through stage automation:

- **Workflows** — triggered on stage entry
- **Emails** — sent on stage entry
- **Owners** — assigned on stage entry
- **Properties** — set on stage entry

These dependencies are resolved during import and deployed before the pipeline is created or updated.

## Edge Cases and Special Handling

### Deal Rotation (NOT_PORTABLE)

Deal rotation rules (round-robin owner assignment) associated with pipeline stages are marked as **NOT_PORTABLE**. HubSpot’s API does not support creating or modifying deal rotation configurations programmatically. These must be manually recreated in the destination portal after deploy.

### Custom Object Pipeline objectTypeId Tracking

When deploying pipelines for custom objects, the `objectTypeId` (e.g., `2-12345`) will differ between the source and destination portals. Jetstack AI tracks the custom object mapping and remaps the `objectTypeId` accordingly. Ordering is handled automatically: custom-object pipelines carry the object’s schema with them, so the object is created (or matched) in the destination portal during the pre-deploy phase before the pipeline is created. Importing a custom object from the Custom Objects tab also auto-imports its pipelines, so the pair always travels together.

### Default Pipeline Handling

Each object type has exactly one default pipeline in HubSpot. Jetstack AI does not attempt to change which pipeline is the default in the destination portal. If the source pipeline is marked as default, it will be created as a non-default pipeline unless it maps to the destination’s existing default.

### Probability Validation

If a source stage has a probability value outside the 0-100 range (which can occur with legacy data), Jetstack AI clamps the value to the valid range during deploy. Stages with `isClosed: true` have their probability normalized to `0` or `100`.

## Troubleshooting

### Pipeline Already Exists

If you see a “pipeline already exists” message, Jetstack AI has detected an existing pipeline with a matching label. This is expected behavior. Check the deploy log to verify that stages were correctly mapped or auto-created within the existing pipeline.

### Stage Automation Not Applied

If stage automation rules (workflow triggers, email sends) are missing after deploy, verify that the referenced workflows and emails were successfully deployed. Automation references to failed assets are silently skipped.

### Custom Object Pipeline Fails

If a custom object pipeline fails to deploy, ensure the custom object schema has been deployed first. The `objectTypeId` must resolve to a valid custom object in the destination portal.
