Create approval workflow
Create a new approval workflow.
curl --request POST \
--url https://api.hyperline.co/v1/approvals/workflows \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Enterprise quote approval",
"applicable_flows": [
"quote_subscription"
],
"is_active": true,
"priority": 10,
"step_execution": "sequential",
"rules": [
{
"operator": "and",
"conditions": [
{
"field": "total_amount",
"operator": "gte",
"value": 100000,
"scope": {
"operator": "and",
"conditions": [
{
"field": "product_ids",
"operator": "in",
"value": [
"itm_DKL4Xcb5VSa8CQ"
]
}
]
}
}
]
}
],
"steps": [
{
"name": "Finance approval",
"order": 1,
"approver_requirement": "any",
"approver_role_ids": [
"rol_DKL4Xcb5VSa8CQ"
],
"approver_user_ids": [
"usr_DKL4Xcb5VSa8CQ"
],
"approver_sources": [
"manager_of_owner"
]
}
],
"description": "Requires approval for high-value subscription quotes.",
"category": "Discount",
"email_notification_enabled": true
}
'import requests
url = "https://api.hyperline.co/v1/approvals/workflows"
payload = {
"name": "Enterprise quote approval",
"applicable_flows": ["quote_subscription"],
"is_active": True,
"priority": 10,
"step_execution": "sequential",
"rules": [
{
"operator": "and",
"conditions": [
{
"field": "total_amount",
"operator": "gte",
"value": 100000,
"scope": {
"operator": "and",
"conditions": [
{
"field": "product_ids",
"operator": "in",
"value": ["itm_DKL4Xcb5VSa8CQ"]
}
]
}
}
]
}
],
"steps": [
{
"name": "Finance approval",
"order": 1,
"approver_requirement": "any",
"approver_role_ids": ["rol_DKL4Xcb5VSa8CQ"],
"approver_user_ids": ["usr_DKL4Xcb5VSa8CQ"],
"approver_sources": ["manager_of_owner"]
}
],
"description": "Requires approval for high-value subscription quotes.",
"category": "Discount",
"email_notification_enabled": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Enterprise quote approval',
applicable_flows: ['quote_subscription'],
is_active: true,
priority: 10,
step_execution: 'sequential',
rules: [
{
operator: 'and',
conditions: [
{
field: 'total_amount',
operator: 'gte',
value: 100000,
scope: {
operator: 'and',
conditions: [{field: 'product_ids', operator: 'in', value: ['itm_DKL4Xcb5VSa8CQ']}]
}
}
]
}
],
steps: [
{
name: 'Finance approval',
order: 1,
approver_requirement: 'any',
approver_role_ids: ['rol_DKL4Xcb5VSa8CQ'],
approver_user_ids: ['usr_DKL4Xcb5VSa8CQ'],
approver_sources: ['manager_of_owner']
}
],
description: 'Requires approval for high-value subscription quotes.',
category: 'Discount',
email_notification_enabled: true
})
};
fetch('https://api.hyperline.co/v1/approvals/workflows', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hyperline.co/v1/approvals/workflows",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Enterprise quote approval',
'applicable_flows' => [
'quote_subscription'
],
'is_active' => true,
'priority' => 10,
'step_execution' => 'sequential',
'rules' => [
[
'operator' => 'and',
'conditions' => [
[
'field' => 'total_amount',
'operator' => 'gte',
'value' => 100000,
'scope' => [
'operator' => 'and',
'conditions' => [
[
'field' => 'product_ids',
'operator' => 'in',
'value' => [
'itm_DKL4Xcb5VSa8CQ'
]
]
]
]
]
]
]
],
'steps' => [
[
'name' => 'Finance approval',
'order' => 1,
'approver_requirement' => 'any',
'approver_role_ids' => [
'rol_DKL4Xcb5VSa8CQ'
],
'approver_user_ids' => [
'usr_DKL4Xcb5VSa8CQ'
],
'approver_sources' => [
'manager_of_owner'
]
]
],
'description' => 'Requires approval for high-value subscription quotes.',
'category' => 'Discount',
'email_notification_enabled' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hyperline.co/v1/approvals/workflows"
payload := strings.NewReader("{\n \"name\": \"Enterprise quote approval\",\n \"applicable_flows\": [\n \"quote_subscription\"\n ],\n \"is_active\": true,\n \"priority\": 10,\n \"step_execution\": \"sequential\",\n \"rules\": [\n {\n \"operator\": \"and\",\n \"conditions\": [\n {\n \"field\": \"total_amount\",\n \"operator\": \"gte\",\n \"value\": 100000,\n \"scope\": {\n \"operator\": \"and\",\n \"conditions\": [\n {\n \"field\": \"product_ids\",\n \"operator\": \"in\",\n \"value\": [\n \"itm_DKL4Xcb5VSa8CQ\"\n ]\n }\n ]\n }\n }\n ]\n }\n ],\n \"steps\": [\n {\n \"name\": \"Finance approval\",\n \"order\": 1,\n \"approver_requirement\": \"any\",\n \"approver_role_ids\": [\n \"rol_DKL4Xcb5VSa8CQ\"\n ],\n \"approver_user_ids\": [\n \"usr_DKL4Xcb5VSa8CQ\"\n ],\n \"approver_sources\": [\n \"manager_of_owner\"\n ]\n }\n ],\n \"description\": \"Requires approval for high-value subscription quotes.\",\n \"category\": \"Discount\",\n \"email_notification_enabled\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.hyperline.co/v1/approvals/workflows")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Enterprise quote approval\",\n \"applicable_flows\": [\n \"quote_subscription\"\n ],\n \"is_active\": true,\n \"priority\": 10,\n \"step_execution\": \"sequential\",\n \"rules\": [\n {\n \"operator\": \"and\",\n \"conditions\": [\n {\n \"field\": \"total_amount\",\n \"operator\": \"gte\",\n \"value\": 100000,\n \"scope\": {\n \"operator\": \"and\",\n \"conditions\": [\n {\n \"field\": \"product_ids\",\n \"operator\": \"in\",\n \"value\": [\n \"itm_DKL4Xcb5VSa8CQ\"\n ]\n }\n ]\n }\n }\n ]\n }\n ],\n \"steps\": [\n {\n \"name\": \"Finance approval\",\n \"order\": 1,\n \"approver_requirement\": \"any\",\n \"approver_role_ids\": [\n \"rol_DKL4Xcb5VSa8CQ\"\n ],\n \"approver_user_ids\": [\n \"usr_DKL4Xcb5VSa8CQ\"\n ],\n \"approver_sources\": [\n \"manager_of_owner\"\n ]\n }\n ],\n \"description\": \"Requires approval for high-value subscription quotes.\",\n \"category\": \"Discount\",\n \"email_notification_enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hyperline.co/v1/approvals/workflows")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Enterprise quote approval\",\n \"applicable_flows\": [\n \"quote_subscription\"\n ],\n \"is_active\": true,\n \"priority\": 10,\n \"step_execution\": \"sequential\",\n \"rules\": [\n {\n \"operator\": \"and\",\n \"conditions\": [\n {\n \"field\": \"total_amount\",\n \"operator\": \"gte\",\n \"value\": 100000,\n \"scope\": {\n \"operator\": \"and\",\n \"conditions\": [\n {\n \"field\": \"product_ids\",\n \"operator\": \"in\",\n \"value\": [\n \"itm_DKL4Xcb5VSa8CQ\"\n ]\n }\n ]\n }\n }\n ]\n }\n ],\n \"steps\": [\n {\n \"name\": \"Finance approval\",\n \"order\": 1,\n \"approver_requirement\": \"any\",\n \"approver_role_ids\": [\n \"rol_DKL4Xcb5VSa8CQ\"\n ],\n \"approver_user_ids\": [\n \"usr_DKL4Xcb5VSa8CQ\"\n ],\n \"approver_sources\": [\n \"manager_of_owner\"\n ]\n }\n ],\n \"description\": \"Requires approval for high-value subscription quotes.\",\n \"category\": \"Discount\",\n \"email_notification_enabled\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "apw_DKL4Xcb5VSa8CQ",
"name": "Enterprise quote approval",
"description": "Requires approval for high-value subscription quotes.",
"applicable_flows": [
"quote_subscription"
],
"is_active": true,
"category": "Discount",
"priority": 10,
"rules": [
{
"id": "apr_DKL4Xcb5VSa8CQ",
"operator": "and",
"conditions": [
{
"field": "total_amount",
"operator": "gte",
"value": 100000,
"scope": {
"operator": "and",
"conditions": [
{
"field": "product_ids",
"operator": "in",
"value": [
"itm_DKL4Xcb5VSa8CQ"
]
}
]
}
}
]
}
],
"step_execution": "sequential",
"email_notification_enabled": true,
"steps": [
{
"id": "aps_DKL4Xcb5VSa8CQ",
"name": "Finance approval",
"order": 1,
"approver_requirement": "any",
"approver_role_ids": [
"rol_DKL4Xcb5VSa8CQ"
],
"approver_user_ids": [
"usr_DKL4Xcb5VSa8CQ"
],
"approver_sources": [
"manager_of_owner"
]
}
],
"version": 1,
"original_workflow_id": null,
"created_at": "2024-12-20T16:04:11Z"
}Authorizations
Body
Approval workflow creation payload.
Quote, subscription, invoice, or credit-note flows where the workflow applies. workflow_step workflows are picked by a workflow's Request approval step, apply to no other flow, have no rules, and can't be created or updated through the API.
1quote_subscription, quote_subscription_update, quote_one_off, invoice, credit_note ["quote_subscription"]
Approval category of the workflow, null for the default category. Only the first matching workflow of a category applies, by priority, and each category with a match requires its own approval: the quote, invoice or subscription update is approved once all of them are.
1 - 100"Discount"
Response
Quote, subscription, invoice, or credit-note flows where the workflow applies. workflow_step workflows are picked by a workflow's Request approval step, apply to no other flow, have no rules, and can't be created or updated through the API.
quote_subscription, quote_subscription_update, quote_one_off, subscription_update, invoice, credit_note, workflow_step ["quote_subscription"]
Approval category of the workflow, null for the default category. Only the first matching workflow of a category applies, by priority, and each category with a match requires its own approval: the quote, invoice or subscription update is approved once all of them are.
"Discount"
Approval workflow creation date. UTC date time string in the ISO 8601 format.
"2024-12-20T16:04:11Z"
Was this page helpful?
curl --request POST \
--url https://api.hyperline.co/v1/approvals/workflows \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Enterprise quote approval",
"applicable_flows": [
"quote_subscription"
],
"is_active": true,
"priority": 10,
"step_execution": "sequential",
"rules": [
{
"operator": "and",
"conditions": [
{
"field": "total_amount",
"operator": "gte",
"value": 100000,
"scope": {
"operator": "and",
"conditions": [
{
"field": "product_ids",
"operator": "in",
"value": [
"itm_DKL4Xcb5VSa8CQ"
]
}
]
}
}
]
}
],
"steps": [
{
"name": "Finance approval",
"order": 1,
"approver_requirement": "any",
"approver_role_ids": [
"rol_DKL4Xcb5VSa8CQ"
],
"approver_user_ids": [
"usr_DKL4Xcb5VSa8CQ"
],
"approver_sources": [
"manager_of_owner"
]
}
],
"description": "Requires approval for high-value subscription quotes.",
"category": "Discount",
"email_notification_enabled": true
}
'import requests
url = "https://api.hyperline.co/v1/approvals/workflows"
payload = {
"name": "Enterprise quote approval",
"applicable_flows": ["quote_subscription"],
"is_active": True,
"priority": 10,
"step_execution": "sequential",
"rules": [
{
"operator": "and",
"conditions": [
{
"field": "total_amount",
"operator": "gte",
"value": 100000,
"scope": {
"operator": "and",
"conditions": [
{
"field": "product_ids",
"operator": "in",
"value": ["itm_DKL4Xcb5VSa8CQ"]
}
]
}
}
]
}
],
"steps": [
{
"name": "Finance approval",
"order": 1,
"approver_requirement": "any",
"approver_role_ids": ["rol_DKL4Xcb5VSa8CQ"],
"approver_user_ids": ["usr_DKL4Xcb5VSa8CQ"],
"approver_sources": ["manager_of_owner"]
}
],
"description": "Requires approval for high-value subscription quotes.",
"category": "Discount",
"email_notification_enabled": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Enterprise quote approval',
applicable_flows: ['quote_subscription'],
is_active: true,
priority: 10,
step_execution: 'sequential',
rules: [
{
operator: 'and',
conditions: [
{
field: 'total_amount',
operator: 'gte',
value: 100000,
scope: {
operator: 'and',
conditions: [{field: 'product_ids', operator: 'in', value: ['itm_DKL4Xcb5VSa8CQ']}]
}
}
]
}
],
steps: [
{
name: 'Finance approval',
order: 1,
approver_requirement: 'any',
approver_role_ids: ['rol_DKL4Xcb5VSa8CQ'],
approver_user_ids: ['usr_DKL4Xcb5VSa8CQ'],
approver_sources: ['manager_of_owner']
}
],
description: 'Requires approval for high-value subscription quotes.',
category: 'Discount',
email_notification_enabled: true
})
};
fetch('https://api.hyperline.co/v1/approvals/workflows', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hyperline.co/v1/approvals/workflows",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Enterprise quote approval',
'applicable_flows' => [
'quote_subscription'
],
'is_active' => true,
'priority' => 10,
'step_execution' => 'sequential',
'rules' => [
[
'operator' => 'and',
'conditions' => [
[
'field' => 'total_amount',
'operator' => 'gte',
'value' => 100000,
'scope' => [
'operator' => 'and',
'conditions' => [
[
'field' => 'product_ids',
'operator' => 'in',
'value' => [
'itm_DKL4Xcb5VSa8CQ'
]
]
]
]
]
]
]
],
'steps' => [
[
'name' => 'Finance approval',
'order' => 1,
'approver_requirement' => 'any',
'approver_role_ids' => [
'rol_DKL4Xcb5VSa8CQ'
],
'approver_user_ids' => [
'usr_DKL4Xcb5VSa8CQ'
],
'approver_sources' => [
'manager_of_owner'
]
]
],
'description' => 'Requires approval for high-value subscription quotes.',
'category' => 'Discount',
'email_notification_enabled' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hyperline.co/v1/approvals/workflows"
payload := strings.NewReader("{\n \"name\": \"Enterprise quote approval\",\n \"applicable_flows\": [\n \"quote_subscription\"\n ],\n \"is_active\": true,\n \"priority\": 10,\n \"step_execution\": \"sequential\",\n \"rules\": [\n {\n \"operator\": \"and\",\n \"conditions\": [\n {\n \"field\": \"total_amount\",\n \"operator\": \"gte\",\n \"value\": 100000,\n \"scope\": {\n \"operator\": \"and\",\n \"conditions\": [\n {\n \"field\": \"product_ids\",\n \"operator\": \"in\",\n \"value\": [\n \"itm_DKL4Xcb5VSa8CQ\"\n ]\n }\n ]\n }\n }\n ]\n }\n ],\n \"steps\": [\n {\n \"name\": \"Finance approval\",\n \"order\": 1,\n \"approver_requirement\": \"any\",\n \"approver_role_ids\": [\n \"rol_DKL4Xcb5VSa8CQ\"\n ],\n \"approver_user_ids\": [\n \"usr_DKL4Xcb5VSa8CQ\"\n ],\n \"approver_sources\": [\n \"manager_of_owner\"\n ]\n }\n ],\n \"description\": \"Requires approval for high-value subscription quotes.\",\n \"category\": \"Discount\",\n \"email_notification_enabled\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.hyperline.co/v1/approvals/workflows")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Enterprise quote approval\",\n \"applicable_flows\": [\n \"quote_subscription\"\n ],\n \"is_active\": true,\n \"priority\": 10,\n \"step_execution\": \"sequential\",\n \"rules\": [\n {\n \"operator\": \"and\",\n \"conditions\": [\n {\n \"field\": \"total_amount\",\n \"operator\": \"gte\",\n \"value\": 100000,\n \"scope\": {\n \"operator\": \"and\",\n \"conditions\": [\n {\n \"field\": \"product_ids\",\n \"operator\": \"in\",\n \"value\": [\n \"itm_DKL4Xcb5VSa8CQ\"\n ]\n }\n ]\n }\n }\n ]\n }\n ],\n \"steps\": [\n {\n \"name\": \"Finance approval\",\n \"order\": 1,\n \"approver_requirement\": \"any\",\n \"approver_role_ids\": [\n \"rol_DKL4Xcb5VSa8CQ\"\n ],\n \"approver_user_ids\": [\n \"usr_DKL4Xcb5VSa8CQ\"\n ],\n \"approver_sources\": [\n \"manager_of_owner\"\n ]\n }\n ],\n \"description\": \"Requires approval for high-value subscription quotes.\",\n \"category\": \"Discount\",\n \"email_notification_enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hyperline.co/v1/approvals/workflows")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Enterprise quote approval\",\n \"applicable_flows\": [\n \"quote_subscription\"\n ],\n \"is_active\": true,\n \"priority\": 10,\n \"step_execution\": \"sequential\",\n \"rules\": [\n {\n \"operator\": \"and\",\n \"conditions\": [\n {\n \"field\": \"total_amount\",\n \"operator\": \"gte\",\n \"value\": 100000,\n \"scope\": {\n \"operator\": \"and\",\n \"conditions\": [\n {\n \"field\": \"product_ids\",\n \"operator\": \"in\",\n \"value\": [\n \"itm_DKL4Xcb5VSa8CQ\"\n ]\n }\n ]\n }\n }\n ]\n }\n ],\n \"steps\": [\n {\n \"name\": \"Finance approval\",\n \"order\": 1,\n \"approver_requirement\": \"any\",\n \"approver_role_ids\": [\n \"rol_DKL4Xcb5VSa8CQ\"\n ],\n \"approver_user_ids\": [\n \"usr_DKL4Xcb5VSa8CQ\"\n ],\n \"approver_sources\": [\n \"manager_of_owner\"\n ]\n }\n ],\n \"description\": \"Requires approval for high-value subscription quotes.\",\n \"category\": \"Discount\",\n \"email_notification_enabled\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "apw_DKL4Xcb5VSa8CQ",
"name": "Enterprise quote approval",
"description": "Requires approval for high-value subscription quotes.",
"applicable_flows": [
"quote_subscription"
],
"is_active": true,
"category": "Discount",
"priority": 10,
"rules": [
{
"id": "apr_DKL4Xcb5VSa8CQ",
"operator": "and",
"conditions": [
{
"field": "total_amount",
"operator": "gte",
"value": 100000,
"scope": {
"operator": "and",
"conditions": [
{
"field": "product_ids",
"operator": "in",
"value": [
"itm_DKL4Xcb5VSa8CQ"
]
}
]
}
}
]
}
],
"step_execution": "sequential",
"email_notification_enabled": true,
"steps": [
{
"id": "aps_DKL4Xcb5VSa8CQ",
"name": "Finance approval",
"order": 1,
"approver_requirement": "any",
"approver_role_ids": [
"rol_DKL4Xcb5VSa8CQ"
],
"approver_user_ids": [
"usr_DKL4Xcb5VSa8CQ"
],
"approver_sources": [
"manager_of_owner"
]
}
],
"version": 1,
"original_workflow_id": null,
"created_at": "2024-12-20T16:04:11Z"
}
