Publishing to the Cloud
Publish and generate documents from your document templates using the API
Prerequisites
First, ensure you have the latest version of the htmldocs CLI installed:
This command installs or updates the CLI globally on your system.
If you haven’t already, run the following command to create a new htmldocs project:
Authentication
Before publishing, you’ll need to authenticate with the htmldocs cloud platform:
This command will open a browser window where you can:
- Select your team
- Complete the authentication process
- Store your credentials securely for future use
Publishing Templates
Once authenticated, you can publish your document templates using the publish
command:
Make sure your template has a unique documentId
defined before publishing:
Generating Documents via API
After publishing, you can generate documents using the REST API. First, obtain an API key from the Dashboard.
API Authentication
Include your API key in requests using the Bearer token format:
API keys are scoped to your team and provide access only to documents owned by that team.
Making API Requests
To generate a document, send a POST request to the generation endpoint with your document variables:
Replace {documentId}
with your template’s document ID (e.g., “invoice”).
Managing Published Templates
You can view and manage your published templates in the Dashboard, where you can:
- View all published templates
- Get document IDs
- Manage API keys
- Monitor usage
- View generation history