# Problem when create a Quote

**URL:** <https://community.hubspot.com/t/problem-when-create-a-quote/124901>\
**Category:** APIs & Integrations\
**Tags:** python, object, starter\
**Created:** [January 28, 2025, 9:44am UTC](https://community.hubspot.com/t/problem-when-create-a-quote/124901 "2025-01-28T09:44:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![IAlbanese](https://avatars.discourse-cdn.com/v4/letter/i/c77e96/32.png) [@IAlbanese](https://community.hubspot.com/u/IAlbanese)\
**Post date:** [January 28, 2025, 9:44am UTC](https://community.hubspot.com/t/problem-when-create-a-quote/124901/1 "2025-01-28T09:44:25Z")

</div>

I am having trouble creating a quote. A lot of the information I pass is not being inserted into the entity. This is the code quote\_url = “[https://api.hubapi.com/crm/v3/objects/quotes](https://api.hubapi.com/crm/v3/objects/quotes)”  
quote\_payload = {  
“properties”: {  
“hs\_title”: f"Contratto per {customer\_name}",  
“hs\_expiration\_date”: expiration\_date\_timestamp,  
“hs\_esign\_enabled”: “true”,  
“hs\_status”: “DRAFT”, # Imposta la Quote come “PUBLISHED” per inviare l’email  
“hs\_language”: “it”, # Imposta la lingua della Quote su Italiano  
“hs\_template\_type”: “QUOTE”, # Usa un template valido di HubSpot  
“hubspot\_owner\_id”: “169999874268”,  
}  
}  
quote\_response = [requests.post](http://requests.post/)(quote\_url, json=quote\_payload, headers=headers)  
# Verificare la risposta della creazione della Quote  
if quote\_response.status\_code != 201:  
return {  
“statusCode”: quote\_response.status\_code,  
“body”: json.dumps(  
{  
“success”: False,  
“message”: “Errore nella creazione della Quote”,  
“details”: quote\_response.text,  
}  
),  
}  
# Ottenere l’ID della Quote appena creata  
quote\_id = quote\_response.json()[“id”]  
# 🔹 5. Associare la Quote al Deal  
quote\_association\_url = (  
“[https://api.hubapi.com/crm/v3/associations/Deals/Quotes/batch/create](https://api.hubapi.com/crm/v3/associations/Deals/Quotes/batch/create)”  
)  
quote\_association\_payload = {  
“inputs”: [  
{  
“from”: {“id”: deal\_id},  
“to”: {“id”: quote\_id},  
“type”: “deal\_to\_quote”,  
}  
]  
}  
quote\_association\_response = [requests.post](http://requests.post/)(  
quote\_association\_url, json=quote\_association\_payload, headers=headers  
)  
association\_url = (  
“[https://api.hubapi.com/crm/v3/associations/Quotes/Line\_Items/batch/create](https://api.hubapi.com/crm/v3/associations/Quotes/Line_Items/batch/create)”  
)  
association\_payload = {  
“inputs”: [  
{  
“from”: {“id”: quote\_id},  
“to”: {“id”: “109266461927”},  
“type”: “quote\_to\_line\_item”,  
}  
]  
}  
association\_response = [requests.post](http://requests.post/)(  
association\_url, json=association\_payload, headers=headers  
)

these are the pages that appear after the quote has been created

 ![Screenshot 2025-01-23 alle 10.34.36.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/3X/7/f/7fd5e7c15f5e33364ee5eabed135c5b220ffec71.jpeg)

 ![Screenshot 2025-01-23 alle 10.34.22.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/3X/9/9/99b6f2645fc0348924b5943a64dbc5ace8fbcc07.jpeg)

 ![Screenshot 2025-01-23 alle 10.34.10.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/2X/d/d594e6a99f687cdcf5833dc3e827019dc59e7fe3.jpeg)

 ![Screenshot 2025-01-23 alle 10.33.56.jpg](https://d2qpr2jzcazej7.cloudfront.net/original/3X/f/6/f64ede1c91b80d201356bfaa173cdd2736ef33df.jpeg)

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [January 30, 2025, 3:22am UTC](https://community.hubspot.com/t/problem-when-create-a-quote/124901/2 "2025-01-30T03:22:52Z")

</div>

Hey @IAlbanese 👋 Thanks for providing your code example and screenshots. Have you tried doing this in one call instead of making calls to multiple endpoints?

If it were me, I’d take the example provided here for [**creating a quote with associations in a single request**](https://developers.hubspot.com/docs/guides/api/crm/commerce/quotes#create-a-quote-with-associations-single-request), adapt it to your specific details — template ID, object IDs, and item IDs for your associations. Then jump over to Postman to see if you can get it working outside your code. That should yield some good feedback on what you might need to adjust in your code.

Have fun testing! — Jaycee
