Add Workflow from Template
This endpoint allows you to create a new workflow based on a workflow template. If the workflow template is using any database templates, then these databases will be recreated in the group in which you are creating the new workflow in. If that group has databases with the same names, then these will be used instead.
Template-based Creation: Templates provide pre-configured workflow structures including field definitions, validation rules, and database connections. This is the recommended way to create new workflows with consistent settings.
POST Parameters
| Parameter | Required | Value | Description |
|---|---|---|---|
api_key | {key} | An API key that has access to the resource you want to query for | |
workflow_template_id | {integer} | The Workflow template you wish to create from | |
workflow_name | {unicode} | The name of the new workflow to be created | |
group_id | {integer} | The group where you want to place the new workflow (if left blank will be put in the root group of the API key) | |
input_account | {ASCII} | An optional field allowing the override of the default randomly generated email address (the prefix before the @ only) | |
db_links | {string} | Accepts either 1 to create new database structures and a workflow with links (default), or 0 to create a workflow without database-linked rules. |
Code Examples
The cURL, PHP, Python, Node.js, and C# examples call Xtracta from a trusted server. The React example calls an application-defined backend proxy so the API key is never exposed in browser code.
Store XTRACTA_API_KEY as a server-side environment variable. Never embed it in browser-delivered code.
curl --request POST 'https://api-app.xtracta.com/v1/workflow/add_from_template' \ --header 'Accept: application/json' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'api_key=<API_KEY>' \ --data-urlencode 'workflow_template_id=<WORKFLOW_TEMPLATE_ID>' \ --data-urlencode 'workflow_name=Example_workflow' \ --data-urlencode 'input_account=example1'
Sample Request
POST https://api-app.xtracta.com/v1/workflow/add_from_template HTTP/1.1 api_key=123&workflow_template_id=456789&workflow_name=Example_workflow&input_account=example1
Sample Response
<?xml version="1.0" encoding="UTF-8"?>
<workflow_response>
<status>200</status>
<message>The workflow and database were successfully updated.</message>
<workflow>
<workflow_id>1002</workflow_id>
<workflow_name>Updated Sample Workflow</workflow_name>
<workflow_email>sampleuser123@example.com</workflow_email>
<workflow_file_transfer>sampleuser123:samplePass456@ftp.example.com</workflow_file_transfer>
<source_workflow_id>999</source_workflow_id>
</workflow>
<database>
<database_id>3001</database_id>
<database_name>Updated Sample Database</database_name>
<column>
<column_id>101</column_id>
<column_name>CustomerName</column_name>
</column>
<column>
<column_id>102</column_id>
<column_name>CustomerEmail</column_name>
</column>
<column>
<column_id>103</column_id>
<column_name>OrderID</column_name>
</column>
<column>
<column_id>104</column_id>
<column_name>OrderDate</column_name>
</column>
</database>
</workflow_response>
Schema Definition
Response Elements
| Element | Description |
|---|---|
<status> | A status code in response to the operation. |
<message> | Additional information about the operation – human readable. |
<workflow> | This element contains all of the further sub-elements with information about the workflow that has just been created. |
<workflow_id> | The unique ID of the workflow. |
<workflow_name> | The name of the workflow. |
<workflow_email> | The input email address that accepts documents for the workflow. |
<workflow_file_transfer_username> | The username to connect to the file transfer server with (note the same username, password and server address work with all supported file transfer types including FTP/FTPS/SFTP). |
<workflow_file_transfer_password> | The password to connect to the file transfer server with (note the same username, password and server address work with all supported file transfer types including FTP/FTPS/SFTP). |
<workflow_file_transfer_server> | The FQDN of the file transfer server (note the same username, password and server address work with all supported file transfer types including FTP/FTPS/SFTP). |
<source_workflow_id> | The ID of the workflow from which this workflow was copied or cloned. |
<database> | Contains the metadata for a database associated with the workflow. |
<database_id> | The unique ID of the associated database. |
<database_name> | The name of the associated database. |
<column> | Represents a single column in the associated database. |
<column_id> | The unique ID of the column. |
<column_name> | The name of the column. |
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:complexType name="WorkflowType">
<xs:sequence>
<xs:element name="workflow_id" type="xs:positiveInteger"/>
<xs:element name="workflow_name" type="xs:string"/>
<xs:element name="workflow_email" type="xs:string" minOccurs="0"/>
<xs:element name="workflow_file_transfer" type="xs:string" minOccurs="0"/>
<xs:element name="source_workflow_id" type="xs:string" minOccurs="0" nillable="true"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ColumnType">
<xs:sequence>
<xs:element name="column_id" type="xs:positiveInteger"/>
<xs:element name="column_name" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DatabaseType">
<xs:sequence>
<xs:element name="database_id" type="xs:positiveInteger" minOccurs="0"/>
<xs:element name="database_name" type="xs:string" minOccurs="0"/>
<xs:element name="column" type="ColumnType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:element name="workflow_response">
<xs:complexType>
<xs:sequence>
<xs:element name="status" type="xs:positiveInteger"/>
<xs:element name="message" type="xs:string"/>
<xs:element name="workflow" type="WorkflowType" maxOccurs="unbounded" minOccurs="0"/>
<xs:element name="database" type="DatabaseType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Error Responses
For JSON and XML responses generated by this endpoint, the response is wrapped in workflow_response and includes the HTTP status code and a message.
| Status | Message | Description |
|---|---|---|
400 | workflow_template_id is required / workflow_template_id must be natural number | Supply a positive integer template workflow ID. |
400 | Invalid parameter (workflow_template_id) is specified | The workflow does not exist or is not a template. |
400 | workflow_name cannot exceed 255 characters | Shorten the new workflow name. |
400 | input_account cannot be below 1 characters | When supplied, input_account cannot be empty. |
400 | group_id must be natural number | Use a positive integer target group ID. |
400 | db_links must be '0' or '1' | Use 1 to clone linked databases or 0 not to. |
500 | Internal server error occurred. Please try again later or contact support@xtracta.com | Retry and contact support with the request parameters and timestamp if it persists. |
Authentication, permission, IP-access-control, and rate-limit failures can be returned before this endpoint processes the request. Confirm the API key and caller access first.