Uploading a document for e-Meterai stamping

In this guide, we'll introduce you to integrating e-Meterai stamping into your applications. We'll cover securely uploading documents, designating signers with legal binding power, and streamlining the stamping process using our API.

Prerequisites

  • Signer/viewer email address or addresses: who needs to sign a document.

  • Role: the role of the user. Signing user should use the role signer, while viewing user should use the role viewer.

  • Order: an integer that defines the order of signing in a document.

  • Parallel: an integer to mark whether the signing of the document can be done in parallel. 0 for non-parallel signing, 1 for parallel signing.

Fetching signers

TBD

curl --location 'https://api-platform.momofin.com/api/v1/auth/list_user' \
--header 'X-Access-Token: $ACCESS_TOKEN'
{
  "code": 200,
  "data": {
    "user": [
      {
        "id": "98dfdec0-ea6c-11ee-bf51-dd5edb44a4c5",
        "name": "John Doe",
        "email": "john.doe@momofin.com",
        "avatar": "https://ui-avatars.com/api/?background=random"
      }
    ],
    "pagination": {
      "total_data": 1,
      "total_page": 1,
      "total_display": 1,
      "first_page": false,
      "last_page": false,
      "prev": 0,
      "current": 1,
      "next": 0,
      "limit": 10,
      "detail": []
    }
  }
}

Upload document and assign signers

You can upload a document using the Upload Document API. You can request signature from a registered Momofin user or a guest user (an unregistered user). Registered signer/viewer in Momofin platform should be mapped to the signer object, while guest signer/viewer should be assigned with the guest object. Upload API currently supports .pdf, .doc, and .docx format. You can try this request in your terminal to upload a document and assign signers:

curl --location 'https://api-platform.momofin.com/api/v1/econtract/momofingo/sign/upload-docs' \
--header 'X-Access-Token: $ACCESS_TOKEN' \
--form 'document_title="Signing Contract"' \
--form 'filename="Signing Contract"' \
--form 'files=@/path/to/your/document/signing-contract.pdf"' \
--form 'guest[0][name]="Mary Land"' \
--form 'guest[0][email]="mary.land@xyz.com"' \
--form 'guest[0][role]="viewer"' \
--form 'guest[0][number]="2"' \
--form 'signer[0][id]="98dfdec0-ea6c-11ee-bf51-dd5edb44a4c5"' \
--form 'signer[0][name]="John Doe"' \
--form 'signer[0][email]="john.doe@xyz.com"' \
--form 'signer[0][role]="signer"' \
--form 'signer[0][number]="1"' \
--form 'parallel="0"'

Here, mary.land@xyz.com is the viewer of the document and john.doe@xyz.com is the signer. John will be the first to sign the document. After John signs the document, Mary will be able to view the document.

After making the request, the response will contain a document ID which will be used later when placing the signature field. The document ID can be accessed in response.data.document_id.

{
    "code": 200,
    "success": true,
    "msg": "Berhasil mengunggah dokumen.",
    "response": {
        "data": {
            "document_id": 14082,
            "document_name": "Signing Contract",
            "signer": [
                {
                    "id": "98dfdec0-ea6c-11ee-bf51-dd5edb44a4c5",
                    "name": "John Doe",
                    "email": "john.doe@momofin.com",
                    "role": "signer",
                    "number": "1",
                    "is_guest": false
                },
                {
                    "id": "a881daf0-0226-11ef-8bd3-49fa1f9c6589",
                    "name": "Darell",
                    "email": "darell.hoei@momofin.com",
                    "role": "viewer",
                    "number": "2",
                    "is_guest": 1,
                    "document_code": "61f4051a7dc9b22be30c8e8e0e5c1ed1abc8fed5ef090e2d00443e8fdb7c4d78"
                }
            ]
        }
    }
}

Retain the document_id for later use. This identifier will be referenced in subsequent API calls to specify the location for signature placement within the document.

e-Meterai placement

You can define the exact coordinates and dimensions for signature placement on a designated page of the document. The provided request outlines essential parameters such as signer details, page number, signature box dimensions, and document size, facilitating precise signature positioning.

curl --location 'https://api-platform.momofin.com/api/v1/econtract/momofingo/sign/placement-docs' \
--header 'X-Access-Token: $ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
  "signer": [
    {
      "page": 1,
      "props": {
        "x": 306,
        "y": 396,
        "w": 50,
        "h": 50
      },
      "user": {
        "speciment": "",
        "name": "Mary",
        "email": "mary@xyz.com",
        "userid": "6eae1fa0-f850-11ec-926e-d9207c602237"
      },
      "emet": {
        "urx": 356,
        "ury": 396,
        "llx": 306,
        "lly": 346
      },
      "sign": null,
      "type": "emet",
      "documentSize": {
        "height": 792,
        "width": 612
      }
    }
  ],
  "document_id": 14082
}'

This is a successful response of signature placement.

{
  "code": 200,
  "success": true,
  "msg": "Berhasil mengirimkan dokumen.",
  "response": {
    "data": {
      "document_id": 590386,
      "signer": [
        {
          "page": 1,
          "props": {
            "x": 306,
            "y": 396,
            "w": 50,
            "h": 50
          },
          "user": {
            "speciment": "",
            "name": "Mary",
            "email": "mary@xyz.com",
            "userid": "6eae1fa0-f850-11ec-926e-d9207c602237"
          },
          "emet": {
            "urx": 356,
            "ury": 396,
            "llx": 306,
            "lly": 346
          },
          "sign": null,
          "type": "emet",
          "documentSize": {
            "height": 792,
            "width": 612
          }
        }
      ]
    }
  }
}

Given the above success response, your request to define signer placements has been accepted. The document with signature locations has been prepared. Please note the document ID in response.data.document_id. You will need this ID in the next step to finalize the document for signing.

Finalize e-Meterai stamping

Afterwards, use the document ID from the previous API call to prepare the document for signing by designated individuals:

curl --location 'https://api-platform.momofin.com/api/v1/econtract/momofingo/sign/process-docs' \
--header 'X-Access-Token: $ACCESS_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
    "document_id": 14082
}'

Here's the successful response upon finalizing the document with the placement:

{
    "document_id": 14082
}

The document finalization process has completed successfully.

Downloading the stamped document

Upon completing the stamping process, you are able to use the document ID to download the stamped document:

curl --location 'https://api-platform.momofin.com/api/v1/econtract/momofingo/document/latest-docs/14082' \
--header 'X-Access-Token: $ACCESS_TOKEN'

A successful response will download the document into your filesystem.

Last updated