Skip to main content

Sales Pipelines

Fetch the pipeline names, stage names and stage-reason labels that the Leads API accepts. Use this endpoint before creating or updating leads instead of hardcoding CRM configuration.

Authentication

The Pipelines API is authorised with an app token sent as Authorization: Bearer <jwt>. You can obtain the token in either of two ways:

  • Call Create Token with strategy: app-secret, or
  • Self-sign a token with your private key (strategy: app-iss-app-token).

The calling app must be attached to the business in the path. Otherwise, the request is rejected with 403 PERMISSION_DENIED. A user session token is not accepted.

List Pipelines

get /api/v1/businesses/:urlKey/pipelines

Returns all pipelines for the business in one response. Each pipeline contains its stages in their configured order. The response also contains the business's stage-reason catalog.

This endpoint is not paginated. It does not support search, filters or sorting.

Path Params

NameDescription
urlKeyThe business urlKey provided by Refrens.

Headers

NameTypeValue Description
Authorization *stringBearer <jwt>

Query Params

NameTypeValue Description
includeArchivedbooleanDefaults to false. Set to true to also return archived pipelines, stages and stage reasons, each marked with isArchived.

Unknown query parameters, including $limit, $skip and $sort, are rejected.

Example

GET /api/v1/businesses/acme-corp/pipelines

To look up configuration referenced by older leads:

GET /api/v1/businesses/acme-corp/pipelines?includeArchived=true

Pipeline fields

FieldTypeDescription
idstringOpaque identifier that distinguishes pipelines with the same name. Lead writes still use the pipeline name, not this id.
namestringPipeline name accepted by lead create and edit while the pipeline is live.
descriptionstringDescription configured in the dashboard. Omitted when no value is set.
isPrimarybooleanWhether this is the business's default lead pipeline.
isArchivedbooleanWhether the pipeline is archived. Archived pipelines are returned only when includeArchived=true.
stagesarray[object]Stages in the order configured in the dashboard.

Stage fields

FieldTypeDescription
idstringOpaque identifier that distinguishes stages with the same name. Lead writes still use the stage name, not this id.
namestringStage name accepted by lead create and edit while the stage and its pipeline are live.
statestringLead status associated with this stage: NEW, OPEN, CLOSED, DROPPED or REJECTED.
reasonsarray[string]Keys from stageReasons that this stage accepts. Match each key to its catalog entry, then send that entry's label when editing a lead.
labelsarray[string]Labels configured for the stage, in their configured order.
closurenumberSales probability used in reporting. A configured 0 is returned. Omitted when no value is set.
decayThresholdHoursnumberStage decay threshold in hours. For example, three days is returned as 72. A configured 0 is returned. Omitted when no value is set.
isArchivedbooleanWhether the stage is archived. Archived stages are returned only when includeArchived=true and remain in their configured position.

Stage-reason fields

FieldTypeDescription
keystringStable key referenced by a stage's reasons array.
labelstringValue to send in stageReasons when editing a lead, provided the target stage lists this reason's key.
isArchivedbooleanWhether the reason is archived. Archived reasons are returned only when includeArchived=true.

Use the response with Leads

Lead create and edit resolve pipelines and stages by name. They do not accept the id values returned here.

  1. Select a live pipeline and stage from the default response.
  2. Send their name values as pipeline and stage in the lead request.
  3. To add a stage reason, select a catalog entry whose key appears in that stage's reasons array. Send the catalog entry's label in the lead's stageReasons array.
{
"pipeline": "Sales Pipeline",
"stage": "Contacted",
"stageReasons": ["Not reachable"]
}

Archived names are returned only to help interpret older leads. Lead create and edit reject an archived pipeline, an archived stage, or a stage inside an archived pipeline.

Duplicate names

Pipeline and stage names are not guaranteed to be unique. Their id values reveal duplicates but cannot be used in lead writes. A lead write using a duplicate pipeline name selects the first matching pipeline, then looks for the stage only inside that pipeline. Avoid duplicate live names when configuring an integration.

Error codes

data.error.codeStatusWhen
INVALID_QUERY_FIELD400Unknown query parameter, including $limit, $skip or $sort.
INVALID_QUERY_VALUE400includeArchived has a value other than true or false.
PERMISSION_DENIED403The calling app is not attached to the business in the path.

Authentication failures return 401 NotAuthenticated.

Unsupported operations

The Pipelines API is read-only. Creating, editing and archiving pipeline configuration remains in the Refrens dashboard. The following operations return 405 Method Not Allowed:

  • POST /api/v1/businesses/:urlKey/pipelines
  • GET /api/v1/businesses/:urlKey/pipelines/:pipelineId
  • PATCH /api/v1/businesses/:urlKey/pipelines/:pipelineId
  • PUT /api/v1/businesses/:urlKey/pipelines/:pipelineId
  • DELETE /api/v1/businesses/:urlKey/pipelines/:pipelineId