> ## Documentation Index
> Fetch the complete documentation index at: https://docs.appeeky.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Answers

> Drill into a single AI assistant response — raw text, parsed app mentions, citations, and sentiment per app

```
GET /v1/ai-visibility/:appId/answers/:answerId
```

Returns the **raw** response from one AI assistant for one prompt, plus the parsed list of apps the assistant mentioned. This is the "show me the receipts" endpoint — useful for:

* Verifying *why* a particular intent has the visibility / sentiment score it does.
* Debugging an unexpected mention (e.g. why the assistant suggested an unrelated competitor).
* Embedding a "view source answer" link in your dashboard so users can see the actual model output.

`answerId` is exposed by the [intent drill-down](/docs/ai-visibility-intents) endpoint inside the `prompts[].latestAnswers[]` array.

***

## Path parameters

| Name     | Type          | Required | Description                                                             |
| -------- | ------------- | -------- | ----------------------------------------------------------------------- |
| appId    | string        | Yes      | Apple App ID (numeric) — must match the answer's owner app for security |
| answerId | string (UUID) | Yes      | Returned by [GET /intents/:intentId](/docs/ai-visibility-intents)       |

***

## Response

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "data": {
    "answer": {
      "id": "a789...",
      "promptId": "p123...",
      "intentId": "9c1f...",
      "modelSlug": "perplexity",
      "modelId": "sonar",
      "rawText": "If you have trouble winding down at night, here are five apps to consider:\n1. Calm — guided sleep stories and meditations [1].\n2. Headspace — sleepcasts that ease you into rest [2].\n3. Sleepwell — focuses on adaptive bedtime routines.\n4. Insight Timer — large free library of sleep sounds [3].\n5. Pillow — works with Apple Watch for gentle wake-ups.",
      "citations": [
        { "url": "https://www.calm.com/sleep", "title": "Sleep — Calm" },
        { "url": "https://www.headspace.com/sleep", "title": "Sleep with Headspace" },
        { "url": "https://insighttimer.com/", "title": "Insight Timer" }
      ],
      "fetchedAt": "2026-05-12T08:14:02.000Z",
      "status": "ok"
    },
    "mentions": [
      {
        "name": "Calm",
        "position": 1,
        "trackId": "571800810",
        "isOwnerApp": false,
        "sentiment": 0.8
      },
      {
        "name": "Headspace",
        "position": 2,
        "trackId": "493145008",
        "isOwnerApp": false,
        "sentiment": 0.6
      },
      {
        "name": "Sleepwell",
        "position": 3,
        "trackId": "1234567890",
        "isOwnerApp": true,
        "sentiment": 0.4
      },
      {
        "name": "Insight Timer",
        "position": 4,
        "trackId": "337472899",
        "isOwnerApp": false,
        "sentiment": 0.5
      },
      {
        "name": "Pillow",
        "position": 5,
        "trackId": "878988933",
        "isOwnerApp": false,
        "sentiment": 0.3
      }
    ]
  }
}
```

### `answer` fields

| Field       | Description                                                                                                                                                                                                       |
| ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`        | UUID. Same as the `answerId` you requested.                                                                                                                                                                       |
| `promptId`  | The prompt this answer was for. Use [GET /intents/:intentId](/docs/ai-visibility-intents) to find the prompt text.                                                                                                |
| `intentId`  | The intent the prompt belongs to.                                                                                                                                                                                 |
| `modelSlug` | One of `chatgpt`, `claude`, `gemini`, `perplexity`.                                                                                                                                                               |
| `modelId`   | Exact model ID used (e.g. `gpt-4.1`, `claude-sonnet-4-20250514`, `gemini-2.5-flash`, `sonar`).                                                                                                                    |
| `rawText`   | The assistant's complete answer. Whitespace-preserved. May contain markdown.                                                                                                                                      |
| `citations` | Web sources the assistant cited, when the model supports them. Currently only Perplexity returns citations; other models return `[]`.                                                                             |
| `fetchedAt` | When Appeeky fetched the answer (UTC).                                                                                                                                                                            |
| `status`    | `ok` (parsed cleanly), `parse_failed` (we kept the raw text but couldn't extract structured mentions), `refusal` (assistant declined to answer), `error` (the model call itself failed; `rawText` will be empty). |

### `mentions` fields

One row per app the assistant referred to in the answer, ordered by `position`.

| Field        | Description                                                                                                                                                           |
| ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `name`       | App name as the assistant wrote it.                                                                                                                                   |
| `position`   | 1-based rank when the assistant gave a list. `null` for free-form prose.                                                                                              |
| `trackId`    | Canonical App Store ID. `null` when the resolver couldn't confidently match the assistant's spelling.                                                                 |
| `isOwnerApp` | `true` when this mention is your tracked app.                                                                                                                         |
| `sentiment`  | −1 (negative) to +1 (positive), reflecting the assistant's framing in the surrounding sentence. `null` when the answer was a neutral list with no per-app commentary. |

***

## Citation handling

For models with web search (currently Perplexity), the assistant often inserts inline citation markers like `[1]`, `[2]`, `[3]` — those numbers map **1-indexed** into the `answer.citations` array.

If you want to match a mention back to a citation: when we extract mentions, the second-pass parser also returns a `citationIndex` on each app. That value is stored in the underlying `ai_visibility_app_mentions` table; it isn't currently exposed on this endpoint, but you can match the `[N]` markers in `rawText` to `answer.citations[N-1]` yourself for now.

***

## Code examples

<CodeGroup>
  ```bash curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl "https://api.appeeky.com/v1/ai-visibility/1234567890/answers/a789..." \
    -H "X-API-Key: YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const res = await fetch(
    "https://api.appeeky.com/v1/ai-visibility/1234567890/answers/a789...",
    { headers: { "X-API-Key": "YOUR_API_KEY" } }
  );
  const { answer, mentions } = (await res.json()).data;

  console.log(`[${answer.modelSlug}] ${answer.fetchedAt}`);
  console.log("\nRaw answer:\n" + answer.rawText);
  console.log("\nApps mentioned:");
  mentions.forEach((m) => {
    const star = m.isOwnerApp ? " ★" : "";
    console.log(`  ${m.position ?? "·"}. ${m.name}${star}  sentiment=${m.sentiment ?? "n/a"}`);
  });
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import requests

  r = requests.get(
    "https://api.appeeky.com/v1/ai-visibility/1234567890/answers/a789...",
    headers={"X-API-Key": "YOUR_API_KEY"},
  )
  data = r.json()["data"]
  print(data["answer"]["rawText"])
  print()
  for m in data["mentions"]:
      star = " ★" if m["isOwnerApp"] else ""
      print(f"  {m['position']}. {m['name']}{star}  sentiment={m['sentiment']}")
  ```
</CodeGroup>

***

## Pattern: walk every answer for an intent

```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}}
const HEADERS = { "X-API-Key": "YOUR_API_KEY" };

// 1. Get the intent drill-down
const intent = (
  await fetch(
    "https://api.appeeky.com/v1/ai-visibility/1234567890/intents/9c1f...?model=chatgpt",
    { headers: HEADERS }
  ).then((r) => r.json())
).data;

// 2. For each prompt's latest answer, fetch the raw text
for (const prompt of intent.prompts) {
  for (const a of prompt.latestAnswers) {
    const detail = await fetch(
      `https://api.appeeky.com/v1/ai-visibility/1234567890/answers/${a.answerId}`,
      { headers: HEADERS }
    ).then((r) => r.json());

    console.log(`\n## Prompt: ${prompt.text}`);
    console.log(`### Model: ${detail.data.answer.modelSlug}`);
    console.log(detail.data.answer.rawText);
  }
}
```

***

## Credits

* **1 credit** per call.

***

## Errors

| Status | Code       | When                                               |
| ------ | ---------- | -------------------------------------------------- |
| 404    | NOT\_FOUND | Answer doesn't exist or doesn't belong to this app |
| 401    | —          | Missing or invalid API key / JWT                   |
| 429    | —          | Insufficient monthly credits                       |

***

## See also

* [Intents endpoint](/docs/ai-visibility-intents) — source of `answerId`s in `prompts[].latestAnswers[]`
* [Prompts](/docs/ai-visibility-prompts) — see/manage the prompt that produced this answer
* [Overview](/docs/ai-visibility-overview) — concept page
