# Creating a quote via API missing quote template

**URL:** <https://community.hubspot.com/t/creating-a-quote-via-api-missing-quote-template/133431>\
**Category:** APIs & Integrations\
**Tags:** timeline-and-extensions-apis\
**Created:** [May 27, 2025, 5:32pm UTC](https://community.hubspot.com/t/creating-a-quote-via-api-missing-quote-template/133431 "2025-05-27T17:32:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aalonso88](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@aalonso88](https://community.hubspot.com/u/aalonso88)\
**Post date:** [May 27, 2025, 5:32pm UTC](https://community.hubspot.com/t/creating-a-quote-via-api-missing-quote-template/133431/1 "2025-05-27T17:32:21Z")

</div>

Hi there!!!

I’m exercising Hubspot API to create a quote. I was able of creating a quote, including most of the fields within the quote. But I am unable of selecting a template for the quote, so it can not be finished.

I’m programming in javascript and when creating the quote I fetch to the URL ‘[https://api.hubapi.com/crm/v4/objects/quotes](https://api.hubapi.com/crm/v4/objects/quotes)’ for creating the quote. It works.

In the payload I include next properties:

properties: {

hs\_title: `Title`,

hs\_expiration\_date: date\_selected,

hs\_comments: comments\_selected,

hs\_status: “DRAFT”,

hs\_template\_type: “QUOTE”,

hs\_language: “es”,

hs\_sender\_firstname: ‘Romeo’,

hs\_sender\_lastname: ‘Santos’,

hs\_sender\_jobtitle: ‘Account Manager’,

hs\_sender\_company\_name: ‘Company’,

hs\_sender\_email: ‘roma@paris.com’,

hs\_sender\_company\_address: “Street 1223”,

hs\_sender\_company\_city: “City”,

hs\_sender\_company\_zip: “12345”,

hs\_sender\_company\_country: “XXX”,

hs\_currency : ‘EUR’

}

All the fields are correctly placed in the quote and quote is created as draft, but no template is selected.

I have tried both:

hs\_template\_type: “CUSTOMIZABLE\_QUOTE\_TEMPLATE”

hs\_template\_type: “QUOTE”

But none is working. When checking the created quote in the Hubspot web, it appears linked to the deal, but the template appears empty, pending to be selected.

How can I select a template to be added to the quote? What should I update or change for this purpose?

---

<div class="post-metadata">

**Author:** ![BrandonWoodruff](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/brandonwoodruff/32/61045_2.png) [@BrandonWoodruff](https://community.hubspot.com/u/BrandonWoodruff)\
**Post date:** [May 27, 2025, 5:48pm UTC](https://community.hubspot.com/t/creating-a-quote-via-api-missing-quote-template/133431/2 "2025-05-27T17:48:41Z")

</div>

### Hello!

Based on your message, I would suggest that try and do it with the association attribute:

> **[Accounts Dashboard | HubSpot](https://app.hubspot.com/myaccounts?next=developerdocs&redirect=%2Fguides%2Fapi%2Fcrm%2Fcommerce%2Fquotes)**

Here is how I would do it. I would first get your Template ID via api, and then create the quote with the template association:

### Step 1: Get Available Quote Templates

const axios = require(‘axios’);

async function getQuoteTemplates() {

const response = await axios.get(‘[https://api.hubapi.com/crm/v3/objects/quote\_templates](https://api.hubapi.com/crm/v3/objects/quote_templates)’, {

headers: {

Authorization: `Bearer ${HUBSPOT_API_KEY}` } });

const templates = response.data.results;

console.log(“Available templates:”);

templates.forEach(template =\> { console.log(`Template ID: ${template.id}, Name: ${template.properties.name}`); });

// Return first template ID for demo purposes

return templates[0].id; }

### Step 2: Create the quote with the Association to the template

async function createQuote(templateId) {

const quoteData = {

properties: {

hs\_title: “ClientX - Website Redesign Project”,

hs\_expiration\_date: “2025-12-31”,

hs\_status: “DRAFT”,

hs\_currency: “USD”,

hs\_language: “en” },

associations: [ { to: { id: templateId },

types: [ {

associationCategory: “HUBSPOT\_DEFINED”,

associationTypeId: 286 // quote → quote template

} ] },

{ to: { id: 987654321 }, // replace with Deal ID types: [ { associationCategory: “HUBSPOT\_DEFINED”, associationTypeId: 64 // quote → deal

} ] },

{ to: { id: 1111111 }, // replace with Line Item ID #1

types: [ { associationCategory: “HUBSPOT\_DEFINED”,

associationTypeId: 67 // quote → line item } ] },

{ to: { id: 2222222 }, // replace with Line Item ID #2

types: [{ associationCategory: “HUBSPOT\_DEFINED”, associationTypeId: 67 }] },

{ to: { id: 3333333 }, // replace with Contact ID

types: [{ associationCategory: “HUBSPOT\_DEFINED”, associationTypeId: 3 // quote → contact }] } ] };

const response = await axios.post(‘[https://api.hubapi.com/crm/v3/objects/quotes](https://api.hubapi.com/crm/v3/objects/quotes)’,

quoteData, { headers: { Authorization: `Bearer ${HUBSPOT_API_KEY}`, ‘Content-Type’: ‘application/json’ } });

console.log(“Quote created with ID:”, response.data.id); }

Let me know if this helps or if you are still running into issues! Hope you have a great day!

---

<div class="post-metadata">

**Author:** ![aalonso88](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@aalonso88](https://community.hubspot.com/u/aalonso88)\
**Post date:** [May 28, 2025, 12:35pm UTC](https://community.hubspot.com/t/creating-a-quote-via-api-missing-quote-template/133431/3 "2025-05-28T12:35:54Z")

</div>

Thank you very much [BrandonWoodruff.](https://community.hubspot.com/t5/user/viewprofilepage/user-id/945160)

I could manage it reviewing the associations part as suggested by you.

I used for this purpose, to associate template to quote:

associateTemplateUrl = …/crm/v3/objects/quotes/${quoteId}/associations/quote\_template/${templateId}/quote\_to\_quote\_template;

and it worked.

Thank you very much
