Preskočiť na obsah
Pre vývojárov

Referencia API

Všetky adresy API poskladané priamo zo špecifikácie OpenAPI. Názvy polí a podrobné popisy sú po anglicky.

Základná adresa je https://ottoai.sk. Každá požiadavka posiela Authorization: Bearer <kľúč>. Strojovo čitateľná podoba je v openapi.json.

Account

GET/api/v1/me

Kto som: firma, plán, funkcie a zoznam udalostí

Odpoveď 200

  • tenant object
    • id string (uuid)
    • name string
  • plan string
  • features object
    • api boolean
    • webhooks boolean
    • whiteLabel boolean
  • limits object
    • conversationsPerMonth integer | null
  • events string[]

Chyby: 401 403 429

GET/api/v1/stats

Počty a výsledky konverzácií v čase

Without parameters: the last 30 days by day in Europe/Bratislava. The range is at most 400 days. resolvedByOtto + unanswered are the conversations Otto handled alone, which the panel shows as solved by Otto.

Parametre

  • since query · string (date-time) nepovinné Created at or after this time.
  • until query · string (date-time) nepovinné Created before this time.
  • interval query · day | week | month nepovinné Weeks start on Monday.
  • timezone query · string nepovinné IANA time zone for the series boundaries.

Odpoveď 200

  • conversationsTotal integer
  • conversationsMonth integer
  • products integer
  • range object
    • since string (date-time)
    • until string (date-time)
    • interval day | week | month
    • timezone string
    • totals object
      • conversations integer
      • resolvedByOtto integer
      • unanswered integer
      • handedOff integer
      • missed integer
      • ratingUp integer
      • ratingDown integer
      • leads integer
      • returns integer
    • series object[]
      • date string (date) First day of the interval in the given time zone.
      • conversations integer
      • resolvedByOtto integer
      • unanswered integer
      • handedOff integer
      • missed integer
      • ratingUp integer
      • ratingDown integer

Chyby: 400 401 403 429

GET/api/v1/usage

Spotreba odpovedí v tomto mesiaci

limit and remaining are null on an unlimited plan.

Odpoveď 200

  • month string
  • conversations integer
  • limit integer | null
  • remaining integer | null

Chyby: 401 403 429

Conversations

GET/api/v1/conversations

Zoznam konverzácií

Newest activity first. Returns no message text, use GET /api/v1/conversations/{id} for that.

Parametre

  • status query · bot | human | resolved nepovinné
  • outcome query · resolved_by_otto | unanswered | handed_off | missed nepovinné
  • lang query · string nepovinné Two-letter language code, for example sk, cs or en.
  • since query · string (date-time) nepovinné Created at or after this time.
  • until query · string (date-time) nepovinné Created before this time.
  • updatedSince query · string (date-time) nepovinné Changed at or after this time.
  • before query · string nepovinné nextBefore from the previous page. Opaque, do not build it yourself.
  • limit query · integer nepovinné

Odpoveď 200

  • conversations Conversation[]
    • id string (uuid)
    • status bot | human | resolved
    • outcome resolved_by_otto | unanswered | handed_off | missed
    • lang string | null
    • tags string[]
    • rating 1 | -1 | null
    • createdAt string (date-time)
    • lastAt string | null (date-time)
    • updatedAt string (date-time)
  • nextBefore string | null

Chyby: 400 401 403 429

GET/api/v1/conversations/{id}

Jedna konverzácia aj so správami

The only endpoint that returns message text. At most 500 messages, oldest first.

Parametre

  • id path · string (uuid)

Odpoveď 200

  • conversation ConversationDetail
    • id string (uuid)
    • status bot | human | resolved
    • outcome resolved_by_otto | unanswered | handed_off | missed
    • lang string | null
    • tags string[]
    • rating 1 | -1 | null
    • createdAt string (date-time)
    • lastAt string | null (date-time)
  • messages Message[]
    • role user | bot | operator
    • kind string | null
    • text string
    • at string (date-time)

Chyby: 401 403 404 429

POST/api/v1/conversations/{id}/messages

Odpovedať zákazníkovi

Sends a message as a colleague, exactly like replying in the panel. The conversation switches to human and Otto stays quiet in it. A customer who is not on the site gets the reply by email.

Parametre

  • id path · string (uuid)

Telo požiadavky

  • text string
  • operatorId string (uuid) nepovinné Team member from GET /api/v1/operators. Without it the author is shown as API.

Odpoveď 200

  • ok true
  • message object
    • role "operator"
    • kind "text"
    • text string
    • author string
    • at string (date-time)
  • conversation object
    • id string (uuid)
    • status "human"

Chyby: 400 401 403 404 429

POST/api/v1/conversations/{id}/notes

Pridať internú poznámku

The customer never sees notes.

