Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time
July 4, 2020 18:23
September 11, 2022 21:08
February 20, 2021 12:49
July 21, 2018 13:35
July 21, 2018 13:35
July 21, 2018 13:35
September 11, 2022 21:02
July 21, 2018 13:35
July 21, 2018 13:35
September 22, 2022 09:11
September 11, 2022 21:13

ConvertAPI Node.js Client

npm version Build Status License: MIT

Convert your files with our online file conversion API

The ConvertAPI helps in converting various file formats. Creating PDF and Images from various sources like Word, Excel, Powerpoint, images, web pages or raw HTML codes. Merge, Encrypt, Split, Repair and Decrypt PDF files and many other file manipulations. You can integrate it into your application in just a few minutes and use it easily.


Node.js v6.0 and later.


npm install convertapi --save


The package needs to be configured with your account's secret key which is available at

Require it with the key's value:

var convertapi = require('convertapi')('your-api-secret');

Or using ES modules:

import ConvertAPI from 'convertapi';

const convertapi = new ConvertAPI('your-api-secret');

You can specify additional options, like proxy configuration and timeouts, when initializing the client:

var convertapi = require('convertapi')('your-api-secret', {
  conversionTimeout: 60,
  uploadTimeout: 60,
  downloadTimeout: 60,
  proxy: {
    host: '',
    port: 9000,
    auth: {
      username: 'testuser',
      password: 'secret'

If using ES module:

const convertapi = new ConvertAPI('your-api-secret', { conversionTimeout: 60 });

File conversion

Convert file to PDF example. All supported file formats and options can be found here.

convertapi.convert('pdf', { File: '/path/to/my_file.docx' })
  .then(function(result) {
    // get converted file url
    console.log("Converted file url: " + result.file.url);

    // save to file
  .then(function(file) {
    console.log("File saved: " + file);
  .catch(function(e) {

Other result operations:

// save all result files to folder
result.saveFiles('/path/to/save/files').then(function(files) {
  console.log("Files saved: " + files);

// get conversion cost
console.log("Conversion cost: " + result.conversionCost);

Convert file url

var resultPromise = convertapi.convert('pdf', { File: 'https://website/my_file.docx' });

Specifying from format

var resultPromise = convertapi.convert('pdf', { File: 'https://website/my_file' }, 'docx');

Additional conversion parameters

ConvertAPI accepts additional conversion parameters depending on selected formats. All conversion parameters and explanations can be found here.

var resultPromise = convertapi.convert(
    File: '/path/to/my_file.docx',
    PageRange: '1-10',
    PdfResolution: '150',

User information

You can always check your remaining seconds amount programmatically by fetching user information.

convertapi.getUser().then(function(info) {
  console.log("Seconds left: " + info.SecondsLeft);

Error handling

  .convert('pdf', { File: 'https://website/my_file.docx' })
  .catch(function(e) {

More examples

Find more advanced examples in the examples/ folder.

Development Commands

  • npm run clean - Remove the lib/ directory
  • npm test - Run tests with linting and coverage results.
  • npm run test:only - Run tests without linting or coverage.
  • npm run test:watch - You can even re-run tests on file changes!
  • npm run test:prod - Run tests with minified code.
  • npm run test:examples - Test written examples on pure JS for better understanding module usage.
  • npm run lint - Run ESlint with airbnb-config
  • npm run cover - Get coverage report for your code.
  • npm run build - Babel will transpile ES6 => ES5 and minify the code.
  • npm run prepublish - Hook for npm. Do all the checks before publishing your module.


Bug reports and pull requests are welcome on GitHub at This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.


ConvertAPI Node.js Client is available as open source under the terms of the MIT License.


A Node.js library for the ConvertAPI







No packages published