<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Associate product as line item to deal in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Associate-product-as-line-item-to-deal/m-p/663964#M54764</link>
    <description>&lt;P&gt;How can I associate product as line item to deal?&lt;/P&gt;&lt;P&gt;Tried this way&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;curl --request POST \
  --url 'https://api.hubapi.com/crm/v3/associations/deal/product/batch/create?hapikey=q1w2e3' \
  --header 'content-type: application/json' \
  --data '{
  "inputs": [
    {
      "from": {
        "id": "1"
      },
      "to": {
        "id": "2"
      },
      "type": "line_item_to_deal"
    }
  ]
}'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and got next error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
  "status": "COMPLETE",
  "results": [],
  "numErrors": 1,
  "errors": [
    {
      "status": "error",
      "category": "VALIDATION_ERROR",
      "subCategory": "crm.associations.INVALID_ASSOCIATION_TYPE",
      "message": "line_item_to_deal is not a valid association type between deals and products",
      "context": {
        "type": [
          "line_item_to_deal"
        ],
        "fromObjectType": [
          "deals"
        ],
        "toObjectType": [
          "products"
        ]
      }
    }
  ],
  "startedAt": "2022-07-12T18:04:25.631Z",
  "completedAt": "2022-07-12T18:04:25.662Z"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 12 Jul 2022 18:43:04 GMT</pubDate>
    <dc:creator>konyaev</dc:creator>
    <dc:date>2022-07-12T18:43:04Z</dc:date>
    <item>
      <title>Associate product as line item to deal</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Associate-product-as-line-item-to-deal/m-p/663964#M54764</link>
      <description>&lt;P&gt;How can I associate product as line item to deal?&lt;/P&gt;&lt;P&gt;Tried this way&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;curl --request POST \
  --url 'https://api.hubapi.com/crm/v3/associations/deal/product/batch/create?hapikey=q1w2e3' \
  --header 'content-type: application/json' \
  --data '{
  "inputs": [
    {
      "from": {
        "id": "1"
      },
      "to": {
        "id": "2"
      },
      "type": "line_item_to_deal"
    }
  ]
}'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and got next error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
  "status": "COMPLETE",
  "results": [],
  "numErrors": 1,
  "errors": [
    {
      "status": "error",
      "category": "VALIDATION_ERROR",
      "subCategory": "crm.associations.INVALID_ASSOCIATION_TYPE",
      "message": "line_item_to_deal is not a valid association type between deals and products",
      "context": {
        "type": [
          "line_item_to_deal"
        ],
        "fromObjectType": [
          "deals"
        ],
        "toObjectType": [
          "products"
        ]
      }
    }
  ],
  "startedAt": "2022-07-12T18:04:25.631Z",
  "completedAt": "2022-07-12T18:04:25.662Z"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 18:43:04 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Associate-product-as-line-item-to-deal/m-p/663964#M54764</guid>
      <dc:creator>konyaev</dc:creator>
      <dc:date>2022-07-12T18:43:04Z</dc:date>
    </item>
    <item>
      <title>Re: Associate product as line item to deal</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Associate-product-as-line-item-to-deal/m-p/664818#M54791</link>
      <description>&lt;P&gt;Hey,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/416732"&gt;@konyaev&lt;/a&gt;&amp;nbsp;Is this still occurring for you? &lt;span class="lia-unicode-emoji" title=":waving_hand:"&gt;👋&lt;/span&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I recreated your steps, and I am getting a successful response. Here's what I did:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;I followed this guide from&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/20405"&gt;@himanshurauthan&lt;/a&gt;&amp;nbsp;on how to generate a &lt;A href="https://community.hubspot.com/t5/APIs-Integrations/Get-line-item-id-for-a-specific-product/m-p/350075/highlight/true#M34317" target="_blank" rel="noopener"&gt;Product and Line Item via the API&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;I used the v3 endpoint from your original post&amp;nbsp;&lt;BR /&gt;&lt;LI-CODE lang="markup"&gt;POST /crm/v3/associations/{fromObjectType}/{toObjectType}/batch/create​&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Here's my request and response:&lt;BR /&gt;&lt;LI-CODE lang="markup"&gt;curl --request POST \
  --url https://api.hubapi.com/crm/v3/associations/Line_items/Deal/batch/create \
  --header 'authorization: Bearer NOPE' \
  --header 'content-type: application/json' \
  --data '{
  "inputs": [
    {
      "from": {
        "id": "3389121391"
      },
      "to": {
        "id": "9475998565"
      },
      "type": "line_item_to_deal"
    }
  ]
}'​&lt;/LI-CODE&gt;&lt;BR /&gt;&lt;LI-CODE lang="markup"&gt;HTTP 201

{
  "status": "COMPLETE",
  "results": [
    {
      "from": {
        "id": "3389121391"
      },
      "to": {
        "id": "9475998565"
      },
      "type": "line_item_to_deal"
    },
    {
      "from": {
        "id": "9475998565"
      },
      "to": {
        "id": "3389121391"
      },
      "type": "deal_to_line_item"
    }
  ],
  "startedAt": "2022-07-13T21:50:33.210Z",
  "completedAt": "2022-07-13T21:50:33.266Z"
}​&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;I think the difference is you used:&lt;BR /&gt;&lt;LI-CODE lang="markup"&gt;"fromObjectType": [
          "deals"
        ],
"toObjectType": [
          "products"​&lt;/LI-CODE&gt;
&lt;P&gt;and I used Line_items and Deals:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Line_items_to_Deals.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/70562i62351C4CEB497A67/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Line_items_to_Deals.png" alt="Line_items_to_Deals.png" /&gt;&lt;/span&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;I hope this is helpful in getting you on your way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Happy coding! — Jaycee &lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2022 22:04:11 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Associate-product-as-line-item-to-deal/m-p/664818#M54791</guid>
      <dc:creator>Jaycee_Lewis</dc:creator>
      <dc:date>2022-07-13T22:04:11Z</dc:date>
    </item>
  </channel>
</rss>

