TehProf Support API

REST API for managing support tickets, clients, operators and integrations.

Base URL: https://support.tehprof.kz/api/

Overview

All API endpoints accept JSON request bodies (POST) and return JSON responses.

Every request includes an action parameter that specifies the operation.

{
  "action": "list_tickets",
  "status": "active",
  "page": 1
}

Successful responses:

{
  "ok": true,
  "data": { ... }
}

Error responses:

{
  "ok": false,
  "error": "Error description"
}

How to Get an API Key

Follow these steps to create your API key:

#Step
1Log in to the admin panel (via Bitrix24 app or standalone login at tenant.html)
2Navigate to Settings → Integrations
3Click the REST API card
4Click "Create Key", choose a name, scopes, and expiration
5Copy the key immediately — it is shown only once!
Note: Only users with the admin role can create API keys. Requires Starter plan or higher.

API Access by Plan

API access level depends on your subscription plan:

PlanMax KeysAvailable ScopesRate Limit
FreeWidget API only
Starter1read, tickets60/min
Pro3read, write, tickets, messages, clients120/min
Business10read, write, tickets, messages, clients300/min
EnterpriseAll scopes (including webhooks)600/min
Scopes: read — read data, write — create/update, tickets — ticket operations, messages — messages, clients — clients/contacts, webhooks — outgoing webhooks management.

Authentication

1. API Key (Recommended for integrations)

Pass your API key via X-Api-Key header. This is the recommended method for external integrations.

POST /api/admin.php
Content-Type: application/json
X-Api-Key: tps_your_api_key_here

{"action": "list_tickets"}
Security: API keys provide access only to your tenant's data (tickets, messages, clients). Admin settings, platform configuration, and other tenants' data are never accessible via API keys.

2. Session Cookie

Login via admin_login action with your tenant email/phone and password. The server sets an httpOnly session cookie.

POST /api/admin.php
Content-Type: application/json

{"action": "admin_login", "login": "admin@company.kz", "password": "your_password"}

3. Bitrix24 OAuth

Used when embedded as a Bitrix24 app. Pass domain and auth_token.

{"action": "list_tickets", "domain": "your.bitrix24.kz", "auth_token": "..."}

4. Mobile Session (HMAC)

Lightweight token-based auth for mobile/external apps. Pass via X-Mobile-Token header or mobile_token in request body.

Important: API keys grant operator-level access only. You can read and manage tickets, messages, clients — but NOT access admin settings, billing, branding, or platform configuration.

Error Handling

HTTP CodeMeaning
200Success (check ok field in response)
400Bad request — missing/invalid parameters
403Forbidden — authentication failed or insufficient permissions
500Internal server error
Legend: POST = HTTP method   API Key = available via X-Api-Key header   Admin UI = available only through admin panel (not via API key)

Tickets

POST /api/admin.php API Key

List tickets with filtering and pagination. Scope: read + tickets

ParameterTypeDescription
actionstring"list_tickets"
statusstringFilter: active | new | in_progress | done | all
prioritystringFilter: normal | urgent | low
categorystringFilter by category code
searchstringSearch by subject/description
portal_domainstringFilter by client portal
assigned_tointFilter by assigned operator ID
pageintPage number (default: 1)
limitintItems per page (default: 30, max: 100)

Response: list_tickets

{
  "ok": true,
  "data": {
    "tickets": [
      {
        "id": 42,
        "subject": "CRM не синхронизируется",
        "status": "in_progress",
        "priority": "urgent",
        "category": "crm",
        "portal_domain": "client.bitrix24.kz",
        "company_name": "ТОО Рога и Копыта",
        "assigned_to": 5,
        "assigned_name": "Алия Нурбекова",
        "created_at": "2026-03-19T10:30:00.000Z",
        "updated_at": "2026-03-20T08:15:00.000Z",
        "creator_name": "Иван Петров",
        "message_count": 7,
        "unread_count": 2
      }
    ],
    "total": 156,
    "page": 1,
    "limit": 30
  }
}
POST /api/admin.php API Key

Get single ticket with all messages and files. Scope: read + tickets

ParameterTypeDescription
actionstring"get_ticket"
ticket_idintTicket ID

Response: get_ticket

