<?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 Re: Create contact in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792615#M63913</link>
    <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/566973"&gt;@DvonLemberg&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This format is for legacy APIs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;$arr = array(
  'properties' =&amp;gt; array(
    array(
      'property' =&amp;gt; 'email',
      'value' =&amp;gt; 'XXX'
    ),
  ),
...
);&lt;/LI-CODE&gt;
&lt;P&gt;&lt;A href="https://legacydocs.hubspot.com/docs/methods/contacts/create_contact" target="_blank"&gt;https://legacydocs.hubspot.com/docs/methods/contacts/create_contact&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your code uses hubspot API &lt;STRONG&gt;v3&lt;/STRONG&gt;.&amp;nbsp; ('&lt;A href="https://api.hubapi.com/crm/" target="_blank"&gt;https://api.hubapi.com/crm/&lt;/A&gt;&lt;STRONG&gt;v3&lt;/STRONG&gt;/objects/contacts')&lt;/P&gt;
&lt;P&gt;v3 APIs format is like this.&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;$arr = array(
  'properties' =&amp;gt; array(
    'email' =&amp;gt; 'XXX'
    ...
  )
);&lt;/LI-CODE&gt;
&lt;P&gt;Please check v3 APIs reference.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://developers.hubspot.com/docs/api/crm/contacts#properties" target="_blank"&gt;https://developers.hubspot.com/docs/api/crm/contacts#properties&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 11 May 2023 12:09:14 GMT</pubDate>
    <dc:creator>skimura</dc:creator>
    <dc:date>2023-05-11T12:09:14Z</dc:date>
    <item>
      <title>Create contact</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792573#M63906</link>
      <description>&lt;P&gt;&lt;BR /&gt;Hi,&lt;BR /&gt;We are migrating to a private app.&lt;/P&gt;&lt;P&gt;Hi, I'm trying to add a new user directly to a list using php. If I just try to create a contact within hubspot&lt;BR /&gt;I have a problem,&amp;nbsp; the contact will be not created.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;this is my code:&lt;/P&gt;&lt;P&gt;$arr = array(&lt;BR /&gt;'properties' =&amp;gt; array(&lt;BR /&gt;array(&lt;BR /&gt;'property' =&amp;gt; 'email',&lt;BR /&gt;'value' =&amp;gt; $email&lt;BR /&gt;),&lt;BR /&gt;array(&lt;BR /&gt;'property' =&amp;gt; 'firstname',&lt;BR /&gt;'value' =&amp;gt; $vorname&lt;BR /&gt;),&lt;BR /&gt;array(&lt;BR /&gt;'property' =&amp;gt; 'lastname',&lt;BR /&gt;'value' =&amp;gt; $nachname&lt;BR /&gt;),&lt;BR /&gt;array(&lt;BR /&gt;'property' =&amp;gt; 'newsletter',&lt;BR /&gt;'value' =&amp;gt; $newsletter&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;)&lt;BR /&gt;);&lt;BR /&gt;$post_json = json_encode($arr);&lt;BR /&gt;$bkey = "pat-na1-xxxxxx";&lt;BR /&gt;$headers = [&lt;BR /&gt;'Content-Type: application/json',&lt;BR /&gt;'Authorization: Bearer ' . $bkey,&lt;BR /&gt;];&lt;BR /&gt;&lt;BR /&gt;$curl = curl_init();&lt;BR /&gt;@curl_setopt($curl, CURLOPT_POSTFIELDS, $post_json);&lt;BR /&gt;@curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);&lt;BR /&gt;@curl_setopt($curl, CURLOPT_URL, '&lt;A href="https://api.hubapi.com/crm/v3/objects/contacts" target="_blank"&gt;https://api.hubapi.com/crm/v3/objects/contacts&lt;/A&gt;');&lt;BR /&gt;@curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);&lt;BR /&gt;&lt;BR /&gt;$contacts = curl_exec($curl);&lt;BR /&gt;curl_close($curl);&lt;/P&gt;&lt;P&gt;Can you help me, please? Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 10:05:41 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792573#M63906</guid>
      <dc:creator>DvonLemberg</dc:creator>
      <dc:date>2023-05-11T10:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: Create contact</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792578#M63907</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/566973"&gt;@DvonLemberg&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How about try this?&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;..
