# Account

GDPR and account management

Source: https://keyenv.dev/docs/api/account/

GDPR and account management

## Get data export status

```http
GET /api/v1/account/data-export
```

Returns the status of a pending data export request

**Operation ID:** `getDataExportStatus` &middot; **Authentication:** `Authorization: Bearer <token>`

### Responses

| Status | Description | Body |
| --- | --- | --- |
| `200` | Export status | `DataExportStatusResponse` |
| `401` | Authentication required | `Error` |

### Response body (`200`)

| Field | Type | Description |
| --- | --- | --- |
| `status` | `enum (none, pending, ready, expired)` |  |
| `requested_at` | `string (date-time)` |  |
| `expires_at` | `string (date-time)` |  |

### Example

```bash
curl -X GET "https://api.keyenv.dev/api/v1/account/data-export" \
  -H "Authorization: Bearer $KEYENV_TOKEN"
```

## Request data export

```http
POST /api/v1/account/data-export/request
```

Requests a GDPR data export

**Operation ID:** `requestDataExport` &middot; **Authentication:** `Authorization: Bearer <token>`

### Responses

| Status | Description | Body |
| --- | --- | --- |
| `200` | Export requested | `DataExportRequestResponse` |
| `401` | Authentication required | `Error` |
| `409` | Resource already exists | `Error` |

### Response body (`200`)

| Field | Type | Description |
| --- | --- | --- |
| `status` | `string` |  |
| `message` | `string` |  |

### Example

```bash
curl -X POST "https://api.keyenv.dev/api/v1/account/data-export/request" \
  -H "Authorization: Bearer $KEYENV_TOKEN"
```

## Download data export

```http
GET /api/v1/account/data-export/download
```

Downloads the completed data export

**Operation ID:** `downloadDataExport` &middot; **Authentication:** `Authorization: Bearer <token>`

### Responses

| Status | Description | Body |
| --- | --- | --- |
| `200` | Export data | `UserDataExport` |
| `401` | Authentication required | `Error` |
| `404` | Resource not found | `Error` |

### Response body (`200`)

| Field | Type | Description |
| --- | --- | --- |
| `user` | `object` |  |
| `teams` | `object[]` |  |
| `exported_at` | `string (date-time)` |  |

### Example

```bash
curl -X GET "https://api.keyenv.dev/api/v1/account/data-export/download" \
  -H "Authorization: Bearer $KEYENV_TOKEN"
```

## Delete account

```http
DELETE /api/v1/account
```

Permanently deletes the user account and all associated data

**Operation ID:** `deleteAccount` &middot; **Authentication:** `Authorization: Bearer <token>`

### Request body

`application/json` (required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `confirmation` | `string` | yes | Must be "DELETE" |

### Responses

| Status | Description | Body |
| --- | --- | --- |
| `200` | Account deleted | `DeleteAccountResponse` |
| `400` | Invalid request | `Error` |
| `401` | Authentication required | `Error` |

### Response body (`200`)

| Field | Type | Description |
| --- | --- | --- |
| `success` | `boolean` |  |
| `message` | `string` |  |

### Example

```bash
curl -X DELETE "https://api.keyenv.dev/api/v1/account" \
  -H "Authorization: Bearer $KEYENV_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"confirmation":"string"}'
```
