API i MCP

API raportów

Raport AI czyta zestaw zakończonych rozmów i opisuje sentyment, powtarzające się tematy i problemy. API zwraca raporty, które Twój zespół utworzył w panelu. Nie może tworzyć nowych. O uwierzytelnianiu, paginacji i błędach przeczytasz na stronie Przegląd API.

Lista raportów#

HTTP
GET /api/v1/projects/{project_id}/reports

Zwraca raporty w projekcie, od najnowszych, bez ich treści. Usunięte raporty są pomijane.

Parametry zapytania#

ParametrOpis
statusJedna lub więcej wartości generating, completed, failed, rozdzielonych przecinkami
limitOd 1 do 100. Domyślnie 25.
cursorWartość next_cursor z poprzedniej strony

Przykład#

curl -G "https://diaform.io/api/v1/projects/b8acb3ab-1f3d-4a7e-a846-b7f493f86b6d/reports" \
  -H "Authorization: Bearer $DIAFORM_API_KEY" \
  --data-urlencode "status=completed"

Odpowiedź#

JSON
{
  "data": [
    {
      "id": "882f2ed7-07d9-4344-aced-9e523275b196",
      "project_id": "b8acb3ab-1f3d-4a7e-a846-b7f493f86b6d",
      "status": "completed",
      "title": "Support problems overshadow a well-liked product",
      "focus": null,
      "selection": {
        "mode": "date_range",
        "range_start": "2026-05-01T00:00:00+00:00",
        "range_end": "2026-05-31T23:59:59+00:00"
      },
      "conversation_count": 48,
      "first_conversation_at": "2026-05-01T08:12:09.692998+00:00",
      "last_conversation_at": "2026-05-30T13:11:09.628765+00:00",
      "sentiment_counts": {
        "positive": 14,
        "negative": 11,
        "neutral": 8,
        "mixed": 15,
        "unknown": 0
      },
      "error_message": null,
      "created_at": "2026-06-01T09:33:49.465144+00:00",
      "completed_at": "2026-06-01T09:34:07.2+00:00"
    }
  ],
  "has_more": false,
  "next_cursor": null
}

Pola raportu#

PoleTypOpis
idstringID raportu
project_idstringProjekt, do którego należy raport
statusstringgenerating, completed lub failed
titlestring lub nullTytuł, który AI nadało raportowi. null, dopóki raport nie jest gotowy.
focusstring lub nullPytanie od Twojego zespołu, na którym raport ma się skupić, jeśli je podano
selection.modestringdate_range (wszystkie zakończone rozmowy z danego okresu) lub manual (ręcznie wybrane rozmowy)
selection.range_start, selection.range_endstring lub nullOkres dla date_range. null oznacza brak ograniczenia z tej strony.
conversation_countnumberIle rozmów obejmuje raport
first_conversation_at, last_conversation_atstring lub nullKiedy utworzono najstarszą i najnowszą z objętych rozmów
sentiment_countsobject lub nullObjęte rozmowy w podziale na ogólny sentyment. null, dopóki raport nie jest gotowy.
error_messagestring lub nullDlaczego raport ze statusem failed się nie powiódł
created_atstringKiedy zlecono raport
completed_atstring lub nullKiedy został ukończony lub się nie powiódł

Pobieranie raportu#

HTTP
GET /api/v1/reports/{report_id}

Zwraca jeden raport ze wszystkimi polami z listy oraz conversation_ids i treścią w content.

Przykład#

curl "https://diaform.io/api/v1/reports/882f2ed7-07d9-4344-aced-9e523275b196" \
  -H "Authorization: Bearer $DIAFORM_API_KEY"

Odpowiedź#

Pola wspólne z listą są tu pominięte.

JSON
{
  "id": "882f2ed7-07d9-4344-aced-9e523275b196",
  "status": "completed",
  "title": "Support problems overshadow a well-liked product",
  "conversation_ids": [
    "0f8d43a2-6df9-49c8-bf5d-fd2b6ec2d9ee",
    "912b8ced-f69d-4f50-b497-9a712fe59359"
  ],
  "content": {
    "summary": "Most respondents like the product and would recommend it, but support wait times came up in a quarter of the interviews.",
    "focus_answer": null,
    "sentiment_explanation": "Praise for the product is offset by frustration with support.",
    "themes": [
      {
        "title": "Customer support is the top complaint",
        "detail": "Twelve respondents described long waits before reaching support.",
        "tone": "negative",
        "mention_count": 12,
        "conversation_ids": ["912b8ced-f69d-4f50-b497-9a712fe59359"],
        "quotes": [
          {
            "conversation_id": "912b8ced-f69d-4f50-b497-9a712fe59359",
            "text": "it took me 25 min to connect last time, which is too long",
            "translation": null,
            "respondent_label": "alex@acme.com",
            "created_at": "2026-05-10T17:52:10.539708+00:00"
          }
        ]
      }
    ],
    "issues": [
      {
        "title": "Invite emails land in spam",
        "detail": "Three respondents never received their teammate invite.",
        "severity": "high",
        "mention_count": 3,
        "conversation_ids": ["0f8d43a2-6df9-49c8-bf5d-fd2b6ec2d9ee"],
        "quotes": []
      }
    ],
    "outliers": [
      {
        "title": "Request for an on-premise version",
        "detail": "One enterprise respondent can't use cloud tools.",
        "mention_count": 1,
        "conversation_ids": ["0f8d43a2-6df9-49c8-bf5d-fd2b6ec2d9ee"]
      }
    ]
  }
}

Pola treści#

content ma wartość null, gdy raport ma status generating lub failed.

PoleTypOpis
conversation_idsarrayWszystkie rozmowy objęte raportem
content.summarystringOgólne podsumowanie raportu
content.focus_answerstring lub nullOdpowiedź na focus raportu, jeśli go ustawiono
content.sentiment_explanationstringCo stoi za takim rozkładem sentymentu
content.themesarrayPowtarzające się tematy, od najczęściej wspominanych
content.themes[].tonestringpositive, negative, mixed lub neutral
content.issuesarrayKonkretne problemy do naprawy
content.issues[].severitystringhigh, medium lub low
content.outliersarrayWarte uwagi kwestie poruszone tylko przez kilku respondentów. Nie mają cytatów.
title, detailstringPrzy każdym temacie, problemie i odosobnionym głosie: nagłówek i krótkie wyjaśnienie
mention_countnumberW ilu rozmowach to się pojawiło
conversation_idsarrayTe rozmowy. Każdą z nich pobierzesz przez API rozmów.
quotes[].textstringDosłowne słowa respondenta
quotes[].translationstring lub nullAngielskie tłumaczenie, gdy cytat jest w innym języku
quotes[].conversation_idstringRozmowa, z której pochodzi cytat
quotes[].respondent_labelstring lub nullKto to powiedział, jeśli wiadomo
quotes[].created_atstringKiedy utworzono tę rozmowę

Raport to obraz rozmów z chwili, w której został napisany. Jeśli rozmowa zostanie później usunięta, jej cytaty są usuwane z raportu.