User Templates
User Templates allow you to create and reuse form templates with pre-filled information, saving time and ensuring consistency across your forms in Forms Live. On this page, we'll dive into the different user template endpoints you can use to manage templates programmatically. We'll look at how to list, retrieve, create, and delete user templates.
The user template model
The user template model contains all the information about your saved templates, such as their name, associated template version, and creation details. User templates are essentially pre-configured forms that can be quickly reused.
Properties
- Name
id
- Type
- integer
- Description
Unique identifier for the user template.
- Name
template_version_id
- Type
- integer
- Description
Unique identifier representing the user template version.
- Name
agency_id
- Type
- integer
- Description
Unique identifier for the agency associated with the user template.
- Name
user_id
- Type
- integer
- Description
Unique identifier for the user that created the user template.
- Name
name
- Type
- string
- Description
Name of the user template.
- Name
template
- Type
- boolean
- Description
Indicates if the user template is a template.
- Name
finalised
- Type
- boolean
- Description
Indicates if the user template is finalised.
- Name
private
- Type
- boolean
- Description
Indicates if the user template is private.
- Name
created
- Type
- timestamp
- Description
Timestamp of when the user template was created.
- Name
updated
- Type
- timestamp
- Description
Timestamp of when the user template was last updated.
- Name
given_name
- Type
- string
- Description
First name of the creator of the user template.
- Name
surname
- Type
- string
- Description
Last name of the creator of the user template.
- Name
template_cost
- Type
- integer
- Description
Monetary value of the user template specified in cents.
- Name
template_id
- Type
- integer
- Description
Unique identifier representing the base template.
- Name
template_name
- Type
- string
- Description
Name of the template the user template is made from.
- Name
template_code
- Type
- string
- Description
Template code of the template the user template is made from.
- Name
template_orientation
- Type
- string
- Description
Orientation of the template (portrait or landscape).
- Name
values
- Type
- object
- Description
Collection of key-value pairs containing the pre-filled form values.
List all user templates
This endpoint allows you to retrieve a paginated list of all your user templates. By default, results are returned one page at a time.
Optional attributes
- Name
page
- Type
- string or integer
- Description
Page number for pagination. Pass 'all' to return all active user templates. Default is 1.
- Name
query
- Type
- string
- Description
Filter user templates by name based on the passed query value.
- Name
template_id
- Type
- integer
- Description
Filter user templates by a specific template ID.
Request
curl https://app-api.reiformslive.com.au/user-templates \
--request GET \
--header "Authorization: Basic YTlkOWIwYItNGY4Yi1hYTQxLTI5NzZmMTcyZmEyMQ=="
Response
[
{
"id": 1,
"template_version_id": 2,
"agency_id": 1,
"user_id": 1,
"name": "A user template",
"template": true,
"finalised": false,
"private": false,
"created": 1348728696,
"updated": 1349143614,
"given_name": "John",
"surname": "Doe",
"template_cost": 110,
"template_id": 138,
"template_name": "Original Template",
"template_code": "T1000"
},
{
"id": 2,
// ...
}
]
Retrieve a user template
This endpoint allows you to retrieve a single user template by providing its ID. The response includes all the details of the user template, including the pre-filled form values.
Optional attributes
- Name
query
- Type
- string
- Description
Can be used to retrieve forms with a certain name.
Request
curl https://app-api.reiformslive.com.au/user-templates/1 \
--request GET \
--header "Authorization: Basic YTlkOWIwYItNGY4Yi1hYTQxLTI5NzZmMTcyZmEyMQ=="
Response
{
"id": 1,
"template_version_id": 1,
"agency_id": 1,
"user_id": 1,
"name": "Important form",
"template": false,
"finalised": true,
"private": false,
"created": 1351569329,
"updated": 1351569546,
"template_cost": 50,
"template_instruction_pages": 0,
"template_id": 131,
"template_name": "Agency Template",
"template_orientation": "portrait",
"values": {
"Premises_Postcode": "5000",
"Premises_Address": "123 Example Ave",
"Parties_Principal_Title": "John Doe",
"id": "1",
"Agent_GST_Reg": "Yes",
"Agent_Name": "Example Realty",
"Agent_Licence_No": "000000",
"Agent_ABN_ACN": "00 0000 0000",
"Agent_Address": "1 Example St",
"Agent_Address2": "",
"Agent_Postcode": "5000",
"Agent_Phone_Work": "08 0000 0000",
"Agent_Phone_Mobile": "0000 000 000",
"Agent_Fax": "",
"Agent_Email": "agent@example.com",
"Agent_Trading_As": "Example Realty Realty Ltd Pty"
}
}
Create a form from user template
This endpoint allows you to create a new form based on an existing user template. The form will include all the pre-filled values from the user template.
Required attributes
- Name
name
- Type
- string
- Description
The name for the new form.
Optional attributes
- Name
private
- Type
- boolean
- Description
Whether the form is private or not. If not specified, the user's default preference will be used.
Request
curl https://app-api.reiformslive.com.au/user-templates/1/form \
--request POST \
--header "content-type: application/json" \
--header "Authorization: Basic YTlkOWIwYItNGY4Yi1hYTQxLTI5NzZmMTcyZmEyMQ==" \
--data '{"name": "New Form", "private": false}'
Response
{
"id": 404,
"template_version_id": 104,
"agency_id": 1,
"user_id": 37,
"name": "New Form",
"template": false,
"finalised": false,
"private": false,
"created": 1354766531,
"updated": 1354766531
}
Delete a user template
This endpoint allows you to delete a user template when it's no longer needed. This action cannot be undone.
Request
curl https://app-api.reiformslive.com.au/user-templates/1 \
--request DELETE \
--header "content-type: application/json" \
--header "Authorization: Basic YTlkOWIwYItNGY4Yi1hYTQxLTI5NzZmMTcyZmEyMQ=="
Response
{
"message": "The form was successfully deleted."
}