How does the condition part of the SLA create API work?


  • Used Zammad version: 4.1.x
  • Used Zammad installation type: docker-compose
  • Operating system: Linux
  • Browser + version: Chrome 98.0.4758.81

When trying to create an SLA via the API, the “condition” part of the request is being ignored
This is the request that is being sent (the condition part is the same as the one in the documentation):

payload = {
        "name": "name",
        "first_response_time": "240"
        "condition": {
            "ticket.state_id": {
                "operator": "is",
                "value": "2"
        "calendar_id": "1"

This is the response body I get:

Note the empty condition in the response. What is the correct format?
I’d like to add condition ticket.tags contains one name, but I’m not sure how to format the request.
Is there documentation for this somewhere? I was unable to find it.

On a related note, is it possible to control (mainly create) triggers via the API?

I figured it out. The problem was with the requests library I was using.

I wrote this: + endpoint, headers=headers, data=payload, verify=False)

but I should have written this instead: + endpoint, headers=headers, json=payload, verify=False)

As for the conditions, I just set the condition manually in the GUI and then requested that SLA via the API and noted the formatting of the condition in the response.

As for the triggers go, there’s an endpoint api/v1/triggers where a new trigger can be POSTed:

"name": "Bedastoće2",
"condition": {
    "ticket.action": {
        "operator": "is",
        "value": "create"
"perform": {
    "ticket.owner_id": {
        "pre_condition": "specific",
        "value": "3",
        "value_completion": "Ivan Karlovic <>"
"disable_notification": True,
"note": "",
"active": True

GET on the same endpoint will make fetch all existing triggers, so you can check how to create a specific trigger by creating it manually and fetching it.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.