Getting started with DocLab
Getting started with DocLab
Start with a fixed sample, then use your own template when you are ready.
Try the web workbench
- Open Cloudwell DocLab.
- Choose a public sample template and fill in its declared fields. The public demo uses five server-owned templates; it does not accept uploads or API keys.
- Choose the native document format, or PDF if the API advertises an available renderer.
- Generate and download the result.
Office preview for canned samples may be selected by default when available. Choose download-only if you do not want Microsoft Office’s online viewer to receive the generated content. See preview privacy.
Use your own template
- Sign in to the private workspace with your organizational Microsoft account in a configured deployment. Your tenant’s consent policy may require administrator approval.
- Obtain an active tenant API key from the API Keys page, or from your API operator if self-service keys are not enabled.
- Connect the workspace to the intended DocLab API using that key.
- Upload a supported DOCX, XLSX, or fillable PDF template within the size limits.
- Inspect its fields, supply values using the discovered names and groups, and generate the document.
Sign-in and document API authentication are separate steps. Do not paste a Microsoft ID token into the API-key field. See authentication.
Generate through the API
You need an API origin, an authorized key with documents.read and documents.generate, and a Word template containing a named CustomerName field.
1. Inspect the template
This PowerShell example prompts for the API origin and key instead of embedding credentials. Run it from the folder containing your template.
$apiBase = (Read-Host "DocLab API origin, for example https://your-api.example").TrimEnd("/")
$secureKey = Read-Host "DocLab API key" -AsSecureString
$apiKey = [System.Net.NetworkCredential]::new("", $secureKey).Password
try {
$templateBase64 = [Convert]::ToBase64String(
[IO.File]::ReadAllBytes((Join-Path $PWD "template.docx"))
)
$inspectBody = @{
template = @{ contentBase64 = $templateBase64; format = "Docx" }
} | ConvertTo-Json -Depth 32
$inspection = Invoke-RestMethod `
-Uri "$apiBase/api/v1/templates/inspect" `
-Method Post `
-Headers @{ "X-Api-Key" = $apiKey } `
-ContentType "application/json" `
-Body $inspectBody
$inspection
# Use a field name returned by inspection in the next request.
$body = @{
template = @{ contentBase64 = $templateBase64; format = "Docx" }
options = @{
outputFormat = "Docx"
delivery = "Binary"
disposition = "Attachment"
fileName = "invoice"
missingFields = "Preserve"
fields = @(
@{ name = "CustomerName"; kind = "Text"; text = "Cloudwell" }
)
}
} | ConvertTo-Json -Depth 32
Invoke-WebRequest `
-Uri "$apiBase/api/v1/documents/generate" `
-Method Post `
-Headers @{ "X-Api-Key" = $apiKey } `
-ContentType "application/json" `
-Body $body `
-OutFile "invoice.docx"
}
finally {
$apiKey = $null
$secureKey.Dispose()
}
2. Check the output
Open invoice.docx and verify the replacement, formatting, and any repeating content. Replace CustomerName in the example with your actual inspected field name. Inspection does not decide which fields your business requires.
The example runs inspection and generation together. Each admitted inspection or generation can consume a credit when usage enforcement is enabled. To review inspection first, run only that request before preparing the generation request.
Never print request headers, commit keys, or include credentials or document contents in a support request. A secure prompt avoids command-history exposure but does not remove the need to protect the running process.
Next steps
- Design templates and repeating fields.
- Explore all API routes and request shapes.
- Choose download, JSON, or preview delivery.