# GET - Get request

The GDPR API allows you to create GDPR requests and get their status. This page documents the `request` endpoint.

### Request structure

#### Route

The GDPR API exposes a GET endpoint to get the status of a single GDPR request:

`https://api.batch.com/1.0/BATCH_API_KEY/gdpr/request/REQUEST_ID`

Here is a valid cURL example:

```
curl -H "Content-Type: application/json" \
     -H "X-Authorization: BATCH_REST_API_KEY" \
     -X GET "https://api.batch.com/1.0/BATCH_API_KEY/gdpr/request/REQUEST_ID"
```

The `REQUEST_ID` value is the token you get when creating the request.

The `BATCH_API_KEY` value is either your **Live**, **Dev** or **SDK** Batch API key from the settings page of your app within the dashboard (⚙ Settings → General).

#### Headers

In order to authenticate with the API, you need to provide your **company REST API Key** as the value of the `X-Authorization` header. You can find it in ⚙ Settings → General.

### Responses

#### Success

If the GET to the API endpoint is successful you will receive an **HTTP 200** confirmation and information about the GDPR request.

**Fields breakdown**

Following is the detail about each possible field in the response object.

<table data-full-width="false"><thead><tr><th width="155">Id</th><th width="655.5">Description</th></tr></thead><tbody><tr><td><code>request_date</code></td><td><strong>String</strong> -<br>The date at which the request was made (always in UTC).</td></tr><tr><td><code>status</code></td><td><strong>String</strong> -<br>Indicates the status of the request. There are two possible states, `pending` which means the request is currently being processed, `done` which means the request has been processed.</td></tr><tr><td><code>request_type</code></td><td><strong>String</strong> -<br>Indicates if the request is to either `review` or `remove` the data. This is the same thing you provide when calling the API to create a request.</td></tr><tr><td><code>trigger_type</code></td><td><strong>String</strong> -<br>Indicates if the request was created via the Batch dashboard or via the public API. Possible values are `dashboard` or `api`.</td></tr><tr><td><code>error</code></td><td><strong>String</strong> -<br>Indicates if there was an error processing the request.</td></tr><tr><td><code>data_url</code></td><td><strong>String</strong> -<br>Only present if the `request_type` is `review`. This is a link to a zip file containing the data.</td></tr><tr><td><code>id</code></td><td><strong>Object</strong> -<br>An object describing the identifier of a user concerned by this request. This is the same object you provide when calling the API to create a request.</td></tr></tbody></table>

**Details about the error field**

The `error` field is a generic field indicating something went wrong while processing the request.

Right now only the `user not found` error is possible.

**Examples**

* Finished **review** request :

```json
{
  "request_date": "2021-01-03T16:52:16.051",
  "status": "done",
  "request_type": "review",
  "trigger_type": "api",
  "id": {
    "type": "custom_id",
    "value": "john.doe"
  },
  "data_url": "https://api.batch.com/1.0/[APIKEY]/gdpr/request/[REQUEST_ID]/results/[RESULT_ID].zip"
}
```

* Pending request :

```json
{
  "request_date": "2020-12-24T06:16:00.000",
  "status": "pending",
  "request_type": "review",
  "trigger_type": "api",
  "id": {
    "type": "custom_id",
    "value": "john.doe"
  }
}
```

* Finished **remove** request :

```json
{
  "request_date": "2020-09-05T11:32:48.204",
  "status": "done",
  "request_type": "remove",
  "trigger_type": "api",
  "id": {
    "type": "custom_id",
    "value": "john.doe"
  }
}
```

* Request in error :

```json
{
  "request_date": "2020-05-15T01:28:22.588",
  "status": "done",
  "request_type": "remove",
  "trigger_type": "api",
  "id": {
    "type": "custom_id",
    "value": "john.doe"
  },
  "error": "user not found"
}
```

> Note: Expired requests are not returned by this API.

#### Failure

If the POST data does not meet the API requirements you will receive an actionable error message. Contact us at <support@batch.com> if you need further support.

* `AUTHENTICATION_INVALID` (Http status code: 401, Error code: 10)
* `API_MISUSE` (Http status code: 403, Error code: 12)
* `ROUTE_NOT_FOUND` (HTTP status code: 404, Error code: 20)
* `MISSING_PARAMETER` (HTTP status code: 400, Error code: 30)
* `MALFORMED_PARAMETER` (HTTP status code: 400, Error code: 31)
* `SERVER_ERROR` (HTTP status code: 500, Error code: 1)
* `MAINTENANCE_ERROR` (HTTP status code: 503, Error code: 2)
