POST

Documents.View

Return the viewable file URL for a business document (documents.pdf_url) or an uploaded customer file (client_file). Use the document_id from Documents.List / Documents.Add, or a client_file id / hex hash, or file_name.

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

  • Returns Documents information as JSON for the UI.

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.
  • Send document_id from Documents.List / Documents.Add for invoices/receipts/etc. Response output and file_url are the PDF URL.
  • For uploaded customer files (client_file), send document_id/file_id as decimal id or the dashboard hex hash. file_name also works as a direct path/URL.
  • Requires view_files / document_view permission (owners and member admins always allowed).

Required Parameters

No body parameters are required for this function.

Optional Parameters

NameTypeSampleWhat it gives
document_id
post
int650406Business document id from Documents.List, or client_file id. Aliases: file_id, id.
file_id
post
string650406Alias for document_id. May be decimal or dashboard hex client_file hash.
file_name
post
stringhttps://files.example/file.pdfDirect file URL/path when id is not used.

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.View",
    "method": "POST",
    "headers": {
        "Authorization": "Bearer YOUR TOKEN"
    },
    "body": {
        "document_id": "650406"
    },
    "url_user": "https:\/\/{user}.bull36.com\/app\/Documents.View",
    "url_domain": "https:\/\/{domain}\/app\/Documents.View"
}

Endpoint

POST /app/Documents.View
POST https://{user}.bull36.com/app/Documents.View
POST https://{domain}/app/Documents.View

Sample Output

{
    "success": 1,
    "output": "https:\/\/files.biz1.co.il\/biz1upload\/invoice_docs\/invoice-650406.pdf",
    "type": "pdf",
    "file_url": "https:\/\/files.biz1.co.il\/biz1upload\/invoice_docs\/invoice-650406.pdf",
    "document_id": 650406,
    "source": "documents"
}

JavaScript Example

const token = 'YOUR TOKEN';
const body = new URLSearchParams({ document_id: '650406' });
const res = await fetch('/app/Documents.View', { method: 'POST', headers: { Authorization: 'Bearer ' + token }, body });
const data = await res.json();
console.log(data.file_url || data.output);

Error Example

{
    "success": 0,
    "message": "Document not found"
}