Get templates
In this tutorial, you will learn how to list templates available in your Oneflow account.
Templates are the predefined format used for creating contracts allowing users to quickly generate and customize the contracts based on a standardized format. The Get templates endpoint can be used to retrieve list of available templates for a specific user.
Step 1. Obtain necessary information
To run the script described in this step, you’ll need the following data:
Headers | |
x-oneflow-api-token
|
You will only be able to run the script by using a valid API token. You can create an API token in the Oneflow web application. Find out more in the Authentication section. |
x-oneflow-user-email
|
Your Oneflow user account email. |
Query parameters | |
offset
|
Offset for pagination. |
limit
|
Limit for pagination. |
sort
|
Response can be sorted by name. |
extension_type
|
A key to uniquely identify a specific integration extension, and it is provided during the integration creation process. |
template_type_id
|
The unique ID of the template type. |
filter | |
workspace_ids
|
A comma-separated list of workspace IDs that to be filtered the templates. |
active
|
filter[active]=true : This will return only active templates. filter[active]=flase : This will return only inactive templates. filter[active]= (empty): This will return both active and inactive templates.
|
Note:
You can specify any string as the
extension_type
. However, if there is no template associated with the providedextension_type
, the system will return an error message. In case you forget theextension_type
you need, please refer to the Get integration extensions.
Note:
If the
active
filter is not specified in the request, the system will follow the default behavior, which is to return only active templates.
Step 2. Run the code
Replace the values of the parameters in the following command with the actual data from your account and run it:
curl --request GET \
--url https://api.oneflow.com/v1/templates?offset=XX&limit=YY&filter[active]=true&extension_type=hubspot \
--header 'Accept: application/json' \
--header 'x-oneflow-api-token: API_TOKEN'
import requests
headers = {
'Accept': 'application/json',
'x-oneflow-api-token': API_TOKEN
}
response = requests.get('https://api.oneflow.com/v1/templates?offset=XX&limit=YY&filter[active]=true&extension_type=hubspot',
headers=headers)
print(response.json())
Expected response
This request returns the requested templates list in JSON format.
{
"_links": {
"next": {
"href": "https://api.oneflow.com/v1/templates?offset=1&limit=1&filter%5Bactive%5D=&extension_type=hubspot"
},
"previous": {
"href": null
},
"self": {
"href": "https://api.oneflow.com/v1/template_types?offset=0&limit=1&filter%5Bactive%5D=&extension_type=hubspot"
}
},
"count": 1,
"data": [
{
"_links": {
"self": {
"href": "https://api.oneflow.com/v1/templates/170001"
},
"template_type": {
"href": "https://api.oneflow.com/v1/template_types/220001"
}
},
"available_options": {
"can_receive_attachments": false,
"can_receive_expanded_pdf": false,
"can_receive_products": true,
"delivery_channels": [
{
"name": "email",
"preferred": true,
"required_participant_attributes": [
"email"
]
},
{
"name": "none",
"preferred": false,
"required_participant_attributes": []
},
{
"name": "same_device",
"preferred": false,
"required_participant_attributes": [
"sign_method"
]
},
{
"name": "sms",
"preferred": false,
"required_participant_attributes": [
"phone_number"
]
}
],
"sign_methods": [
{
"name": "sms",
"preferred": false
},
{
"name": "standard_esign",
"preferred": true
}
],
"two_step_authentication_methods": [
{
"name": "email",
"preferred": false,
"required_participant_attributes": [
"email"
]
},
{
"name": "none",
"preferred": true,
"required_participant_attributes": []
},
{
"name": "sms",
"preferred": false,
"required_participant_attributes": [
"phone_number"
]
}
]
},
"configuration": {
"default_creator_roles": {
"_permissions": {
"contract:update": true
},
"organizer": false,
"signatory": true
}
},
"created_time": "2023-04-20T11:49:44+00:00",
"id": 170001,
"name": "Sales Proposal template",
"tags": [],
"template_active": true,
"template_type": {
"created_time": "2021-07-05T07:28:26+00:00",
"description": "Hubspot data fields",
"extension_type": "hubspot",
"id": 220001,
"name": "Hubspot Template",
"updated_time": "2023-04-03T12:41:41+00:00"
},
"updated_time": "2023-04-20T11:50:20+00:00",
"workspaces": [
{
"id": 398200,
"name": "Hubspot Workspace"
}
]
}
]
}
Please see the Template section for more information about the output.
Response codes
Status | Meaning | Description |
---|---|---|
200 | OK | Returns the list of template. |
400 | Bad Request | Invalid format or content of the request. |
401 | Unauthorized | The API token or the user email is invalid. |
403 | Forbidden | The request is not authorized by the server. |
Updated about 1 year ago