> For the complete documentation index, see [llms.txt](https://docs.amigo.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.amigo.ai/developer-guide/platform-api/safety/prompt-logs.md).

# Prompt Logs

The Prompt Logs endpoint lets you retrieve captured LLM inputs and outputs from agent conversations, including available system prompts, conversation history, tool catalogs, model selection, and responses. Coverage and populated fields vary by prompt type and logging path. This is useful for auditing agent behavior, debugging unexpected responses, and understanding how context flows through multi-turn conversations.

{% hint style="warning" %}
**Access restriction**: Prompt log access requires an API key with the **admin** or **owner** role. Prompt logs contain full conversation history and tool I/O, which may include PHI. All reads are audit-logged.
{% endhint %}

## List Prompt Logs

{% openapi src="<https://api.platform.amigo.ai/v1/openapi.json>" path="/v1/{workspace\_id}/prompt-logs" method="get" %}
<https://api.platform.amigo.ai/v1/openapi.json>
{% endopenapi %}

Returns available prompt log entries for the workspace, newest first.

{% hint style="info" %}
**Auto-applied time window**: When none of `conversation_id`, `call_sid`, `from_ts`, or `to_ts` is provided, the query is automatically capped to the last 7 days. The applied window is reported in the `applied_time_window_days` response field.
{% endhint %}

{% hint style="info" %}
String fields such as `system_prompt`, `full_prompt`, and `llm_response` can be large. Do not assume a maximum length beyond limits published in the API schema.
{% endhint %}

### Pagination

The endpoint uses peek-ahead pagination. When `has_more` is true, pass the value of `next_offset` as the `offset` parameter on the next request to retrieve the next page.

### Error Responses

| Status                    | Description                                                                       |
| ------------------------- | --------------------------------------------------------------------------------- |
| `400 Bad Request`         | Both `conversation_id` and `call_sid` were supplied (they are mutually exclusive) |
| `403 Forbidden`           | Caller does not have admin or owner role                                          |
| `404 Not Found`           | `conversation_id` does not match a conversation in this workspace                 |
| `503 Service Unavailable` | Prompt log data source is unavailable                                             |

### Example

```bash
curl -X GET \
  'https://api.platform.amigo.ai/v1/{workspace_id}/prompt-logs?call_sid=CA1234567890&limit=10' \
  -H 'Authorization: Bearer {api_key}'
```

```json
{
  "items": [
    {
      "event_id": "evt_abc123",
      "call_sid": "CA1234567890",
      "workspace_id": "ws_xyz",
      "effective_at": "2026-07-15T14:30:00Z",
      "prompt_type": "engage_user",
      "turn_index": 3,
      "system_prompt": "You are a helpful healthcare scheduling assistant...",
      "history": [
        {"role": "user", "content": "I need to reschedule my appointment"},
        {"role": "assistant", "content": "I can help with that..."}
      ],
      "llm_model": "model-v2",
      "llm_response": "Let me look up your upcoming appointments...",
      "state_name": "scheduling",
      "tool_names": ["search_appointments", "reschedule_appointment"],
      "has_tools": true,
      "data_parse_error": false
    }
  ],
  "count": 1,
  "has_more": false,
  "next_offset": null,
  "applied_time_window_days": null
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.amigo.ai/developer-guide/platform-api/safety/prompt-logs.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
