npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

esign-api-js

v1.0.0

Published

Unofficial JavaScript SDK for Mekari eSign API. Manage documents, signings, e-meterai, and eKYC easily.

Readme

Mekari eSign API JS SDK (Unofficial)

Note: This is an unofficial SDK and is not affiliated with or supported by Mekari.

The esign-api-js SDK is a JavaScript library that provides a convenient way to interact with the Mekari eSign API. It simplifies the process of integrating eSign functionality into your JavaScript/Node.js applications.

With this SDK, you can easily manage documents, signatures, e-meterai, eKYC, and user profiles.

Installation

Install the SDK via npm:

npm install esign-api-js

Initialization

You can initialize the SDK with either OAuth2 (for user-based apps) or HMAC (for server-to-server integration).

Option 1: OAuth2 Authentication (Default)

Suitable for applications where users log in to Mekari eSign to grant access.

const { eSignAPi } = require('esign-api-js');

const client = new eSignAPi({
    clientId: 'YOUR_CLIENT_ID',
    clientSecret: 'YOUR_CLIENT_SECRET',
    sandbox: true, // Set to false for production
    // authType: 'oauth' // Default
});

Option 2: HMAC Authentication

Suitable for backend services where you sign requests with your credentials directly.

const { eSignAPi } = require('esign-api-js');

const client = new eSignAPi({
    clientId: 'YOUR_CLIENT_ID',
    clientSecret: 'YOUR_CLIENT_SECRET',
    sandbox: true,
    authType: 'hmac' // REQUIRED for HMAC
});

Authentication (OAuth Only)

If using OAuth, you need to obtain an accessToken first.

  1. Generate Auth URL: Redirect user to this URL to login.

    const authUrl = client.auth.authUrl();
    console.log('Login URL:', authUrl);
  2. Exchange Code for Token: After login, use the returned code to get an access token.

    const response = await client.auth.requestAuthToken('CODE_FROM_CALLBACK');
    const accessToken = response.access_token;

Note: For HMAC, you don't need to manage access tokens manually; authentication headers are generated automatically per request.


Usage Examples

1. User Profile & Quota

Check user information and remaining balance (e-meterai quota).

const profile = await client.profile.getProfile(accessToken);
console.log('Balance:', profile.data.remaining_emeterai_balance);

2. Document Management

Create & Request Sign (Global)

const document = await client.documents.createGlobalDocument(accessToken, {
  doc: 'base64_encoded_pdf_string...', // Base64 string of the PDF
  filename: 'contract.pdf',
  signers: [
    {
      name: 'John Doe',
      email: '[email protected]',
      annotations: [
        {
          page: 1,
          type_of: 'signature',
          position_x: 100,
          position_y: 100,
          canvas_width: 595,
          canvas_height: 842,
          element_width: 100,
          element_height: 50
        }
      ]
    }
  ],
  signing_order: false,
  callback_url: 'https://your-webhook.com/callback'
});

List Documents

const docs = await client.documents.getAll({
  page: 1,
  limit: 10,
  signing_status: 'waiting' // optional: waiting, signed, rejected
}, accessToken);

List Documents in Folder

const folderDocs = await client.documents.getAllInFolder('folder_id_123', {
  page: 1, 
  limit: 10
}, accessToken);

Get Document Detail

const doc = await client.documents.getById('document_id_123', accessToken);

Download Document

const result = await client.documents.downloadDocument('document_id_123', accessToken);
// Returns download URL or content depending on API response

Void, Resend, or Delete

// Void
await client.documents.voidDocument('document_id_123', 'Reason for voiding', accessToken);

// Resend Notification
await client.documents.resendDocument('document_id_123', accessToken);

// Delete
await client.documents.deleteDocument('document_id_123', accessToken);

3. Advanced Features

Bulk Sign

Sign multiple envelopes/documents at once.

await client.documents.bulkSign({
  envelope_ids: ['doc_id_1', 'doc_id_2'],
  signature_base64: 'base64_image_of_signature...'
}, accessToken);

Annotation Placement

Place stamps/signatures on an existing document.

await client.documents.annotationPlacement('document_id_123', {
  base64_doc: 'base64_string...',
  filename: 'stamped.pdf',
  signers: [ ... ] // similar structure to createGlobalDocument
}, accessToken);

4. eKYC (Identity Verification)

Request eKYC

const ekycRequest = await client.ekyc.requestEkyc({
  param1: 'value', // Refer to API docs for required eKYC params
  // ...
}, accessToken);

Check eKYC Status

const status = await client.ekyc.getEkycStatus('[email protected]', 1, 10, accessToken);

5. Stamping (e-Meterai)

Directly stamp a document with e-meterai.

await client.stamping.stamp({
  doc: 'base64_pdf...',
  filename: 'doc.pdf',
  annotation: {
    page: 1,
    position_x: 100,
    position_y: 100,
    canvas_width: 595,
    canvas_height: 842
  }
}, accessToken);

Disclaimer

This SDK is an unofficial library and is not directly supported by or affiliated with Mekari. It is developed by the community for the community. Use it at your own risk.

License

This project is licensed under the MIT License. You are free to use, modify, and distribute this software. Contributions are welcome!