POST
Documents.Send
Send an existing documents row PDF to the customer by email, WhatsApp, or SMS. Same as the dashboard document modal icons (email / WhatsApp / SMS) that call Collapse::send_pdf_to_social_media. Uses the document pdf_url and customer contact details; WhatsApp may return a wa.me link in whatsapp_link / data.
Permissions
- User must be logged in with a valid bearer token.
- The user must be from the same company domain as the request Host (call the API on that account subdomain or allowed custom domain). A token from another company returns success=0, error user_not_in_company.
- Returned or changed records are limited by the user permissions, team access, folder access, and account settings.
Action
- Runs the Documents.Send function and returns JSON.
Push Service
No push is sent because this function only reads data or returns helper information.
Automation
No automation is run for this function.
Special Instructions
- On a company subdomain (e.g. https://{user_domain}.bull36.com) the user must match that Host — Login and protected APIs reject another company with success=0, error user_not_in_company. On a main brand host (bull36.com, biz1.co.il, mastrocrm.com, …) the company domain gate is skipped.
- Staff bearer token only.
- Required: document_id and data_share_to (email | whatsapp | sms). Aliases for channel: share_to, channel, send_via, via.
- Optional: cust_id, invoice_setting_id, data_url/pdf_url (defaults from the document row), data_type (e.g. newspaper).
- If PDF is still generating, response is success=0 with a wait message (same as dashboard).
- For WhatsApp, when data.mobile and data.text are returned, open whatsapp_link (or build wa.me yourself) — same as the dashboard.
- Creating a document with send_email/send_whatsapp on Documents.Add is separate; this route resends an already-created document.
Required Parameters
| Name | Type | Sample | Explanation |
|---|---|---|---|
document_idpost | int | 1627 | documents.id. Aliases: id, inid. |
data_share_topost | string | email | Channel: email, whatsapp, or sms. Aliases: share_to, channel, send_via, via. |
Optional Parameters
| Name | Type | Sample | What it gives |
|---|---|---|---|
cust_idpost | int | 121 | Customer id. Defaults to documents.cust_id. Alias: customer_id. |
invoice_setting_idpost | int | 5 | Company / invoice settings id. Defaults from the document. |
data_urlpost | string | biz1upload/invoice_docs/file.pdf | PDF path or full URL. Defaults to documents.pdf_url. Alias: pdf_url. |
data_typepost | string | | Optional label override (e.g. newspaper), same as dashboard. |
Authentication
Send the bearer token returned by Login in the request header. The user must be from the same company domain as this Host — a token from another company is rejected (user_not_in_company).
Authorization: Bearer YOUR TOKEN
Sample Request
{
"url": "\/app\/Documents.Send",
"method": "POST",
"headers": {
"Authorization": "Bearer YOUR TOKEN"
},
"body": {
"document_id": "1627",
"data_share_to": "email"
},
"url_user": "https:\/\/{user}.bull36.com\/app\/Documents.Send",
"url_domain": "https:\/\/{domain}\/app\/Documents.Send"
}Endpoint
POST /app/Documents.Send
POST https://{user}.bull36.com/app/Documents.Send
POST https://{domain}/app/Documents.SendSample Output
{
"success": 1,
"message": "Success",
"document_id": 1627,
"data_share_to": "email"
}JavaScript Example
const token = 'YOUR TOKEN';
const body = new URLSearchParams();
body.set('document_id', '1627');
body.set('data_share_to', 'email');
const res = await fetch('/app/Documents.Send', {
method: 'POST',
headers: { Authorization: `Bearer ${token}` },
body
});
const data = await res.json();
console.log(data);Error Example
{
"success": 0,
"message": "Document is generating. wait a moment..!"
}