APIs & Integrations

ELH
Participant

Creating deals using v3 api specifying a custom pipeline and stage

SOLVE

I'm trying to create a deal under a pipeline using the v3 api and it works using the default pipeline with a payload like this:

 

 

 

properties: {
  pipeline: 'default',
  dealstage: '111111111', // example dealStageId from the default pipeline
}

 

 

 

but as soon as I try to create the deal under a different pipeline, I get an error:

 

 

 

properties: {
    pipeline: '6661342', // another pipelineId 
    dealstage: '2222222', // another dealstage from that pipelineId
}

 

 

 

 I get the message:  

 

 

 

Property values were not valid: {
  "isValid": false,
  "message": "2222222 is not a valid pipeline stage ID. Valid options are: pipelineId=default : [1111111, .... ]",
  "category":"VALIDATION_ERROR"
}

 

 

 

Like if I were trying to create it in the default pipeline.
Trying to list them trough this endpoint (v3):

 

crm
.pipelines
.pipelineApi
.getAll('deal')

 

 I only see the the default one with all the stages. But using the interface I have multiple pipelines crated.

Additional notes:

  • I'm migrating the versions and in the v1 works
  • Using the replica environment for our prod


Can someone point me what I maight be doing wrong?

I've tried to list all ticket pipelines but it tells me that I d not have permissions to do that, how can I seeif that is not the mistake?

0 Upvotes
1 Accepted solution
ELH
Solution
Participant

Creating deals using v3 api specifying a custom pipeline and stage

SOLVE

@coldrickjack Thanks for the help! 

I ended up figuring the problem (and some other that I had). It was related with few things:

  • permissions: checking the permissions of the Integration Token.
  • sync: As we had different environments, some of the attributes giving problems were not synced in the replica environments.
  • envs token: make sure you are pointing to the right environment.

 

View solution in original post

0 Upvotes
3 Replies 3
ELH
Solution
Participant

Creating deals using v3 api specifying a custom pipeline and stage

SOLVE

@coldrickjack Thanks for the help! 

I ended up figuring the problem (and some other that I had). It was related with few things:

  • permissions: checking the permissions of the Integration Token.
  • sync: As we had different environments, some of the attributes giving problems were not synced in the replica environments.
  • envs token: make sure you are pointing to the right environment.

 

0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

Creating deals using v3 api specifying a custom pipeline and stage

SOLVE

Hey, @ELH 👋 Thank you very much for taking the time to let us know what worked for you. — Jaycee







HubSpot’s AI-powered customer agent resolves up to 50% of customer queries instantly, with some customers reaching up to 90% resolution rates.


Learn More.





Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !
0 Upvotes
coldrickjack
Guide

Creating deals using v3 api specifying a custom pipeline and stage

SOLVE

Hi @ELH,

 

When you create a deal in HubSpot using the API you are required to specify the "pipeline" and "dealstage" in your request body. You can retrieve all of the deal pipelines (and their stages) by calling this endpoint. This will then show you the possible values you can use when creating your deal via this endpoint.

 

For instance, when I retreieve all of the deal pipelines in my portal I receive the below:

