Skip to content

Znuny Web Services – REST API

In this detailed guide, you will learn how to activate, configure, and integrate the Znuny REST API (part of the Generic Interface) into your own applications.

Znuny provides its Generic Interface via REST and SOAP web services. The REST API communicates via HTTP(S) using the JSON data format and enables:

  • Ticket Management: Create, retrieve, update, delete
  • Article Management: Add articles, manage attachments
  • History & Search: View ticket history and perform complex search queries

Important Note: A standard installation does not contain pre-configured web services – these must be created manually in the Admin area under “Processes & Automation → Web Services”.

  1. In the Admin area, navigate to SysConfigGenericInterface.Transport and select REST (HTTP).
  2. Under AdminGenericInterfaceTransportHTTPREST, configure timeouts, host headers, and debug levels.
  3. In GenericInterface.Operation, define the desired operations (e.g., TicketCreate, TicketSearch, TicketGet, TicketUpdate, TicketDelete, TicketHistoryGet) and activate them.
  • Base URL TicketCreate
  • Authentication
    • Znuny session cookies
    • API keys / tokens (configurable via SysConfig)
    • Always use HTTPS for secure transmissions!

3. Endpoints & HTTP Methods (Detailed Overview)

Section titled “3. Endpoints & HTTP Methods (Detailed Overview)”

For each endpoint, you will find a detailed presentation of parameters, possible responses, and practical examples here.

URL: /Webservice/<ServiceName>/TicketCreate Method: POST Description: Creates a new ticket and simultaneously creates an initial article.

ParameterTypeRequiredDescription
SessionIDIntegerYes¹Session ID or UserLogin+Password
UserLoginStringYes²Agent login (in combination with Password)
PasswordStringYes²Password (in combination with UserLogin)
Ticket.TitleStringYesSubject of the ticket
Ticket.QueueStringYesQueue name or Ticket.QueueID
Ticket.StateStringYesInitial state (e.g., new)
Ticket.PriorityStringYesPriority (e.g., 3 normal)
Ticket.CustomerUserStringYesCustomer email or login
Article.SubjectStringYesSubject of the first article
Article.BodyStringYesContent of the first article
Article.MimeTypeStringYestext/plain or text/html

¹ Either SessionID OR UserLogin+Password required. ² If no SessionID token is present.

Example Request: TicketSearch

Example Response: TicketGet

URL: /Webservice/<ServiceName>/TicketSearch Method: GET Description: Searches for tickets based on various filter criteria.

ParameterTypeRequiredDescription
UserLogin, PasswordString,StringYes¹Agent credentials or SessionID²
SessionIDIntegerYes²Token for authenticated sessions
TitleString/String[]NoWildcard search in title (%Order%)
TicketNumberString/String[]NoTicket number(s)
QueueIDsInteger[]NoQueue IDs
StatesString[]NoStates (new, open, …)
StateTypeString/String[]NoOpen/Closed category
DynamicField_Name.OpMixedNoDynamic fields with operator (Equals, Like, GreaterThan …)

¹ Either UserLogin+Password OR SessionID. ² If no login pair is provided.

Example Request: TicketUpdate

Example Response: TicketDelete

URL: /Webservice/<ServiceName>/TicketGet Method: GET Description: Retrieves detailed ticket data including articles, attachments, and dynamic fields.

ParameterTypeRequiredDescription
UserLogin, PasswordString,StringYes¹Agent credentials or SessionID²
SessionIDIntegerYes²Token for authenticated sessions
TicketIDString/String[]YesOne or more ticket IDs (comma-separated or array)
DynamicFieldsBoolean (0/1)No1 = Dynamic fields in result, default = 0
ExtendedBooleanNo1 = Extended metadata (e.g., FirstResponse)
AllArticlesBooleanNo1 = Return all articles
ArticleLimitIntegerNoMax. number of returned articles
AttachmentsBooleanNo1 = Embed attachments in Base64
GetAttachmentContentsBooleanNo1 = Also load attachment contents
HTMLBodyAsAttachmentBooleanNo1 = Attach HTML version of article as attachment

¹ Either UserLogin+Password OR SessionID. ² If no login pair is provided.

Example Request: TicketHistoryGet

Example Response (abbreviated): /Webservice/<ServiceName>/TicketCreate

URL: /Webservice/<ServiceName>/TicketUpdate Method: PUT Description: Updates fields of an existing ticket and can optionally create a new article.

ParameterTypeRequiredDescription
SessionIDIntegerYes¹Token or UserLogin+Password²
TicketIDIntegerYesID of the ticket to be updated
Ticket.TitleStringNoNew title
Ticket.StateStringNoNew state
Ticket.OwnerString/IDNoNew owner
Ticket.PendingTimeHash / DiffNoNew pending time
Article.SubjectStringNoCreates a new article
Article.BodyStringNoContent of the new article
DynamicField…ArrayNoUpdate dynamic fields
Attachment…ArrayNoAdd new attachments

¹ Either SessionID OR UserLogin+Password. ² If no SessionID token is present.

Example Request: POST

Example Response: new

URL: /Webservice/<ServiceName>/TicketDelete Method: DELETE Description: Permanently deletes one or more tickets.

ParameterTypeRequiredDescription
SessionIDIntegerYes¹Token or UserLogin+Password²
TicketIDString/ArrayYesOne or more ticket IDs

