openapi: 3.1.0
info:
  title: Personal Data Introduction
  version: '1.0'
  # language=markdown
  description: |
    
    In Commerce, every change to a user’s personal data is logged.

    Personal data sets are groups of data items that are related to each other. For example, customer, addresses, and authentication information. The contents of a personal data set is dynamic. Data items are attached to each other automatically as they are created or updated.
    
    The API allows you to fetch these logs, including the list of related data items. In other words, the data items that belong to the same personal data set.
    
    Log entries are kept in the system for a limited time. You can configure the retention period using the Logs Time-to-live (TTL) settings API. The default retention period is 365 days for production store types and 7 days for other store types.

    ## Personal Data Resource Types

    | Entity type                               | Endpoint                                                                                                                                              | Documentation                                                                                                    |
    |-------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------|
    | customer                                  | `v2/customers/{id}`                                                                                                                                   | [Customers](/docs/customer-management/customer-management-api/customer-management-api-overview)                  |
    | account                                   | `v2/accounts/{id}`                                                                                                                                    | [Accounts](/docs/api/accounts/post-v-2-accounts)                                                                 |
    | account-member                            | `v2/account-members/{id}`                                                                                                                             | [Account Members](/docs/api/accounts/account-members)                                                            |
    | account-membership                        | `v2/accounts/{accountId}/account-memberships/{id}`                                                                                                    | [Account Memberships](/docs/api/accounts/account-membership)                                                     |
    | address                                   | `v2/customers/{customerId}/addresses/{id}`; `v2/accounts/{accountId}/addresses/{id}`                                                                  | [Addresses](/docs/api/addresses/addresses-introduction)                                                          |
    | user-authentication-info                  | `v2/authentication-realms/{realmId}/user-authentication-info/{id}`                                                                                    | [User Authentication Info](/docs/api/single-sign-on/user-authentication-infos)                                   |
    | user-authentication-oidc-profile-info     | `v2/authentication-realms/{authenticationRealmId}/user-authentication-info/{userAuthenticationInfoId}/user-authentication-oidc-profile-info/{id}`     | [User Authentication OIDC Profile Info](/docs/api/single-sign-on/user-authentication-oidc-profile-infos)         |
    | user-authentication-password-profile-info | `v2/authentication-realms/{authenticationRealmId}/user-authentication-info/{userAuthenticationInfoId}/user-authentication-password-profile-info/{id}` | [User Authentication Password Profile Info](/docs/api/single-sign-on/user-authentication-password-profile-infos) |
    | order                                     | `v2/orders/{id}`                                                                                                                                      | [Orders](/docs/api/carts/orders)                                                                                 |

  contact:
    name: Elastic Path
    url: 'https://www.elasticpath.com'
    email: support@elasticpath.com
  license:
    url: 'https://elasticpath.dev'
    name: MIT
servers:
  - url: 'https://useast.api.elasticpath.com'
    description: US East
  - url: 'https://euwest.api.elasticpath.com'
    description: EU West
security:
  - bearerAuth: []
tags:
  - name: Personal Data Logs
    # language=Markdown
    description: |
      When a user’s personal data is changed, an event is logged by Commerce. You can use the Personal Data Logs endpoint to access these logs.
      
      This API is read only, and you cannot add, update, or delete logs using this API.
      
      The API only allows you to read all logs for a particular data entry (specified in the filter GET parameter).
      
      :::note
      Currently, personal data management is only enabled for a limited set of endpoints. See the [personal data concepts page](/docs/api/personal-data/personal-data-introduction) for the list of endpoints that support personal data management.
      :::
  - name: Personal Data Related Data Entries
    # language=Markdown
    description: |
      This is a supplementary endpoint for the [logs](/docs/api/personal-data/logs-time-to-live-settings) endpoint. It allows you to view all data entries that are related to the
      resource specified in the filter. For example, a user can get all data items that relate to a customer, such as addresses or user authentication info.
      
      This API is read only, and you cannot add, update, or delete anything using this API.
      
      The API only allows you to list related data items for a particular data entry (specified in the filter GET parameter).
  - name: Personal Data Erasure Requests
    # language=Markdown
    description: |
      Erasure requests enable you to exercise the right, referred to in regulations such as GDPR, as the right to be
      forgotten or right to erase.
      Erasure requests allow you to wipe out personal data from Commerce in an automated way, including:

      * All related resources (for example, addresses, customers, and so on.)
      * Personal Data Logs

      Erasure requests can be created for any data entry in the personal data set (see [Personal Data Concept](/docs/api/personal-data/personal-data-introduction) for details), and the result is the same.

      :::note
      Currently, it does not include flows or data external to Commerce.
      :::

      Erasure requests are processed asynchronously. The POST requests return immediately, and processing continues in
      the background. You can use the GET endpoint to poll for results until you see `{..."status":"SUCCESS"...}` in the
      response body.

      In the unlikely event an erasure request fails (if the status is not equal to `SUCCESS`), you are advised to retry
      by creating another erasure request. If the problem persists, contact Support.

      :::note
      Currently, personal data management is only enabled for a limited set of endpoints. See
      the [personal data concepts page](/docs/api/personal-data/personal-data-introduction) for the list of endpoints that support personal data
      management.
      :::

      Seller Admin & IT users have full access to Erasure Requests, and Support users have read access.
  - name: Logs Time to Live Settings
    # language=Markdown
    description: |
      You can use the Logs TTL Settings endpoint to retrieve and update settings controlling logs time-to-live (TTL).
