Creating quotes via API

Hello everyone :slightly_smiling_face:
I’m still quite new to Hubspot so this might be some silly mistake I don’t see but the support couldn’t help me on this so here we are.
I want to automate the creation of quotes. I got really far as I can now create quotes via postman with all the necessary information and associations. When I created the quote and open it in Hubspot I can click ‘next’ on all pages to eventually publish the quote.
Obviously I don’t want to click anything manually.
If I understand the documentation correctly, I must change the state of the quote to ‘Approval not needed’.
I’m using postman.
I have tried both ways:
1. Creating a quote with said state

2. Creating a quote with with a draft status and then patching it with the said state.
In both cases I get an error:

“status”: “error”,

“message”: “There was a problem with the request.”,

“correlationId”: “ca2c524b-f48f-4f08-a05f-6517d330b33g”
Correlation ID varies obviously
Unfortunately this error doesnt tell me what I did wrong.
And now here I am…
Hope anyone can guide me in the correct direction of what I might have done wrong.
Thanks! :slightly_smiling_face:

Hey, @NThiele :waving_hand: Thanks for your question. I agree the error returned isn’t very helpful. I did a bit of digging and found this solution from one of our amazing community champions @zach_threadint — Update quote status. Can you follow his steps and report back if that works for you, please?

Thank you! — Jaycee

Hi @Jaycee_Lewis
Thanks for solution from Zach.
Unfortunately I was already doing all the steps already.
I have included the 286, 64 and 67 associations successfully for the status draft but not for any other status.
I had enabled e-sign and also linked an ‘e-signer’ and just now tried to crate a quote without it. Status ‘APPROVAL_NOT_NEEDED’ still gives me the same error.
Any chance you could try my code to identify if the problem is in the request or maybe even with postman settings etc.?
Would be much appreciated. Thanks!
Edit: Yes I also tried copy & paste of Zachs solution but it gave me the error that it needs a currency. Added the currency and I’m back where I startet with:

“status”: “error”,

“message”: “There was a problem with the request.”,

“correlationId”: “f020de9e-fc95-499e-b688-e71600b84abc”

My Code:

{
"properties": {
"hs_title": "API Testquote 11",
"hs_expiration_date": "2024-09-30",
//"hs_esign_enabled": "true",
"hs_status": "APPROVAL_NOT_NEEDED",
//"hs_template": "307938224762",
//Company Sender
"hs_sender_company_name": "Test GmbH",
"hs_sender_company_address": "Teststreet 5",
"hs_sender_company_zip": "50743",
"hs_sender_company_city": "Köln",
"hs_sender_company_country": "Deutschland",

"hs_sender_email": "nickstestmail@web.de",
"hs_sender_firstname": "NT",
"hs_sender_lastname": "NThi",
"hs_sender_phone": "01512323423",
//Vertragsdetails
"hs_currency": "EUR",
"hs_language": "de"
//receiver

},
"associations": [
{
"to": {
"id": 307938224762
},
"types": [
{
"associationCategory": "HUBSPOT_DEFINED",
"associationTypeId": 286 //Quote to quote template
}
]
},
{
"to": {
"id": 17804791675
},
"types": [
{
"associationCategory": "HUBSPOT_DEFINED",
"associationTypeId": 64 //Quote to deal
}
]
},

/*
{
"to": {
"id": 8459875223 //Nicks Test Produkt
},
"types": [
{
"associationCategory": "HUBSPOT_DEFINED",
"associationTypeId": 67 //Quote to line item
}
]
}*/
{
"to": {
"id": 8484061566 //premium 20
},
"types": [
{
"associationCategory": "HUBSPOT_DEFINED",
"associationTypeId": 67 //Quote to line item
}
]
},
/*
{
"to": {
"id": 9911
},

"types": [
{
"associationCategory": "HUBSPOT_DEFINED",
"associationTypeId": 702 //Quote to Contact signer
}
]
},*/
{
"to": {
"id": 19321716766
},
"types": [
{
"associationCategory": "HUBSPOT_DEFINED",
"associationTypeId": 71 //Quote to receiver Company
}
]
}

]
}

Hi @NThiele :waving_hand:

Based on my testing, it looks like this could be related to the Quote property “hs_currency”.

It seems as though a Quote’s currency can only be set to either:

  1. The given HubSpot Portal’s primary/default currency, OR
  2. The associated Deal’s currency

This is mentioned in the relevant HubSpot API documentation (search for “hs_currency”).

I get the same error message as you’ve shared when I try to set the Quote’s “hs_currency” to anything other than the above. As such, I’m guessing [1] euros (code “EUR”) is not your default currency AND/OR is not the currency of the Deal you’re trying to associate with the Quote. Hopefully it’s that simple :crossed_fingers:

I hope this proves helpful. Please let me know if you have any follow-up questions.

Hi @zach_threadint
Thank you for testing!
I think you are correct. Funny enough I tried the quote creating in the production area and it worked perfectly fine. I had no Idea what is different, as the sandbox had been copied from production a couple of month ago.
I checked and someone seems to have changed the primary currency in the sandbox area.
What I’m trying to say: Thank you so much.
Maybe Hubspot can include this in their error messages from now on.