# Report on Privacy Requests

## Overview  
The reporting feature allows you to fetch information about privacy requests. You can opt for high-level status information, or get more detailed information about the status of the requests on each of your collections.

## View high-level statuses  
This request displays concise, high-level information for all your privacy requests including their status and related timestamps.

{
        "items": [
            {
                "id": "pri_5f4feff5-fb60-4286-82bd-7e0748ce90ac",
                "created_at": "2021-10-04T17:36:32.223287+00:00",
                "started_processing_at": "2021-10-04T17:36:37.248880+00:00",
                "finished_processing_at": "2021-10-04T17:36:37.263121+00:00",
                "status": "pending"
            }
        ],
        "total": 1,
        "page": 1,
        "size": 50
    }

### View a single privacy request  
Use the `id` query param to view the high-level status of a single privacy request.

GET /api/v1/privacy-request?request_id=<privacy_request_id>

If an `external_id` was provided at request creation, we can also track the privacy request using:

GET /api/v1/privacy-request?external_id=<external_id>

### Filtering options  
Use the following query params to further filter your privacy requests. Filters can be chained, for example,

GET /api/v1/privacy-request?created_gt=2021-10-01&created_lt=2021-10-05&status=pending

- `id`
- status (one of `in_processing`, `pending`, `paused`, `complete`, or `error`)
- `created_lt`
- `created_gt`
- `started_lt`
- `started_gt`
- `completed_lt`
- `completed_gt`
- `errored_lt`
- `errored_gt`

You can filter for multiple statuses by repeating the status query param:

GET /api/v1/privacy-request?status=paused&status=complete

## View privacy request logs  
To view all the execution logs for a privacy request, visit `/api/v1/privacy-request/{privacy_request_id}/logs`.  
Embedded logs in the previous endpoints are truncated at 50 logs.

## View a request's identity data  
Use the optional `include_identities` query param to include all identity data that was submitted for the privacy request.

Due to the way Fides stores identity data, this data will expire automatically according to the `FIDES__REDIS__DEFAULT_TTL_SECONDS` variable in your Fides configuration. Read how to set [Fides configuration variables here](/content/docs/platform/configuration/configuration/index.html).

## View individual request log details  
The `verbose` query parameter will display more details about individual collections visited as part of the privacy request, along with individual statuses. Individual collection statuses include `in_processing`, `retrying`, `complete` or `error`. You may see multiple logs for each collection as they reach different steps in the lifecycle.

GET /api/v1/privacy-request?request_id={privacy_request_id}&verbose=True

{
        "items": [
            {
                "id": "pri_2e0655c3-7a76-425e-8c4c-52fee32ce14b",
                "created_at": "2022-02-28T16:38:03.878898+00:00",
                "started_processing_at": "2022-02-28T16:38:04.021763+00:00",
                "finished_processing_at": "2022-02-28T16:38:06.211547+00:00",
                "status": "complete",
                "external_id": null,
                "results": {
                     "Request approved": [
                        {
                            "collection_name": null,
                            "fields_affected": null,
                            "message": "",
                            "action_type": null,
                            "status": "approved",
                            "updated_at": "2022-08-11T14:03:37.679732+00:00",
                            "user_id": "system"
                        }
                    ],
                    "my-mongo-db": [
                        {
                            "collection_name": "flights",
                            "fields_affected": [],
                            "message": "starting",
                            "action_type": "access",
                            "status": "in_processing",
                            "updated_at": "2022-02-28T16:38:04.668513+00:00"
                        },
                         {
                            "collection_name": "flights",
                            "fields_affected": [
                                {
                                    "path": "mongo_test:flights:passenger_information.full_name",
                                    "field_name": "passenger_information.full_name",
                                    "data_categories": [
                                        "user.name"
                                    ]
                                }
                            ],
                            "message": "success",
                            "action_type": "access",
                            "status": "complete",
                            "updated_at": "2022-02-28T16:38:04.727094+00:00",
                            "user_id": null
                        }
                    ],
                    "my-postgres-db": [
                        {
                            "collection_name": "order",
                            "fields_affected": [],
                            "message": "starting",
                            "action_type": "access",
                            "status": "in_processing",
                            "updated_at": "2022-02-28T16:38:04.668513+00:00"
                        },
                        {
                            "collection_name": "order",
                            "fields_affected": [
                                {
                                    "path": "order.customer_name",
                                    "field_name": "name",
                                    "data_categories": [
                                        "user.name"
                                    ]
                                }
                            ],
                            "message": "success",
                            "action_type": "access",
                            "status": "complete",
                            "updated_at": "2022-02-28T16:39:04.668513+00:00",
                            "user_id": null
                        }
                    ]
                },
                "Request finished": [
                    {
                        "collection_name": null,
                        "fields_affected": null,
                        "message": "",
                        "action_type": null,
                        "status": "finished",
                        "updated_at": "2022-08-11T14:04:29.611878+00:00",
                        "user_id": "system"
                    }
                ]
            }
        ],
        "total": 1,
        "page": 1,
        "size": 50
    }

## Download all privacy requests as a CSV  
To get all privacy requests in CSV format, use the `download_csv` query param:

Time received,Subject identity,Policy key,Request status,Reviewer,Time approved/denied
    2022-03-14 16:53:28.869258+00:00,{\n        'email': 'customer-1@example.com'\n    },my_primary_policy,complete,fid_16ffde2f-613b-4f79-bbae-41420b0f836b,2022-03-14 16:54:08.804283+00:00

## Paused or failed request details  
A privacy request may pause when manual input is needed from the user, or it might fail for various reasons on a specific collection.

To retrieve information to resume or retry a privacy request, the following endpoint is available:

GET /api/v1/privacy-request?request_id=<privacy_request_id>

### Paused access request example  
The request below is in a `paused` state as it waits on manual input from the user to proceed. Looking at the `stopped_collection_details` key shows the request paused execution during the `access` step of the `manual_key:filing_cabinet` collection.

```json
{
    "items": [
        {
            "id": "pri_ed4a6b7d-deab-489a-9a9f-9c2b19cd0713",
            "created_at": "2022-06-06T20:12:28.809815+00:00",
            "started_processing_at": "2022-06-06T20:12:28.986462+00:00",
            ...,
            "stopped_collection_details": {
                "step": "access",
                "collection": "manual_key:filing_cabinet",
                "action_needed": [
                    {
                        "locators": {
                            "customer_id": [
                                72909
                            ]
                        },
                        "get": [
                            "authorized_user",
                            "customer_id",
                            "id",
                            "payment_card_id"
                        ],
                        "update": null
                    }
                ]
            },
            "resume_endpoint": "/privacy-request/pri_ed4a6b7d-deab-489a-9a9f-9c2b19cd0713/manual_input"
        }
    ],
    "total": 1,
    "page": 1,
    "size": 50
}
```
