# Export a contact's data

`GET /v1/contacts/{id}/data-export`

Requires an API key with the `contacts:read` scope. [About keys and scopes](/docs/api/authentication)

Everything held about one contact, for answering a right-of-access request: profile, consent history, events, messages, groups, segments, topics, journeys, push devices (without tokens), form submissions, conversions and suppressions. Data past the retention periods is no longer held, so it is not included. The response is streamed as it is read, so a long history arrives without a length. Each export is recorded in the audit log. Owners and admins in the dashboard; `contacts:read` over the API.

## Path parameters

- `id` (string, required, uuid)

## Returns

Returns `200 OK` with a `ContactDataExport` in `data`. Otherwise returns an error; [Errors](/docs/api/errors) lists every code and which to retry.

- `exportedAt` (string, required, date-time) — When this export was produced.
- `contact` (ContactDetail, required)
  - `id` (string, required, uuid)
  - `externalId` (string | null, required) — Your own id for the contact, if set.
  - `email` (string | null, required, email)
  - `firstName` (string | null, required)
  - `lastName` (string | null, required)
  - `phone` (string | null, required) — Phone number in E.164 format.
  - `timezone` (string | null, required) — IANA timezone, e.g. `Europe/London`.
  - `country` (string | null, required) — ISO 3166-1 alpha-2 code: as written, or inferred from the phone, else the timezone.
  - `dates` (object, required) — Named calendar dates, e.g. `birthday`, as `YYYY-MM-DD` or `--MM-DD`.
  - `attributes` (object, required) — Custom attributes, keyed by attribute name.
  - `emailConsent` (boolean, required) — Whether the contact has consented to email.
  - `pushConsent` (boolean, required) — Whether the contact has consented to push.
  - `createdAt` (string, required, date-time)
  - `updatedAt` (string, required, date-time)
  - `emailSuppression` (object, required)
    - `suppressed` (boolean, required) — Whether email to this contact is blocked.
    - `reason` (string | null, required) — Why email to this contact is suppressed: `bounced`, `complained`, `complained_transactional`, `unsubscribed`, `manual`, `imported`, or `other_workspace` (a bounce or complaint in another workspace with the same owner or partner).
- `consentHistory` (object[], required)
  - `id` (string, required, uuid)
  - `channel` (string | null, required, one of `email`, `push`) — The channel consented to. With `topicId` null: consent to the channel; with both set: a per-channel topic choice.
  - `topicId` (string | null, required, uuid) — The topic consented to, if any.
  - `granted` (boolean, required) — True for a grant, false for a withdrawal.
  - `source` (string, required, one of `dashboard`, `api`, `import`, `form`, `unsubscribe`, `system`, `sdk`)
  - `sourceId` (string | null, required, uuid) — The form, when `source` is `form`.
  - `actorType` (string, required, one of `user`, `api_key`, `contact`, `system`)
  - `actorId` (string | null, required, uuid) — Member or API key id; null for the contact themselves and the system.
  - `ip` (string | null, required) — IP address the change came from.
  - `reason` (string | null, required) — Why it changed, when one was given.
  - `basis` (string | null, required, one of `opted_in`, `existing_customer`) — How the person agreed, as the workspace stated it; null when nobody did.
  - `evidence` (string | null, required) — Where and how they agreed, as stated.
  - `occurredAt` (string, required, date-time)
- `events` (object[], required)
  - `id` (string, required, uuid)
  - `eventName` (string, required)
  - `properties` (object, required)
  - `occurredAt` (string, required, date-time)
- `messages` (object[], required)
  - `id` (string, required, uuid)
  - `campaignId` (string | null, required, uuid)
  - `channel` (string, required, one of `email`, `push`)
  - `messageType` (string, required, one of `marketing`, `transactional`)
  - `status` (string, required, one of `queued`, `sending`, `skipped`, `sent`, `failed`, `delivered`, `bounced`, `complained`)
  - `recipientAddress` (string | null, required) — The address or device it was sent to.
  - `sentAt` (string | null, required, date-time)
  - `deliveredAt` (string | null, required, date-time)
  - `openedAt` (string | null, required, date-time)
  - `clickedAt` (string | null, required, date-time)
  - `unsubscribedAt` (string | null, required, date-time)
  - `createdAt` (string, required, date-time)
- `groups` (object[], required)
  - `id` (string, required, uuid)
  - `name` (string, required)
  - `addedAt` (string, required, date-time)
- `segments` (object[], required)
  - `id` (string, required, uuid)
  - `name` (string, required)
  - `enteredAt` (string, required, date-time)
- `topics` (object[], required)
  - `id` (string, required, uuid)
  - `name` (string, required)
  - `subscribed` (boolean, required) — Whether the contact is subscribed to the topic.
  - `updatedAt` (string, required, date-time)
- `journeys` (object[], required)
  - `id` (string, required, uuid)
  - `name` (string, required)
  - `status` (string, required, one of `active`, `completed`, `exited`)
  - `enrolledAt` (string, required, date-time)
  - `completedAt` (string | null, required, date-time)
- `pushDevices` (object[], required)
  - `kind` (string, required, one of `apns_token`, `fcm_token`, `web_push_subscription`)
  - `permission` (string, required, one of `granted`, `denied`) — Notification permission on the device.
  - `active` (boolean, required) — Whether the device can still receive push.
  - `lastSeenAt` (string, required, date-time)
  - `createdAt` (string, required, date-time)
