Hello,
i’m trying to create an approved quote via the API.
I have associated a deal, line-item and quote template but i always get a `there was a problem with your request` error. I can’t do much with this error message.
This is my request (i removed all the id’s but they are fine in my code)
{ "properties": { "hs_status": "APPROVAL_NOT_NEEDED", "hs_sender_firstname": "myName", "hs_sender_email": "my@mail.com", "hs_comments": "Comments for dealName 1", "hs_terms": "terms for dealName 1", "hs_currency": "EUR", "hs_expiration_date": "2024-04-08", "hs_title": "Quote With Template 1", "hs_domain": {{myQuoteDomain}}, "hs_template_type": "QUOTE" }, "associations": [ { "to": {"id": {{templateId}}}, "types": [{"associationCategory": "HUBSPOT_DEFINED", "associationTypeId": 286}] }, { "to": {"id": {{dealID}}}, "types": [{"associationCategory": "HUBSPOT_DEFINED", "associationTypeId": 64}] }, { "to": {"id": {{lineItemId}}}, "types": [{"associationCategory": "HUBSPOT_DEFINED", "associationTypeId": 67}] } ]}
What am i missing?
I already tried different variations, with and without setting the domain and template type, owner, different date formats (with hours etc) … always the same error.
Hi @enrico_baskey 
Certainly sounds like a strange one. I can’t find any clear issues with your request body. Could you also please share additional information relating to your request? For example:
- Endpoint / URL
- Query string parameters (if relevant)
- Request method
- Headers
That additional context might help us get closer to the bottom of this.
Please let me know if you have any follow-up questions.
Hi Zach,
Thanks for your reply!
First i sent a post request to
POST https://api.hubspot.com/crm/v3/objects/line_items
to create a line item to associate it with the quote.
Then i also sent a post request to
POST https://api.hubspot.com/crm/v3/objects/quote
to create the quote with the given request body. I have the correct scopes in my token, because i can create it as draft, and also tried with a private app token with all available scopes.
The headers for my create quote request are these:
Content-Type: application/jsonAuthorization: Bearer {{allscopes}}
I have no query strings.
So the full request looks like this (intellij HTTP Client format):
POST https://api.hubspot.com/crm/v3/objects/quoteContent-Type: application/jsonAuthorization: Bearer {{allscopes}}{ "properties": { "hs_status": "APPROVAL_NOT_NEEDED", "hs_sender_firstname": "myName", "hs_sender_email": "my@mail.com", "hs_comments": "Comments for dealName 1", "hs_terms": "terms for dealName 1", "hs_currency": "EUR", "hs_expiration_date": "2024-04-08", "hs_title": "Quote With Template 1", "hs_domain": {{myQuoteDomain}}, "hs_template_type": "QUOTE" }, "associations": [ { "to": {"id": {{templateId}}}, "types": [{"associationCategory": "HUBSPOT_DEFINED", "associationTypeId": 286}] }, { "to": {"id": {{dealID}}}, "types": [{"associationCategory": "HUBSPOT_DEFINED", "associationTypeId": 64}] }, { "to": {"id": {{lineItemId}}}, "types": [{"associationCategory": "HUBSPOT_DEFINED", "associationTypeId": 67}] } ]}
Hi @enrico_baskey 
No problem at all, happy to help.
Can you please double check your “hs_domain” property (in your Create Quote API call) and also confirm that you have a connected HubSpot Domain? This can be found in HubSpot Settings > Tools > Website > Domain & URLs
The reason being is I was able to replicate your error response in a test HubSpot account that has no connected domains.
I hope this proves useful. Please let me know if you have any follow-up questions.
Hi Zach,
Thats a good call!
I have no connected domains.
But i created and approved a quote with the HubSpot UI, and then copied the default domain which for me was <PortalId>.hs-sites-eu1.com/.
I wonder why i can use this domain over the ui, but not via the API, do you think this is the issue? Could you replicate with this domain aswell?
oh my god i found the issue.
First i used
"hs_template_type": "QUOTE"
Which was an issue because i needed to use: CUSTOMIZABLE_QUOTE_TEMPLATE.
When using QUOTE, the hs-domain was always empty.
Then my other issue was i used “EUR” as quote currency, but the line-item was in USD.
Thanks for your time!