client.request_logs
Your recent API requests. These methods are on client.request_logs, where client is a MoreVoice client (see the Python SDK). On AsyncMoreVoice the same methods are awaited. Each one returns the response object and raises an exception when the API answers with an error.
list()
Section titled “list()”List request logs. Your recent /v1 requests in this mode, newest first, with redacted bodies: what was sent, what came back, how long it took. Filters combine: status (4xx, error, 404…), method, path (prefix), key_id, request_id, operation_id, created[gte]… Kept 30 days (test mode 7). Logging is switched on per organisation.
def list(self, *, limit: int | Unset = 20, starting_after: str | Unset = UNSET, ending_before: str | Unset = UNSET, status: str | Unset = UNSET, method: _m.RequestLogsListMethod | Unset = UNSET, path: str | Unset = UNSET, key_id: str | Unset = UNSET, request_id: str | Unset = UNSET, operation_id: str | Unset = UNSET, created: _m.RequestLogsListCreated | Unset = UNSET, more_voice_version: str | Unset = UNSET) -> AsyncPage[_m.RequestLog]client.request_logs.list() · await async_client.request_logs.list() · GET /request_logs · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
limit |
integer |
no | How many objects to return, 1–100 (default 20). |
starting_after |
string |
no | A cursor (next_cursor) or object ID: return the objects after it (older). |
ending_before |
string |
no | A cursor or object ID: return the objects before it (newer). |
status |
string |
no | A status class (2xx, 3xx, 4xx, 5xx), error (any 4xx or 5xx), or one status code (404). |
method |
"GET" | "POST" | "PATCH" | "PUT" | "DELETE" |
no | Only this HTTP method. |
path |
string |
no | Only paths starting with this (/v1/calls matches /v1/calls/call_…). |
key_id |
string |
no | Only requests made with this API key (key_…). |
request_id |
string |
no | Only the request with this X-Request-Id (req_…). |
operation_id |
string |
no | Only this operation (calls_create). |
created |
object |
no | Filter on when the request arrived: created[gte], created[gt], created[lte], created[lt] (ISO-8601). |
Returns
Section titled “Returns”A page of results (RequestLogList): data, has_more and next_cursor.
Example
Section titled “Example”from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
for request_log in client.request_logs.list(): print(request_log)retrieve()
Section titled “retrieve()”Retrieve a request log. Returns the RequestLog object. Answers 404 with the code resource_missing when nothing has this ID in this organisation and mode.
def retrieve(self, id: str, *, more_voice_version: str | Unset = UNSET) -> _m.RequestLogclient.request_logs.retrieve() · await async_client.request_logs.retrieve() · GET /request_logs/{id} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
str |
yes | A request log ID (rlog_…). |
Returns
Section titled “Returns”RequestLog:
| Field | Type | Description |
|---|---|---|
id |
string |
A request log ID (prefix rlog_). |
object |
"request_log" |
Always request_log. |
livemode |
boolean |
true in live mode, false in test mode. |
request_id |
string |
The request’s X-Request-Id (req_…), as error bodies and the X-Request-Id header show it. |
created |
string |
When the request arrived. |
method |
string |
— |
path |
string |
The path without the query string. |
query |
object | null |
The query string as an object (redacted), or null. |
route |
string | null |
The matched route template, e.g. /v1/calls/:id (null when no route matched). |
operation_id |
string | null |
The OpenAPI operationId of the route, e.g. calls_create. |
api_version |
string | null |
The API version the response was rendered in. |
status |
integer |
The HTTP status of the response. |
error_code |
string | null |
The error code (error.code) of an error response. |
latency_ms |
integer |
Time to answer, in milliseconds (streams: how long they stayed open). |
key_id |
string | null |
The API key that made the request. |
ip |
string | null |
— |
user_agent |
string | null |
— |
idempotency_key |
string | null |
— |
request_body |
any |
The request body, redacted (secrets, tokens, passwords and header values masked) and cut to 8 KB; null when there was none. |
response_body |
any |
The response body of errors and POSTs, redacted and cut to 8 KB; null otherwise. |
Example
Section titled “Example”from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
request_log = client.request_logs.retrieve("rlog_7Hk2Lm9Qp")print(request_log)stream()
Section titled “stream()”Stream request logs as they are written. Server-Sent Events: each new request log (same filters as the list, without created) a few seconds after the request finished. Counts against the key’s stream limit.
client.request_logs.stream() · await async_client.request_logs.stream() · GET /request_logs/stream · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
status |
string |
no | A status class (2xx, 3xx, 4xx, 5xx), error (any 4xx or 5xx), or one status code (404). |
method |
"GET" | "POST" | "PATCH" | "PUT" | "DELETE" |
no | Only this HTTP method. |
path |
string |
no | Only paths starting with this (/v1/calls matches /v1/calls/call_…). |
key_id |
string |
no | Only requests made with this API key (key_…). |
request_id |
string |
no | Only the request with this X-Request-Id (req_…). |
operation_id |
string |
no | Only this operation (calls_create). |
Returns
Section titled “Returns”A stream of events (Server-Sent Events): iterate it, or async for it on AsyncMoreVoice.
Example
Section titled “Example”import os
import httpx
url = "https://api.morevoice.ai/v1/request_logs/stream"headers = {"Authorization": f"Bearer {os.environ['MOREVOICE_API_KEY']}", "Accept": "text/event-stream"}with httpx.stream("GET", url, headers=headers, timeout=None) as response: response.raise_for_status() for line in response.iter_lines(): if line.startswith("data:"): print(line[5:].strip())