<!-- https://developers.silktide.com/v1/governance/reports/get-report | Governance / Reports -->

# Get a report

`GET /v1/reports/{reportId}`

Returns one report, as [List reports](https://developers.silktide.com/v1/governance/reports/list-reports.md) lists it. To read what the report shows, use [Get a report's results](https://developers.silktide.com/v1/governance/reports/get-report-results.md).

Any user who can see the report can get it. When the API key's user can also admin it, the answer includes `permissions`: who may see and admin the report. For anyone else, `permissions` is left out.

`POST /v1/reports/{reportId}` answers exactly the same. It takes a JSON body and ignores it.

## Request

### Path parameters

- `reportId` (integer, required, at least 1): The report.

## Response

Status `200`.

- `report` (object, required): The report.
  - `reportId` (integer, required, at least 1): The report.
  - `reportTemplateId` (string, required, 1 to 16 characters): The report template it is made from.
  - `reportScheduleId` (integer, required): The report schedule that made it. `0` when it was not made by a schedule.
  - `contextTypeId` (string, required): What kind of thing it covers, copied from its template: `website`, `websites`, `account` or `property`. One of: `website`, `websites`, `account`, `property`.
  - `name` (string, required, at least 1 characters): Its name.
  - `thumbnailUrl` (string, required): A small screenshot of it. Empty until one is made, a few minutes after a snapshot is created.
  - `startTime` (integer, required): For a snapshot, the start of the dates it covers. `0` for a live report.
  - `endTime` (integer, required): For a snapshot, the end of the dates it covers. `0` for a live report.
  - `durationInterval` (string, required): The unit of how far back it looks. One of: `day`, `week`, `month`, `year`.
  - `durationPeriod` (integer, required, 0 to 90): How many `durationInterval`s back it looks. `week` and `4` cover the last four weeks.
  - `created` (integer, required): When it was created.
  - `creatorAssigneeId` (string, required): The assignee who created it: a user (`u:`), an API key (`a:`), or `system` for those Silktide made itself.
  - `context` (object or map of any JSON or empty list, required): What it covers, in the shape its `contextTypeId` takes: `{"websiteId": 3, "sectionId": 0}` for one website, `{"criteria": {...}}` for several. `[]` when it has none.
    - `websiteId` (integer, required, at least 1): The website.
    - `sectionId` (integer, required): One of its sections. `0` for the whole website.
  - `isLive` (boolean, required): `true` for a live report (a dashboard), which is built afresh each time it is read. `false` for a snapshot, built once when it is created.
  - `version` (integer, required, at least 1): The version of the format it is stored in, which Silktide uses to upgrade older reports. Nothing to act on.
- `permissions` (object, optional): Who may see and admin the report. Only when the API key's user can admin it.
  - `components` (list of objects, required): The permissions a report has: one to see it, one to admin it.
    - `permissionId` (string, required): The permission, such as `Report-ReportRead`.
    - `componentType` (string, required): What can be given it. `assignees` for users and roles.
    - `label` (string, required): Its name, such as `Can see this dashboard / snapshot`.
    - `description` (string, required, can be null): What it allows. Null for these permissions.
    - `inheritedPermissionIds` (list of strings, required): Permissions that include this one: anyone with those has this too.
    - `models` (list of any JSON, required): Reserved. Empty for these permissions.
  - `componentValues` (map of list of strings, required): Who was given each permission on this report directly, as assignee ids (`u:` users, `g:` roles).
  - `fixedValues` (map of list of strings, required): Who has each permission from elsewhere, such as account-wide roles. Changed elsewhere, not here.

## Errors

| Status | Type | When |
| --- | --- | --- |
| 403 | `EditionNotAvailable` | The account does not have Silktide 4. Reports, report schedules and report templates are Silktide 4's, so an account with only Silktide 5 cannot use them. |
| 400 | `InvalidRequest` | `reportId` is not a whole number. `properties.field` is `reportId`. |
| 404 | `ModelNotFound` | No report with that id exists in the account. |
| 403 | `AccessDenied` | The report exists, but the API key's user cannot see it. |
| 401 | `NotLoggedIn` | No API key was sent, or it is not a key for this region. |
| 429 | `TooManyRequests` | Too many requests to this path in five seconds. Retry after the number of seconds in the `Retry-After` header, which `properties.retryAfter` repeats. |
| 503 | - | Silktide is busy. Retry after the number of seconds in the `Retry-After` header. |

## Access

- Permission: Can see this dashboard / snapshot
- Plan feature: none
- Edition: Silktide 4 only
- Cost: free
- Stability: stable, since 1.0.0

## Example: A live report on one website

```bash
curl "https://api.eu.silktide.com/v1/reports/2" \
  -H "Authorization: silktide token=$SILKTIDE_API_KEY"
```

Response:

```json
{
  "report": {
    "reportId": 2,
    "reportTemplateId": "accessibility-22",
    "reportScheduleId": 0,
    "contextTypeId": "website",
    "name": "Wine Barrel WCAG 2.2",
    "thumbnailUrl": "",
    "startTime": 0,
    "endTime": 0,
    "durationInterval": "week",
    "durationPeriod": 2,
    "created": 1792953607,
    "creatorAssigneeId": "u:eu-12",
    "context": {
      "websiteId": 3,
      "sectionId": 0
    },
    "isLive": true,
    "version": 3
  },
  "permissions": {
    "components": [
      {
        "permissionId": "Report-ReportRead",
        "componentType": "assignees",
        "label": "Can see this dashboard / snapshot",
        "description": null,
        "inheritedPermissionIds": [
          "Report-ReportAdmin",
          "Report-ReportReadAll"
        ],
        "models": []
      },
      {
        "permissionId": "Report-ReportAdmin",
        "componentType": "assignees",
        "label": "Can admin this dashboard / snapshot",
        "description": null,
        "inheritedPermissionIds": [
          "Report-ReportAdminAll"
        ],
        "models": []
      }
    ],
    "componentValues": {
      "Report-ReportRead": [
        "u:eu-14"
      ],
      "Report-ReportAdmin": []
    },
    "fixedValues": {
      "Report-ReportRead": [],
      "Report-ReportAdmin": [],
      "Report-ReportReadAll": [
        "g:2",
        "u:eu-12"
      ],
      "Report-ReportAdminAll": [
        "g:2",
        "u:eu-12"
      ]
    }
  }
}
```