paths:
  /v2/personal-data/logs:
    get:
      tags:
        - Personal Data Logs
      summary: Get Personal Data Logs
      # language=Markdown
      description: |
        Gets a list of logs for a specific resource id and resource type.
        
        You can use pagination with this resource. For more information, see [pagination](/guides/Getting-Started/pagination).
        
        :::note
        * This request is only accessible to `client_credentials` token users with `Seller Admin`, `Support` and `IT` roles.
        * Non `client_credentials` token users cannot access this endpoint. See [Permissions](/docs/authentication/tokens/permissions).
        * This request requires a filter for `resource_type` and `resource_id`.
          :::
        
        ## Filtering

        The following operator and attributes are **required** for [filtering](/guides/Getting-Started/filtering) erasure requests.

        | Operator | Description                                                                                          |
        |:---------|:-----------------------------------------------------------------------------------------------------|
        | `eq`     | Checks whether the values of two operands are equal. If the values are equal, the condition is true. |

        | Attribute         | Type     | Operator | Example                                                   |
        | :---------------- | :---     | :---     | :-------------------------------------------------------- |
        | `resource_type`   | `string` | `eq`     | `eq(resource_type,customer)`                              |
        | `resource_id`     | `string` | `eq`     | `eq(resource_id,0f850c15-d643-480a-a2b4-9e3c26067178)`    |
      operationId: get-personal-data-logs
      parameters:
        - $ref: '#/components/parameters/PageOffset'
        - $ref: '#/components/parameters/PageLimit'
        - $ref: '#/components/parameters/Filter'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/PersonalDataLog"
                  meta:
                    $ref: "#/components/schemas/PaginationMeta"
                  links:
                    $ref: "#/components/schemas/PaginationLinks"
              examples:
                getLogs:
                  value:
                    {
                      "data": [
                        {
                          "id": "faf8c40f-a680-40ae-b7bc-78533bbdd8c3",
                          "store_id": "00000000-0000-1000-8000-000000000000",
                          "type": "personal_data_log_entry",
                          "initiator": {
                            "access-token-email": "accounts@molt.in",
                            "access-token-id": "1222341536243515939",
                            "access-token-name": "moltin test team",
                            "access-token-store-id": "15ea9633-278c-4807-80f7-2009fed63c7e",
                            "access-token-type": "client-credentials-token"
                          },
                          "time": "2022-04-29T10:51:14.374Z",
                          "event_type": "user-authentication-info.event.created",
                          "delta": {
                            "email": "some@email.com",
                            "id": "00000000-0000-1000-8000-111111111112",
                            "name": "some_name",
                            "realm_id": "00000000-0000-1000-8000-111111111111",
                            "store_id": "00000000-0000-1000-8000-000000000000",
                            "type": "user-authentication-info"
                          },
                          "resource_id": "00000000-0000-1000-8000-111111111112",
                          "resource_type": "user-authentication-info",
                          "relationships": {
                            "resource_path": {
                              "url": "http://www.elaticpath.com"
                            }
                          }
                        }
                      ],
                      "meta": {
                        "page": {
                          "limit": 100,
                          "offset": 0,
                          "current": 1,
                          "total": 1
                        },
                        "results": {
                          "total": 1
                        }
                      },
                      "links": {
                        "current": "https://useast.api.elasticpath.com/v2/personal-data/logs?page[offset]=0&page[limit]=20",
                        "first": "https://useast.api.elasticpath.com/v2/personal-data/logs?page[offset]=0&page[limit]=20",
                        "last": "https://useast.api.elasticpath.com/v2/personal-data/logs?page[offset]=0&page[limit]=20",
                        "next": "null",
                        "prev": "null"
                      }
                    }
        '400':
          $ref: '#/components/responses/BadFilterError'
        default:
          $ref: '#/components/responses/InternalServerError'
  /v2/personal-data/related-data-entries:
    get:
      tags:
        - Personal Data Related Data Entries
      summary: Get Personal Data Related Data Entries
      # language=Markdown
      description: |
        Gets a list of related data entries filtered by specific resource id and resource type.
        
        You can use pagination with this resource. For more information, see [pagination](/guides/Getting-Started/pagination).
        
        :::note
        
        * This request is only accessible to `client_credentials` token users with `Seller Admin`, `Support` and `IT` roles.
        * Non `client_credentials` token users cannot access this endpoint. See [Permissions](/docs/authentication/tokens/permissions).
        * This request requires a filter for `resource_type` and `resource_id`.
        
        :::
        
        ## Filtering
        
        The following operator and attributes are **required** for [filtering](/guides/Getting-Started/filtering) erasure requests.

        | Operator | Description                                                                                          |
        |:---------|:-----------------------------------------------------------------------------------------------------|
        | `eq`     | Checks whether the values of two operands are equal. If the values are equal, the condition is true. |
        
        | Attribute         | Type     | Operator | Example                                                   |
        | :---------------- | :---     | :---     | :-------------------------------------------------------- |
        | `resource_type`   | `string` | `eq`     | `eq(resource_type,customer)`                              |
        | `resource_id`     | `string` | `eq`     | `eq(resource_id,0f850c15-d643-480a-a2b4-9e3c26067178)`    |
      operationId: get-related-data-entries
      parameters:
        - $ref: '#/components/parameters/PageOffset'
        - $ref: '#/components/parameters/PageLimit'
        - $ref: '#/components/parameters/Filter'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/RelatedDataEntry"
                  meta:
                    $ref: "#/components/schemas/PaginationMeta"
                  links:
                    $ref: "#/components/schemas/PaginationLinks"
              examples:
                getLogs:
                  value:
                    {
                      "data": [
                        {
                          "resource_id": "00000000-0000-1000-8000-111111111112",
                          "type": "related_data_entry",
                          "resource_type": "user-authentication-info"
                        }
                      ],
                      "meta": {
                        "page": {
                          "limit": 20,
                          "offset": 0,
                          "current": 1,
                          "total": 1
                        },
                        "results": {
                          "total": 1
                        }
                      },
                      "links": {
                        "current": "https://useast.api.elasticpath.com/v2/personal-data/related-data-entries?page[offset]=0&page[limit]=20",
                        "first": "https://useast.api.elasticpath.com/v2/personal-data/related-data-entries?page[limit]=20&page[offset]=0",
                        "last": "https://useast.api.elasticpath.com/v2/personal-data/related-data-entries?page[offset]=0&page[limit]=20",
                        "next": "null",
                        "prev": "null"
                      }
                    }
        '400':
          $ref: '#/components/responses/BadFilterError'
        default:
          $ref: '#/components/responses/InternalServerError'
  /v2/personal-data/erasure-requests:
    post:
      tags:
        - Personal Data Erasure Requests
      summary: Create Personal Data Erasure Request
      # language=Markdown
      description: |
        This request serves to create a new erasure request for a given resource ID and Type. All resources that belong to the same personal data set will be erased.
      operationId: post-erasure-request
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - data
              properties:
                data:
                  $ref: "#/components/schemas/ErasureRequest"
                  required:
                    - type
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    $ref: "#/components/schemas/ErasureRequestResponse"
              examples:
                postErasureRequest:
                  value:
                    {
                      "data": {
                        "id": "fb25ecd9-c610-4659-97d6-0a7550ac0ddc",
                        "type": "erasure_request",
                        "resource_id": "98140362-6caf-4829-b93d-953ac6adbe6e",
                        "resource_type": "account",
                        "initiator": {
                          "access-token-email": "accounts@molt.in",
                          "access-token-id": "1222341536243515939",
                          "access-token-name": "moltin test team",
                          "access-token-store-id": "15ea9633-278c-4807-80f7-2009fed63c7e",
                          "access-token-type": "client-credentials-token"
                        },
                        "status": "CREATED",
                        "status_description": "The erasure request successfully created",
                        "created_at": "2022-06-07T12:25:38.52Z",
                        "updated_at": "2022-06-07T12:25:38.69Z",
                        "links": {
                          "self": "https://useast.api.elasticpath.com/v2/personal-data/erasure-requests/fb25ecd9-c610-4659-97d6-0a7550ac0ddc"
                        }
                      }
                    }
        '400':
          $ref: '#/components/responses/BadRequestError'
        default:
          $ref: '#/components/responses/InternalServerError'
    get:
      tags:
        - Personal Data Erasure Requests
      summary: Get all Personal Data Erasure Request
      # language=Markdown
      description: |
        Gets a list of erasure requests for a specific resource id and resource type.
        
        You can use pagination with this resource. For more information, see [pagination](/guides/Getting-Started/pagination).
        
        ## Filtering

        The following operator and attributes are **required** for [filtering](/guides/Getting-Started/filtering)
        erasure requests.

        | Operator | Description                                                                                          |
        |:---------|:-----------------------------------------------------------------------------------------------------|
        | `eq`     | Checks whether the values of two operands are equal. If the values are equal, the condition is true. |

        | Attribute       | Type | Operator | Example                                                 |
        |:----------------| :--- | :--- |:--------------------------------------------------------|
        | `resource_type` | `string` | `eq`  | `eq(resource_type,customer)`                            |
        | `resource_id`   | `string` | `eq`  | `eq(resource_id,0f850c15-d643-480a-a2b4-9e3c26067178\)` |
      operationId: get-erasure-requests
      parameters:
        - $ref: '#/components/parameters/PageOffset'
        - $ref: '#/components/parameters/PageLimit'
        - $ref: '#/components/parameters/Filter'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/ErasureRequestResponse"
                  meta:
                    $ref: "#/components/schemas/PaginationMeta"
                  links:
                    $ref: "#/components/schemas/PaginationLinks"
              examples:
                postErasureRequest:
                  value:
                    {
                      "meta": {
                        "page": {
                          "limit": 10,
                          "offset": 0,
                          "current": 1,
                          "total": 1
                        },
                        "results": {
                          "total": 1
                        }
                      },
                      "data": [
                        {
                          "id": "43eb23ef-9a97-466f-9315-d0e0c9df25b5",
                          "type": "erasure_request",
                          "resource_id": "abe71c87-974d-4ced-9f83-6b8d5502b0e8",
                          "resource_type": "account",
                          "initiator": {
                            "access-token-email": "accounts@molt.in",
                            "access-token-id": "1222341536243515939",
                            "access-token-name": "moltin test team",
                            "access-token-store-id": "15ea9633-278c-4807-80f7-2009fed63c7e",
                            "access-token-type": "client-credentials-token"
                          },
                          "status": "FAILURE",
                          "status_description": "There was an error processing your request, you can retry it or report it using the id",
                          "created_at": "2022-05-25T10:10:58.623Z",
                          "updated_at": "2022-05-25T10:10:58.676Z"
                        },
                        {
                          "id": "eeb182ed-f929-4197-bb43-7104afa852f2",
                          "type": "erasure_request",
                          "resource_id": "74f98b7a-dbbf-49ed-b7a7-eaea766b8e38",
                          "resource_type": "address",
                          "initiator": {
                            "access-token-email": "accounts@molt.in",
                            "access-token-id": "1222341536243515939",
                            "access-token-name": "moltin test team",
                            "access-token-store-id": "15ea9633-278c-4807-80f7-2009fed63c7e",
                            "access-token-type": "client-credentials-token"
                          },
                          "status": "SUCCESS",
                          "status_description": "The erasure request is successfully processed",
                          "created_at": "2022-05-26T08:25:37.618Z",
                          "updated_at": "2022-05-26T08:25:37.698Z"
                        },
                        {
                          "id": "39787c4b-a338-4bd7-ace9-456d1ae8e90b",
                          "type": "erasure_request",
                          "resource_id": "3327fb93-b687-4c0c-a850-ee95e0303ef1",
                          "resource_type": "account",
                          "initiator": {
                            "access-token-email": "accounts@molt.in",
                            "access-token-id": "1222341536243515939",
                            "access-token-name": "moltin test team",
                            "access-token-store-id": "15ea9633-278c-4807-80f7-2009fed63c7e",
                            "access-token-type": "client-credentials-token"
                          },
                          "status": "FAILURE",
                          "status_description": "There was an error processing your request, you can retry it or report it using the id",
                          "created_at": "2022-05-26T08:48:56.183Z",
                          "updated_at": "2022-05-26T08:48:56.365Z"
                        }
                      ],
                      "links": {
                        "current": "https://useast.api.elasticpath.com/v2/personal-data/erasure-requests?filter=eq(resource_type,account_member):eq(resource_id,00000000-0000-1000-8000-000f00000300)&page[offset]=0&page[limit]=10",
                        "first": "https://useast.api.elasticpath.com/v2/personal-data/erasure-requests?filter=eq(resource_type,account_member):eq(resource_id,00000000-0000-1000-8000-000f00000300)&page[offset]=0&page[limit]=10",
                        "last": "https://useast.api.elasticpath.com/v2/personal-data/erasure-requests?filter=eq(resource_type,account_member):eq(resource_id,00000000-0000-1000-8000-000f00000300)&page[offset]=0&page[limit]=10",
                        "next": "null",
                        "prev": "null"
                      }
                    }
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        default:
          $ref: '#/components/responses/InternalServerError'
  /v2/personal-data/erasure-requests/{erasure_request_id}:
    get:
      parameters:
        - $ref: "#/components/parameters/ErasureRequestId"
      tags:
        - Personal Data Erasure Requests
      summary: Get Personal Data Erasure Request
      # language=Markdown
      description: |
        This request serves to get an existing erasure request by its ID.
      operationId: get-erasure-request
      responses:
        '200':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    $ref: "#/components/schemas/ErasureRequestResponse"
              examples:
                postErasureRequest:
                  value:
                    {
                      "data": {
                        "id": "fb25ecd9-c610-4659-97d6-0a7550ac0ddc",
                        "type": "erasure_request",
                        "resource_id": "98140362-6caf-4829-b93d-953ac6adbe6e",
                        "resource_type": "account",
                        "initiator": {
                          "access-token-email": "accounts@molt.in",
                          "access-token-id": "1222341536243515939",
                          "access-token-name": "moltin test team",
                          "access-token-store-id": "15ea9633-278c-4807-80f7-2009fed63c7e",
                          "access-token-type": "client-credentials-token"
                        },
                        "status": "CREATED",
                        "status_description": "The erasure request successfully created",
                        "created_at": "2022-06-07T12:25:38.52Z",
                        "updated_at": "2022-06-07T12:25:38.69Z",
                        "links": {
                          "self": "https://useast.api.elasticpath.com/v2/personal-data/erasure-requests/fb25ecd9-c610-4659-97d6-0a7550ac0ddc"
                        }
                      }
                    }
        '404':
          $ref: '#/components/responses/NotFoundError'
        default:
          $ref: '#/components/responses/InternalServerError'
  /v2/settings/logs-ttl:
    get:
      tags:
        - Logs Time to Live Settings
      summary: Get Logs Time-to-Live (TTL) Settings
      operationId: get-logs-ttl
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    $ref: "#/components/schemas/LogsTtl"
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        default:
          $ref: '#/components/responses/InternalServerError'
    put:
      tags:
        - Logs Time to Live Settings
      summary: Update Logs Time-to-Live (TTL) Settings
      operationId: put-logs-ttl
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - data
              properties:
                data:
                  $ref: "#/components/schemas/LogsTtl"
                  required:
                    - type
            examples:
              update-logs-ttl:
                summary: "Update Logs TTL"
                value:
                  {
                    "data": {
                      "days": 10,
                      "type": "time_to_live"
                    }
                  }
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    $ref: "#/components/schemas/LogsTtl"
        '400':
          $ref: '#/components/responses/BadRequestError'
        default:
          $ref: '#/components/responses/InternalServerError'
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
  parameters:
    ErasureRequestId:
      name: erasure_request_id
      in: path
      required: true
      description: The id of the Personal-Data Erasure Request.
      schema:
        type: string
      example: "3fa85f64-5717-4562-b3fc-2c963f66afa6"
    PageOffset:
      name: page[offset]
      description: The current offset by number of records, not pages. Offset is zero-based. The maximum records you can offset is 10,000. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used.
      in: query
      required: false
      schema:
        type: integer
        format: int64
        minimum: 0
        maximum: 10000
        example: 0
    PageLimit:
      name: page[limit]
      description: The maximum number of records per page for this response. You can set this value up to 100. If no page size is set, the [page length](/docs/api/settings/settings-introduction#page-length) store setting is used.
      in: query
      required: false
      schema:
        type: integer
        format: int64
        minimum: 0
        example: 100
    Filter:
      name: filter
      in: query
      required: false
      description: Filter attributes. For more information, see the [Filtering](/guides/Getting-Started/filtering) section.
      schema:
        type: string
        format: string
        example: eq(resource_id,0f850c15-d643-480a-a2b4-9e3c26067178)
  schemas:
    PaginationMeta:
      type: object
      required:
        - page
        - results
      properties:
        results:
          type: object
          properties:
            total:
              description: Total number of results for the entire collection.
              type: integer
              example: 1
        page:
          type: object
          properties:
            limit:
              description: The maximum number of records for all pages.
              type: integer
              example: 100
            offset:
              description: The current offset by number of pages.
              type: integer
              example: 0
            current:
              description: The current number of pages.
              type: integer
              example: 1
            total:
              description: The total number of records for the entire collection.
              type: integer
              example: 1
    PaginationLinks:
      required:
        - current
        - first
        - last
        - next
        - prev
      type: object
      properties:
        current:
          description: Always the current page.
          type: [ string, 'null' ]
          format: uri
        first:
          description: Always the first page.
          type: [ string, 'null' ]
          format: uri
        last:
          description: Always `null` if there is only one page.
          type: [ string, 'null' ]
          format: uri
        next:
          description: Always `null` if there is only one page.
          type: [ string, 'null' ]
        prev:
          description: Always `null` if the user is on the first page.
          type: [ string, 'null' ]
    PersonalDataLog:
      properties:
        id:
          type: string
          format: uuid
          description: The unique identifier for the log entry.
          example: faf8c40f-a680-40ae-b7bc-78533bbdd8c3
        store_id:
          type: string
          format: uuid
          description: The unique identifier for the store id.
          example: 00000000-0000-1000-8000-000000000000
        type:
          type: string
          const: personal_data_log_entry
          description: The type of the object. Always equal to `personal_data_log_entry`.
        initiator:
          type: object
          description: Specifies who initiated the personal data change.
          properties:
            access-token-email:
              type: string
              example: accounts@elasticpath.com
            access-token-id:
              type: string
              example: 1222341536243515939
            access-token-name:
              type: string
              example: elastic path test team
            access-token-store-id:
              type: string
              format: uuid
              example: 15ea9633-278c-4807-80f7-2009fed63c7e
            access-token-type:
              type: string
              example: client-credentials-token
        time:
          type: string
          description: Specifies the time when the change happened.
          example: 2022-04-29T10:51:14.374Z
        event_type:
          type: string
          description: Specifies the type of the event.
          example: user-authentication-info.event.created
        delta:
          type: object
          description: Includes fields that were changed as a result of the event.
          properties:
            email:
              type: string
              example: some@eamil.com
            id:
              type: string
              format: uuid
              example: 00000000-0000-1000-8000-111111111112
            name:
              type: string
              example: some_name
            realm_id:
              type: string
              example: 00000000-0000-1000-8000-111111111111
            store_id:
              type: string
              format: uuid
              example: 00000000-0000-1000-8000-000000000000
            type:
              type: string
              example: user-authentication-info
        resource_id:
          type: string
          description: The ID of the data entry that was changed.
          example: 00000000-0000-1000-8000-111111111112
        resource_type:
          type: string
          description: The type of the data entry that was changed.
          example: user-authentication-info
        relationships:
          type: object
          properties:
            resource_path:
              type: object
              properties:
                url:
                  type: string
                  format: uri
                  example: http://www.elaticpath.com
    RelatedDataEntry:
      properties:
        resource_type:
          type: string
          description: The type of a related data entry.
          example: user-authentication-info
        resource_id:
          type: string
          format: uuid
          description: The ID of a related data entry.
          example: 00000000-0000-1000-8000-111111111112
        type:
          type: string
          const: related_data_entry
          description: The type of the object. Always equal to `related_data_entry`.
    LogsTtl:
      properties:
        days:
          type: integer
          description: The number of days to retain the logs. Allowed values are between 1 and 365.
          minimum: 1
          maximum: 365
          example: 10
        type:
          type: string
          const: time_to_live
          description: The type of the object. Always equal to `time_to_live`.
    ErasureRequest:
      properties:
        resource_type:
          type: string
          description: The type of the data entry to be erased.
          example: account
        resource_id:
          type: string
          format: uuid
          description: The ID of the data entry to be erased (note that also all data entries in the personal data set will be erased).
          example: 98140362-6caf-4829-b93d-953ac6adbe6e
        type:
          type: string
          const: erasure_request
          description: The type of the object. Always equal to `erasure_request`.
    ErasureRequestResponse:
      properties:
        id:
          type: string
          format: uuid
          description: The unique identifier for the log entry.
        resource_type:
          type: string
          description: The type of the data entry to be erased.
          example: account
        resource_id:
          type: string
          format: uuid
          description: The ID of the data entry to be erased (note that also all data entries in the personal data set will be erased).
          example: 98140362-6caf-4829-b93d-953ac6adbe6e
        type:
          type: string
          const: erasure_request
          description: The type of the object. Always equal to `erasure_request`.
        initiator:
          type: object
          description: Specifies who initiated the erasure request.
          properties:
            access-token-email:
              type: string
              example: accounts@elasticpath.com
            access-token-id:
              type: string
              example: 1222341536243515939
            access-token-name:
              type: string
              example: elastic path test team
            access-token-store-id:
              type: string
              format: uuid
              example: 15ea9633-278c-4807-80f7-2009fed63c7e
            access-token-type:
              type: string
              example: client-credentials-token
        status:
          type: string
          description: Specifies the status of the erasure request.
        status_description:
          type: string
          description: Elaborates on the erasure request status.
        created_at:
          type: string
          description: Specifies the status of the erasure request.
        updated_at:
          type: string
          description: Elaborates on the erasure request status.
        links:
          type: object
          properties:
            self:
              type: string
              description: The self link.
    Error:
      required:
        - status
        - title
      properties:
        title:
          type: string
          description: A brief summary of the error.
          examples:
            - "Bad Request"
        status:
          type: string
          format: string
          description: The HTTP response code of the error.
          examples:
            - "400"
        detail:
          type: string
          description: Optional additional detail about the error.
          examples:
            - "The field 'name' is required"
    ErrorResponse:
      required:
        - errors
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/Error'
  responses:
    InternalServerError:
      description: Internal server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            internal-server-error:
              summary: Internal server error
              # language=JSON
              value: |
                {
                  "errors": [
                    {
                      "title": "Internal Server Error",
                      "status": "500",
                      "detail": "there was a problem processing your request"
                    }
                  ]
                }
    BadFilterError:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missing-filter:
              summary: Required filter missing
              # language=JSON
              value: |
                {
                  "errors": [
                    {
                      "detail": "bad filter: resource_id and resource_type are the filter fields that are both mandatory and only they are allowed",
                      "status": "400",
                      "title": "Bad Request"
                    }
                  ]
                }
    BadRequestError:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            bad-request-error:
              summary: Required field missing
              # language=JSON
              value: |
                {
                  "errors": [
                    {
                      "title": "Bad Request",
                      "status": "400",
                      "detail": "Validation failed: field 'Type' on the 'ttl-type' tag."
                    }
                  ]
                }
    UnauthorizedError:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            unauthorized-error:
              summary: Unauthorized
              # language=JSON
              value: |
                {
                  "errors": [
                    {
                      "title": "Unauthorized",
                      "status": "401"
                    }
                  ]
                }
    NotFoundError:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            not-found-error:
              summary: Not Found
              # language=JSON
              value: |
                {
                  "errors": [
                    {
                      "detail": "not found",
                      "status": "404",
                      "title": "Not Found"
                    }
                  ]
                }
