mv.requestLogs
Your recent API requests. These methods are on mv.requestLogs, where mv is your client (see the Node.js SDK). Each one returns the response object and throws 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.
mv.requestLogs.list(query?: NonNullable<RequestLogsListData["query"]>, options?: RequestOptions): PagedList<RequestLogsListResponse["data"][number], NonNullable<RequestLogsListData["query"]>>GET /request_logs · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
query.limit |
integer |
no | How many objects to return, 1–100 (default 20). |
query.starting_after |
string |
no | A cursor (next_cursor) or object ID: return the objects after it (older). |
query.ending_before |
string |
no | A cursor or object ID: return the objects before it (newer). |
query.status |
string |
no | A status class (2xx, 3xx, 4xx, 5xx), error (any 4xx or 5xx), or one status code (404). |
query.method |
string |
no | Only this HTTP method. |
query.path |
string |
no | Only paths starting with this (/v1/calls matches /v1/calls/call_…). |
query.key_id |
string |
no | Only requests made with this API key (key_…). |
query.request_id |
string |
no | Only the request with this X-Request-Id (req_…). |
query.operation_id |
string |
no | Only this operation (calls_create). |
query.created |
object |
no | Filter on when the request arrived: created[gte], created[gt], created[lte], created[lt] (ISO-8601). |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”A PagedList: await it for the first page, for await it for every item.
Example
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
for await (const requestLog of mv.requestLogs.list()) { console.log(requestLog);}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.
mv.requestLogs.retrieve(id: RequestLogsRetrieveData["path"]["id"], options?: RequestOptions): Promise<RequestLogsRetrieveResponse>GET /request_logs/{id} · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
yes | A request log ID (rlog_…). |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
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”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const requestLog = await mv.requestLogs.retrieve("rlog_7Hk2Lm9Qp");console.log(requestLog);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.
mv.requestLogs.stream(query?: NonNullable<RequestLogsStreamData["query"]>, options?: RequestOptions): AsyncIterable<RequestLogsStreamResponse>GET /request_logs/stream · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
query.status |
string |
no | A status class (2xx, 3xx, 4xx, 5xx), error (any 4xx or 5xx), or one status code (404). |
query.method |
string |
no | Only this HTTP method. |
query.path |
string |
no | Only paths starting with this (/v1/calls matches /v1/calls/call_…). |
query.key_id |
string |
no | Only requests made with this API key (key_…). |
query.request_id |
string |
no | Only the request with this X-Request-Id (req_…). |
query.operation_id |
string |
no | Only this operation (calls_create). |
options.headers["MoreVoice-Version"] |
string |
no | The API version to use for this request. Defaults to the version the API key is pinned to. |
options |
RequestOptions |
no | idempotencyKey, extra headers and an abort signal: see retries and idempotency. |
Returns
Section titled “Returns”An EventStream of events.
Example
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
for await (const event of mv.requestLogs.stream()) { console.log(event);}