- `formSubmissions` (object[], required)
  - `formId` (string, required, uuid)
  - `formName` (string, required)
  - `outcome` (string, required, one of `created`, `updated`, `honeypot`, `pending`)
  - `createdAt` (string, required, date-time)
  - `confirmedAt` (string | null, required, date-time)
  - `pendingContact` (object | null, required) — What an unconfirmed signup entered, held until confirmed or for 7 days.
- `conversions` (object[], required)
  - `goalId` (string, required, uuid)
  - `value` (number | null, required) — Value recorded with the conversion, if any.
  - `convertedAt` (string, required, date-time)
- `suppressions` (object[], required)
  - `channel` (string, required, one of `email`, `push`)
  - `address` (string | null, required) — Set when the block is on the address itself, not the contact.
  - `reason` (string, required) — Why the channel is blocked.
  - `createdAt` (string, required, date-time)

## Example

```bash
curl https://api.kirora.io/v1/contacts/018f2a4e-6b1c-7d3e-9f40-37386ae05a6b/data-export \
  -H "Authorization: Bearer $KIRORA_API_KEY"
```

Response `200`:

```json
{
  "data": {
    "exportedAt": "2030-03-14T09:30:00Z",
    "contact": {
      "id": "018f2a4e-6b1c-7d3e-9f40-37386ae05a6b",
      "externalId": "user_8812",
      "email": "amaka@juniperkitchen.com",
      "firstName": "Amaka",
      "lastName": "Eze",
      "phone": "+447700900123",
      "timezone": "Europe/London",
      "country": "GB",
      "dates": {},
      "attributes": {},
      "emailConsent": true,
      "pushConsent": true,
      "createdAt": "2030-03-14T09:30:00Z",
      "updatedAt": "2030-03-14T09:30:00Z",
      "emailSuppression": {
        "suppressed": true,
        "reason": "reason_example"
      }
    },
    "consentHistory": [
      {
        "id": "018f2a4e-6b1c-7d3e-9f40-37386ae05a6b",
        "channel": "email",
        "topicId": "018f2a4e-6b1c-7d3e-9f40-84e01f695a6b",
        "granted": true,
        "source": "dashboard",
        "sourceId": "018f2a4e-6b1c-7d3e-9f40-dee8fa655a6b",
        "actorType": "user",
        "actorId": "018f2a4e-6b1c-7d3e-9f40-3c94fe175a6b",
        "ip": "ip_example",
        "reason": "reason_example",
        "basis": "opted_in",
        "evidence": "evidence_example",
        "occurredAt": "2030-03-14T09:30:00Z"
      }
    ],
    "events": [
      {
        "id": "018f2a4e-6b1c-7d3e-9f40-37386ae05a6b",
        "eventName": "Order Completed",
        "properties": {},
        "occurredAt": "2030-03-14T09:30:00Z"
      }
    ],
    "messages": [
      {
        "id": "018f2a4e-6b1c-7d3e-9f40-37386ae05a6b",
        "campaignId": "018f2a4e-6b1c-7d3e-9f40-3478765e5a6b",
        "channel": "email",
        "messageType": "marketing",
        "status": "queued",
        "recipientAddress": "recipientAddress_example",
        "sentAt": "2030-03-14T09:30:00Z",
        "deliveredAt": "2030-03-14T09:30:00Z",
        "openedAt": "2030-03-14T09:30:00Z",
        "clickedAt": "2030-03-14T09:30:00Z",
        "unsubscribedAt": "2030-03-14T09:30:00Z",
        "createdAt": "2030-03-14T09:30:00Z"
      }
    ],
    "groups": [
      {
        "id": "018f2a4e-6b1c-7d3e-9f40-37386ae05a6b",
        "name": "Weekend specials",
        "addedAt": "2030-03-14T09:30:00Z"
      }
    ],
    "segments": [
      {
        "id": "018f2a4e-6b1c-7d3e-9f40-37386ae05a6b",
        "name": "Weekend specials",
        "enteredAt": "2030-03-14T09:30:00Z"
      }
    ],
    "topics": [
      {
        "id": "018f2a4e-6b1c-7d3e-9f40-37386ae05a6b",
        "name": "Weekend specials",
        "subscribed": true,
        "updatedAt": "2030-03-14T09:30:00Z"
      }
    ],
    "journeys": [
      {
        "id": "018f2a4e-6b1c-7d3e-9f40-37386ae05a6b",
        "name": "Weekend specials",
        "status": "active",
        "enrolledAt": "2030-03-14T09:30:00Z",
        "completedAt": "2030-03-14T09:30:00Z"
      }
    ],
    "pushDevices": [
      {
        "kind": "apns_token",
        "permission": "granted",
        "active": true,
        "lastSeenAt": "2030-03-14T09:30:00Z",
        "createdAt": "2030-03-14T09:30:00Z"
      }
    ],
    "formSubmissions": [
      {
        "formId": "018f2a4e-6b1c-7d3e-9f40-b962ee2a5a6b",
        "formName": "formName_example",
        "outcome": "created",
        "createdAt": "2030-03-14T09:30:00Z",
        "confirmedAt": "2030-03-14T09:30:00Z",
        "pendingContact": {}
      }
    ],
    "conversions": [
      {
        "goalId": "018f2a4e-6b1c-7d3e-9f40-91ddf3eb5a6b",
        "value": 1,
        "convertedAt": "2030-03-14T09:30:00Z"
      }
    ],
    "suppressions": [
      {
        "channel": "email",
        "address": "address_example",
        "reason": "reason_example",
        "createdAt": "2030-03-14T09:30:00Z"
      }
    ]
  }
}
```
