Form definitions, recorded responses and exports
Copy a complete form definition
/a/Form_copy
Create a new form from a saved definition, optionally duplicating its directly linked tables and AutoDoc assets.
When to use this endpoint
Use the Forms list Copy action when a whole definition should be reused. For a few questions, cloneFields avoids duplicating the entire form.
Authentication and permissions
Authenticate with a signed API key (acting as its owner) or a logged-in CRM session on the routed account host. Session calls include the dispatcher’s CSRF value when configured. IDs refer to the authenticated tenant unless an explicit cross-account copy is described.
The handler adds no Forms page/role check. The dispatcher does not add a Form record-scope predicate; a screen’s CRM2 role controls are not evidence of an API restriction or a CRM1 permission requirement.
The account’s features2.disableFormEdits setting blocks this mutation with form edits are disabled for this account. A temporary user marked meta.is_tmp=1 bypasses that setting only.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Positive integer-compatible ID | Yes | Source Form ID in the authenticated tenant. |
name | Text | No | Truthy override for the new name. Omitted, blank or "0" retains the source name. |
copy_subforms | Integer-compatible flag | No | Nonzero duplicates directly linked subform definitions and retargets their fields. Default 0 keeps shared table IDs. |
client_id | Integer-compatible tenant ID | No | Legacy cross-account control: a different destination is honored only for an account whose global metadata allows can_login_to_other_accounts_with_tmp_user. Otherwise it silently copies locally; avoid as a normal integration option. |
Example request
$copy = FM_api('Form_copy', [
'id'=>'1042','name'=>'Annual inspection','copy_subforms'=>'1',
]);
Example response
{"id":1088}
Database numeric values can be JSON strings. Examples are representative; legacy application errors can use HTTP 200, so inspect the decoded response.
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"} | No positive source ID. |
{"error":"form does not exist"} | Source unavailable. |
{"error":"linked table form does not exist"} | A requested direct table copy cannot be read. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Copies stored definition columns, including archived state and type. New cdate and last_edited use server time. Valid stable field IDs are preserved; duplicate/malformed IDs are rejected. This copies definitions, not recorded business data.
- With copy_subforms, preflights linked definitions, then copies each linked subform through the same route without recursive copy_subforms. Nested links therefore remain shared. Repeated links can create more than one child copy.
- Retargets copied field extras.values, prefixes copied table-link names with Copy, remaps asset_table_worksheet.selector_table_id and AutoDoc repeatable/binding table IDs after the complete direct-table map exists. Unrelated AutoDoc HTML remains intact.
- Removes inherited form_parents metadata, then synchronizes new linked-table parents. Copies registered AutoDoc files to the destination form and registers them as AutoDoc file type 9. No selection paging or automatic retry.
Side effects
- Inserts the parent and optional child definitions, updates parent metadata, copies files and saves Undo history. Cross-account Undo reads and writes explicitly use the destination tenant, so a colliding source ID is not snapshotted. Copies/files are not one atomic transaction and can remain after a later failure. The destination Disable Form Edits setting is checked.
See it in Fieldmotion
CRM1
In Forms, choose Copy, enter a name and select whether to copy tables; inspect Form_copy. Shared form-builder helpers also use it for linked definitions.
CRM2
In Forms, use Copy Form. The dialog passes the selected form ID, name and copy_subforms and navigates to the returned id. There is no ok key in the normal response.
Related endpoints
Form_cloneFields— append selected fields with fresh IDs.Form_getRequestedDetails— read the resulting definition.