API referencia
Vytvárajte vlastné integrácie s Asyntai REST API
Vyžaduje sa platený plán: API prístup je dostupný na plánoch Starter, Standard a Pro. Zobraziť ceny
Prehľad
The Asyntai API allows you to integrate AI-powered customer support into any application. Send messages and receive intelligent responses grounded in your website content and knowledge base.
Autentifikácia
All API requests require authentication using your API key. You can get your API key from the API Settings page.
Zahrňte svoj API kľúč do požiadaviek pomocou jednej z týchto metód:
- Hlavička Authorization (odporúčaná):
Authorization: Bearer YOUR_API_KEY - Hlavička X-API-Key:
X-API-Key: YOUR_API_KEY
Udržujte svoj API kľúč v tajnosti. Ktokoľvek s vaším kľúčom môže pristupovať k vášmu účtu cez API. Nikdy ho nezverejňujte v kóde na strane klienta.
Základná URL
https://asyntai.com/api/v1/
Koncové body
POST /chat/
Odošlite správu a dostanete odpoveď vygenerovanú AI.
Telo požiadavky
{
"message": "What are your business hours?",
"session_id": "user_123", // optional
"website_id": 1 // optional
}
| Parameter | Typ | Povinné | Popis |
|---|---|---|---|
message |
string | Áno | Správa používateľa na odoslanie do AI |
session_id |
string | Nie | Jedinečný identifikátor konverzácie. Použite rovnaký session_id na zachovanie histórie konverzácie. |
website_id |
integer | Nie | ID konkrétneho webu. Ak nie je zadané, použije sa váš primárny web. |
Odpoveď
{
"success": true,
"response": "Our business hours are Monday-Friday, 9 AM to 5 PM EST.",
"session_id": "user_123"
}
Príklad (cURL)
curl -X POST https://asyntai.com/api/v1/chat/ \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"message": "What are your business hours?", "session_id": "user_123"}'
Príklad (Python)
import requests
response = requests.post(
"https://asyntai.com/api/v1/chat/",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
json={
"message": "What are your business hours?",
"session_id": "user_123"
}
)
data = response.json()
print(data["response"])
Príklad (JavaScript)
const response = await fetch("https://asyntai.com/api/v1/chat/", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
message: "What are your business hours?",
session_id: "user_123"
})
});
const data = await response.json();
console.log(data.response);
GET /websites/
Zobrazte zoznam všetkých webových stránok priradených k vášmu účtu.
Odpoveď
{
"success": true,
"websites": [
{
"id": 1,
"name": "My Website",
"domain": "example.com",
"is_primary": true
}
]
}
Príklad (cURL)
curl https://asyntai.com/api/v1/websites/ \
-H "Authorization: Bearer YOUR_API_KEY"
POST /websites/
Create a new AI agent. This does the same thing as adding a website in your dashboard: it makes the agent, reads your site, and writes the first draft of the AI instructions.
Use this to set up customers from your own software. You get back the widget ID and the code to put on the website.
Telo požiadavky
| Pole | Typ | Popis |
|---|---|---|
domain |
string | Required. The website address, for example example.com |
name |
string | Optional. A display name for the agent. Useful when one website has several agents. |
crawl |
boolean | Optional, true by default. Set it to false to create the agent without reading the website. Nothing is crawled and no instructions are written. |
force |
boolean | Optional, false by default. Set it to true to add a website you already have. The copy is stored with a number after it. |
Odpoveď
{
"success": true,
"website": {
"id": 42,
"domain": "example.com",
"name": "Support agent",
"widget_id": "asyntai_ab12cd34ef56",
"is_primary": true,
"crawl_started": true,
"instructions_status": "generating",
"job_id": "8f2c1e90-..."
},
"embed_code": "<script>...</script>"
}
Príklad (cURL)
curl -X POST https://asyntai.com/api/v1/websites/ \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"domain": "example.com", "name": "Support agent"}'
Reading a website takes a few minutes, so this call answers straight away. Check when the agent is ready with the next endpoint.
Errors
| Code | Meaning |
|---|---|
403 |
You have reached the number of websites your plan allows. The answer tells you the limit. |
409 |
Your account already has this website. Send force as true to add it again. |
GET /websites/{id}/
Get one website and see whether it is ready. Use this after you create an agent, to wait until the website has been read and the AI instructions are written.
Odpoveď
{
"success": true,
"website": {
"id": 42,
"domain": "example.com",
"name": "Support agent",
"widget_id": "asyntai_ab12cd34ef56",
"is_primary": true,
"created_at": "2026-08-11T09:12:00+00:00",
"ready": true,
"instructions": {
"status": "completed",
"has_instructions": true,
"characters": 3421
},
"crawl": {
"job_id": "8f2c1e90-...",
"status": "completed",
"pages_crawled": 47,
"pages_found": 50,
"max_pages": 50,
"completed_at": "2026-08-11T09:15:31+00:00",
"error": ""
},
"knowledge_items": 47
},
"embed_code": "<script>...</script>"
}
The ready field is true when nothing is still running. A crawl that failed also counts as ready, because it has finished. Look at the crawl status to see what happened.
Príklad (cURL)
curl https://asyntai.com/api/v1/websites/42/ \
-H "Authorization: Bearer YOUR_API_KEY"
GET PATCH /websites/{id}/settings/
Read or change the chat widget settings for one website. These are the same settings you see on the Customize page: colours, the name of the assistant, the first message, lead capture, and everything else.
Reading the settings
A GET request returns every setting with its current value, plus a locked list. Locked shows the settings your plan cannot change, and which plans they need.
{
"success": true,
"settings": {
"ai_support_name": "AI Assistant",
"widget_color": "#0B0D10",
"initial_message": "Hi, how can I help you?",
"hide_branding": false,
"...": "..."
},
"locked": {
"hide_branding": ["pro", "enterprise"],
"widget_style": ["pro", "enterprise"]
}
}
Changing the settings
A PATCH request changes only the settings you send. Everything you leave out stays as it is.
curl -X PATCH https://asyntai.com/api/v1/websites/42/settings/ \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"ai_support_name": "Ava", "widget_color": "#0f172a", "use_emoji": true}'
{
"success": true,
"updated": ["ai_support_name", "use_emoji", "widget_color"],
"settings": { "...": "..." },
"locked": { "...": "..." }
}
Plans
Each setting needs its own plan, the same as in the dashboard. For example, hiding the Asyntai branding needs the Pro plan, and voice input needs Standard.
| Plan needed | Nastavenia | Examples |
|---|---|---|
| Any paid plan | 25 | widget_color, ai_support_name, initial_message |
| Starter a vyššie | 22 | profile_picture, conversation_starters_enabled |
| Standard a vyššie | 25 | speech_to_text_enabled, image_vision_enabled, escalation_enabled |
| Pro | 6 | hide_branding, widget_style |
If you send a setting your plan does not allow, the whole request is refused with code 403 and nothing is saved. The same happens if any value is wrong, for example a colour that is not a hex code. Your settings never end up half changed.
GET PUT /websites/{id}/instructions/
Read or replace the AI instructions for one website. These are the rules that tell the assistant who it is, what it may say, and what it must not say. They are the same instructions you edit in the dashboard.
Reading
{
"success": true,
"instructions": "You are the support agent for Acme Tools...",
"characters": 1979,
"version": 7,
"mode": "instructions",
"ask_questions": true,
"generation_status": "completed",
"being_edited_by": null
}
Replacing
A PUT request replaces the whole text, the same as saving in the dashboard. There is no append mode. To add a paragraph, read the instructions, add your text, then write it back.
curl -X PUT https://asyntai.com/api/v1/websites/42/instructions/ \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"instructions": "You are the support agent for Acme Tools...", "version": 7}'
Telo požiadavky
| Pole | Typ | Popis |
|---|---|---|
instructions |
string | Required. The complete new text. It replaces everything that was there. |
version |
number | Optional but recommended. The version you read. If somebody changed the instructions since then, your write is refused instead of overwriting their work. |
mode |
string | Optional. Either instructions or general. |
ask_questions |
boolean | Optional. Whether the assistant asks a follow-up question at the end of its answers. |
force |
boolean | Optional, false by default. Needed only when your new text is less than half the length of the current text. |
How your instructions are protected
Instructions can take hours to write, so a write can be refused to protect them:
| Code | Meaning |
|---|---|
400 |
Your new text is less than half the length of the current text. This catches a script that sends empty or cut-off text over instructions somebody spent hours on. Send force as true if you meant it. |
409 |
The instructions changed after you read them. Read them again, apply your change, then write. |
423 |
Somebody is editing the instructions in the dashboard right now. The answer tells you who. Try again in a couple of minutes. |
Every change also saves a copy of the previous text, so an earlier version can always be restored from the dashboard.
GET /conversations/
Načítajte históriu konverzácie pre konkrétnu reláciu.
Parametre dotazu
| Parameter | Typ | Povinné | Popis |
|---|---|---|---|
session_id |
string | Áno | ID relácie, pre ktorú sa má načítať história |
limit |
integer | Nie | Maximálny počet správ na vrátenie (predvolené: 50, max: 100) |
Odpoveď
{
"success": true,
"session_id": "user_123",
"messages": [
{
"role": "user",
"content": "What are your business hours?",
"timestamp": "2024-01-15T10:30:00Z"
},
{
"role": "assistant",
"content": "Our business hours are Monday-Friday, 9 AM to 5 PM EST.",
"timestamp": "2024-01-15T10:30:01Z",
"sender_type": "ai",
"agent_name": null,
"response_time_ms": 1840.5
}
]
}
Otázka a jej odpoveď sa ukladajú do jedného záznamu, takže obe nesú rovnaký timestamp. Neodčítavajte jeden od druhého na meranie rýchlosti odpovede, pretože výsledok je vždy nula. Použite response_time_ms, čo je skutočný čas odpovede v milisekundách.
sender_type je ai, keď odpovedal chatbot, a human, keď chat prevzal niektorý z vašich agentov. agent_name obsahuje zobrazované meno tohto agenta.
Príklad (cURL)
curl "https://asyntai.com/api/v1/conversations/?session_id=user_123&limit=20" \
-H "Authorization: Bearer YOUR_API_KEY"
GET /sessions/
Zobrazte zoznam vašich posledných chatových relácií. Použite to na zistenie ID relácií, ktoré potom môžete odoslať do /conversations/ na získanie kompletnej histórie správ.
Parametre dotazu
| Parameter | Typ | Povinné | Popis |
|---|---|---|---|
limit |
integer | Nie | Počet posledných relácií na vrátenie (predvolené: 20, max: 100) |
website_id |
string | Nie | Filtrovať relácie podľa konkrétneho ID webovej stránky |
source |
string | Nie | Filtrovať podľa zdroja relácie: widget, api, whatsapp, instagram, messenger, gorgias, freshchat, zapier |
since |
string | Nie | Iba relácie, ktorých posledná správa je v tomto ISO dátume alebo po ňom, napríklad 2024-01-15 |
before |
string | Nie | Iba relácie, ktorých posledná správa je pred týmto ISO dátumom alebo dátumom a časom. Použite ho na stránkovanie späť, pozri nižšie. |
Odpoveď
{
"success": true,
"sessions": [
{
"session_id": "session_abc123def",
"source": "widget",
"message_count": 5,
"first_message": "What are your business hours?",
"first_message_at": "2024-01-15T10:30:00Z",
"last_message_at": "2024-01-15T10:35:00Z",
"first_response_time_ms": 1840.5,
"first_human_response_at": null,
"started_at": "2024-01-15T10:29:58Z",
"ended_at": "2024-01-15T10:41:12Z",
"taken_over_at": null,
"page_url": "https://example.com/pricing",
"country": "Germany",
"category": "Pricing",
"website_domain": "example.com"
}
]
}
Polia s časovými značkami pre reporting
| Pole | Popis |
|---|---|
started_at |
Kedy návštevník otvoril chat. Dostupné iba pre relácie widgetu, pretože relácie vytvorené cez API nikdy neotvoria widget. |
first_message_at |
Kedy sa uložila prvá správa konverzácie. |
first_response_time_ms |
Ako dlho trvala prvá odpoveď, v milisekundách. Použite to pre čas prvej odpovede. |
first_human_response_at |
Kedy poslal prvú odpoveď niektorý z vašich agentov. Hodnota je null, keď celú konverzáciu zvládol chatbot. |
taken_over_at |
Kedy agent prevzal chat od chatbota. |
last_message_at |
Kedy sa uložila posledná správa konverzácie. |
ended_at |
Kedy návštevník opustil chat. Chat nemá stav vyriešené ani uzavreté, pretože návštevník sa môže kedykoľvek vrátiť a položiť ďalšiu otázku. |
Všetky časové značky sú v UTC a používajú formát ISO 8601. Časové pásmo sa nedá zmeniť. Preveďte hodnoty vo svojom nástroji na reporting.
Ďalšie polia pre reporty
| Pole | Popis |
|---|---|
page_url |
Stránka, na ktorej bol návštevník pri začatí chatu. Dostupné iba pre relácie z widgetu. |
country |
Krajina návštevníka podľa IP adresy v čase chatu. Dostupné iba pre relácie z widgetu. |
category |
Téma z kategórií chatov. Prázdne, keď je funkcia vypnutá alebo denná úloha tento chat ešte neoznačila. |
Príklad (cURL)
curl "https://asyntai.com/api/v1/sessions/?since=2024-01-01&limit=100" \
-H "Authorization: Bearer YOUR_API_KEY"
Stránkovanie históriou
Jedno volanie vráti najviac 100 relácií, najnovšie prvé. Ak chcete čítať ďalej do minulosti, vezmite last_message_at poslednej relácie na stránke a odovzdajte ho ako before v ďalšom volaní. Opakujte, kým volanie nevráti prázdny zoznam.
import requests
url = "https://asyntai.com/api/v1/sessions/"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
params = {"since": "2024-01-01", "limit": 100}
sessions = []
while True:
page = requests.get(url, headers=headers, params=params).json()["sessions"]
if not page:
break
sessions.extend(page)
params["before"] = page[-1]["last_message_at"]
print(len(sessions), "sessions since 2024-01-01")
GET /leads/
Získať zozbierané kontakty — e-mailové adresy a telefónne čísla odoslané návštevníkmi počas chatových konverzácií.
Parametre dotazu
| Parameter | Typ | Povinné | Popis |
|---|---|---|---|
limit |
integer | Nie | Počet kontaktov na vrátenie (predvolené: 50, max: 100) |
website_id |
string | Nie | Filtrovať kontakty podľa konkrétneho ID webovej stránky |
since |
string | Nie | Iba kontakty, ktoré začali v tomto ISO dátume alebo po ňom, napríklad 2024-01-15 |
before |
string | Nie | Iba kontakty, ktoré začali pred týmto ISO dátumom alebo časom. Použite to na listovanie späť celou históriou. |
Odpoveď
{
"success": true,
"leads": [
{
"session_id": "session_abc123def",
"email": "[email protected]",
"phone": "+1234567890",
"page_url": "https://example.com/pricing",
"started_at": "2024-01-15T10:30:00Z"
}
]
}
| Pole | Typ | Popis |
|---|---|---|
session_id |
string | ID chatovej relácie. Pošlite ho do /conversations/ pre zobrazenie úplnej histórie chatu. |
email |
reťazec alebo null | E-mailová adresa poskytnutá návštevníkom, alebo null ak nebola zozbieraná |
phone |
reťazec alebo null | Telefónne číslo poskytnuté návštevníkom, alebo null ak nebolo zozbierané |
page_url |
reťazec alebo null | URL stránky, kde návštevník chatoval |
started_at |
string | Časová pečiatka ISO 8601 začiatku chatovej relácie |
Príklad (cURL)
curl "https://asyntai.com/api/v1/leads/?limit=20" \
-H "Authorization: Bearer YOUR_API_KEY"
Príklad (Python)
import requests
response = requests.get(
"https://asyntai.com/api/v1/leads/",
headers={"Authorization": "Bearer YOUR_API_KEY"},
params={"limit": 20}
)
leads = response.json()["leads"]
for lead in leads:
print(f"{lead['email'] or ''} | {lead['phone'] or ''}")
GET /tickets/
Získajte tikety podpory s časovými značkami, ktoré potrebujete na meranie času spracovania: kedy tiket prišiel, kedy si ho niekto prevzal, kedy naň bolo prvýkrát odpovedané a kedy bol vyriešený.
Parametre dotazu
| Parameter | Typ | Povinné | Popis |
|---|---|---|---|
limit |
integer | Nie | Počet vrátených tiketov (predvolené: 50, maximum: 100) |
website_id |
string | Nie | Filtrovať tikety podľa ID webu alebo podľa domény webu, napríklad example.com |
name |
string | Nie | Filtrovať podľa ľubovoľnej časti mena návštevníka, napríklad anna |
status |
string | Nie | Filtrovať podľa stavu: open, in_progress, resolved alebo closed |
since |
string | Nie | Iba tikety vytvorené v tento ISO dátum alebo neskôr, napríklad 2024-01-15 |
before |
string | Nie | Iba tikety vytvorené pred týmto ISO dátumom alebo dátumom a časom. Použite ho na stránkovanie späť, pozri nižšie. |
Odpoveď
{
"success": true,
"tickets": [
{
"ticket_number": "TKT-00001",
"session_id": "session_abc123def",
"status": "resolved",
"priority": "medium",
"subject": "Cannot complete checkout",
"visitor_email": "[email protected]",
"visitor_name": "Anna Novak",
"page_url": "https://example.com/checkout",
"website_id": 12,
"channel": "session",
"assigned_to": "[email protected]",
"created_at": "2024-01-15T10:30:00Z",
"first_assigned_at": "2024-01-15T10:41:00Z",
"first_response_at": "2024-01-15T11:02:00Z",
"resolved_at": "2024-01-15T12:20:00Z"
}
]
}
| Pole | Typ | Popis |
|---|---|---|
ticket_number |
string | Označenie tiketu zobrazené vo vašom paneli |
session_id |
string | Chatová relácia, z ktorej tiket vznikol. Odovzdajte ju na /conversations/ a prečítajte si celý rozhovor za tiketom. |
visitor_name |
reťazec alebo null | Meno návštevníka alebo null, ak ho návštevník neuviedol |
status |
string | Jeden z: open, in_progress, resolved, closed |
priority |
string | Jeden z: low, medium, high |
channel |
string | Odkiaľ rozhovor prišiel, napríklad session pre webový chat |
assigned_to |
reťazec alebo null | Člen tímu, ktorý má tiket, alebo null, ak si ho nikto neprevzal |
created_at |
string | Kedy bol tiket vytvorený |
first_assigned_at |
reťazec alebo null | Kedy si tiket niekto prvýkrát prevzal. Null, ak tak nikto neurobil. |
first_response_at |
reťazec alebo null | Kedy bola z Asyntai odoslaná prvá odpoveď. Null, ak z Asyntai neprišla žiadna odpoveď. |
resolved_at |
reťazec alebo null | Kedy bol tiket označený ako vyriešený. Null, kým zostáva otvorený. |
Vidíme iba odpovede odoslané z Asyntai. Ak váš tím odpovie návštevníkovi z vlastnej schránky, nikdy to neuvidíme a first_response_at zostane prázdne, hoci návštevník odpoveď dostal. Majte to na pamäti, kým budete z týchto čísel počítať priemery.
Všetky časové značky sú v UTC a používajú formát ISO 8601. Tikety vytvorené pred touto funkciou nemajú first_assigned_at ani first_response_at, pretože tieto časy sa nikdy nezaznamenávali.
Príklad (cURL)
curl "https://asyntai.com/api/v1/tickets/?status=resolved&limit=20" \
-H "Authorization: Bearer YOUR_API_KEY"
Príklad (Python)
import requests
from datetime import datetime
response = requests.get(
"https://asyntai.com/api/v1/tickets/",
headers={"Authorization": "Bearer YOUR_API_KEY"},
params={"since": "2024-01-01", "limit": 100}
)
for ticket in response.json()["tickets"]:
if ticket["first_response_at"]:
created = datetime.fromisoformat(ticket["created_at"])
replied = datetime.fromisoformat(ticket["first_response_at"])
print(ticket["ticket_number"], replied - created)
Stránkovanie históriou
Jedno volanie vráti najviac 100 tiketov, najnovšie prvé. Ak chcete čítať ďalej do minulosti, vezmite created_at posledného tiketu na stránke a odovzdajte ho ako before v ďalšom volaní. Opakujte, kým volanie nevráti prázdny zoznam.
import requests
url = "https://asyntai.com/api/v1/tickets/"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
params = {"since": "2024-01-01", "limit": 100}
tickets = []
while True:
page = requests.get(url, headers=headers, params=params).json()["tickets"]
if not page:
break
tickets.extend(page)
params["before"] = page[-1]["created_at"]
print(len(tickets), "tickets since 2024-01-01")
GET /account/
Získajte informácie o svojom účte a štatistiky používania.
Odpoveď
{
"success": true,
"account": {
"email": "[email protected]",
"plan": "starter",
"messages_used": 150,
"messages_limit": 800
}
}
Príklad (cURL)
curl https://asyntai.com/api/v1/account/ \
-H "Authorization: Bearer YOUR_API_KEY"
Viacero webových stránok? Koncové body znalostnej bázy predvolene smerujú na vašu primárnu webovú stránku. Ak máte viacero webových stránok, odošlite website_id na zacielenie konkrétnej. Vaše ID webových stránok nájdete pomocou GET /websites/.
Denné limity nahrávania: Nahrávanie do znalostnej bázy (text, URL, tabuľka) podlieha dennému limitu znakov podľa vášho plánu. Toto sa vzťahuje na celkový obsah nahraný cez všetky koncové body znalostnej bázy za deň.
| Plán | Znaky/deň |
|---|---|
| Starter | 300 000 |
| Standard | 1 500 000 |
| Pro | 6 000 000 |
GET /knowledge/
Zobrazte zoznam záznamov vašej znalostnej bázy. Toto sú obsahové zdroje, ktoré váš AI chatbot používa na odpovedanie na otázky.
Parametre dotazu
| Parameter | Typ | Povinné | Popis |
|---|---|---|---|
limit |
integer | Nie | Počet záznamov na vrátenie (predvolené: 50, max: 100) |
website_id |
string | Nie | Filtrovať podľa ID webovej stránky (predvolene vaša primárna webová stránka) |
Odpoveď
{
"success": true,
"entries": [
{
"id": "abc-123-def",
"type": "text",
"title": "Business Hours",
"description": "Manual text content (150 words)",
"created_at": "2024-01-15T10:30:00Z"
},
{
"id": "ghi-456-jkl",
"type": "url",
"title": "About Us - Example",
"description": "Content from https://example.com/about",
"created_at": "2024-01-14T09:00:00Z"
}
]
}
Príklad (cURL)
curl "https://asyntai.com/api/v1/knowledge/?limit=10" \
-H "Authorization: Bearer YOUR_API_KEY"
POST /knowledge/text/
Pridajte vlastný textový obsah do svojej znalostnej bázy. AI ho použije na odpovedanie na otázky návštevníkov.
Telo požiadavky
{
"title": "Return Policy",
"content": "We offer a 30-day return policy on all items. Items must be unused and in original packaging. Refunds are processed within 5-7 business days.",
"website_id": "123"
}
| Parameter | Typ | Povinné | Popis |
|---|---|---|---|
title |
string | Áno | Názov pre tento záznam znalostnej bázy |
content |
string | Áno | Textový obsah (min. 10 znakov) |
website_id |
string | Nie | Cieľová webová stránka (predvolene vaša primárna webová stránka) |
Odpoveď
{
"success": true,
"id": "abc-123-def",
"title": "Return Policy",
"chunks_created": 1
}
Príklad (cURL)
curl -X POST "https://asyntai.com/api/v1/knowledge/text/" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"title": "Return Policy", "content": "We offer a 30-day return policy..."}'
POST /knowledge/url/
Pridajte webovú stránku do svojej znalostnej bázy. Obsah sa automaticky načíta a extrahuje.
Telo požiadavky
{
"url": "https://example.com/faq",
"website_id": "123"
}
| Parameter | Typ | Povinné | Popis |
|---|---|---|---|
url |
string | Áno | URL, z ktorej sa má načítať obsah |
website_id |
string | Nie | Cieľová webová stránka (predvolene vaša primárna webová stránka) |
Odpoveď
{
"success": true,
"id": "abc-123-def",
"title": "FAQ - Example",
"url": "https://example.com/faq",
"chunks_created": 5
}
Príklad (cURL)
curl -X POST "https://asyntai.com/api/v1/knowledge/url/" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/faq"}'
POST /knowledge/spreadsheet/
Nahrajte CSV alebo Excel (.xlsx) tabuľku do svojej znalostnej bázy. Každý riadok sa stane samostatným záznamom, ideálne pre produktové katalógy, zoznamy často kladených otázok, cenníky a adresáre.
Požiadavka
Odošlite ako multipart/form-data (nahratie súboru), nie JSON.
| Parameter | Typ | Povinné | Popis |
|---|---|---|---|
file |
súbor | Áno | Súbor .csv alebo .xlsx. Prvý riadok musia byť hlavičky stĺpcov. Max. riadkov na nahratie: Starter 500, Standard 2 000, Pro 10 000. Nadbytočné riadky sú orezané. |
website_id |
string | Nie | Cieľová webová stránka (predvolene vaša primárna webová stránka) |
Odpoveď
{
"success": true,
"id": "abc-123-def",
"title": "products.csv",
"rows_processed": 15,
"chunks_created": 15
}
Príklad (cURL)
curl -X POST "https://asyntai.com/api/v1/knowledge/spreadsheet/" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "[email protected]"
GET /knowledge/{id}/
Načítajte jednu položku databázy znalostí vrátane textu, ktorý je pre ňu uložený. Hodnota id pochádza z odpovede GET /knowledge/.
Obsah sa vracia pri položkách, ktoré ste pridali vy: text, súbory, tabuľky, jednotlivé adresy URL a videá. Prechádzanie webu sa zobrazuje v zozname, ale jeho stránky sa nevracajú, pretože zdrojom je vaša vlastná verejná webová stránka. V takom prípade má content hodnotu null a pole reason vysvetlí dôvod.
Odpoveď
{
"success": true,
"id": "abc-123-def",
"type": "text",
"title": "Business Hours",
"description": "Manual text content (150 words)",
"created_at": "2024-01-15T10:30:00Z",
"chunks_count": 3,
"content": "We are open Monday to Friday, 9am to 5pm...",
"content_available": true,
"char_count": 43
}
Príklad (cURL)
curl "https://asyntai.com/api/v1/knowledge/abc-123-def/" \
-H "Authorization: Bearer YOUR_API_KEY"
DELETE /knowledge/{id}/
Odstráňte záznam znalostnej bázy. id nájdete v odpovedi GET /knowledge/.
Odpoveď
{
"success": true,
"message": "Knowledge base entry deleted"
}
Príklad (cURL)
curl -X DELETE "https://asyntai.com/api/v1/knowledge/abc-123-def/" \
-H "Authorization: Bearer YOUR_API_KEY"
Tip: Webhooky môžete spravovať aj z Nastavenia API stránky bez písania akéhokoľvek kódu.
GET /webhooks/
Zobrazte zoznam vašich zaregistrovaných webhookov.
Odpoveď
{
"success": true,
"webhooks": [
{
"id": "abc-123-def",
"url": "https://example.com/webhook",
"events": ["message.received", "escalation.requested"],
"is_active": true,
"created_at": "2024-01-15T10:30:00Z"
}
]
}
Príklad (cURL)
curl "https://asyntai.com/api/v1/webhooks/" \
-H "Authorization: Bearer YOUR_API_KEY"
POST /webhooks/
Zaregistrujte nový webhook na prijímanie upozornení na udalosti v reálnom čase.
Dostupné udalosti
| Udalosť | Popis |
|---|---|
message.received |
Návštevník odoslal správu a dostal odpoveď |
conversation.started |
Nová chatová relácia bola začatá |
escalation.requested |
AI spustila eskaláciu na ľudského agenta |
takeover.started |
Ľudský agent prevzal chatovú reláciu |
Telo požiadavky
{
"url": "https://example.com/webhook",
"events": ["message.received", "escalation.requested"],
"website_id": "123"
}
| Parameter | Typ | Povinné | Popis |
|---|---|---|---|
url |
string | Áno | HTTPS URL na prijímanie POST požiadaviek webhooku |
events |
pole | Áno | Zoznam udalostí na odber (pozri tabuľku vyššie) |
website_id |
string | Nie | Cieľová webová stránka (predvolene vaša primárna webová stránka) |
Odpoveď
{
"success": true,
"webhook": {
"id": "abc-123-def",
"url": "https://example.com/webhook",
"events": ["message.received", "escalation.requested"],
"secret": "whsec_abc123...",
"created_at": "2024-01-15T10:30:00Z"
}
}
Overenie webhookov: Každý webhook obsahuje secret (zobrazený iba pri vytvorení). Každý POST na vašu URL obsahuje X-Webhook-Signature hlavičku — HMAC-SHA256 tela požiadavky podpísanú vaším tajným kľúčom.
Príklad (cURL)
curl -X POST "https://asyntai.com/api/v1/webhooks/" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/webhook", "events": ["message.received"]}'
DELETE /webhooks/{id}/
Odstráňte webhook. id nájdete v odpovedi GET /webhooks/.
Odpoveď
{
"success": true,
"message": "Webhook deleted"
}
Príklad (cURL)
curl -X DELETE "https://asyntai.com/api/v1/webhooks/abc-123-def/" \
-H "Authorization: Bearer YOUR_API_KEY"
Chybové odpovede
Všetky chybové odpovede majú tento formát:
{
"success": false,
"error": "Error message describing what went wrong"
}
| Stavový kód | Popis |
|---|---|
400 |
Chybná požiadavka - Neplatné parametre alebo chýbajúce povinné polia |
401 |
Neautorizované - Neplatný alebo chýbajúci API kľúč |
429 |
Príliš veľa požiadaviek - Dosiahnutý limit správ pre váš plán |
503 |
Služba nedostupná - AI služba je dočasne nedostupná |
Limity požiadaviek
Používanie API je obmedzené vaším predplatným plánom:
- Free: 50 správ/mesiac
- Starter (39 $/mes.): 800 správ/mesiac
- Standard (139 $/mes.): 15 000 správ/mesiac
- Pro (449 $/mes.): 50 000 správ/mesiac
Potrebujete pomoc?
If you have any questions or run into issues, contact us at [email protected].