Documentd API

Deliver documents from your own systems

Use the Documentd API to send documents directly from CRMs, billing systems, onboarding flows and internal business applications.

1

Simple workflow

Prepare the message, attach documents, then deliver everything into the customer’s secure document space.

2

Built for automation

Trigger document delivery from CRMs, billing systems, onboarding flows, case management tools or internal workflows.

3

Secure by design

Use JWT authentication, company API IDs and controlled document delivery with secure customer access.

Authorization

Each API request must include your company API ID and a valid JWT.

Headers
Content-Type: application/json
SP-Company-Api-Id: <company id>
Authorization: Bearer <token>
Key generation
openssl genrsa -out privatejwt.key 2048
openssl rsa -in privatejwt.key -pubout -out publicjwt.key

Using the API

For messages with attachments:

  1. Prepare message
  2. Attach documents
  3. Deliver or send
POST

Prepare Message

Prepare a message before attaching files.

Endpoint

https://api.stayprivate.com/1.0/emails/prepare

Request body

Field Status Description
senderEmail required Sender email
emailSubject optional Subject
Success response
{"success": true}
cURL example
curl -X POST https://api.stayprivate.com/1.0/emails/prepare
Error response
{"success": false, "error": {"code": <the error code>, "message": <the error message>}}
POST

Attach Document

Upload a document.

Endpoint

https://api.stayprivate.com/1.0/emails/<emailRef>/attachments/upload

Request body

Field Status Description
emailAttachment required File
Success response
{"success": true}
cURL example
curl -X POST https://api.stayprivate.com/1.0/emails/<emailRef>/attachments/upload
Error response
{"success": false, "error": {"code": <the error code>, "message": <the error message>}}
POST

Deliver Message

Deliver documents into the customer vault.

Endpoint

https://api.stayprivate.com/1.0/emails/<emailRef>/deliver

Request body

Field Status Description
emailToList required Recipients
Success response
{"success": true}
cURL example
curl -X POST https://api.stayprivate.com/1.0/emails/<emailRef>/deliver
Error response
{"success": false, "error": {"code": <the error code>, "message": <the error message>}}
POST

Send Message

Send a secure message that the recipient can reply to.

Endpoint

https://api.stayprivate.com/1.0/emails/<emailRef>/send

Request body

Field Status Description
emailToList required Recipients
Success response
{"success": true}
cURL example
curl -X POST https://api.stayprivate.com/1.0/emails/<emailRef>/send
Error response
{"success": false, "error": {"code": <the error code>, "message": <the error message>}}