Export monitors, destinations, routes, templates and status pages as Terraform HCL
Renders the authenticated project's resources as ready-to-commit Terraform HCL, with an import {} block paired to every resource so it is adopted rather than recreated. This is the primary way to bring monitors created imperatively — via the dashboard or the MCP server — under Terraform management.
Secrets are never exported. The API never returns channel secrets (webhook URLs, bot tokens, etc.), so the corresponding HCL attribute is emitted as a var.<kind>_<attr>_<label> reference instead of an empty string, together with a matching variable block (sensitive = true) and a # Set this comment. Omitting the secret silently would ship a broken destination; the variable indirection makes the gap visible and forces it to be filled in before terraform apply.
Query parameters:
- tag — optional. Only export monitors carrying this tag (and their routes/templates).
- monitor_slug — optional. Narrows the export to the single monitor with this exact slug. If tag is also given, tag is applied first and monitor_slug filters within that tag-filtered set — the two combine as an AND, not an override. If the named monitor doesn't carry the given tag, the result is an empty export, not an error.
- include — optional comma-separated subset of monitors,destinations,routes,templates,status_pages. Omit to export everything.
A route, alert template, or status page referencing a monitor or destination that was excluded from the export (by include, or because it just isn't in this project) is skipped rather than emitted with a dangling reference.
Request
- Base URL: https://app.lastping.dev
- URL: https://app.lastping.dev/api/v1/export/terraform
- Auth: API key in header X-Api-Key
Query parameters
Only export monitors carrying this tag.
Narrow the export to a single monitor by its exact slug. Combines with tag as an AND (both must match); does not override it. Matches at most one monitor.
Comma-separated subset of monitors,destinations,routes,templates,status_pages. Empty means all. An unrecognised value is a 400.
Response
Terraform HCL as plain text. Content-Type is text/plain; charset=utf-8.
Changes
No recorded changes to this operation across all 2 revisions of this API.