Nazaj na nadzorno ploščo

Dokumentacija

Naučite se uporabljati Asyntai

API referenca

Zgradite prilagojene integracije z Asyntai REST API

Pridobite API ključ

Zahtevan plačljiv načrt: Dostop do API je na voljo v načrtih Starter, Standard in Pro. Ogled cen

Pregled

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.

Avtentikacija

All API requests require authentication using your API key. You can get your API key from the API Settings page.

Vključite svoj API ključ v zahteve z eno od teh metod:

  • Glava Authorization (priporočeno): Authorization: Bearer YOUR_API_KEY
  • Glava X-API-Key: X-API-Key: YOUR_API_KEY

Vaš API ključ naj ostane skrivnost. Kdorkoli z vašim ključem lahko dostopa do vašega računa prek API. Nikoli ga ne izpostavljajte v kodi na strani odjemalca.

Osnovni URL

https://asyntai.com/api/v1/

Končne točke

POST /chat/

Pošljite sporočilo in prejmite odgovor, ustvarjen z UI.

Telo zahteve

{
  "message": "What are your business hours?",
  "session_id": "user_123",      // optional
  "website_id": 1                 // optional
}
Parameter Tip Zahtevano Opis
message string Da Uporabnikovo sporočilo za pošiljanje UI-ju
session_id string Ne Edinstven identifikator za pogovor. Uporabite isti session_id za ohranjanje zgodovine pogovora.
website_id integer Ne Specifičen ID spletnega mesta. Če ni naveden, se uporabi vaše primarno spletno mesto.

Odgovor

{
  "success": true,
  "response": "Our business hours are Monday-Friday, 9 AM to 5 PM EST.",
  "session_id": "user_123"
}