{
  "ok": true,
  "data": {
    "ticket": {
      "id": 42,
      "subject": "CRM не синхронизируется",
      "description": "После обновления контакты не подтягиваются...",
      "status": "in_progress",
      "priority": "urgent",
      "category": "crm",
      "portal_domain": "client.bitrix24.kz",
      "assigned_to": 5,
      "assigned_name": "Алия Нурбекова",
      "created_at": "2026-03-19T10:30:00.000Z",
      "sla_response_at": "2026-03-19T11:00:00.000Z",
      "sla_response_breached": false
    },
    "messages": [
      {
        "id": 101,
        "message": "После обновления контакты не подтягиваются...",
        "author_type": "client",
        "author_name": "Иван Петров",
        "is_note": false,
        "created_at": "2026-03-19T10:30:00.000Z",
        "files": []
      },
      {
        "id": 102,
        "message": "Проверяю настройки синхронизации, отпишу через 10 минут",
        "author_type": "support",
        "author_name": "Алия Нурбекова",
        "is_note": false,
        "created_at": "2026-03-19T10:45:00.000Z",
        "delivery_status": "read",
        "files": []
      }
    ],
    "files": []
  }
}
POST /api/admin.php API Key

Create a new ticket. Scope: write + tickets

ParameterTypeDescription
actionstring"create_ticket"
subjectstringTicket subject (required)
descriptionstringTicket description (required)
prioritystringnormal | urgent | low
categorystringCategory code (crm, telephony, whatsapp, setup, bugfix, other...)
portal_domainstringClient portal domain (to assign ticket to a client)

Response: create_ticket

{
  "ok": true,
  "data": {
    "id": 43,
    "subject": "Новая заявка из мониторинга",
    "status": "new",
    "created_at": "2026-03-20T09:00:00.000Z"
  }
}
POST /api/admin.php API Key

Update ticket fields. Scope: write + tickets

ParameterTypeDescription
actionstring"update_ticket"
ticket_idintTicket ID
subjectstringNew subject
prioritystringNew priority
categorystringNew category
statusstringNew status
assigned_tointAssign to operator ID

Ticket Lifecycle Actions API Key: write + tickets

ActionParametersDescription
take_ticketticket_idAssign ticket to current user
reassign_ticketticket_id, assigned_toReassign to another operator
set_estimateticket_id, hours, descriptionSet time/cost estimate
complete_ticketticket_id, resultMark as done with result text
hold_ticketticket_idPut on hold (pause SLA timer)
resume_ticketticket_idResume from hold
reopen_ticketticket_idReopen closed/done ticket

Messages

POST /api/admin.php API Key

Add message to ticket. Scope: write + messages

ParameterTypeDescription
actionstring"add_message"
ticket_idintTicket ID
messagestringMessage text (required)
is_noteboolInternal note — not visible to client (default: false)
File uploads: Use multipart/form-data with files[] field. Max file size depends on plan (5–100 MB).
ActionScopeParametersDescription
edit_messagewrite + messagesmessage_id, messageEdit message text
delete_messagewrite + messagesmessage_idSoft-delete a message

Response: dashboard

{
  "ok": true,
  "data": {
    "total_open": 12,
    "total_new": 3,
    "total_in_progress": 7,
    "total_done": 2,
    "total_on_hold": 1,
    "avg_response_min": 18,
    "avg_resolution_hours": 4.5,
    "sla_compliance_pct": 92,
    "per_portal": [
      { "portal_domain": "client.bitrix24.kz", "company_name": "ТОО Рога и Копыта", "open": 5, "new": 1 },
      { "portal_domain": "other.bitrix24.kz", "company_name": "ИП Сидоров", "open": 7, "new": 2 }
    ]
  }
}

Clients & Contacts

POST /api/admin.php API Key

Scope: read + clients

ActionParametersDescription
list_clientsList all client portals with settings and ticket stats
list_contactsList all contacts (name, phone, email, photo)
client_settingsportal_domain, data{}Update client settings (scope: write + clients)
create_client_tokenportal_domain, user_id, user_name, ttlGenerate passwordless access token for a client (scope: write + clients). See Client Token.

Response: list_clients

{
  "ok": true,
  "data": [
    {
      "portal_domain": "client.bitrix24.kz",
      "company_name": "ТОО Рога и Копыта",
      "tariff_plan": "standard",
      "hours_per_month": 20,
      "hours_used": 12.5,
      "ticket_stats": { "open": 5, "done_month": 8, "total": 47 }
    }
  ]
}

Operators

POST /api/admin.php API Key

Scope: read (list only — management requires admin panel)

