{"id":28808,"date":"2026-02-19T16:35:57","date_gmt":"2026-02-19T14:35:57","guid":{"rendered":"https:\/\/aivie.ch\/faq\/how-can-i-create-a-contact-in-aivie-via-api\/"},"modified":"2026-02-19T16:38:35","modified_gmt":"2026-02-19T14:38:35","slug":"how-can-i-create-a-contact-in-aivie-via-api","status":"publish","type":"faq","link":"https:\/\/aivie.ch\/en\/faq\/how-can-i-create-a-contact-in-aivie-via-api\/","title":{"rendered":"How can I create a contact in Aivie via API?"},"content":{"rendered":"\n<p>In short: You can easily create a contact in Aivie via the REST API by sending a POST request to the <code>\/api\/contacts\/new<\/code> endpoint and authenticating via Basic Auth or OAuth2.<\/p>\n\n<!--more-->\n\n<h2 class=\"wp-block-heading\">Create contact via API<\/h2>\n\n<p>To create a new contact, use the API endpoint:<\/p>\n\n<pre class=\"wp-block-code\"><code>POST \/api\/contacts\/new\n<\/code><\/pre>\n\n<p>A simple example using <code>curl<\/code> looks like this:<\/p>\n\n<pre class=\"wp-block-code\"><code>curl --location 'https:\/\/aivie-v6.0.ddev.site\/api\/contacts\/new' \\\n--header 'Authorization: Basic VVNF***==' \\\n--header 'Content-Type: application\/json' \\\n--data-raw '{\n    \"email\": \"aivie@dev.ch\",\n    \"firstname\": \"aivie\"\n}'\n<\/code><\/pre>\n\n<p>Important:<\/p>\n\n<ul class=\"wp-block-list\">\n<li>The request must be sent as <code>POST<\/code>.<\/li>\n\n\n\n<li>Authentication is done via either <strong>Basic Auth<\/strong> or <strong>OAuth2<\/strong>.<\/li>\n\n\n\n<li>The <code>Content-Type: application\/json<\/code> header should be set.<\/li>\n\n\n\n<li>At least the <code>email<\/code> field is required.<\/li>\n<\/ul>\n\n<h2 class=\"wp-block-heading\">Authentication<\/h2>\n\n<p>Two options are available for accessing the API:<\/p>\n\n<p><strong>Basic Auth<\/strong><br\/>Suitable for simple integrations or internal systems. Here, a Base64-encoded username and password are sent in the Authorization header. <\/p>\n\n<p><strong>OAuth2<\/strong><br\/>Recommended for production integrations with external systems. OAuth2 offers more secure and flexibly controllable authentication. <\/p>\n\n<h2 class=\"wp-block-heading\">Passing additional fields<\/h2>\n\n<p>In addition to <code>email<\/code> and <code>firstname<\/code>, you can also send other fields such as:<\/p>\n\n<ul class=\"wp-block-list\">\n<li>lastname<\/li>\n\n\n\n<li>company<\/li>\n\n\n\n<li>phone<\/li>\n\n\n\n<li>your own custom contact fields<\/li>\n<\/ul>\n\n<p>send along. The field names must match the alias of the custom field exactly. <\/p>\n\n<h2 class=\"wp-block-heading\">Official documentation<\/h2>\n\n<p>You can find all available fields, response codes, and further examples in the official API documentation:<\/p>\n\n<p><a href=\"https:\/\/devdocs.mautic.org\/en\/5.x\/rest_api\/contacts.html#create-contact\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/devdocs.mautic.org\/en\/5.x\/rest_api\/contacts.html#create-contact<\/a><\/p>\n\n<p>Examples for SDKs and more complex use cases are also described there.<\/p>\n\n<h2 class=\"wp-block-heading\">Summary<\/h2>\n\n<p>A contact is created via a POST request to <code>\/api\/contacts\/new<\/code>. Authentication is done via Basic Auth or OAuth2, and at least one email address must be provided. You can find the full field overview in the official API documentation.  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>In short: You can easily create a contact in Aivie via the REST API by sending a POST request to the \/api\/contacts\/new endpoint and authenticating via Basic Auth or OAuth2.<\/p>\n","protected":false},"featured_media":0,"template":"","categories":[],"tags":[1581,1582],"FaqCategories":[996],"FaqTags":[300,920],"class_list":["post-28808","faq","type-faq","status-publish","hentry","tag-api","tag-contact","FaqCategories-integrations","FaqTags-api-en","FaqTags-contact"],"acf":[],"featured_image_urls_v2":{"full":"","thumbnail":"","medium":"","medium_large":"","large":"","post-thumbnail":"","aiv_480w":"","woocommerce_thumbnail":"","woocommerce_single":"","woocommerce_gallery_thumbnail":""},"post_excerpt_stackable_v2":"<p>In short: You can easily create a contact in Aivie via the REST API by sending a POST request to the \/api\/contacts\/new endpoint and authenticating via Basic Auth or OAuth2. Create contact via API To create a new contact, use the API endpoint: POST \/api\/contacts\/new A simple example using curl looks like this: curl &#8211;location &#8216;https:\/\/aivie-v6.0.ddev.site\/api\/contacts\/new&#8217; \\ &#8211;header &#8216;Authorization: Basic VVNF***==&#8217; \\ &#8211;header &#8216;Content-Type: application\/json&#8217; \\ &#8211;data-raw &#8216;{ &#8220;email&#8221;: &#8220;aivie@dev.ch&#8221;, &#8220;firstname&#8221;: &#8220;aivie&#8221; }&#8217; Important: The request must be sent as POST. Authentication is done via either Basic Auth or OAuth2. The Content-Type: application\/json header should be set. At least the&hellip;<\/p>\n","category_list_v2":"Uncategorized","author_info_v2":{"name":"","url":""},"comments_num_v2":"0 comments","_links":{"self":[{"href":"https:\/\/aivie.ch\/en\/wp-json\/wp\/v2\/faq\/28808","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aivie.ch\/en\/wp-json\/wp\/v2\/faq"}],"about":[{"href":"https:\/\/aivie.ch\/en\/wp-json\/wp\/v2\/types\/faq"}],"version-history":[{"count":4,"href":"https:\/\/aivie.ch\/en\/wp-json\/wp\/v2\/faq\/28808\/revisions"}],"predecessor-version":[{"id":28824,"href":"https:\/\/aivie.ch\/en\/wp-json\/wp\/v2\/faq\/28808\/revisions\/28824"}],"wp:attachment":[{"href":"https:\/\/aivie.ch\/en\/wp-json\/wp\/v2\/media?parent=28808"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aivie.ch\/en\/wp-json\/wp\/v2\/categories?post=28808"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aivie.ch\/en\/wp-json\/wp\/v2\/tags?post=28808"},{"taxonomy":"FaqCategories","embeddable":true,"href":"https:\/\/aivie.ch\/en\/wp-json\/wp\/v2\/FaqCategories?post=28808"},{"taxonomy":"FaqTags","embeddable":true,"href":"https:\/\/aivie.ch\/en\/wp-json\/wp\/v2\/FaqTags?post=28808"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}