Get Started

API & Integration

Use the Deskuss REST API to create tickets programmatically and trigger cron jobs remotely. The API covers ticket creation (JSON, XML, email) and cron execution — that's the full surface in this version.

What's in this version: The Deskuss API exposes three endpoints — create a ticket via JSON, create a ticket via XML, and trigger the internal cron tasks. There is no read API, no list endpoint, no webhooks, and no dispatcher registration in this version. For everything else, use the staff UI or the database directly.

API Keys

Every API request must be authenticated with a valid API key. API keys are managed from Settings → API Keys in the staff control panel (or directly under Deskuss → Settings → API Keys).

Creating an API Key

  1. Go to Deskuss → Settings → API Keys
  2. Click Add New Key
  3. Enter a descriptive label for the key (e.g., "CRM Integration", "Monitoring Service")
  4. Select the permissions for this key:
    • Ticket Creation — allows creating new tickets via the API
    • Cron Execution — allows triggering Deskuss cron tasks remotely
  5. Click Save
  6. Copy the generated key immediately — it is shown only once for security
Important: API keys are displayed only at creation time. Deskuss does not store the raw key — only a hashed version. If you lose a key, you must revoke it and generate a new one.

Managing API Keys

From the API Keys management screen you can:

Best practice: Create a separate API key for each external service that connects to Deskuss. This way, if one service is compromised, you only revoke that specific key without affecting other integrations.

The Endpoints

All three endpoints are POST-only. The base URL is https://yoursite.com/deskuss/api/ followed by the endpoint path.

EndpointPurposePermission required
POST /api/tickets.jsonCreate a ticket from a JSON payloadTicket Creation
POST /api/tickets.xmlCreate a ticket from an XML payloadTicket Creation
POST /api/tasks/cronTrigger the internal cron tasks (overdue check, mail fetch, log cleanup, etc.)Cron Execution

Authentication

Every API request must include the API key in a custom HTTP header. Requests without a valid key receive a 401 Unauthorized response.

Header Format

X-Deskuss-API-Key: your_api_key_here

Authentication Flow

  1. Client sends a request with the X-Deskuss-API-Key header
  2. The Deskuss dispatcher hashes the key and compares it against stored hashes
  3. If the key is valid and has the required permission, the request is processed
  4. If the key is missing, invalid, revoked, or lacks the required permission, a 401 or 403 response is returned

Creating a Ticket (JSON)

The tickets.json endpoint accepts a JSON payload with the ticket's fields. Subject and message are required; everything else is optional.

Endpoint

POST /api/tickets.json
Content-Type: application/json
X-Deskuss-API-Key: your_api_key_here

Request Body

{
  "name": "Jane Smith",
  "email": "jane@example.com",
  "subject": "Cannot log in to my account",
  "message": "I've been trying to log in for the past hour. The login button does nothing when I click it.",
  "department": "Support",
  "priority": "normal",
  "topic": "Account Access"
}

Field Reference

FieldTypeRequiredNotes
namestringYesCustomer's full name
emailstringYesCustomer's email address; becomes the From address on replies
subjectstringYesTicket subject line
messagestringYesThe full ticket body (plain text or HTML)
departmentstring or intNoDepartment name or ID. Defaults to the system's default department.
prioritystringNoOne of low, normal, high, emergency. Defaults to normal.
topicstring or intNoHelp topic name or ID. Defaults to none.
phonestringNoCustomer's phone number
sourcestringNoTag for the ticket source. Defaults to API.
ipstringNoIP address to attribute the ticket to. Defaults to the API caller's IP.

Success Response

{
  "id": 1042,
  "number": "#1042",
  "created": "2026-06-12 14:32:01"
}

Error Responses

StatusMeaning
400Invalid payload — missing required field, malformed JSON, etc.
401Missing X-Deskuss-API-Key header
403API key is valid but does not have the Ticket Creation permission
404Specified department, priority, or topic doesn't exist
500Server error — see the system log

Example: curl

curl -X POST https://example.com/deskuss/api/tickets.json \
  -H "X-Deskuss-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Jane Smith",
    "email": "jane@example.com",
    "subject": "Cannot log in to my account",
    "message": "I have been trying to log in for the past hour. The login button does nothing when I click it.",
    "department": "Support",
    "priority": "high"
  }'