$arr = array(
  'properties' =&amp;gt; array(
    'email' =&amp;gt; $email,
    'firstname' =&amp;gt; $vorname,
    'lastname' =&amp;gt; $nachname,
    'newsletter' =&amp;gt; $newsletter,
  )
);
...&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please check api reference.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://developers.hubspot.com/docs/api/crm/contacts#properties" target="_blank"&gt;https://developers.hubspot.com/docs/api/crm/contacts#properties&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 10:15:00 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792578#M63907</guid>
      <dc:creator>skimura</dc:creator>
      <dc:date>2023-05-11T10:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: Create contact</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792609#M63910</link>
      <description>&lt;P&gt;I try&lt;BR /&gt;$arr = array(&lt;BR /&gt;'properties' =&amp;gt; array(&lt;BR /&gt;'email' =&amp;gt; $email,&lt;BR /&gt;'firstname' =&amp;gt; $vorname,&lt;BR /&gt;'lastname' =&amp;gt; $nachname&lt;BR /&gt;)&lt;BR /&gt;);&lt;BR /&gt;I don't know what is wrong with my code. This is very frustrating. Can anyone recommend something?&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 11:57:25 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792609#M63910</guid>
      <dc:creator>DvonLemberg</dc:creator>
      <dc:date>2023-05-11T11:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: Create contact</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792615#M63913</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/566973"&gt;@DvonLemberg&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This format is for legacy APIs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;$arr = array(
  'properties' =&amp;gt; array(
    array(
      'property' =&amp;gt; 'email',
      'value' =&amp;gt; 'XXX'
    ),
  ),
...
);&lt;/LI-CODE&gt;
&lt;P&gt;&lt;A href="https://legacydocs.hubspot.com/docs/methods/contacts/create_contact" target="_blank"&gt;https://legacydocs.hubspot.com/docs/methods/contacts/create_contact&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your code uses hubspot API &lt;STRONG&gt;v3&lt;/STRONG&gt;.&amp;nbsp; ('&lt;A href="https://api.hubapi.com/crm/" target="_blank"&gt;https://api.hubapi.com/crm/&lt;/A&gt;&lt;STRONG&gt;v3&lt;/STRONG&gt;/objects/contacts')&lt;/P&gt;
&lt;P&gt;v3 APIs format is like this.&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;$arr = array(
  'properties' =&amp;gt; array(
    'email' =&amp;gt; 'XXX'
    ...
  )
);&lt;/LI-CODE&gt;
&lt;P&gt;Please check v3 APIs reference.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://developers.hubspot.com/docs/api/crm/contacts#properties" target="_blank"&gt;https://developers.hubspot.com/docs/api/crm/contacts#properties&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 12:09:14 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792615#M63913</guid>
      <dc:creator>skimura</dc:creator>
      <dc:date>2023-05-11T12:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: Create contact</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792617#M63914</link>
      <description>&lt;P&gt;I check the link and I use the correct api.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"To create new contacts, make a&amp;nbsp;&lt;/SPAN&gt;POST&lt;SPAN&gt;&amp;nbsp;request to&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;/crm/v3/objects/contacts"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When creating a new contact, you should include&amp;nbsp;at least one&amp;nbsp;of the following properties in your request:&amp;nbsp;email,&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;firstname, or&amp;nbsp;lastname."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I use&amp;nbsp;&lt;/P&gt;&lt;P&gt;$arr = array(&lt;BR /&gt;'properties' =&amp;gt; array(&lt;BR /&gt;'email' =&amp;gt; $email,&lt;BR /&gt;'firstname' =&amp;gt; $vorname,&lt;BR /&gt;'lastname' =&amp;gt; $nachname&lt;/P&gt;&lt;P&gt;)&lt;BR /&gt;);&amp;nbsp;&lt;/P&gt;&lt;P&gt;The contact is not created.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am not able to find the error&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 12:14:28 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792617#M63914</guid>
      <dc:creator>DvonLemberg</dc:creator>
      <dc:date>2023-05-11T12:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: Create contact</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792622#M63915</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you for the replay. I use&amp;nbsp;&lt;SPAN&gt;v3 APIs and formats like this.&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;$arr = array(
  'properties' =&amp;gt; array(
    'email' =&amp;gt; 'XXX'
    ...
  )
);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;but the contact will be not created&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 12:30:11 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792622#M63915</guid>
      <dc:creator>DvonLemberg</dc:creator>
      <dc:date>2023-05-11T12:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: Create contact</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792624#M63916</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/566973"&gt;@DvonLemberg&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you post the response code and response message?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 12:32:30 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792624#M63916</guid>
      <dc:creator>skimura</dc:creator>
      <dc:date>2023-05-11T12:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: Create contact</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792628#M63917</link>
      <description>&lt;P&gt;In my case this works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;$arr = [
    'properties' =&amp;gt; [
      'email' =&amp;gt; 'XXXX',
      'firstname' =&amp;gt; 'test',
      'lastname' =&amp;gt; 'test',
    ]
];

