Artifi API Integration

Artifi provides flexible API-based integration capabilities that allow eCommerce platforms to generate customized product previews and final artwork without relying entirely on the standard Artifi UI components.

There are two primary approaches for integrating Artifi using APIs:

1. Integration with Artifi Component

2. Integration without Artifi Component (Using Custom eCommerce Components)

 
This document explains both integration methods, their workflows, required APIs, and implementation considerations.

Use Case 1: Integration with Artifi Component

In this approach, the eCommerce application utilizes the Artifi customization component. Users perform personalization actions such as adding text, selecting clipart, or uploading images directly within the Artifi component.

Whenever a customization is added or modified, Artifi emits events/methods containing the updated widget information. The eCommerce application captures these events and uses the provided data to generate an updated product preview by calling the GetImage API.

Workflow

Step 1: Initialize the Artifi

Include the Artifi Headless JavaScript file in your eCommerce page to enable access to Artifi components and APIs.

<script src="https://example.com/artifi-headless-releases/3.0/Artifi.headless.js"></script>

Notes

  • Ensure the script is loaded before initializing any Artifi components
  • It is recommended to load the script in the <head> section or before closing the <body> tag.
  • Before Initialize the Artifi, all domains that will load or interact with Artifi must be whitelisted in Artifi admin.

Sample Code for Initialize Artifi

 
  // Configuration 
  var integrationValues = {}; 
  integrationValues.sku= ""; 
  integrationValues.websiteId = ""; 
  integrationValues.webApiclientKey = ""; 
  integrationValues.userId = ""; 
  integrationValues.isGuest = true/false; 
  integrationValues.decoMethodCodes = "default"; 
  // Launch Artifi 
  Artifi.initialize(integrationValues); 

Parameter Details

Parameter 

Required 

Type 

Description 

sku 

Yes 

String 

Product code/SKU identifier mapped in Artifi 

websiteId 

Yes 

String 

Unique website identifier 

webApiclientKey 

Yes 

String 

API client key provided by Artifi 

userId 

Yes 

String 

Logged-in or guest user identifier. A unique identifier representing the user interacting with the Artifi application. This can be either a logged-in user ID or a guest user identifier. 

isGuest 

Yes 

Boolean 

Indicates if the user is a guest 

decoMethodCodes 

No 

String 

Decoration method codes applicable to the product 

 

Step 2:  Integrate the component

<div id="artifi-user-image-component"  data-view-code="" data-add-widget=""

data-onsuccess="onSuccessHandler" data-onerror="handleUploadError" > 

</div> 

<div id="artifi-clipart-component" data-view-code="" data-add-widget=""

data-onsuccess="onSuccessHandler" data-onerror="handleUploadError" >

</div>

Step 3: User Customizes the Product

The user performs one or more of the following actions:

  • Add/update a text widget
  • Adds clipart/logo
  • Uploads an image

Step 4: Methods to get widget details

Artifi provides a method that contains the widget details which is required to call the GetImage API. The eCommerce application reads the widget details received from the method and get previewImage from GetImage API.

Method details

function handleUploadSuccess(data) {

  console.log("Success",data);

}

function handleUploadError (data) {

  console.log("Error",data);

}

Step 6: Call GetImage API & get Customized Image

The application constructs the widget parameter payload and sends it to the GetImage API. Artifi generates and returns the customized product image based on the supplied widget parameters. For more information about GetImage integration, refer to the documentation here.

GetImage API Example

{DomainName}/Designer/Image/GetImage?websiteId={websiteId}&webApiClientKey={webApiClientKey}&sku={Artifi Product SKU}&parameters=[ 
  { 
    "type":"textbox", 
    "widget_key":"CL_Text", 
    "text":"DJP", 
    "fill":"#951357", 
    "fontFamily":"Impact", 
    "fontWeight":"normal", 
    "vAlign":"middle", 
    "left":200.29, 
    "top":200.44, 
    "width":200.96, 
    "height":164.48, 
    "dm_code":"DE" 
  }, 
  { 
    "type":"image", 
    "src":" Amla logo New Standard.png ", 
    "widget_key":"CR_Image", 
    "left":200.29, 
    "top":200.44, 
    "width":200.96, 
    "height":164.48, 
    "dm_code":"DE" 
  }] 

