API References

Setting Options

OptionDefinitionDefault ValueAvailable values
langEditor languageenen, es
categoryTemplates panel main categoryundefinedcategory’s slug
widthTemplate width85Check on limitations
heightTemplate height54Check on limitations
unitMeasurement unitmmpx, mm
formatDownload formatpdfjpeg, png, pdf, mp4
templateIdTemplate id to load by defaultnew-artboardnew-artboard, user template id

initialize(API_KEY: string, options?: EditorOptions)

Setup Wepik’s editor.

wepik.initialize('API_KEY', {
    lang: 'en',
    height: 1000,
    width: 1000,
    unit: 'px',
    format: 'jpeg',
});

open()

Open Wepik’s editor.

wepik.open();

close()

Close Wepik’s editor.

wepik.close();

onClose(callback: () => void)

This option allows you to execute a function when the user clicks on the Close Editor button.

wepik.onClose(() => {
    wepik.close();
});

onPublish(callback: (data: PublishEvent) => void)

PublishEvent

PropertyDescriptionType
eventNameName of the eventstring
urlTemplate download URLstring
templateIdUser template idstring

This option allows you to execute a function when the user clicks on the Continue button.

The link to download the template is available for 24 hours.

wepik.onPublish((event) => alert(event.url));

onAutoSave(callback: (data: AutoSaveEvent) => void)

AutoSaveEvent

PropertyDescriptionType
eventNameName of the eventstring
templateIdUser template idstring

This option allows you to execute a function when we automatically saved the user template.

wepik.onAutoSave((event) => console.log(`Template saved with id: ${event.templateId}`));