$post_json = json_encode($arr);
$bkey = "XXXX";
$headers = [
    'Content-Type: application/json',
    'Authorization: Bearer ' . $bkey
];

$curl = curl_init();
@curl_setopt($curl, CURLOPT_POSTFIELDS, $post_json);
@curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
@curl_setopt($curl, CURLOPT_URL, 'https://api.hubapi.com/crm/v3/objects/contacts');
@curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($curl);
curl_close($curl);
$status_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($status_code == 200) {
    $response_json = json_decode($response, true);
    print_r($response_json);
} else {
    print_r(json_decode($response, true));
    echo "Request failed with status code: " . $status_code;
}&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 11 May 2023 12:45:25 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792628#M63917</guid>
      <dc:creator>skimura</dc:creator>
      <dc:date>2023-05-11T12:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: Create contact</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792660#M63918</link>
      <description>&lt;P&gt;Hi, response code:&lt;/P&gt;&lt;P&gt;curl Errors: Status code: Response: {"status":"error","message":"Contact already exists. Existing ID: 35401","correlationId":"ce92ca80-99e4-473d-96dd-aa6f93d4b5f8","category":"CONFLICT"}"0 results"&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 13:27:17 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792660#M63918</guid>
      <dc:creator>DvonLemberg</dc:creator>
      <dc:date>2023-05-11T13:27:17Z</dc:date>
    </item>
    <item>
      <title>Re: Create contact</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792664#M63919</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/566973"&gt;@DvonLemberg&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;gt;&lt;SPAN&gt;Contact already exists&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Is the contact already exists?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Please try another 'email'.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Or delete exists contact.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 13:30:56 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792664#M63919</guid>
      <dc:creator>skimura</dc:creator>
      <dc:date>2023-05-11T13:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: Create contact</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792675#M63920</link>
      <description>&lt;P&gt;The contact doesn't exists. I try another email:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;curl Errors: Status code: Response: {"status":"error","message":"Contact already exists. Existing ID: 35401","correlationId":"2132dbc9-ef03-4d6f-bd5e-15e01ee9f0b2","category":"CONFLICT"}"0 results"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 13:50:38 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792675#M63920</guid>
      <dc:creator>DvonLemberg</dc:creator>
      <dc:date>2023-05-11T13:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: Create contact</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792681#M63921</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/566973"&gt;@DvonLemberg&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It may just be that you don't see it in your contact list.&lt;/P&gt;
&lt;P&gt;Since the ID is known, can't it be displayed directly from the URL?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;URL like this.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://app.hubspot.com/contacts/{YOU_PORTAL}/contact/" target="_blank"&gt;https://app.hubspot.com/contacts/{YOU_PORTAL}/contact/&lt;/A&gt;&lt;SPAN&gt;35401&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 13:57:04 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792681#M63921</guid>
      <dc:creator>skimura</dc:creator>
      <dc:date>2023-05-11T13:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: Create contact</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792911#M63943</link>
      <description>&lt;P&gt;Thank you, the issue is solved &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 22:10:47 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Create-contact/m-p/792911#M63943</guid>
      <dc:creator>DvonLemberg</dc:creator>
      <dc:date>2023-05-11T22:10:47Z</dc:date>
    </item>
  </channel>
</rss>

