# Report time in state

```http
GET https://trydimmi.com/api/v1/reports/tickets/time-in-state
```

## Authorization

Send an API token as `Authorization: Bearer <token>`.
The token needs: `tickets:read`.

## Query parameters

- `from` (string): First day, 2006-01-02. Defaults to 30 days ago.
- `to` (string): Last day included, 2006-01-02. Defaults to today.

## Response 200 (OK)

- `data` (object[] | null, required): The items, as a list; empty when there are none.
  - `group` (string, required): The state's fixed group: submitted, in_progress, waiting_customer, waiting_team or resolved.
  - `mean_seconds` (number, required): Average time tickets spent in this state, in seconds.
  - `median_seconds` (number, required): Median time tickets spent in this state, in seconds.
  - `p90_seconds` (number, required): The time 90% of tickets stayed within in this state, in seconds.
  - `state_id` (string, required): Id of the ticket state, such as tkts_....
  - `state_name` (string, required): The state's name as the team sees it.
  - `tickets` (integer, required): How many tickets of this type were in this state.
  - `type_id` (string, required): Id of the ticket type, such as tktt_....
  - `type_name` (string, required): The ticket type's name.

## Response default (Error)

- `code` (string, required): Stable code for programs to tell errors apart, such as validation_failed or internal_error.
- `errors` (object): Each rejected field mapped to its messages. Only present when the input was invalid.
- `message` (string, required): What went wrong, in words safe to show a person.

## Example request

```bash
curl --request GET \
  --url 'https://trydimmi.com/api/v1/reports/tickets/time-in-state' \
  --header 'Authorization: Bearer <token>'
```

## Example response

```json
{
  "data": [
    {
      "group": "<string>",
      "mean_seconds": 123.45,
      "median_seconds": 123.45,
      "p90_seconds": 123.45,
      "state_id": "<string>",
      "state_name": "<string>",
      "tickets": 123,
      "type_id": "<string>",
      "type_name": "<string>"
    }
  ]
}
```

---

Index of all dimmi docs: https://trydimmi.com/llms.txt (full text: https://trydimmi.com/llms-full.txt)