Primer (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"}'

Primer (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"])

Primer (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/

Seznam vseh spletnih mest, povezanih z vašim računom.

Odgovor

{
  "success": true,
  "websites": [
    {
      "id": 1,
      "name": "My Website",
      "domain": "example.com",
      "is_primary": true
    }
  ]
}

Primer (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 zahteve

Polje Tip Opis
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.

Odgovor

{
  "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>"
}

Primer (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.

Odgovor

{
  "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.

Primer (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 Nastavitve Examples
Any paid plan 25 widget_color, ai_support_name, initial_message
Starter in višje 22 profile_picture, conversation_starters_enabled
Standard in višje 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 zahteve

Polje Tip Opis
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/

Pridobite zgodovino pogovorov za določeno sejo.

Parametri poizvedbe

Parameter Tip Zahtevano Opis
session_id string Da ID seje, za katero želite pridobiti zgodovino
limit integer Ne Največje število sporočil za vrnitev (privzeto: 50, maks.: 100)

Odgovor

{
  "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
    }
  ]
}

Vprašanje in njegov odgovor sta shranjena v enem zapisu, zato imata oba enak timestamp. Ne odštevajte enega od drugega za merjenje hitrosti odgovora, ker je rezultat vedno nič. Uporabite response_time_ms, ki je dejanski čas odgovora v milisekundah.

sender_type je ai, ko je odgovoril klepetalni robot, in human, ko je klepet prevzel eden od vaših agentov. agent_name vsebuje prikazno ime tega agenta.

Primer (cURL)

curl "https://asyntai.com/api/v1/conversations/?session_id=user_123&limit=20" \
  -H "Authorization: Bearer YOUR_API_KEY"

GET /sessions/

Seznam vaših nedavnih sej klepeta. Uporabite to za odkrivanje ID-jev sej, ki jih lahko nato posredujete v /conversations/ za pridobitev celotne zgodovine sporočil.

Parametri poizvedbe

Parameter Tip Zahtevano Opis
limit integer Ne Število nedavnih sej za vrnitev (privzeto: 20, maks.: 100)
website_id string Ne Filtrirajte seje po določenem ID-ju spletnega mesta
source string Ne Filtrirajte po viru seje: widget, api, whatsapp, instagram, messenger, gorgias, freshchat, zapier
since string Ne Samo seje, katerih zadnje sporočilo je na ta datum ISO ali pozneje, na primer 2024-01-15
before string Ne Samo seje, katerih zadnje sporočilo je pred tem datumom ISO ali datumom in časom. Uporabite ga za listanje nazaj, glejte spodaj.

Odgovor

{
  "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"
    }
  ]
}

Polja s časovnimi žigi za poročanje

Polje Opis
started_at Kdaj je obiskovalec odprl klepet. Na voljo samo za seje pripomočka, ker seje, ustvarjene prek API-ja, nikoli ne odprejo pripomočka.
first_message_at Kdaj je bilo shranjeno prvo sporočilo pogovora.
first_response_time_ms Koliko časa je trajal prvi odgovor, v milisekundah. To uporabite za čas prvega odgovora.
first_human_response_at Kdaj je eden od vaših agentov poslal prvi odgovor. Vrednost je null, ko je klepetalni robot vodil celoten pogovor.
taken_over_at Kdaj je agent prevzel klepet od klepetalnega robota.
last_message_at Kdaj je bilo shranjeno zadnje sporočilo pogovora.
ended_at Kdaj je obiskovalec zapustil klepet. Klepet nima stanja rešeno ali zaprto, ker se obiskovalec lahko vedno vrne in postavi novo vprašanje.

Vsi časovni žigi so v UTC in uporabljajo obliko ISO 8601. Časovnega pasu ni mogoče spremeniti. Vrednosti pretvorite v svojem orodju za poročanje.

Druga polja za poročanje

Polje Opis
page_url Stran, na kateri je bil obiskovalec ob začetku klepeta. Na voljo samo za seje pripomočka.
country Država obiskovalca po naslovu IP v času klepeta. Na voljo samo za seje pripomočka.
category Tema iz kategorij klepetov. Prazno, ko je funkcija izklopljena ali dnevno opravilo tega klepeta še ni označilo.

Primer (cURL)

curl "https://asyntai.com/api/v1/sessions/?since=2024-01-01&limit=100" \
  -H "Authorization: Bearer YOUR_API_KEY"

Listanje po zgodovini

En klic vrne največ 100 sej, najnovejše najprej. Za branje dlje nazaj vzemite last_message_at zadnje seje na strani in ga v naslednjem klicu podajte kot before. Ponavljajte, dokler klic ne vrne praznega seznama.

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/

Pridobi zbrane potencialne stranke — e-poštne naslove in telefonske številke, ki so jih obiskovalci poslali med pogovori v klepetu.

Parametri poizvedbe

Parameter Tip Zahtevano Opis
limit integer Ne Število potencialnih strank za vrnitev (privzeto: 50, maks: 100)
website_id string Ne Filtrirajte potencialne stranke po določenem ID-ju spletnega mesta
since string Ne Samo potencialne stranke, ki so se začele na ta datum ISO ali pozneje, na primer 2024-01-15
before string Ne Samo potencialne stranke, ki so se začele pred tem datumom ali časom ISO. Uporabite za pomikanje nazaj po celotni zgodovini.

Odgovor

{
  "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"
    }
  ]
}
Polje Tip Opis
session_id string ID seje klepeta. Posredujte ga v /conversations/ za ogled celotne zgodovine klepeta.
email niz ali null E-poštni naslov, ki ga je posredoval obiskovalec, ali null, če ni bil zbran
phone niz ali null Telefonska številka, ki jo je posredovala obiskovalka, ali null, če ni bila zbrana
page_url niz ali null URL strani, kjer se je obiskovalec pogovarjal
started_at string Časovni žig ISO 8601 začetka seje klepeta

Primer (cURL)

curl "https://asyntai.com/api/v1/leads/?limit=20" \
  -H "Authorization: Bearer YOUR_API_KEY"

Primer (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/

Pridobite zahtevke podpore s časovnimi žigi, ki jih potrebujete za merjenje časov obravnave: kdaj je zahtevek prispel, kdaj ga je nekdo prevzel, kdaj je bil prvič odgovorjen in kdaj je bil rešen.

Parametri poizvedbe

Parameter Tip Zahtevano Opis
limit integer Ne Število vrnjenih zahtevkov (privzeto: 50, največ: 100)
website_id string Ne Filtriraj zahtevke po ID-ju spletnega mesta ali po domeni spletnega mesta, na primer example.com
name string Ne Filtriraj po katerem koli delu imena obiskovalca, na primer anna
status string Ne Filtriraj po stanju: open, in_progress, resolved ali closed
since string Ne Samo zahtevki, ustvarjeni na ta datum ISO ali pozneje, na primer 2024-01-15
before string Ne Samo zahtevki, ustvarjeni pred tem datumom ISO ali datumom in časom. Uporabite ga za listanje nazaj, glejte spodaj.

Odgovor

{
  "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"
    }
  ]
}
Polje Tip Opis
ticket_number string Oznaka zahtevka, prikazana v vaši nadzorni plošči
session_id string Seja klepeta, iz katere je nastal zahtevek. Posredujte jo na /conversations/ in preberite celoten pogovor za zahtevkom.
visitor_name niz ali null Ime obiskovalca ali null, če ga obiskovalec ni navedel
status string Eno od: open, in_progress, resolved, closed
priority string Eno od: low, medium, high
channel string Od kod je prišel pogovor, na primer session za spletni klepet
assigned_to niz ali null Član ekipe, ki ima zahtevek, ali null, če ga ni prevzel nihče
created_at string Kdaj je bil zahtevek ustvarjen
first_assigned_at niz ali null Kdaj je nekdo prvič prevzel zahtevek. Null, če tega ni storil nihče.
first_response_at niz ali null Kdaj je bil iz Asyntaija poslan prvi odgovor. Null, če iz Asyntaija ni bilo odgovora.
resolved_at niz ali null Kdaj je bil zahtevek označen kot rešen. Null, dokler ostaja odprt.