Parametre

  • id path · string (uuid)

Telo požiadavky

  • text string
  • operatorId string (uuid) nepovinné Team member from GET /api/v1/operators. Without it the author is shown as API.

Odpoveď 200

  • ok true
  • note object
    • id string
    • author string
    • text string
    • at string (date-time)

Chyby: 400 401 403 404 429

POST/api/v1/conversations/{id}/takeover

Prevziať konverzáciu

Otto stops answering. Without operatorId the current assignee stays. Sends the conversation.operator_joined event.

Parametre

  • id path · string (uuid)

Telo požiadavky

  • operatorId string (uuid) nepovinné Team member from GET /api/v1/operators. Without it the author is shown as API.

Odpoveď 200

  • ok true
  • conversation object
    • id string (uuid)
    • status "human"
    • assignee string | null (uuid)

Chyby: 400 401 403 404 409 429

POST/api/v1/conversations/{id}/release

Vrátiť konverzáciu Ottovi

Otto answers on its own again and nobody is assigned.

Parametre

  • id path · string (uuid)

Odpoveď 200

  • ok true
  • conversation object
    • id string (uuid)
    • status "bot"
    • assignee null

Chyby: 401 403 404 409 429

POST/api/v1/conversations/{id}/resolve

Vyriešiť konverzáciu

Like Resolve in the panel. Sends the conversation.resolved event.

Parametre

  • id path · string (uuid)

Odpoveď 200

  • ok true
  • conversation object
    • id string (uuid)
    • status "resolved"

Chyby: 401 403 404 429

POST/api/v1/conversations/{id}/reopen

Otvoriť vyriešenú konverzáciu

The conversation returns to human.

Parametre

  • id path · string (uuid)

Odpoveď 200

  • ok true
  • conversation object
    • id string (uuid)
    • status "human"

Chyby: 401 403 404 429

Leads

GET/api/v1/leads

Kontakty, ktoré zákazníci nechali

Parametre

  • since query · string (date-time) nepovinné Created at or after this time.
  • until query · string (date-time) nepovinné Created before this time.
  • before query · string nepovinné nextBefore from the previous page. Opaque, do not build it yourself.
  • limit query · integer nepovinné

Odpoveď 200

  • leads Lead[]
    • id string (uuid)
    • conversationId string | null (uuid)
    • name string
    • email string
    • phone string
    • note string
    • handled boolean
    • createdAt string (date-time)
  • nextBefore string | null

Chyby: 400 401 403 429

PATCH/api/v1/leads/{id}

Označiť kontakt ako vybavený

Sends the lead.updated event when the value changes.

Parametre

  • id path · string (uuid)

Telo požiadavky

  • handled boolean

Odpoveď 200

  • ok true
  • lead object
    • id string (uuid)
    • handled boolean

Chyby: 400 401 403 404 429

Returns

GET/api/v1/returns

Reklamácie a vrátenia

Parametre

  • status query · new | approved | rejected | resolved nepovinné
  • kind query · claim | withdrawal nepovinné
  • since query · string (date-time) nepovinné Created at or after this time.
  • until query · string (date-time) nepovinné Created before this time.
  • updatedSince query · string (date-time) nepovinné Changed at or after this time.
  • before query · string nepovinné nextBefore from the previous page. Opaque, do not build it yourself.
  • limit query · integer nepovinné

Odpoveď 200

  • returns Return[]
    • id string
    • kind claim | withdrawal
    • status new | approved | rejected | resolved
    • orderId string
    • issue string
    • want string
    • name string
    • email string
    • conversationId string | null (uuid)
    • createdAt string (date-time)
    • decidedAt string | null (date-time)
  • nextBefore string | null

Chyby: 400 401 403 429

PATCH/api/v1/returns/{id}

Rozhodnúť o reklamácii alebo vrátení

Like the decision in the panel. notify: true emails the customer the decision and your note. Sends the return.updated event.

Parametre

  • id path · string

Telo požiadavky

  • status new | approved | rejected | resolved
  • note string nepovinné
  • notify boolean nepovinné

Odpoveď 200

  • ok true
  • return object
    • id string
    • status string

Chyby: 400 401 403 404 429

Unanswered

GET/api/v1/unanswered

Otázky bez istej odpovede

Parametre

  • since query · string (date-time) nepovinné Created at or after this time.
  • until query · string (date-time) nepovinné Created before this time.
  • before query · string nepovinné nextBefore from the previous page. Opaque, do not build it yourself.
  • limit query · integer nepovinné

Odpoveď 200

  • unanswered Unanswered[]
    • id string
    • conversationId string | null (uuid)
    • question string
    • at string (date-time)
  • nextBefore string | null

Chyby: 400 401 403 429

POST/api/v1/unanswered/{id}/dismiss

