The original extension-import and extension-export packages for Tiptap provide reliable methods to import and export DOCX files.
These extensions, and associated endpoints remain available to anyone with a Tiptap account but are no longer actively developed.
They will be officially sunset later in 2025 and replaced by the new Tiptap Conversion extensions and services.
The following guide focuses on configuring the legacy extensions.
Import legacy extension
Legacy Import Extension Deprecation
The extension-import package will no longer be supported later 2025. Please plan to migrate to our newer solutions or alternative endpoints before then to ensure uninterrupted service.
// Start with importing the extensionimport { Import } from'@tiptap-pro/extension-import'const editor = newEditor({
// ...extensions: [
// ...Import.configure({
// The Convert App-ID from the Convert settings page: https://cloud.tiptap.dev/convert-settingsappId: 'your-app-id',
// The JWT token you generated in the previous steptoken: 'your-jwt',
// The URL to upload images to, if not provided, images will be stripped from the documentimageUploadCallbackUrl: 'https://your-image-upload-url.com',
// Enables the experimental DOCX import which should better preserve content stylingexperimentalDocxImport: true,
}),
],
})
Import your first document
// The most simple way to import a file// This will import the uploaded file, replace the editor content// and focus the editor
editor.chain().focus().import({ file }).run()
Customize the import behavior
// You can also use the onImport callback to customize the import behavior
editor
.chain()
.import({
file,
onImport(context) {
const { setEditorContent, content, error } = context
// add error handlingif (error) {
showErrorToast({ message: error.message })
}
// You could also modify the content before inserting it
content.doc.content.push({ type: 'paragraph', content: [{ type: 'text', text: 'Hello!' }] })
// you can change the loading state of your application for example
isLoading = false// make sure you call the setEditorContent function if you want to run// the default insertion behavior of the extension// setEditorContent()// but since we modified the content, we need to do the insertion manually
editor.commands.setContent(content)
},
})
.focus()
.run()
The JWT token generated from your server via secret
imageUploadCallbackUrl
string
undefined
The URL to upload images to, if not provided, images will be stripped from the document, see more info
experimentalDocxImport
boolean
false
Enables the experimental DOCX import which should better preserve content styling (experimental, and this API may not be completely stable while in alpha), only applies to DOCX files uploaded
Commands
Name
Description
import
Import a file into the editor
import
Arguments
Name
Type
Default
Options
Description
file
File
undefined
Any file
The file to import
format
string
undefined
gfm
Is used for special cases where the format is not clear, for example markdown gfm
onImport
Function
undefined
fn(context)
A callback used to customize the import behavior. The context argument includes information about the content, errors and a setEditorContent function to modify the content
Supported formats
docx - Microsoft Word, Google Docs, OpenOffice, LibreOffice and others
odt - OpenDocument Text format used by OpenOffice, LibreOffice and others
rtf - Rich Text Format used by Microsoft Word, Google Docs and others
Commonmark markdown - Markdown format used by various editors and platforms
GFM markdown - GitHub Flavored Markdown used by GitHub
Caveats and limitations
Image upload - Images are assumed to be inline within the document so, your editor should be setup with Image.configure({ inline: true }) to display them correctly, otherwise they will be stripped from the document
Unsupported docx elements on import - Importing docx files currently does not support page breaks, page headers and footers, horizontal rules or text styles
Content added via suggestion mode - Content added via suggestion mode is not included in the imported prosemirror document
PDF import & export - Importing and exporting PDF files is not yet supported
Inline styles - Inline styles are currently not parsed and are not available in import & export
Export legacy extension
Legacy Export Extension Deprecation
The extension-export package will no longer be supported later 2025. We strongly recommend transitioning to our updated export extension, which offer improved customization and ongoing support.
// Start with importing the extensionimport { Export } from'@tiptap-pro/extension-export'const editor = newEditor({
// ...extensions: [
// ...Export.configure({
// The Convert App-ID from the convert settings page: https://cloud.tiptap.dev/convert-settingsappId: 'your-app-id',
// The JWT token you generated in the previous steptoken: 'your-jwt',
}),
],
})
Export a document
// Do a simple export to docx// Supported formats: docx, odt, md and gfm
editor.chain().focus().export({ format: 'docx' }).run()
Customize the export behavior
// You can also use the onExport callback to customize the export behavior
editor.chain().export({
format: 'docx',
onExport(context) {
const { blob, error, download, filename } = context
// add error handlingif (error) {
showErrorToast({ message: error.message })
}
// you can change the loading state of your application for example
isLoading = false// you could modify the filename or handle the blob differently here// but we will keep them as they are// you can trigger a download directly by calling the download methoddownload()
// keep in mind that the download method will only work in the browser// and if the blob and filename was changed before must be managed manually
},
})
The JWT token generated from your server via secret
Commands
Name
Description
export
Export the editor content
export
Arguments
Name
Type
Default
Options
Description
format
string
undefined
docx,odt,md,gfm
The format you want to export to
content
JSONContent
undefined
Any Tiptap JSON
The Tiptap JSON content you want to export
onExport
Function
undefined
fn(context)
A callback used to customize the export behavior. The context argument includes information about the blob, filename, errors and a download function to download the document directly
Supported formats
docx - Microsoft Word, Google Docs, OpenOffice, LibreOffice and others
odt - OpenDocument Text format used by OpenOffice, LibreOffice and others
Commonmark markdown - Markdown format used by various editors and platforms
GFM markdown - GitHub Flavored Markdown used by GitHub
Caveats and limitations
Custom Node exports - Exporting custom nodes or marks is supported in the new Conversion extensions and endpoints.
Custom docx templates - Review our new Conversion extensions and endpoints to integrate docx templates.
PDF import & export - Exporting PDF files is not yet supported
Inline styles - Review our new Conversion extensions and endpoints to integrate inline styles.
Legacy REST API
Legacy /v1/ Conversion REST API Deprecation
The /v1/ Document Conversion REST API will not be supported later 2025. For continued updates and maintenance, migrate to newer API endpoints or check out our Postman Collection for the latest resources.
The legacy document conversion API supports DOCX, ODT, and Markdown conversion from and to Tiptap’s JSON format.
/import endpoint
The /import endpoint enables the conversion of docx, odt, or markdown files into Tiptap’s JSON format. Users can POST documents to this endpoint and use various parameters to customize how different document elements are handled during the conversion process.
Method: POST
Required headers
Name
Description
Authorization
The JWT token to authenticate the request. Example: Bearer your-jwt-token
The callback endpoint to upload images that were encountered within the uploaded document, see more info
Query parameters
Specify how source document elements are mapped to ProseMirror nodes or marks, and adjust the conversion to meet your specific styling and structural preferences.
Name
Default
Description
paragraph
paragraph
Defines which prosemirror type is used for paragraph conversion
heading
heading
Defines which prosemirror type is used for heading conversion
blockquote
blockquote
Defines which prosemirror type is used for blockquote conversion
codeblock
codeblock
Defines which prosemirror type is used for codeblock conversion
bulletlist
bulletlist
Defines which prosemirror type is used for bulletList conversion
orderedlist
orderedlist
Defines which prosemirror type is used for orderedList conversion
listitem
listitem
Defines which prosemirror type is used for listItem conversion
hardbreak
hardbreak
Defines which prosemirror type is used for hardbreak conversion
horizontalrule
horizontalrule
Defines which prosemirror type is used for horizontalRule conversion
table
table
Defines which prosemirror type is used for table conversion
tablecell
tablecell
Defines which prosemirror type is used for tableCell conversion
tableheader
tableheader
Defines which prosemirror type is used for tableHeader conversion
tablerow
tablerow
Defines which prosemirror type is used for tableRow conversion
bold
bold
Defines which prosemirror mark is used for bold conversion
italic
italic
Defines which prosemirror mark is used for italic conversion
underline
underline
Defines which prosemirror mark is used for underline conversion
strikethrough
strike
Defines which prosemirror mark is used for strikethrough conversion
link
link
Defines which prosemirror mark is used for link conversion
code
code
Defines which prosemirror mark is used for code conversion
image
image
Defines which prosemirror mark is used for image conversion
/import-docx endpoint (experimental)
The /import-docx endpoint enables the conversion of docx files into Tiptap's JSON format and allows for more docx-specific functions than the /import endpoint. Users can POST documents to this endpoint and use various parameters to customize how different document elements are handled during the conversion process.
Method: POST
Required headers
Name
Description
Authorization
The JWT token to authenticate the request. Example: Bearer your-jwt-token
The callback endpoint to upload images that were encountered within the uploaded document, see more info
Query parameters
Specify how source document elements are mapped to ProseMirror nodes or marks, and adjust the conversion to meet your specific styling and structural preferences.
Name
Default
Description
paragraph
paragraph
Defines which prosemirror type is used for paragraph conversion
heading
heading
Defines which prosemirror type is used for heading conversion
blockquote
blockquote
Defines which prosemirror type is used for blockquote conversion
codeblock
codeblock
Defines which prosemirror type is used for codeblock conversion
bulletlist
bulletlist
Defines which prosemirror type is used for bulletList conversion
orderedlist
orderedlist
Defines which prosemirror type is used for orderedList conversion
listitem
listitem
Defines which prosemirror type is used for listItem conversion
hardbreak
hardbreak
Defines which prosemirror type is used for hardbreak conversion
horizontalrule
horizontalrule
Defines which prosemirror type is used for horizontalRule conversion
table
table
Defines which prosemirror type is used for table conversion
tablecell
tablecell
Defines which prosemirror type is used for tableCell conversion
tableheader
tableheader
Defines which prosemirror type is used for tableHeader conversion
tablerow
tablerow
Defines which prosemirror type is used for tableRow conversion
bold
bold
Defines which prosemirror mark is used for bold conversion
italic
italic
Defines which prosemirror mark is used for italic conversion
underline
underline
Defines which prosemirror mark is used for underline conversion
strikethrough
strike
Defines which prosemirror mark is used for strikethrough conversion
link
link
Defines which prosemirror mark is used for link conversion
code
code
Defines which prosemirror mark is used for code conversion
image
image
Defines which prosemirror mark is used for image conversion
/export endpoint
The /export endpoint converts Tiptap documents back into formats like docx, odt, or markdown.
Method: POST
Convert a Tiptap document to a different format.
Required headers
Name
Description
Authorization
The JWT token to authenticate the request. Example: Bearer your-jwt-token