Vidimo samo odgovore, poslane iz Asyntaija. Če vaša ekipa obiskovalcu odgovori iz lastnega poštnega predala, tega nikoli ne vidimo in first_response_at ostane prazen, čeprav je obiskovalec dobil odgovor. Upoštevajte to, preden iz teh številk računate povprečja.

Vsi časovni žigi so v UTC in uporabljajo obliko ISO 8601. Zahtevki, ustvarjeni pred to funkcijo, nimajo first_assigned_at ali first_response_at, ker ti časi nikoli niso bili zabeleženi.

Primer (cURL)

curl "https://asyntai.com/api/v1/tickets/?status=resolved&limit=20" \
  -H "Authorization: Bearer YOUR_API_KEY"

Primer (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)

Listanje po zgodovini

En klic vrne največ 100 zahtevkov, najnovejše najprej. Za branje dlje nazaj vzemite created_at zadnjega zahtevka na strani in ga v naslednjem klicu podajte kot before. Ponavljajte, dokler klic ne vrne praznega seznama.

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/

Pridobite informacije o svojem računu in statistiko uporabe.

Odgovor

{
  "success": true,
  "account": {
    "email": "[email protected]",
    "plan": "starter",
    "messages_used": 150,
    "messages_limit": 800
  }
}

Primer (cURL)

curl https://asyntai.com/api/v1/account/ \
  -H "Authorization: Bearer YOUR_API_KEY"

Več spletnih mest? Končne točke baze znanja privzeto uporabljajo vaše primarno spletno mesto. Če imate več spletnih mest, posredujte website_id za ciljanje določenega. ID-je svojih spletnih mest lahko najdete z uporabo GET /websites/.

Dnevne omejitve nalaganja: Nalaganja v bazo znanja (besedilo, URL, preglednica) so predmet dnevne omejitve znakov glede na vaš načrt. To velja za celotno vsebino, naloženo prek vseh končnih točk baze znanja na dan.

Načrt Znakov/dan
Starter300.000
Standard1.500.000
Pro6.000.000

GET /knowledge/

Seznam vnosov vaše baze znanja. To so viri vsebine, ki jih vaš klepetalni robot z UI uporablja za odgovarjanje na vprašanja.

Parametri poizvedbe

Parameter Tip Zahtevano Opis
limit integer Ne Število vnosov za vrnitev (privzeto: 50, maks.: 100)
website_id string Ne Filtrirajte po ID-ju spletnega mesta (privzeto vaše primarno spletno mesto)

Odgovor

{
  "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"
    }
  ]
}

Primer (cURL)

curl "https://asyntai.com/api/v1/knowledge/?limit=10" \
  -H "Authorization: Bearer YOUR_API_KEY"

POST /knowledge/text/

Dodajte prilagojeno besedilno vsebino v svojo bazo znanja. UI bo to uporabila za odgovarjanje na vprašanja obiskovalcev.

Telo zahteve