Skryť otázku zo zoznamu

Parametre

  • id path · string

Odpoveď 200

  • ok true

Chyby: 401 403 404 429

Catalogue

GET/api/v1/products

Produkty, ktoré Otto pozná

Parametre

  • before query · string nepovinné nextBefore from the previous page. Opaque, do not build it yourself.
  • limit query · integer nepovinné

Odpoveď 200

  • products Product[]
    • id string
    • externalId string | null
    • title string
    • url string | null
    • meta object
    • updatedAt string (date-time)
  • nextBefore string | null

Chyby: 401 403 429

POST/api/v1/products

Pridať alebo zmeniť produkty

Only what you send, nothing is deleted. At most 500 at once. Meant for price and stock changes.

Telo požiadavky

  • products ProductInput[]
    • id string Your product id. externalId works too.
    • title string name works too.
    • description string nepovinné
    • url string nepovinné
    • image string nepovinné imageUrl works too.
    • price number nepovinné
    • currency string nepovinné
    • availability string nepovinné
    • category string nepovinné
    • manufacturer string nepovinné
    • params object nepovinné

Odpoveď 200

  • ok true
  • products integer

Chyby: 400 401 429

POST/api/v1/products/snapshot

Nahradiť celý katalóg

Products missing from the snapshot are deleted. At most 5000 at once and 12 times per hour. If you send far fewer products than we hold, we delete nothing and add warning with errcode prune_skipped.

Telo požiadavky

  • products ProductInput[]
    • id string Your product id. externalId works too.
    • title string name works too.
    • description string nepovinné
    • url string nepovinné
    • image string nepovinné imageUrl works too.
    • price number nepovinné
    • currency string nepovinné
    • availability string nepovinné
    • category string nepovinné
    • manufacturer string nepovinné
    • params object nepovinné

Odpoveď 200

  • ok true
  • products integer
  • removed integer
  • currency string | null nepovinné
  • warning string nepovinné
  • errcode "prune_skipped" nepovinné

Chyby: 400 401 429

DELETE/api/v1/products/{id}

Zmazať jeden produkt

Parametre

  • id path · string

Odpoveď 200

  • ok true

Chyby: 401 404 429

Knowledge

GET/api/v1/knowledge

Znalosti okrem produktov

source faq was added by you, page was read from your website. Only faq records can be deleted.

Parametre

  • before query · string nepovinné nextBefore from the previous page. Opaque, do not build it yourself.
  • limit query · integer nepovinné

Odpoveď 200

  • knowledge Knowledge[]
    • id string
    • source faq | page
    • title string
    • content string
    • url string | null
    • updatedAt string (date-time)
    • deletable boolean
  • nextBefore string | null

Chyby: 401 403 429

POST/api/v1/knowledge

Pridať znalosť

Otto uses it right away.

Telo požiadavky

  • title string
  • content string

Odpoveď 200

  • ok true
  • id string

Chyby: 400 401 403 429

DELETE/api/v1/knowledge/{id}

Zmazať vlastnú znalosť

Parametre

  • id path · string

Odpoveď 200

  • ok true

Chyby: 401 403 404 429

Team

GET/api/v1/operators

Váš tím

Use id as operatorId in conversation actions.

Odpoveď 200

  • operators Operator[]
    • id string (uuid)
    • name string
    • email string
    • role owner | operator

Chyby: 401 403 429

Webhooks

GET/api/v1/webhooks/deliveries

Doručenia webhookov

Parametre

  • status query · pending | delivered | failed | cancelled nepovinné
  • event query · string nepovinné
  • before query · string nepovinné nextBefore from the previous page. Opaque, do not build it yourself.
  • limit query · integer nepovinné

Odpoveď 200

  • deliveries Delivery[]
    • id string (uuid)
    • event string
    • status pending | delivered | failed | cancelled
    • httpStatus integer | null
    • attempts integer
    • error string | null
    • unconfirmed boolean
    • test boolean
    • createdAt string (date-time)
    • lastAttemptAt string | null (date-time)
    • nextAttemptAt string | null (date-time)
    • canResend boolean
  • nextBefore string | null

Chyby: 400 401 403 429

POST/api/v1/webhooks/deliveries/{id}/resend

Poslať udalosť znova

The body is kept 7 days after the last attempt; after that 410.

Parametre

  • id path · string (uuid)

Odpoveď 202

  • ok true
  • id string (uuid)

Chyby: 401 403 404 409 410 429

POST/api/v1/webhooks/test

Poslať skúšobnú udalosť

Delivers right away and tells you how your URL answered.

Odpoveď 200

  • id string (uuid)
  • status pending | delivered | failed | cancelled
  • httpStatus integer | null
  • unconfirmed boolean
  • error string | null

Chyby: 400 401 403 409 429