Create Assignment Rule
Create an assignment rule on a team. Omit display_order to append the rule after the current last one; set it to store that value verbatim. Values are not renumbered around a write, so gaps and ties are both possible. Excluded from the generated MCP tools: Catalyst changes assignment rules through staged, human-published change sets, and an auto-generated tool would be an unstaged second path to the same rows.
curl --request POST \
--url https://public.api.serval.com/v2/teams/{team_id}/assignment-rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"conditions": [
{
"conditions": [
{
"requesterCustomField": {
"fieldKey": "<string>",
"values": [
"<string>"
]
}
}
]
}
],
"actions": [
{
"assignedEntityId": "<string>"
}
],
"displayOrder": 123
}
'import requests
url = "https://public.api.serval.com/v2/teams/{team_id}/assignment-rules"
payload = {
"conditions": [{ "conditions": [{ "requesterCustomField": {
"fieldKey": "<string>",
"values": ["<string>"]
} }] }],
"actions": [{ "assignedEntityId": "<string>" }],
"displayOrder": 123
}
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({
conditions: [
{
conditions: [{requesterCustomField: {fieldKey: '<string>', values: ['<string>']}}]
}
],
actions: [{assignedEntityId: '<string>'}],
displayOrder: 123
})
};
fetch('https://public.api.serval.com/v2/teams/{team_id}/assignment-rules', 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://public.api.serval.com/v2/teams/{team_id}/assignment-rules",
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([
'conditions' => [
[
'conditions' => [
[
'requesterCustomField' => [
'fieldKey' => '<string>',
'values' => [
'<string>'
]
]
]
]
]
],
'actions' => [
[
'assignedEntityId' => '<string>'
]
],
'displayOrder' => 123
]),
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://public.api.serval.com/v2/teams/{team_id}/assignment-rules"
payload := strings.NewReader("{\n \"conditions\": [\n {\n \"conditions\": [\n {\n \"requesterCustomField\": {\n \"fieldKey\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n }\n ]\n }\n ],\n \"actions\": [\n {\n \"assignedEntityId\": \"<string>\"\n }\n ],\n \"displayOrder\": 123\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://public.api.serval.com/v2/teams/{team_id}/assignment-rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"conditions\": [\n {\n \"conditions\": [\n {\n \"requesterCustomField\": {\n \"fieldKey\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n }\n ]\n }\n ],\n \"actions\": [\n {\n \"assignedEntityId\": \"<string>\"\n }\n ],\n \"displayOrder\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://public.api.serval.com/v2/teams/{team_id}/assignment-rules")
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 \"conditions\": [\n {\n \"conditions\": [\n {\n \"requesterCustomField\": {\n \"fieldKey\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n }\n ]\n }\n ],\n \"actions\": [\n {\n \"assignedEntityId\": \"<string>\"\n }\n ],\n \"displayOrder\": 123\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"conditions": [
{
"conditions": [
{
"requesterCustomField": {
"fieldKey": "<string>",
"operator": "RULE_CONDITION_OPERATOR_UNSPECIFIED",
"values": [
"<string>"
]
}
}
]
}
],
"actions": [
{
"assignedEntityId": "<string>",
"assignedEntityType": "ASSIGNED_ENTITY_TYPE_UNSPECIFIED"
}
],
"displayOrder": 123,
"createdAt": "2025-01-15T01:30:15.000Z",
"updatedAt": "2025-01-15T01:30:15.000Z"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
Create carries its own fields rather than the AssignmentRule model, so the fields a caller cannot set are absent rather than merely documented as read-only.
display_order is one of them. A new rule is always appended after the team's current last, which is the safe end: the first matching rule wins, so a rule that lands last cannot pre-empt the routing a team already has. Placing it somewhere else is a second call, and needs a read first anyway -- the values are sparse, so "between these two rules" means knowing what both of them are.
When the rule applies. Empty matches every ticket.
Show child attributes
Show child attributes
At least one is required, which is also what rejects an empty body.
Show child attributes
Show child attributes
Absent appends the rule after the team's last one, which is the safe end: the first matching rule wins, so a rule landing last cannot pre-empt existing routing. Values are not renumbered around a write, so a value given here may tie with an existing rule, in which case created_at decides which of the two is evaluated first.
Response
Success
Show child attributes
Show child attributes
Was this page helpful?
curl --request POST \
--url https://public.api.serval.com/v2/teams/{team_id}/assignment-rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"conditions": [
{
"conditions": [
{
"requesterCustomField": {
"fieldKey": "<string>",
"values": [
"<string>"
]
}
}
]
}
],
"actions": [
{
"assignedEntityId": "<string>"
}
],
"displayOrder": 123
}
'import requests
url = "https://public.api.serval.com/v2/teams/{team_id}/assignment-rules"
payload = {
"conditions": [{ "conditions": [{ "requesterCustomField": {
"fieldKey": "<string>",
"values": ["<string>"]
} }] }],
"actions": [{ "assignedEntityId": "<string>" }],
"displayOrder": 123
}
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({
conditions: [
{
conditions: [{requesterCustomField: {fieldKey: '<string>', values: ['<string>']}}]
}
],
actions: [{assignedEntityId: '<string>'}],
displayOrder: 123
})
};
fetch('https://public.api.serval.com/v2/teams/{team_id}/assignment-rules', 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://public.api.serval.com/v2/teams/{team_id}/assignment-rules",
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([
'conditions' => [
[
'conditions' => [
[
'requesterCustomField' => [
'fieldKey' => '<string>',
'values' => [
'<string>'
]
]
]
]
]
],
'actions' => [
[
'assignedEntityId' => '<string>'
]
],
'displayOrder' => 123
]),
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://public.api.serval.com/v2/teams/{team_id}/assignment-rules"
payload := strings.NewReader("{\n \"conditions\": [\n {\n \"conditions\": [\n {\n \"requesterCustomField\": {\n \"fieldKey\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n }\n ]\n }\n ],\n \"actions\": [\n {\n \"assignedEntityId\": \"<string>\"\n }\n ],\n \"displayOrder\": 123\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://public.api.serval.com/v2/teams/{team_id}/assignment-rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"conditions\": [\n {\n \"conditions\": [\n {\n \"requesterCustomField\": {\n \"fieldKey\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n }\n ]\n }\n ],\n \"actions\": [\n {\n \"assignedEntityId\": \"<string>\"\n }\n ],\n \"displayOrder\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://public.api.serval.com/v2/teams/{team_id}/assignment-rules")
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 \"conditions\": [\n {\n \"conditions\": [\n {\n \"requesterCustomField\": {\n \"fieldKey\": \"<string>\",\n \"values\": [\n \"<string>\"\n ]\n }\n }\n ]\n }\n ],\n \"actions\": [\n {\n \"assignedEntityId\": \"<string>\"\n }\n ],\n \"displayOrder\": 123\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"conditions": [
{
"conditions": [
{
"requesterCustomField": {
"fieldKey": "<string>",
"operator": "RULE_CONDITION_OPERATOR_UNSPECIFIED",
"values": [
"<string>"
]
}
}
]
}
],
"actions": [
{
"assignedEntityId": "<string>",
"assignedEntityType": "ASSIGNED_ENTITY_TYPE_UNSPECIFIED"
}
],
"displayOrder": 123,
"createdAt": "2025-01-15T01:30:15.000Z",
"updatedAt": "2025-01-15T01:30:15.000Z"
}
}
