Request Log

The request_log object

A log of a single API request, capturing its route, outcome, latency, and actor.

Logs are written after the response has been sent, so a new entry may take a moment to become readable.

idstring

Request log ID.

objectstringenumValues:request_log

Resource type identifier.

methodstringenumValues:GETPOSTPUT

HTTP method.

hoststring

Request host.

Usually api.openmrp.ai.

pathstring

The exact path the request was made to, including path parameter values.

normalized_routestring

The route template the request matched, with path parameters left as placeholders.

For example /v1/sales/customers/{id} is the normalized route for the request path /v1/sales/customers/ac_.... Falls back to the raw path when the request did not match a registered route.

query_paramsobjectnullable

Query-string parameters the request was made with, as a JSON object.

Encoded as a JSON value (object, array, string, number, boolean, or null), not a JSON-encoded string.

status_codeinteger

HTTP response status code (e.g. 200, 404).

latency_usinteger

Request latency in microseconds.

Measured at the API edge, from the moment the request was received until the response was written, so it excludes network time between your client and OpenMRP.

api_versionstringnullable

The API version the request was served with.

Taken from the OpenMRP-Version header the caller sent; requests rejected for omitting that header record no version.

client_ipstringnullable

Client IP address the request came from.

Not recorded for requests an OpenMRP agent made on your behalf, since those originate inside OpenMRP's own network.

user_agentstringnullable

User agent.

referrerstringnullable

Referrer header.

error_codestringnullableenumValues:expired_tokenapi_key_expiredapi_key_revoked

Machine-readable API error code.

Matches the code of the error response the caller received. Populated only for failed requests.

error_messagestringnullable

Human-readable error message.

The same message the caller received. Populated only for failed requests.

occurred_atstring (date-time)

When the request was received.

Request logs are ordered and date-filtered by this timestamp rather than by created_at.

created_atstring (date-time)

When the log entry was written.

accountaccountnullable

Account targeted by the request: the account the request acted upon.

Results are scoped to logs where your account is either the acting account or the target account. Use the target_account_ids query parameter to filter by which account was acted upon, and actor_account_ids to filter by who acted.

idstring

Account ID.

objectstringenumValues:account

Resource type identifier.

namestring

The account's display name.

default_billing_addressaddressnullable

The address billed by default on orders for this account.

Always returned as null in this endpoint.
default_shipping_addressaddressnullable

The address shipped to by default on orders for this account.

Always returned as null in this endpoint.
brandingaccount_brandingnullable

Customer-facing branding for the account, such as the logo, support contacts, and social links.

Always returned as null in this endpoint.
portalaccount_portalnullable

The account's customer portal settings, including the portal URL slug.

Always returned as null in this endpoint.
created_atstring (date-time)

Creation timestamp.

updated_atstring (date-time)

Last updated timestamp.

actoractornullable

Actor who made the request.

idstring

Unique identifier of the actor.

objectstringenumValues:actor

Resource type identifier.

typestringenumValues:userapi_keyagent

Actor type.

  • user: a human user account.
  • api_key: a programmatic caller authenticating with an API key.
  • agent: an automated agent acting on the account's behalf.
  • group: a shared group identity, such as a "Customer Service" persona, rather than a single individual.
namestringnullable

The actor's display name.

handlestringnullable

Human-readable handle identifying the actor.

  • For user actors: the user's email address.
  • For api_key actors: the redacted key value.

Other actor types carry no handle.

avatar_urlstringnullable

URL of the actor's profile photo, if one is set.

Only populated for user actors.

rolerolenullable

The role the actor holds in the account, which determines what it is permitted to do.

idstring

Role ID.

objectstringenumValues:role

Resource type identifier.

namestring

Display name of the role.

Unique within the account.

typestringenumValues:adminuserscanner

The kind of role.

The type gates behavior that individual permissions do not cover, and some actions are reserved for a single role type.

  • admin: full administrative access. Sensitive areas such as API keys, billing, and third-party integrations are restricted to admins no matter what permissions another role holds.
  • user: a custom role tailored to a specific need, with its permissions defined explicitly. Roles created through the API always have this type.
  • scanner: the role used by shop-floor scanning stations, assigned automatically when a scanning-station user is created.
  • sales_rep: a role for sales representatives. Order analytics are scoped to the rep's own orders.
  • agent: a role assigned to an automated agent rather than a person.
ownerownernullable

Provenance of this role.

System-owned roles are platform-provided defaults shared across all accounts and cannot be updated or deleted; account-owned roles are custom to your account.

Always returned as null in this endpoint.
permissionsarray of stringnullable

Permissions granted by this role, in {permission}:{action} format, such as customers:read.

created_atstring (date-time)

Creation timestamp.

updated_atstring (date-time)

Last updated timestamp.

idempotency_keystringnullable

User-provided idempotency key.

request_bodyobjectnullable

The JSON body the request was sent with.

Sensitive values such as passwords, tokens, and secrets are redacted before the body is stored. Bodies larger than 256 KB are not stored in full; a small marker object with _truncated set to true is stored in their place.

Encoded as a JSON value (object, array, string, number, boolean, or null), not a JSON-encoded string.

response_bodyobjectnullable

The JSON body OpenMRP responded with.

Sensitive values such as generated API key secrets are redacted before the body is stored. Bodies larger than 256 KB are not stored in full; a small marker object with _truncated set to true is stored in their place.

Encoded as a JSON value (object, array, string, number, boolean, or null), not a JSON-encoded string.

Used by