ActionParametersDescription
list_operatorsList all operators for your tenant (name, role, department)

Dashboard & Analytics

POST /api/admin.php API Key

Scope: read

ActionParametersDescription
dashboardQuick stats: open, new, done, in_progress counts + per-client breakdown
dashboard_analyticsdays (default: 30)Extended analytics: daily trends, SLA stats, category breakdown, average resolution time
report_ticketsdays (default: 30)All tickets for period with full details (for export/BI)
report_operatorsdays (default: 30)Operator performance: assigned, done, avg response time, CSAT score

Knowledge Base

POST /api/admin.php API Key

Scope: read

ActionParametersDescription
list_kb_articlesList all KB articles (title, status, views, created_at)

Reference Data

POST /api/admin.php API Key

Scope: read

ActionParametersDescription
get_tariff_plansActive tariff plans (hours, rates, SLA)
list_tagsAll tags (name, color)
get_sla_rulesSLA rules per priority (response time, resolution time)
get_business_hoursBusiness hours schedule and timezone
list_quick_repliesCanned responses (title, content, shortcut)
list_macrosText macros (title, content)
notif_countUnread notification count
get_notificationslimit (default: 20)List notifications

Admin-Only Endpoints

Not available via API Key. These endpoints require admin panel login (Session Cookie, B24 OAuth, or Tenant Token). They manage platform settings and are not accessible via REST API keys.
CategoryActions
Operators Managementadd_operator, remove_operator, update_operator_role, toggle_operator_edit
Channelscreate_channel, update_channel, delete_channel, get_channels_status
Branding / White-Labelget_branding, save_branding, reset_branding
Automationlist_triggers, save_trigger, delete_trigger
Tariff Managementcreate_tariff, update_tariff, delete_tariff, save_business_hours
KB Managementcreate_kb_article, update_kb_article, delete_kb_article
Tags Managementcreate_tag, delete_tag, add_ticket_tag, remove_ticket_tag
Demo Modecheck_demo_status, enable_demo, get_plan_features
API Key Managementlist_api_keys, create_api_key, revoke_api_key, regenerate_api_key
Ticket Mergemerge_tickets (supervisor+)
Ticket Deletedelete_ticket, bulk_delete_tickets (supervisor+)
Platform (HEAD_ADMIN)list_tenants, update_tenant, list_error_logs, demo_analytics

Client API

Client-facing API for end-users. Authenticated via B24 OAuth or Client Token (X-Client-Token header).

POST /api/client.php B24 / Client Token
ActionParametersDescription
create_ticketsubject, description, priority, categoryCreate ticket
list_ticketspage, search, statusList own tickets
get_ticketticket_idView ticket details + messages
add_messageticket_id, messageReply to ticket
accept_ticketticket_idAccept/close ticket
reopen_ticketticket_idReopen ticket
approve_estimateticket_idApprove time/cost estimate
client_dashboardDashboard stats
kb_articlessearchBrowse knowledge base
submit_csatticket_id, rating (1-5)Submit satisfaction rating

Widget API

Public API for the embeddable support widget (no user auth, API key only).

POST /api/widget.php API Key

Pass widget API key as api_key parameter.

ActionParametersDescription
create_ticketname, email, phone, subject, descriptionCreate ticket from widget
check_statusticket_id, emailCheck ticket status
add_replyticket_id, email, messageAdd reply to ticket
get_messagesticket_id, emailGet ticket messages

Widget Embed Code

<script src="https://support.tehprof.kz/widget/loader.js"
  data-api-key="YOUR_WIDGET_API_KEY"
  data-lang="ru"></script>

Channel Webhooks

Receive incoming messages from external channels.

POST /api/channel-webhook.php?type={type} Public
TypeWebhook URLDescription
whatsapp/api/channel-webhook.php?type=whatsappEvolution API webhook (messages.upsert)
telegram/api/channel-webhook.php?type=telegramTelegram Bot API webhook
email/api/channel-webhook.php?type=emailIncoming email (Mailgun/SendGrid format)
WhatsApp: Configure your Evolution API instance to send webhooks to https://support.tehprof.kz/api/channel-webhook.php?type=whatsapp
Telegram: Set webhook via https://api.telegram.org/bot{TOKEN}/setWebhook?url=https://support.tehprof.kz/api/channel-webhook.php?type=telegram

Client Token (Passwordless Access)

Generate a token for your client to access the support portal without login. Perfect for embedding support into your own portal.

