@lap v0.3
# Machine-readable API spec. Each @endpoint block is one API call.
@api Pipelines
@base https://api.hubapi.com
@version v3
@auth OAuth2 | ApiKey private-app-legacy in header | ApiKey private-app in header
@common_fields {objectType: str}
@endpoints 14
@toc crm(14)

@endpoint GET /crm/v3/pipelines/{objectType}
@desc Retrieve all pipelines
@returns(200) {results: [map]} # successful operation

@endpoint POST /crm/v3/pipelines/{objectType}
@desc Create a pipeline
@required {displayOrder: int(int32) # The order for displaying this pipeline. If two pipelines have a matching `displayOrder`, they will be sorted alphabetically by label., label: str # A unique label used to organize pipelines in HubSpot's UI, stages: [map{displayOrder!: int(int32), label!: str, metadata!: map, stageId: str}] # Pipeline stage inputs used to create the new or replacement pipeline.}
@optional {pipelineId: str}
@returns(201) {archived: bool, archivedAt: str(date-time), createdAt: str(date-time), displayOrder: int(int32), id: str, label: str, stages: [map], updatedAt: str(date-time)} # successful operation

@endpoint GET /crm/v3/pipelines/{objectType}/{pipelineId}
@desc Return a pipeline by ID
@required {pipelineId: str}
@returns(200) {archived: bool, archivedAt: str(date-time), createdAt: str(date-time), displayOrder: int(int32), id: str, label: str, stages: [map], updatedAt: str(date-time)} # successful operation

@endpoint PUT /crm/v3/pipelines/{objectType}/{pipelineId}
@desc Replace a pipeline
@required {pipelineId: str, displayOrder: int(int32) # The order for displaying this pipeline stage. If two pipeline stages have a matching `displayOrder`, they will be sorted alphabetically by label., label: str # A label used to organize pipeline stages in HubSpot's UI. Each pipeline stage's label must be unique within that pipeline., stages: [map{displayOrder!: int(int32), label!: str, metadata!: map, stageId: str}] # The stages associated with the pipeline. They can be retrieved and updated via the pipeline stages endpoints.}
@optional {validateDealStageUsagesBeforeDelete: bool=false, validateReferencesBeforeDelete: bool=false}
@returns(200) {archived: bool, archivedAt: str(date-time), createdAt: str(date-time), displayOrder: int(int32), id: str, label: str, stages: [map], updatedAt: str(date-time)} # successful operation

@endpoint DELETE /crm/v3/pipelines/{objectType}/{pipelineId}
@desc Delete a pipeline
@required {pipelineId: str}
@optional {validateDealStageUsagesBeforeDelete: bool=false, validateReferencesBeforeDelete: bool=false}
@returns(204) No content

@endpoint PATCH /crm/v3/pipelines/{objectType}/{pipelineId}
@desc Perform a partial update of the pipeline identified by `{pipelineId}`. The updated pipeline will be returned in the response.
@required {pipelineId: str}
@optional {validateDealStageUsagesBeforeDelete: bool=false, validateReferencesBeforeDelete: bool=false, archived: bool # Whether the pipeline is archived. This property should only be provided when restoring an archived pipeline. If it's provided in any other call, the request will fail and a `400 Bad Request` will be returned., displayOrder: int(int32) # The order for displaying this pipeline. If two pipelines have a matching `displayOrder`, they will be sorted alphabetically by label., label: str # A unique label used to organize pipelines in HubSpot's UI}
@returns(200) {archived: bool, archivedAt: str(date-time), createdAt: str(date-time), displayOrder: int(int32), id: str, label: str, stages: [map], updatedAt: str(date-time)} # successful operation

@endpoint GET /crm/v3/pipelines/{objectType}/{pipelineId}/audit
@desc Return an audit of all changes to the pipeline
@required {pipelineId: str}
@returns(200) {results: [map]} # successful operation

@endpoint GET /crm/v3/pipelines/{objectType}/{pipelineId}/stages
@desc Return all stages of a pipeline
@required {pipelineId: str}
@returns(200) {results: [map]} # successful operation

@endpoint POST /crm/v3/pipelines/{objectType}/{pipelineId}/stages
@desc Create a pipeline stage
@required {pipelineId: str, displayOrder: int(int32) # The order for displaying this pipeline stage. If two pipeline stages have a matching `displayOrder`, they will be sorted alphabetically by label., label: str # A label used to organize pipeline stages in HubSpot's UI. Each pipeline stage's label must be unique within that pipeline., metadata: map # A JSON object containing properties that are not present on all object pipelines.  For `deals` pipelines, the `probability` field is required (`{ "probability": 0.5 }`), and represents the likelihood a deal will close. Possible values are between 0.0 and 1.0 in increments of 0.1.  For `tickets` pipelines, the `ticketState` field is optional (`{ "ticketState": "OPEN" }`), and represents whether the ticket remains open or has been closed by a member of your Support team. Possible values are `OPEN` or `CLOSED`.}
@optional {stageId: str}
@returns(201) {archived: bool, archivedAt: str(date-time), createdAt: str(date-time), displayOrder: int(int32), id: str, label: str, metadata: map, updatedAt: str(date-time), writePermissions: str} # successful operation

@endpoint GET /crm/v3/pipelines/{objectType}/{pipelineId}/stages/{stageId}
@desc Return a pipeline stage by ID
@required {pipelineId: str, stageId: str}
@returns(200) {archived: bool, archivedAt: str(date-time), createdAt: str(date-time), displayOrder: int(int32), id: str, label: str, metadata: map, updatedAt: str(date-time), writePermissions: str} # successful operation

@endpoint PUT /crm/v3/pipelines/{objectType}/{pipelineId}/stages/{stageId}
@desc Replace a pipeline stage
@required {pipelineId: str, stageId: str, displayOrder: int(int32) # The order for displaying this pipeline stage. If two pipeline stages have a matching `displayOrder`, they will be sorted alphabetically by label., label: str # A label used to organize pipeline stages in HubSpot's UI. Each pipeline stage's label must be unique within that pipeline., metadata: map # A JSON object containing properties that are not present on all object pipelines.  For `deals` pipelines, the `probability` field is required (`{ "probability": 0.5 }`), and represents the likelihood a deal will close. Possible values are between 0.0 and 1.0 in increments of 0.1.  For `tickets` pipelines, the `ticketState` field is optional (`{ "ticketState": "OPEN" }`), and represents whether the ticket remains open or has been closed by a member of your Support team. Possible values are `OPEN` or `CLOSED`.}
@returns(200) {archived: bool, archivedAt: str(date-time), createdAt: str(date-time), displayOrder: int(int32), id: str, label: str, metadata: map, updatedAt: str(date-time), writePermissions: str} # successful operation

@endpoint DELETE /crm/v3/pipelines/{objectType}/{pipelineId}/stages/{stageId}
@desc Delete a pipeline stage
@required {pipelineId: str, stageId: str}
@returns(204) No content

@endpoint PATCH /crm/v3/pipelines/{objectType}/{pipelineId}/stages/{stageId}
@required {pipelineId: str, stageId: str, metadata: map # A JSON object containing properties that are not present on all object pipelines.  For `deals` pipelines, the `probability` field is required (`{ "probability": 0.5 }`), and represents the likelihood a deal will close. Possible values are between 0.0 and 1.0 in increments of 0.1.  For `tickets` pipelines, the `ticketState` field is optional (`{ "ticketState": "OPEN" }`), and represents whether the ticket remains open or has been closed by a member of your Support team. Possible values are `OPEN` or `CLOSED`.}
@optional {archived: bool # Whether the pipeline is archived., displayOrder: int(int32) # The order for displaying this pipeline stage. If two pipeline stages have a matching `displayOrder`, they will be sorted alphabetically by label., label: str # A label used to organize pipeline stages in HubSpot's UI. Each pipeline stage's label must be unique within that pipeline.}
@returns(200) {archived: bool, archivedAt: str(date-time), createdAt: str(date-time), displayOrder: int(int32), id: str, label: str, metadata: map, updatedAt: str(date-time), writePermissions: str} # successful operation

@endpoint GET /crm/v3/pipelines/{objectType}/{pipelineId}/stages/{stageId}/audit
@desc Return a reverse chronological list of all mutations that have occurred on the pipeline stage identified by `{stageId}`.
@required {pipelineId: str, stageId: str}
@returns(200) {results: [map]} # successful operation

@end
