Reusable document and recurrence templates
Read a reusable template
/a/Template_get
Read the saved input payload and metadata of one reusable template
When to use this endpoint
Read a selected preset before applying it to an editor or replacing its payload. This returns storage fields, not a rendered document, a new job, or a recurrence schedule. Templates_get can fetch several presets of one type with fewer fields.
Authentication and permissions
Authenticate with signed API-key fields or a logged-in CRM session. Template_get, Template_new, Template_setObj and Templates_get require an authenticated tenant context; Template_delete and both table handlers also call the login guard. There is no handler-level administrator, page, role, creator or ownership check.
Templates are shared within the authenticated tenant, not private to created_by. There is no user, department, feature-setting or active/deleted filter. The dispatcher also applies its normal account, authentication and team-access checks; the shared table predicate adds no template-specific row restriction.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer | Yes | Template ID, integer-converted and required to be greater than zero. Omitted, blank, null, zero and negative values fail. No type parameter is checked. |
Example request
$template = FM_api('Template_get', ['id' => '1042']);
Example response
{"id":"1042","cdate":"1792832400","last_edited":"1792832400","obj":"{\"notes\":\"Reusable quote notes\"}","obj_type":"3","name":"Standard quote","created_by":"1088"}
Returns the complete database row with storage names, not the mapped names used by Templates_getDataTable. obj remains an encoded JSON string; numeric database fields can be strings. No matching row returns the database helper’s false value (JSON false), not a not-found error or empty object.
Errors and unusual responses
| Response | Condition |
|---|---|
{"error":"not logged in"} | No authenticated tenant context is available. Invalid signed credentials can be rejected by the dispatcher before the handler runs. |
{"error":"missing or invalid parameter: id"} | Integer-converted id is below 1. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- The CRM2 enum defines 1=recurrence, 2=job, 3=quote, 4=invoice and 5=opportunity. The PHP handlers accept any positive integer, not just that enum. These are saved input presets, not email templates or PDF/Word document designs.
- Looks up only the supplied tenant-local ID. It does not verify that the preset has the type expected by the calling screen. There is no pagination, ordering or related-object expansion.
- No direct mobile-app or m-service caller for this template family was found in the source search. The CRM2 widget’s payload is client-defined; storing it does not validate that another document endpoint will accept every field.
Side effects
- Reads only; it does not apply the template, start recurrence or update last_edited.
See it in Fieldmotion
CRM1
In CRM1’s job recurrence editor, selecting a saved recurrence template requests Template_get by ID, parses obj and copies its recurrence values into the editor. Filter developer tools for that exact route.
CRM2
No direct production CRM2 caller for Template_get was found. The Template widget and recurrence picker load obj through Templates_get instead; browser tests also read Template_get to verify persistence, but that is not production UI usage.
Related endpoints
- Templates_get supplies the selectable presets for one type.
- Template_get reads one stored preset without applying it.
- Template_new creates a separate preset; Template_setObj replaces an existing preset’s payload.
- Template_delete removes the reusable preset, not documents previously created from it.