rendering
APITemplate.io CLI for AI Agents
Use the APITemplate.io CLI from KosmoKrator to call APITemplate.io tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.APITemplate.io CLI Setup
APITemplate.io can be configured headlessly with `kosmokrator integrations:configure apitemplateio`.
# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash
# Configure and verify this integration.
kosmokrator integrations:configure apitemplateio --set api_key="$APITEMPLATEIO_API_KEY" --enable --read allow --write ask --json
kosmokrator integrations:doctor apitemplateio --json
kosmokrator integrations:status --json Credentials
Authentication type: API key api_key. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.
| Key | Env var | Type | Required | Label |
|---|---|---|---|---|
api_key | APITEMPLATEIO_API_KEY | Secret secret | yes | API Key |
url | APITEMPLATEIO_URL | URL url | no | API Base URL |
Command Patterns
The generic command is stable across every integration. The provider shortcut is shorter for humans.
kosmo integrations:call apitemplateio.apitemplateio_create_pdf '{"template_id":"example_template_id","data":"example_data","export_type":"example_export_type","output_format":"example_output_format","output_html":true,"expiration":1,"expire":1,"filename":"example_filename"}' --json kosmo integrations:apitemplateio apitemplateio_create_pdf '{"template_id":"example_template_id","data":"example_data","export_type":"example_export_type","output_format":"example_output_format","output_html":true,"expiration":1,"expire":1,"filename":"example_filename"}' --json Discovery
These commands return structured output for coding agents that need to inspect capabilities before choosing a function.
kosmo integrations:docs apitemplateio --json
kosmo integrations:docs apitemplateio.apitemplateio_create_pdf --json
kosmo integrations:schema apitemplateio.apitemplateio_create_pdf --json
kosmo integrations:search "APITemplate.io" --json
kosmo integrations:list --json Automation Contexts
The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.
CLI Functions
Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.
apitemplateio.apitemplateio_create_pdf
Generate a PDF document from an API Template IO template. Provide a template ID and the data to merge into the template.
write - Parameters
- template_id, data, export_type, output_format, output_html, expiration, expire, filename, async, webhook_url, webhook_method, meta
kosmo integrations:call apitemplateio.apitemplateio_create_pdf '{"template_id":"example_template_id","data":"example_data","export_type":"example_export_type","output_format":"example_output_format","output_html":true,"expiration":1,"expire":1,"filename":"example_filename"}' --json kosmo integrations:apitemplateio apitemplateio_create_pdf '{"template_id":"example_template_id","data":"example_data","export_type":"example_export_type","output_format":"example_output_format","output_html":true,"expiration":1,"expire":1,"filename":"example_filename"}' --json apitemplateio.apitemplateio_create_image
Generate PNG and/or JPEG images from an APITemplate.io image template. Provide a template ID and override payload.
write - Parameters
- template_id, overrides, data, output_image_type, output_format, expiration, expire, meta
kosmo integrations:call apitemplateio.apitemplateio_create_image '{"template_id":"example_template_id","overrides":"example_overrides","data":"example_data","output_image_type":"example_output_image_type","output_format":"example_output_format","expiration":1,"expire":1,"meta":"example_meta"}' --json kosmo integrations:apitemplateio apitemplateio_create_image '{"template_id":"example_template_id","overrides":"example_overrides","data":"example_data","output_image_type":"example_output_image_type","output_format":"example_output_format","expiration":1,"expire":1,"meta":"example_meta"}' --json apitemplateio.apitemplateio_create_pdf_from_html
Generate a PDF from raw HTML, optional CSS, dynamic data, and rendering settings.
write - Parameters
- body, css, data, settings, export_type, output_format, expiration, filename, async, webhook_url, webhook_method, meta
kosmo integrations:call apitemplateio.apitemplateio_create_pdf_from_html '{"body":"example_body","css":"example_css","data":"example_data","settings":"example_settings","export_type":"example_export_type","output_format":"example_output_format","expiration":1,"filename":"example_filename"}' --json kosmo integrations:apitemplateio apitemplateio_create_pdf_from_html '{"body":"example_body","css":"example_css","data":"example_data","settings":"example_settings","export_type":"example_export_type","output_format":"example_output_format","expiration":1,"filename":"example_filename"}' --json apitemplateio.apitemplateio_create_pdf_from_url
Generate a PDF by rendering a public URL with optional page settings.
write - Parameters
- url, settings, export_type, output_format, expiration, filename, async, webhook_url, webhook_method, meta
kosmo integrations:call apitemplateio.apitemplateio_create_pdf_from_url '{"url":"example_url","settings":"example_settings","export_type":"example_export_type","output_format":"example_output_format","expiration":1,"filename":"example_filename","async":true,"webhook_url":"example_webhook_url"}' --json kosmo integrations:apitemplateio apitemplateio_create_pdf_from_url '{"url":"example_url","settings":"example_settings","export_type":"example_export_type","output_format":"example_output_format","expiration":1,"filename":"example_filename","async":true,"webhook_url":"example_webhook_url"}' --json apitemplateio.apitemplateio_create_pdf_from_markdown
Generate a PDF from Markdown, optional CSS, dynamic data, and rendering settings.
write - Parameters
- body, css, data, settings, export_type, output_format, expiration, filename, async, webhook_url, webhook_method, meta
kosmo integrations:call apitemplateio.apitemplateio_create_pdf_from_markdown '{"body":"example_body","css":"example_css","data":"example_data","settings":"example_settings","export_type":"example_export_type","output_format":"example_output_format","expiration":1,"filename":"example_filename"}' --json kosmo integrations:apitemplateio apitemplateio_create_pdf_from_markdown '{"body":"example_body","css":"example_css","data":"example_data","settings":"example_settings","export_type":"example_export_type","output_format":"example_output_format","expiration":1,"filename":"example_filename"}' --json apitemplateio.apitemplateio_merge_pdfs
Merge multiple PDF URLs or PDF data URLs into a single PDF.
write - Parameters
- urls, export_type, expiration, cloud_storage, meta, postaction_enabled, postaction_s3_filekey, postaction_s3_bucket
kosmo integrations:call apitemplateio.apitemplateio_merge_pdfs '{"urls":"example_urls","export_type":"example_export_type","expiration":1,"cloud_storage":1,"meta":"example_meta","postaction_enabled":"example_postaction_enabled","postaction_s3_filekey":"example_postaction_s3_filekey","postaction_s3_bucket":"example_postaction_s3_bucket"}' --json kosmo integrations:apitemplateio apitemplateio_merge_pdfs '{"urls":"example_urls","export_type":"example_export_type","expiration":1,"cloud_storage":1,"meta":"example_meta","postaction_enabled":"example_postaction_enabled","postaction_s3_filekey":"example_postaction_s3_filekey","postaction_s3_bucket":"example_postaction_s3_bucket"}' --json apitemplateio.apitemplateio_list_objects
List generated PDFs and images, optionally filtered by template ID, transaction type, or transaction reference.
read - Parameters
- limit, offset, template_id, transaction_type, transaction_ref
kosmo integrations:call apitemplateio.apitemplateio_list_objects '{"limit":1,"offset":1,"template_id":"example_template_id","transaction_type":"example_transaction_type","transaction_ref":"example_transaction_ref"}' --json kosmo integrations:apitemplateio apitemplateio_list_objects '{"limit":1,"offset":1,"template_id":"example_template_id","transaction_type":"example_transaction_type","transaction_ref":"example_transaction_ref"}' --json apitemplateio.apitemplateio_delete_object
Delete a generated PDF or image by transaction reference.
write - Parameters
- transaction_ref
kosmo integrations:call apitemplateio.apitemplateio_delete_object '{"transaction_ref":"example_transaction_ref"}' --json kosmo integrations:apitemplateio apitemplateio_delete_object '{"transaction_ref":"example_transaction_ref"}' --json apitemplateio.apitemplateio_get_current_user
Get APITemplate.io account information for the configured API key, including plan and usage fields returned by the API.
read - Parameters
- none
kosmo integrations:call apitemplateio.apitemplateio_get_current_user '{}' --json kosmo integrations:apitemplateio apitemplateio_get_current_user '{}' --json apitemplateio.apitemplateio_list_templates
List available templates in API Template IO. Returns a paginated list of template IDs, names, and metadata.
read - Parameters
- limit, offset, format, template_id, group_name, with_layer_info
kosmo integrations:call apitemplateio.apitemplateio_list_templates '{"limit":1,"offset":1,"format":"example_format","template_id":"example_template_id","group_name":"example_group_name","with_layer_info":true}' --json kosmo integrations:apitemplateio apitemplateio_list_templates '{"limit":1,"offset":1,"format":"example_format","template_id":"example_template_id","group_name":"example_group_name","with_layer_info":true}' --json apitemplateio.apitemplateio_get_template
Get details for a specific API Template IO template by ID. Returns the template definition, schema, and configuration.
read - Parameters
- template_id
kosmo integrations:call apitemplateio.apitemplateio_get_template '{"template_id":"example_template_id"}' --json kosmo integrations:apitemplateio apitemplateio_get_template '{"template_id":"example_template_id"}' --json apitemplateio.apitemplateio_update_template
Update a PDF template body, CSS, or settings. This uses APITemplate.io experimental template-management API.
write - Parameters
- template_id, body, css, settings
kosmo integrations:call apitemplateio.apitemplateio_update_template '{"template_id":"example_template_id","body":"example_body","css":"example_css","settings":"example_settings"}' --json kosmo integrations:apitemplateio apitemplateio_update_template '{"template_id":"example_template_id","body":"example_body","css":"example_css","settings":"example_settings"}' --json Function Schemas
Use these parameter tables when building CLI payloads without calling integrations:schema first.
apitemplateio.apitemplateio_create_pdf 12 parameters
kosmo integrations:schema apitemplateio.apitemplateio_create_pdf --json | Parameter | Type | Required | Description |
|---|---|---|---|
template_id | string | yes | The template ID to use for PDF generation (e.g., "tpl_abc123"). |
data | object | yes | Key-value pairs to merge into the template placeholders. |
export_type | string | no | Return mode: "json" for a CDN URL or "file" for binary output. Defaults to "json". |
output_format | string | no | Output format: pdf, html, png, or jpeg. Defaults to pdf. |
output_html | boolean | no | If true, returns rendered HTML as an html_url field. |
expiration | integer | no | Minutes until the generated file URL expires. Use 0 to store permanently. |
expire | integer | no | Deprecated alias for expiration. |
filename | string | no | Optional generated filename, usually ending with .pdf. |
async | boolean | no | Generate asynchronously. Requires webhook_url when true. |
webhook_url | string | no | Webhook URL for asynchronous generation callbacks. |
webhook_method | string | no | Webhook method: GET or POST. Defaults to GET. |
meta | string | no | Optional metadata string to attach to the generation request. |
apitemplateio.apitemplateio_create_image 8 parameters
kosmo integrations:schema apitemplateio.apitemplateio_create_image --json | Parameter | Type | Required | Description |
|---|---|---|---|
template_id | string | yes | The template ID to use for image generation (e.g., "tpl_abc123"). |
overrides | array | no | Image object overrides. Each item should include a name and the properties to replace. |
data | object | no | Backward-compatible full image payload. Prefer overrides for new calls. |
output_image_type | string | no | Which image outputs to generate: all, jpegOnly, or pngOnly. Defaults to all. |
output_format | string | no | Deprecated alias: png maps to pngOnly, jpeg maps to jpegOnly. |
expiration | integer | no | Minutes until generated file URLs expire. Use 0 to store permanently. |
expire | integer | no | Deprecated alias for expiration. |
meta | string | no | Optional metadata string to attach to the generation request. |
apitemplateio.apitemplateio_create_pdf_from_html 12 parameters
kosmo integrations:schema apitemplateio.apitemplateio_create_pdf_from_html --json | Parameter | Type | Required | Description |
|---|---|---|---|
body | string | yes | HTML body content. Jinja2 variables can reference keys from data. |
css | string | no | Optional CSS, usually including a style tag. |
data | object | no | Values for dynamic variables in the HTML body. |
settings | object | no | PDF rendering settings such as paper_size, orientation, margins, headers, and footers. |
export_type | string | no | Return mode: json or file. |
output_format | string | no | Output format: pdf, html, png, or jpeg. |
expiration | integer | no | Minutes until generated file URLs expire. |
filename | string | no | Optional generated filename. |
async | boolean | no | Generate asynchronously. Requires webhook_url when true. |
webhook_url | string | no | Webhook URL for asynchronous callbacks. |
webhook_method | string | no | Webhook method: GET or POST. |
meta | string | no | Optional external reference ID. |
apitemplateio.apitemplateio_create_pdf_from_url 10 parameters
kosmo integrations:schema apitemplateio.apitemplateio_create_pdf_from_url --json | Parameter | Type | Required | Description |
|---|---|---|---|
url | string | yes | Public URL to render into a PDF. |
settings | object | no | PDF rendering settings such as paper_size, orientation, margins, headers, and footers. |
export_type | string | no | Return mode: json or file. |
output_format | string | no | Output format: pdf, html, png, or jpeg. |
expiration | integer | no | Minutes until generated file URLs expire. |
filename | string | no | Optional generated filename. |
async | boolean | no | Generate asynchronously. Requires webhook_url when true. |
webhook_url | string | no | Webhook URL for asynchronous callbacks. |
webhook_method | string | no | Webhook method: GET or POST. |
meta | string | no | Optional external reference ID. |
apitemplateio.apitemplateio_create_pdf_from_markdown 12 parameters
kosmo integrations:schema apitemplateio.apitemplateio_create_pdf_from_markdown --json | Parameter | Type | Required | Description |
|---|---|---|---|
body | string | yes | Markdown content. Jinja2 variables can reference keys from data. |
css | string | no | Optional CSS, usually including a style tag. |
data | object | no | Values for dynamic variables in the Markdown body. |
settings | object | no | PDF rendering settings such as paper_size, orientation, margins, headers, and footers. |
export_type | string | no | Return mode: json or file. |
output_format | string | no | Output format: pdf, html, png, or jpeg. |
expiration | integer | no | Minutes until generated file URLs expire. |
filename | string | no | Optional generated filename. |
async | boolean | no | Generate asynchronously. Requires webhook_url when true. |
webhook_url | string | no | Webhook URL for asynchronous callbacks. |
webhook_method | string | no | Webhook method: GET or POST. |
meta | string | no | Optional external reference ID. |
apitemplateio.apitemplateio_merge_pdfs 8 parameters
kosmo integrations:schema apitemplateio.apitemplateio_merge_pdfs --json | Parameter | Type | Required | Description |
|---|---|---|---|
urls | array | yes | PDF URLs or data URLs to merge in order. |
export_type | string | no | Return mode: json or file. |
expiration | integer | no | Minutes until the generated merged PDF URL expires. |
cloud_storage | integer | no | Upload output to APITemplate.io CDN. 1 by default, 0 when BYOS handles storage. |
meta | string | no | Optional external reference ID. |
postaction_enabled | string | no | Enable post actions: 1 or 0. |
postaction_s3_filekey | string | no | Override post-action object key without file extension. |
postaction_s3_bucket | string | no | Override post-action bucket or container. |
apitemplateio.apitemplateio_list_objects 5 parameters
kosmo integrations:schema apitemplateio.apitemplateio_list_objects --json | Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Number of records to return. Defaults to 300 upstream. |
offset | integer | no | Number of records to skip. Defaults to 0 upstream. |
template_id | string | no | Filter generated objects by template ID. |
transaction_type | string | no | Filter by transaction type: PDF, JPEG, or MERGE. |
transaction_ref | string | no | Filter by a specific generated object transaction reference. |
apitemplateio.apitemplateio_delete_object 1 parameters
kosmo integrations:schema apitemplateio.apitemplateio_delete_object --json | Parameter | Type | Required | Description |
|---|---|---|---|
transaction_ref | string | yes | Generated object transaction reference to delete. |
apitemplateio.apitemplateio_get_current_user 0 parameters
kosmo integrations:schema apitemplateio.apitemplateio_get_current_user --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
apitemplateio.apitemplateio_list_templates 6 parameters
kosmo integrations:schema apitemplateio.apitemplateio_list_templates --json | Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Number of templates to return. Defaults to 300 upstream. |
offset | integer | no | Offset for pagination. Defaults to 0 upstream. |
format | string | no | Filter by template format: PDF or JPEG. |
template_id | string | no | Filter to a specific template ID. |
group_name | string | no | Filter templates by group name. |
with_layer_info | boolean | no | Include image-template layer information when true. |
apitemplateio.apitemplateio_get_template 1 parameters
kosmo integrations:schema apitemplateio.apitemplateio_get_template --json | Parameter | Type | Required | Description |
|---|---|---|---|
template_id | string | yes | The template ID to retrieve (e.g., "tpl_abc123"). |
apitemplateio.apitemplateio_update_template 4 parameters
kosmo integrations:schema apitemplateio.apitemplateio_update_template --json | Parameter | Type | Required | Description |
|---|---|---|---|
template_id | string | yes | Template ID to update. |
body | string | no | Replacement HTML body. |
css | string | no | Replacement CSS. |
settings | object | no | Template settings such as custom_header or custom_footer. |
Permissions
Headless calls still follow the integration read/write permission policy. Configure read/write defaults with
integrations:configure. Add --force only for trusted automation that should bypass that policy.