Example: PHP

<?php
$api_key = 'your_api_key_here';
$payload = [
    'name' => 'Jane Smith',
    'email' => 'jane@example.com',
    'subject' => 'Cannot log in to my account',
    'message' => 'I have been trying to log in for the past hour.',
    'department' => 'Support',
    'priority' => 'high',
];

$ch = curl_init('https://example.com/deskuss/api/tickets.json');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'X-Deskuss-API-Key: ' . $api_key,
    'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($status === 200) {
    $ticket = json_decode($response, true);
    echo "Created ticket " . $ticket['number'] . "\n";
} else {
    echo "Error $status: $response\n";
}

Example: Node.js

const fetch = require('node-fetch');

(async () => {
    const response = await fetch('https://example.com/deskuss/api/tickets.json', {
        method: 'POST',
        headers: {
            'X-Deskuss-API-Key': 'your_api_key_here',
            'Content-Type': 'application/json',
        },
        body: JSON.stringify({
            name: 'Jane Smith',
            email: 'jane@example.com',
            subject: 'Cannot log in to my account',
            message: 'I have been trying to log in for the past hour.',
            department: 'Support',
            priority: 'high',
        }),
    });

    if (response.ok) {
        const ticket = await response.json();
        console.log('Created ticket', ticket.number);
    } else {
        console.error('Error', response.status, await response.text());
    }
})();

Creating a Ticket (XML)

Identical to the JSON endpoint but with an XML payload. Useful for osTicket-compatible integrations.

Endpoint

POST /api/tickets.xml
Content-Type: application/xml
X-Deskuss-API-Key: your_api_key_here

Request Body

<?xml version="1.0" encoding="UTF-8"?>
<ticket>
  <name>Jane Smith</name>
  <email>jane@example.com</email>
  <subject>Cannot log in to my account</subject>
  <message>I have been trying to log in for the past hour.</message>
  <department>Support</department>
  <priority>high</priority>
  <topic>Account Access</topic>
</ticket>

Success Response

<?xml version="1.0" encoding="UTF-8"?>
<response>
  <id>1042</id>
  <number>#1042</number>
  <created>2026-06-12 14:32:01</created>
</response>

Creating a Ticket (Email)

The API also accepts email-format payloads sent with Content-Type: message/rfc822. Use this when piping from a system that produces email output (e.g., monitoring alerts that send mail). The raw email becomes the ticket; the From: header becomes the customer.

This endpoint is enabled by default. To disable it, set Settings → Tickets → Accept Email API to Off.

Cron Execution

Deskuss has internal cron tasks that run on a schedule (overdue check, mail fetching, log cleanup, draft cleanup, orphan-file cleanup, expired-session cleanup, table optimization). Normally these run via WP-Cron on every page load — see System Requirements.

The tasks/cron endpoint lets you trigger them on demand — useful for sites that disable WP-Cron and prefer a real system cron job that hits this endpoint every few minutes.

Endpoint

POST /api/tasks/cron
X-Deskuss-API-Key: your_api_key_here

Example: curl

curl -X POST https://example.com/deskuss/api/tasks/cron \
  -H "X-Deskuss-API-Key: your_api_key_here"

Setting Up a Real Cron Job

Replace the WP-Cron schedule with a real system cron that hits the API endpoint:

*/5 * * * * curl -s -X POST https://example.com/deskuss/api/tasks/cron -H "X-Deskuss-API-Key: your_key" > /dev/null 2>&1

Add the wp-config.php constant define('DISABLE_WP_CRON', true); to fully replace WP-Cron with this approach.

Rate Limits & Errors

There are no per-key rate limits in this version, but Deskuss will return 429 Too Many Requests if a flood is detected (e.g., a misbehaving client retrying in a tight loop). The response is plain text with a short error message.

All errors include a short message in the response body. For full diagnostics, check Deskuss → System → Logs for the corresponding entry.

Best Practices

Security

Reliability

Performance

What's Not in the API (Yet)

For completeness, here's what the API doesn't do in this version. If you need any of these, the workaround today is direct database access or staff-UI automation:

For a roadmap of upcoming API improvements, see the Changelog.