API Documentation

Complete guide to using the Ticket Field Detection API

API Health | 05 Feb 2026 01:55

Overview

The Ticket Field Detection API allows you to automatically detect and classify ticket fields based on ticket subject text. The API analyzes keywords in your subject line and returns the matching service, category, group, and item type.

Base URL: http://your-domain/api

Authentication: API Key + API Secret (via headers)

Authentication

All API requests must include two headers with your credentials:

X-API-Key: your_api_key_here
X-API-Secret: your_api_secret_here

Getting Your Credentials: Generate API keys from the API Keys page in the management panel.

Note: Keep your API Secret confidential. If compromised, regenerate it immediately from the API Keys page.

Endpoints

Detect Ticket Fields

Analyze ticket subject and get field recommendations

POST
/api/detect-fields

Request Headers

X-API-Key: string (required)
X-API-Secret: string (required)
Content-Type: application/json

Request Body

{
"subject": "sap issue with access permissions"
}

Response (Success)

{
"success": true,
"match_type": "keyword_match",
"service_id": 5,
"service_name": "Accesos y Permisos - UM",
"category_id": 15,
"category_name": "Accesos-SAP",
"category_description": "SAP System Access",
"group_id": 2,
"group_name": "Support Group",
"item_type_id": 4,
"item_type_name": "ServiceCall",
"project_id": 1
}

Response (No Match)

{
"success": false,
"error": "No matching category found for the given subject"
}

Response Fields

success

Boolean indicating if a match was found

match_type

Type of match: "keyword_match", "phrase_match", or "fuzzy_match"

service_id, service_name

The matched service information

category_id, category_name, category_description

The matched category information

group_id, group_name

The assigned support group

item_type_id, item_type_name

The ticket item type classification

Get Available Options

Retrieve all available services, categories, and keywords

GET
/api/available-options

Returns all services, categories, and keywords that can be used for detection.

Get API Statistics

Retrieve API usage statistics

GET
/api/statistics

Returns API usage statistics including total requests and match rates.

HTTP Status Codes

200 OK

Request successful (match found or not)

400 Bad Request

Missing or invalid parameters

401 Unauthorized

Missing or invalid API credentials

500 Internal Server Error

Server error during processing

Code Examples

JavaScript / Fetch

const response = await fetch('/api/detect-fields', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'your_api_key',
    'X-API-Secret': 'your_api_secret'
  },
  body: JSON.stringify({
    subject: 'sap access issue'
  })
});

const data = await response.json();
if (data.success) {
  console.log('Service:', data.service_name);
  console.log('Category:', data.category_name);
}

PHP / cURL

$ch = curl_init('http://your-domain/api/detect-fields');

curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_POST => true,
  CURLOPT_POSTFIELDS => json_encode(['subject' => 'sap issue']),
  CURLOPT_HTTPHEADER => [
    'Content-Type: application/json',
    'X-API-Key: your_api_key',
    'X-API-Secret: your_api_secret'
  ]
]);

$response = curl_exec($ch);
$data = json_decode($response, true);

if ($data['success']) {
  echo "Service: " . $data['service_name'];
}

Python / Requests

import requests
import json

url = 'http://your-domain/api/detect-fields'

headers = {
    'Content-Type': 'application/json',
    'X-API-Key': 'your_api_key',
    'X-API-Secret': 'your_api_secret'
}

payload = {
    'subject': 'sap access issue'
}

response = requests.post(url, headers=headers, json=payload)
data = response.json()

if data['success']:
    print(f"Service: {data['service_name']}")
    print(f"Category: {data['category_name']}")

Best Practices

Use Descriptive Subjects

Include keywords related to the issue (e.g., "sap access", "network connectivity") for better detection accuracy.

Handle Failed Matches

Always check the "success" field. If no match is found, provide a fallback category or prompt for manual selection.

Implement Error Handling

Handle HTTP errors (401, 400, 500) gracefully. Implement retry logic for transient failures.

Secure Your Credentials

Store API credentials in environment variables, never hardcode them. Regenerate secrets if compromised.

Support

For issues or questions about the API, please refer to the API Keys page for management, or test the API using the API Tester.