# userActivityTrail

mutation · in the family [Support trail](/reference/support-trail/)

## What it does

Ask what one of your users was doing — a user, a window of at most seven days and your reason; the sealed per-call trail opens for that window alone.

THE MERCHANT’S DOOR: open ONE user’s sealed activity trail for ONE window (ISO instants, at most 7 days) with a reason (1–256 characters). the ledger-first rule: the opening is recorded — the ledger row + the permanent log event — BEFORE any row is unsealed; no record, no unseal. Answers the timeline in time order (time · app · build · screen · op · outcome · milliseconds · call id · session). OWNER-ONLY (the A19_TRAIL area). VALIDATION/INVALID on a bad window or a blank reason.

## What happens

Records the opening in the trail ledger (visible to every owner) and on the permanent log, then reads that user’s sealed rows for the window; changes nothing else.

## Who may call it

Capability area: **Support trail** — Opening a user’s sealed activity trail and the ledger of every opening.

- Owner
- An API key whose scope allows `api:userActivityTrail`

## Arguments

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `userId` | [ID](/types/#scalars) `ID!` | yes | No further notes. |
| `from` | [String](/types/#scalars) `String!` | yes | No further notes. |
| `to` | [String](/types/#scalars) `String!` | yes | No further notes. |
| `reason` | [String](/types/#scalars) `String!` | yes | No further notes. |

## Returns

[UserActivityTrail](/types/UserActivityTrail/) `UserActivityTrail!` — The merchant door’s answer: the opening as recorded + the timeline in time order + the rows that refused to open (counted, never hidden).

## Example request

```graphql
mutation ExampleUserActivityTrail($userId: ID!, $from: String!, $to: String!, $reason: String!) {
  userActivityTrail(userId: $userId, from: $from, to: $to, reason: $reason) {
    unreadable
  }
}
```

Variables:

```json
{
  "userId": "01900000-0000-7000-8000-11f967df0000",
  "from": "<from>",
  "to": "<to>",
  "reason": "Correcting a miscount."
}
```

Send it with the envelope naming the version: `"extensions": {"at": {"version": {"name":"genesis","number":0}}}`.

## Example response

```json
{
  "data": {
    "userActivityTrail": {
      "unreadable": 1
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}
```

## Errors this call can answer

- `VALIDATION/INVALID` — Something in the request is not valid. ([VALIDATION](/errors/VALIDATION/))
- `AUTHN/REQUIRED` — Sign in to do this. ([AUTHN](/errors/AUTHN/))
- `AUTHZ/FORBIDDEN` — Your role does not allow this action. ([AUTHZ](/errors/AUTHZ/))
- `RATE_LIMIT/THROTTLED` — Too many requests in a short time. ([RATE_LIMIT](/errors/RATE_LIMIT/))
- `NOT_FOUND/*` — That record could not be found. ([NOT_FOUND](/errors/NOT_FOUND/))
- `CONFLICT/*` — The record’s state, or a change made in the meantime, does not allow this; the codes are on the CONFLICT page. ([CONFLICT](/errors/CONFLICT/))
- `VALIDATION/VERSION_REQUIRED` — The request did not say which app version it came from. ([VALIDATION](/errors/VALIDATION/))