POST /api/admin.php API Key

Create a client token for passwordless access.

ParameterTypeDescription
actionstring"create_client_token"
portal_domainstringClient portal domain (required)
user_idintClient user ID (0 for anonymous)
user_namestringDisplay name (default: "Client")
ttlintToken lifetime in seconds (300–604800, default: 86400 = 24h)
curl -X POST https://support.tehprof.kz/api/admin.php \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: tps_your_key" \
  -d '{"action":"create_client_token","portal_domain":"client.bitrix24.kz","user_id":123,"user_name":"John"}'

Response:

{
  "ok": true,
  "data": {
    "token": "ct_eyJ0IjoxLCJwI...",
    "expires_in": 86400,
    "portal_url": "https://support.tehprof.kz/index.html?ctoken=ct_...",
    "embed_url": "https://support.tehprof.kz/embed.html?ctoken=ct_..."
  }
}
Security: Client tokens provide read/write access only to the specified client's tickets. The client sees only their own data within their portal. Admin settings are never accessible.

Embed (iframe)

Embed the support portal into your website or application using an iframe with a client token.

Quick Embed

<iframe
  src="https://support.tehprof.kz/embed.html?ctoken=CLIENT_TOKEN_HERE"
  style="width:100%;height:600px;border:none;border-radius:8px"
  allow="microphone;camera;display-capture"
></iframe>

Dynamic Token (Server-Side)

Your backend generates a fresh token for each user session:

// Your backend (Node.js example)
app.get('/support', async (req, res) => {
  const response = await fetch('https://support.tehprof.kz/api/admin.php', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-Api-Key': 'tps_your_api_key'
    },
    body: JSON.stringify({
      action: 'create_client_token',
      portal_domain: 'client.bitrix24.kz',
      user_id: req.user.id,
      user_name: req.user.name,
      ttl: 28800 // 8 hours
    })
  });
  const { data } = await response.json();
  res.render('support', { embedUrl: data.embed_url });
});
Important: Never expose your API key (tps_...) in client-side JavaScript. Generate tokens server-side only. Client tokens (ct_...) are safe for the browser — they are scoped to one user and expire.

Quick Start Examples

Copy-paste these examples to get started quickly. Replace tps_your_key with your actual API key.

1. List all open tickets

curl -X POST https://support.tehprof.kz/api/admin.php \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: tps_your_key" \
  -d '{"action":"list_tickets","status":"active"}'

2. Create ticket from monitoring alert

curl -X POST https://support.tehprof.kz/api/admin.php \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: tps_your_key" \
  -d '{
    "action": "create_ticket",
    "subject": "Server CPU > 90%",
    "description": "Alert from Zabbix: host prod-01, CPU 94% for 5 min",
    "priority": "urgent",
    "category": "infrastructure",
    "portal_domain": "client.bitrix24.kz"
  }'

3. Reply to a ticket

curl -X POST https://support.tehprof.kz/api/admin.php \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: tps_your_key" \
  -d '{
    "action": "add_message",
    "ticket_id": 42,
    "message": "Fixed. CPU dropped to 35% after restarting the service."
  }'

4. Close a ticket

curl -X POST https://support.tehprof.kz/api/admin.php \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: tps_your_key" \
  -d '{
    "action": "complete_ticket",
    "ticket_id": 42,
    "result": "Service restarted, monitoring confirmed normal operation"
  }'

5. Get dashboard stats (for your TV/BI dashboard)

curl -X POST https://support.tehprof.kz/api/admin.php \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: tps_your_key" \
  -d '{"action":"dashboard"}'

6. Generate client access token (embed support into your portal)

curl -X POST https://support.tehprof.kz/api/admin.php \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: tps_your_key" \
  -d '{
    "action": "create_client_token",
    "portal_domain": "client.bitrix24.kz",
    "user_id": 123,
    "user_name": "Иван Петров",
    "ttl": 28800
  }'

Ticket State Machine

new → estimated → in_progress → done → closed
                      ↕ on_hold
           closed → reopened → in_progress

Categories

CodeDescription
crmCRM
telephonyTelephony / SIP
whatsappWhatsApp / Messengers
tasksTasks
automationAutomation / Business Processes
setupConfiguration / Setup
bugfixBug fix
consultationConsultation
otherOther
generalGeneral (from channels)
TehProf Support API Documentation © 2026 — tehprof.kz