Widget Parameter Details

Text Widget

The following properties can be supplied for text personalization:

Parameter 

Description 

type 

Widget type (textbox) 

widget_key 

Widget identifier 

text 

User-entered text 

fill 

Text color 

fontFamily 

Font family 

fontWeight 

Font style/weight 

vAlign 

Vertical alignment 

left 

X position 

top 

Y position 

width 

Widget width 

height 

Widget height 

dm_code 

Decoration method code 

Image Widget

The following properties can be supplied for image personalization:

Parameter 

Description 

type 

Widget type (image) 

src 

Image source reference 

widget_key 

Widget identifier 

left 

X position 

top 

Y position 

width 

Widget width 

height 

Widget height 

dm_code 

Decoration method code 

Important Notes

Clipart Images

When a user selects or changes a clipart/logo:

  • The corresponding clipart code must be passed in the src parameter.
  • Artifi will use the supplied clipart code to render the selected logo within the generated image.

User Uploaded Images

When a user uploads an image:

  • The unique image name returned by Artifi must be supplied in the src parameter.
  • The filename should include its extension.
  • Artifi will use the uploaded image when generating the customized product preview.

Use Case 2: Integration without Artifi Component

In this approach, the eCommerce platform manages the entire customization experience using its own UI components instead of the Artifi customization component.

Since personalization is performed outside Artifi, uploaded images must first be migrated to the Artifi platform before they can be used in image generation.

Workflow

Step 1: User Personalizes Product

The user interacts with custom eCommerce UI components such as:

  • Custom text fields
  • Custom image upload 

Step 2: Upload Image to Artifi

If the user uploads an image, the eCommerce application must call the Upload Image API to transfer the image to Artifi. For more information about Upload Image API, refer to the documentation here.    

The Upload Image API allows users to upload images into the Artifi system for use in product personalization workflows.

Typical use cases include:

  • Custom product designs
  • User-uploaded artwork
  • Personalized graphics
  • Profile or branding images

After a successful upload:

  • Artifi stores the image.
  • A unique image name is generated.
  • The unique image name is returned in the API response.
  • This unique image name must be supplied to the GetImage API for image rendering.

Step 3: Receive Image Details

After the image is uploaded, the Upload Image API returns the unique image name along with file metadata and other image-related information. The application then uses the returned unique image name together with the user-entered text values to construct the GetImage API request, which is used to generate the personalized product preview.

Step 4: Call GetImage API

The unique image name returned from the Upload Image API must be passed as the src value of the image widget. For more information about GetImage API, refer to the documentation here.

Step 5: Customized Image Returned

Artifi generates and returns the final customized product image.

Updating Text Values

Unlike uploaded images, text values do not require a separate upload process.

Text entered by the user can be passed directly in the GetImage API parameters:

{ 
  "type":"textbox", 
  "widget_key":"CL_Text", 
  "text":"My Custom Text" 
} 

Artifi will render the supplied text directly in the generated product image.

Integration Comparison

Feature 

With Artifi Component 

Without Artifi Component 

Personalization UI 

Managed by Artifi 

Managed by eCommerce 

Widget Events 

Provided by Artifi 

Handled by eCommerce 

Image Upload Handling 

Artifi Component 

Upload Image API Required 

Text Handling 

Event Data 

Direct API Parameters 

Development Effort 

Lower 

Higher 

Custom UI Flexibility 

Limited to Component 

Fully Customizable 


Summary

Artifi's API-driven architecture supports both component-based and fully custom integration approaches. Organizations can choose the implementation strategy that best aligns with their business requirements, customization workflows, and user experience goals.

  • Use Artifi Component Integration for faster implementation and simplified personalization workflows.
  • Use Custom eCommerce Integration when complete control over the user interface and customization experience is required.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.