Skip to main content

Quick start

This guide signs a document from end to end: your backend uploads the PDF to MobbSign Server, the Web SDK shows it in the browser so the user can sign it, and your backend downloads the signed PDF.

#StepCall
1Upload the documentPOST /documents
2Create the viewernew MobbSign()
3Load the documentload(documentId)
4Download the signed PDFGET /documents/{id}/content
Before you begin

The SDK is installed, and you have the URL of your MobbSign Server environment, an API key and an App ID.

1. Upload the document​

Your backend uploads the PDF, encoded in base64, to MobbSign Server and declares its signers. The response includes the documentId:

Backend
curl -X POST 'https://mobbsign.mobbeel.com/api/v1/documents' \
-H 'API_KEY: YOUR_API_KEY' \
-H 'APP_ID: YOUR_APP_ID' \
-H 'Content-Type: application/json' \
-d '{
"title": "Service contract",
"content": "JVBERi0xLjcKJeLjz9MK…",
"signatureType": "HANDWRITTEN",
"signers": [{"name": "Jane Doe", "rol": "Client"}]
}'

See Add a document in the API reference.

2. Create the viewer​

Create a MobbSign instance. The constructor returns a promise that resolves to the configured instance:

const mobbsign = await new MobbSign({
root: document.getElementById('mobbsign'),
endpoint: 'https://mobbsign.mobbeel.com/api/v1',
apiKey: 'YOUR_API_KEY',
appID: 'YOUR_APP_ID',
language: 'en',
configPath: 'assets/mobbsign/config.js',
libPath: 'assets/mobbsign/lib',
imgUrl: 'assets/mobbsign/assets/img',
localesUrl: 'assets/mobbsign/locales',
onDocumentSigned: () => console.log('Document signed'),
onDone: () => notifyBackend(documentId),
onError: (error) => console.error(error),
});

The paths point to the assets you published. See all the options in Configuration.

Always use the instance from the promise

Call the methods on the instance that the promise resolves to, never on the value returned by new MobbSign().

3. Load the document​

await mobbsign.load(documentId);

The document appears in the viewer. The signer taps Sign, draws their signature, confirms it and taps Finish.

4. Download the signed PDF​

When the signer finishes, onDone is called. Your backend downloads the signed document from MobbSign Server:

Backend
curl 'https://mobbsign.mobbeel.com/api/v1/documents/{documentId}/content' \
-H 'API_KEY: YOUR_API_KEY' \
-H 'APP_ID: YOUR_APP_ID'

The response contains the signed PDF in base64. See Get the document content.

Next step​

Learn how signatures are captured, confirmed and finished in Signing process.