{
  "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 Tip Zahtevano Opis
title string Da Naslov za ta vnos v bazo znanja
content string Da Besedilna vsebina (najmanj 10 znakov)
website_id string Ne Ciljno spletno mesto (privzeto vaše primarno spletno mesto)

Odgovor

{
  "success": true,
  "id": "abc-123-def",
  "title": "Return Policy",
  "chunks_created": 1
}

Primer (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/

Dodajte spletno stran v svojo bazo znanja. Vsebina bo samodejno pridobljena in izvlečena.

Telo zahteve

{
  "url": "https://example.com/faq",
  "website_id": "123"
}
Parameter Tip Zahtevano Opis
url string Da URL, s katerega se pridobi vsebina
website_id string Ne Ciljno spletno mesto (privzeto vaše primarno spletno mesto)

Odgovor

{
  "success": true,
  "id": "abc-123-def",
  "title": "FAQ - Example",
  "url": "https://example.com/faq",
  "chunks_created": 5
}

Primer (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/

Naložite preglednico CSV ali Excel (.xlsx) v svojo bazo znanja. Vsaka vrstica postane ločen vnos v bazo znanja, idealno za kataloge izdelkov, sezname pogostih vprašanj, cenike in imenike.

Zahteva

Pošljite kot multipart/form-data (nalaganje datoteke), ne JSON.

Parameter Tip Zahtevano Opis
file datoteka Da Datoteka .csv ali .xlsx. Prva vrstica morajo biti glave stolpcev. Največje število vrstic na nalaganje: Starter 500, Standard 2.000, Pro 10.000. Presežne vrstice so odrezane.
website_id string Ne Ciljno spletno mesto (privzeto vaše primarno spletno mesto)

Odgovor

{
  "success": true,
  "id": "abc-123-def",
  "title": "products.csv",
  "rows_processed": 15,
  "chunks_created": 15
}

Primer (cURL)

curl -X POST "https://asyntai.com/api/v1/knowledge/spreadsheet/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "[email protected]"

GET /knowledge/{id}/

Preberite en vnos iz zbirke znanja, vključno z besedilom, shranjenim zanj. Vrednost id izhaja iz odgovora GET /knowledge/.

Vsebina se vrne za vnose, ki ste jih dodali sami: besedilo, datoteke, preglednice, posamezne naslove URL in videoposnetke. Pregled spletnega mesta je na seznamu, vendar se njegove strani ne vrnejo, ker je vir vaše lastno javno spletno mesto. V tem primeru je content enak null, polje reason pa pojasni razlog.

Odgovor

{
  "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
}

Primer (cURL)

curl "https://asyntai.com/api/v1/knowledge/abc-123-def/" \
  -H "Authorization: Bearer YOUR_API_KEY"

DELETE /knowledge/{id}/

Izbrišite vnos iz baze znanja. id lahko najdete v odgovoru GET /knowledge/.

Odgovor

{
  "success": true,
  "message": "Knowledge base entry deleted"
}

Primer (cURL)

curl -X DELETE "https://asyntai.com/api/v1/knowledge/abc-123-def/" \
  -H "Authorization: Bearer YOUR_API_KEY"

Nasvet: Webhooke lahko upravljate tudi iz Nastavitve API strani brez pisanja kakršne koli kode.

GET /webhooks/

Seznam vaših registriranih webhookov.

Odgovor

{
  "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"
    }
  ]
}

Primer (cURL)

curl "https://asyntai.com/api/v1/webhooks/" \
  -H "Authorization: Bearer YOUR_API_KEY"

POST /webhooks/

Registrirajte nov webhook za prejemanje obvestil o dogodkih v realnem času.

Razpoložljivi dogodki

Dogodek Opis
message.received Obiskovalec je poslal sporočilo in prejel odgovor
conversation.started Začeta je bila nova seja klepeta
escalation.requested UI je sprožila eskalacijo na človeškega agenta
takeover.started Človeški agent je prevzel sejo klepeta

Telo zahteve

{
  "url": "https://example.com/webhook",
  "events": ["message.received", "escalation.requested"],
  "website_id": "123"
}
Parameter Tip Zahtevano Opis
url string Da HTTPS URL za prejemanje POST zahtev webhookov
events array Da Seznam dogodkov za naročilo (glejte zgornjo tabelo)
website_id string Ne Ciljno spletno mesto (privzeto vaše primarno spletno mesto)

Odgovor

{
  "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"
  }
}

Preverjanje webhookov: Vsak webhook vključuje secret (prikazano samo ob ustvarjanju). Vsak POST na vaš URL vključuje X-Webhook-Signature glavo — HMAC-SHA256 telesa zahteve, podpisan z vašim tajnim ključem.

Primer (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}/

Izbrišite webhook. id lahko najdete v odgovoru GET /webhooks/.

Odgovor

{
  "success": true,
  "message": "Webhook deleted"
}

Primer (cURL)

curl -X DELETE "https://asyntai.com/api/v1/webhooks/abc-123-def/" \
  -H "Authorization: Bearer YOUR_API_KEY"

Odgovori z napako

Vsi odgovori z napako sledijo temu formatu:

{
  "success": false,
  "error": "Error message describing what went wrong"
}
Statusna koda Opis
400 Napačna zahteva - Neveljavni parametri ali manjkajoča zahtevana polja
401 Nepooblaščeno - Neveljaven ali manjkajoč API ključ
429 Preveč zahtev - Dosežena omejitev sporočil za vaš načrt
503 Storitev ni na voljo - Storitev UI je začasno nedosegljiva

Omejitve hitrosti

Uporaba API je omejena z vašim naročniškim načrtom:

  • Free: 50 sporočil/mesec
  • Starter (39 $/mesec): 800 sporočil/mesec
  • Standard (139 $/mesec): 15.000 sporočil/mesec
  • Pro (449 $/mesec): 50.000 sporočil/mesec

Potrebujete pomoč?

If you have any questions or run into issues, contact us at [email protected].