Example Request: 3 normal

Example Response: text/plain

URL: /Webservice/<ServiceName>/TicketHistoryGet Method: GET Description: Retrieves the history of one or more tickets.

ParameterTypeRequiredDescription
SessionIDIntegerYes¹Token or UserLogin+Password²
TicketIDString/ArrayYesOne or more ticket IDs

Example Request: text/html

Define new resources in the WADL file: /Webservice/<ServiceName>/TicketSearch

Alternatively, you can define operations via YAML: GET


  • Success indicator: Success: 0|1
  • Error message: ErrorMessage in JSON
  • Debugging: Set Debug-Level to Debug in the transport dialog → log entries become visible in the database

ScenarioDescription
Cross-system automationCreate tickets from monitoring tools (Nagios, Zabbix)
Data synchronizationBatch updates of ticket fields from external CRM
Self-service portalsCustomers create their own tickets via REST
Mobile appsNative iOS/Android apps communicate via REST

The Znuny REST API is flexible, performant, and highly extensible thanks to the Generic Interface. Whether it’s simple ticket creation or complex workflow automation – with just a few steps in the Admin area and standard JSON requests, you can realize seamless integrations into any IT landscape.


For Python developers, the official package pyznuny is available, which encapsulates the entire Znuny REST API in a simple, typed library. You do not need to formulate HTTP requests by hand – pyznuny handles authentication, session management, and the serialization of all parameters.

Terminal window
pip install pyznuny
from pyznuny import ZnunyClient
client = ZnunyClient(
url="https://znuny.example.com",
username="admin",
password="secret"
)
# Create ticket
ticket_id = client.ticket_create(
title="Server unreachable",
queue="Support",
state="new",
priority="3 normal",
customer_user="customer@example.com",
article_subject="Initial report",
article_body="The server has not been responding since 08:00 AM.",
mime_type="text/plain"
)
print(f"New ticket created: #{ticket_id}")
# Retrieve ticket
ticket = client.ticket_get(ticket_id=ticket_id, all_articles=True)
print(ticket)
# Update ticket
client.ticket_update(ticket_id=ticket_id, state="open", owner="max.muster")
MethodDescription
ticket_create()Create new ticket with first article
ticket_get()Retrieve ticket details incl. articles & attachments
ticket_search()Search tickets by filters
ticket_update()Update fields, state, owner, and articles
ticket_delete()Permanently delete ticket
ticket_history_get()Load full history of a ticket

Note: pyznuny is available on PyPI and is actively maintained by Softoft.


For those who want to not only use the Znuny REST API but intelligently automate it, the OpenTicketAI Runtime is the solution – an on-premise AI platform that classifies, prioritizes, and routes incoming tickets fully automatically.

┌─────────────────────────┐
Incoming Emails ────► │ Znuny (Generic Interface / REST API) │
└────────────┬────────────┘
│ Webhook / Polling
┌─────────────────────────┐
│ OpenTicketAI Runtime │
│ (Docker, On-Premise) │
│ ┌───────────────────┐ │
│ │ AI Model (NLP) │ │
│ └───────────────────┘ │
└────────────┬────────────┘
│ otai-znuny-znuny Connector
┌─────────────────────────┐
│ Znuny REST API │
│ TicketUpdate / Routing │
└─────────────────────────┘

The runtime runs entirely locally in your data center – no ticket data leaves your infrastructure.

Install the OpenTicketAI core library together with the Znuny-specific connector package otai-znuny-znuny:

Terminal window
pip install open-ticket-ai otai-hf-local otai-znuny-znuny
PackageFunction
open-ticket-aiOpenTicketAI core: orchestration, pipelines, config
otai-hf-localLocal AI models via Hugging Face (On-Premise)
otai-znuny-znunyConnector: reads & writes tickets via Znuny REST

Create a config.yaml and connect the runtime to your Znuny instance:

connector:
type: znuny
url: https://znuny.example.com
username: otai-bot
password: "${ZNUNY_PASSWORD}"
model:
provider: hf-local
model_name: softoft/ticket-classifier-de
routing:
default_queue: "Unclassified"
rules:
- category: "Network"
queue: "IT-Infrastructure"
priority: "4 high"
- category: "Billing"
queue: "Accounting"
priority: "3 normal"

8.4 Workflow of Automatic Ticket Processing

Section titled “8.4 Workflow of Automatic Ticket Processing”
  1. Ticket arrives in Znuny (via email or REST TicketCreate)
  2. Connector polls for new tickets at the configured interval via TicketSearch
  3. AI model analyzes subject and article text with Natural Language Processing
  4. Classification result (category, priority, suggested queue) is determined
  5. TicketUpdate via REST sets queue, priority, and optional internal article
  6. Ticket lands fully automatically with the correct team – without manual triage

8.5 Advantages over Manual REST Integration

Section titled “8.5 Advantages over Manual REST Integration”
FeatureManual REST IntegrationOpenTicketAI + Connector
Classification❌ Manual✅ Fully automatic (AI)
Data protection✅ Local✅ 100% On-Premise
Rule-based routing✅ Possible✅ Included
Learning capability❌ Rigid rules✅ Model trainable
Setup effortHighLow (YAML config)

Learn more: Visit openticketai.com or contact Softoft for an individual demo.