GET https://api.hubapi.com/crm/v3/pipelines/deals
Headers: Authorization Bearer {{token}}
Response:
{
    "results": [
        {
            "label": "Renewals Pipeline",
            "displayOrder": 1,
            "id": "457553644",
            "stages": [
                {
                    "label": "Appointment Scheduled",
                    "displayOrder": 0,
                    "metadata": {
                        "isClosed": "false",
                        "probability": "0.2"
                    },
                    "id": "701459927",
                    "createdAt": "2024-07-23T09:40:52.693Z",
                    "updatedAt": "2024-07-23T09:40:52.693Z",
                    "archived": false,
                    "writePermissions": "CRM_PERMISSIONS_ENFORCEMENT"
                },
                {
                    "label": "Qualified To Buy",
                    "displayOrder": 1,
                    "metadata": {
                        "isClosed": "false",
                        "probability": "0.4"
                    },
                    "id": "701459928",
                    "createdAt": "2024-07-23T09:40:52.693Z",
                    "updatedAt": "2024-07-23T09:40:52.693Z",
                    "archived": false,
                    "writePermissions": "CRM_PERMISSIONS_ENFORCEMENT"
                },
                {
                    "label": "Presentation Scheduled",
                    "displayOrder": 2,
                    "metadata": {
                        "isClosed": "false",
                        "probability": "0.6"
                    },
                    "id": "701459929",
                    "createdAt": "2024-07-23T09:40:52.693Z",
                    "updatedAt": "2024-07-23T09:40:52.693Z",
                    "archived": false,
                    "writePermissions": "CRM_PERMISSIONS_ENFORCEMENT"
                },
                {
                    "label": "Decision Maker Bought-In",
                    "displayOrder": 3,
                    "metadata": {
                        "isClosed": "false",
                        "probability": "0.8"
                    },
                    "id": "701459930",
                    "createdAt": "2024-07-23T09:40:52.693Z",
                    "updatedAt": "2024-07-23T09:40:52.693Z",
                    "archived": false,
                    "writePermissions": "CRM_PERMISSIONS_ENFORCEMENT"
                },
                {
                    "label": "Contract Sent",
                    "displayOrder": 4,
                    "metadata": {
                        "isClosed": "false",
                        "probability": "0.9"
                    },
                    "id": "701459931",
                    "createdAt": "2024-07-23T09:40:52.693Z",
                    "updatedAt": "2024-07-23T09:40:52.693Z",
                    "archived": false,
                    "writePermissions": "CRM_PERMISSIONS_ENFORCEMENT"
                },
                {
                    "label": "Closed Won",
                    "displayOrder": 5,
                    "metadata": {
                        "isClosed": "true",
                        "probability": "1.0"
                    },
                    "id": "701459932",
                    "createdAt": "2024-07-23T09:40:52.693Z",
                    "updatedAt": "2024-07-23T09:40:52.693Z",
                    "archived": false,
                    "writePermissions": "CRM_PERMISSIONS_ENFORCEMENT"
                },
                {
                    "label": "Closed Lost",
                    "displayOrder": 6,
                    "metadata": {
                        "isClosed": "true",
                        "probability": "0.0"
                    },
                    "id": "701459933",
                    "createdAt": "2024-07-23T09:40:52.693Z",
                    "updatedAt": "2024-07-23T09:40:52.693Z",
                    "archived": false,
                    "writePermissions": "CRM_PERMISSIONS_ENFORCEMENT"
                }
            ],
            "createdAt": "2024-07-23T09:40:52.693Z",
            "updatedAt": "2024-07-23T09:40:52.693Z",
            "archived": false
        },
        {
            "label": "Sales Pipeline",
            "displayOrder": 0,
            "id": "default",
            "stages": [
                {
                    "label": "Appointment Scheduled",
                    "displayOrder": 0,
                    "metadata": {
                        "isClosed": "false",
                        "probability": "0.2"
                    },
                    "id": "appointmentscheduled",
                    "createdAt": "1970-01-01T00:00:00Z",
                    "updatedAt": "1970-01-01T00:00:00Z",
                    "archived": false,
                    "writePermissions": "CRM_PERMISSIONS_ENFORCEMENT"
                },
                {
                    "label": "Qualified To Buy",
                    "displayOrder": 1,
                    "metadata": {
                        "isClosed": "false",
                        "probability": "0.4"
                    },
                    "id": "qualifiedtobuy",
                    "createdAt": "1970-01-01T00:00:00Z",
                    "updatedAt": "1970-01-01T00:00:00Z",
                    "archived": false,
                    "writePermissions": "CRM_PERMISSIONS_ENFORCEMENT"
                },
                {
                    "label": "Presentation Scheduled",
                    "displayOrder": 2,
                    "metadata": {
                        "isClosed": "false",
                        "probability": "0.6"
                    },
                    "id": "presentationscheduled",
                    "createdAt": "1970-01-01T00:00:00Z",
                    "updatedAt": "1970-01-01T00:00:00Z",
                    "archived": false,
                    "writePermissions": "CRM_PERMISSIONS_ENFORCEMENT"
                },
                {
                    "label": "Decision Maker Bought-In",
                    "displayOrder": 3,
                    "metadata": {
                        "isClosed": "false",
                        "probability": "0.8"
                    },
                    "id": "decisionmakerboughtin",
                    "createdAt": "1970-01-01T00:00:00Z",
                    "updatedAt": "1970-01-01T00:00:00Z",
                    "archived": false,
                    "writePermissions": "CRM_PERMISSIONS_ENFORCEMENT"
                },
                {
                    "label": "Contract Sent",
                    "displayOrder": 4,
                    "metadata": {
                        "isClosed": "false",
                        "probability": "0.9"
                    },
                    "id": "contractsent",
                    "createdAt": "1970-01-01T00:00:00Z",
                    "updatedAt": "1970-01-01T00:00:00Z",
                    "archived": false,
                    "writePermissions": "CRM_PERMISSIONS_ENFORCEMENT"
                },
                {
                    "label": "Closed Won",
                    "displayOrder": 5,
                    "metadata": {
                        "isClosed": "true",
                        "probability": "1.0"
                    },
                    "id": "closedwon",
                    "createdAt": "1970-01-01T00:00:00Z",
                    "updatedAt": "1970-01-01T00:00:00Z",
                    "archived": false,
                    "writePermissions": "CRM_PERMISSIONS_ENFORCEMENT"
                },
                {
                    "label": "Closed Lost",
                    "displayOrder": 6,
                    "metadata": {
                        "isClosed": "true",
                        "probability": "0.0"
                    },
                    "id": "closedlost",
                    "createdAt": "1970-01-01T00:00:00Z",
                    "updatedAt": "1970-01-01T00:00:00Z",
                    "archived": false,
                    "writePermissions": "CRM_PERMISSIONS_ENFORCEMENT"
                }
            ],
            "createdAt": "1970-01-01T00:00:00Z",
            "updatedAt": "1970-01-01T00:00:00Z",
            "archived": false
        }
    ]
}

 

Notice the "id" attribute returned for the various pipelines and the stages they contain. I can use these to 

create a deal as per the following request:

 

POST https://api.hubapi.com/crm/v3/objects/deals
Headers: Authorization Bearer {{token}}
Body:

{
    "properties": {
        "amount": 500,
        "dealname": "Deal X",
        "pipeline": "457553644",
        "dealstage": "701459928"
    }
}

 

I've recorded a video walkthrough of how you can achieve this:

 

I hope this helps!

Jack