> ## Documentation Index
> Fetch the complete documentation index at: https://docs.paysway.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Data packaging

The Gamgem dataset is delivered as structured files that contain the gambling platform and payment destination entities described in the [data models](/gamgem/data-models) specification.

The dataset is incrementally versioned, with each version containing two complementary files: a complete snapshot and a delta file showing changes from the previous version.

## Snapshots and deltas

Gamgem provides data through two complementary file types that serve different integration needs:

<Tabs>
  <Tab title="Snapshot file" icon="camera">
    **Complete dataset state**

    Snapshot files contain the current state of all gambling platforms and their payment destinations at a specific point in time. These files include every entity in the dataset.

    **Use snapshots for:**

    * Initial data loads when implementing Gamgem
    * Full system refreshes or rebuilds
    * Recovering from data synchronization issues
    * Periodic dataset validation

    <Info>
      Snapshot files provide a reliable baseline for your implementation, ensuring you have the picture of all known payment destinations.
    </Info>
  </Tab>

  <Tab title="Delta file" icon="git-branch">
    **Incremental changes only**

    Delta files contain only the changes that occurred between two dataset versions. This includes newly identified platforms, updated payment details, and obsoleted entries.

    **Use deltas for:**

    * Regular incremental updates to maintain current data
    * Reduced bandwidth usage for frequent updates
    * Real-time synchronization with threat intelligence
    * Maintaining change history and audit trails

    <Info>
      Delta files are smaller than snapshots, making them ideal for automated updates to your systems.
    </Info>
  </Tab>
</Tabs>

## Snapshot file structure

Snapshot files use JSON Lines format (`.jsonl`), where each line contains a JSON object representing a single [entity](/gamgem/data-models). This format enables streaming processing and supports mixed entity types within the same file.

Dataset versions follow the pattern `YYYYMMDDHHMMSS` (timestamp format), and snapshot files are named accordingly:

```
gamgem-snapshot-YYYYMMDDHHMMSS.jsonl
```

### Snapshot file example

```jsonl gamgem-snapshot-20250306213304.jsonl theme={null}
{"id":"23dd4532-0aec-4794-88ea-ebe2aa330da3","schema":"PLATFORM","createdDate":"2025-01-19T13:51:56.793Z","updatedDate":"2025-03-06T21:33:04.559Z","state":"ACTIVE","attributes":{"name":"YET_ANOTHER_CASINO","services":["CASINO","SPORTS"],"urls":["https://yet-another-casino.bet"]}}
{"id":"a2a0cb2f-ff94-4cfd-b71d-316e513682ba","schema":"MERCHANT","createdDate":"2025-02-01T10:15:30.000Z","updatedDate":"2025-03-06T21:33:04.559Z","state":"ACTIVE","attributes":{"platformId":"23dd4532-0aec-4794-88ea-ebe2aa330da3","cardNetwork":"MASTERCARD","mid":"123456789012345","name":"fake-merchant.io","mcc":"6051","isImpactful":false}}
{"id":"cad6f951-125a-4bd1-a46c-7ad2c4f0b661","schema":"BANK_ACCOUNT","createdDate":"2025-02-15T14:20:45.000Z","updatedDate":"2025-03-06T21:33:04.559Z","state":"ACTIVE","attributes":{"platformId":"23dd4532-0aec-4794-88ea-ebe2aa330da3","bankId":"123456","bankIdType":"GBDSC","accountId":"98765432","accountIdType":"ACCOUNT_NUMBER","accountHolderName":"Yet Another Casino Group Ltd"}}
```

<Info>
  Each line is a valid JSON object.
</Info>

## Delta file structure

Delta files track changes between dataset versions, enabling incremental updates. Like snapshots, they use JSON Lines format but with a structure focused on change events.

### File format

```
gamgem-delta-YYYYMMDDHHMMSS.jsonl
```

Each line represents a single change event with the following structure:

<ParamField body="changeType" type="enum<string>" required>
  Type of change: `ADD`, `UPDATE`, or `OBSOLETE`
</ParamField>

<ParamField body="occurredDate" type="timestamp" required>
  ISO 8601 timestamp when the change was recorded
</ParamField>

<ParamField body="entity" type="object" required>
  The entity that was changed
</ParamField>

### Change types

<AccordionGroup>
  <Accordion title="ADD - New entity discovered">
    Indicates a newly identified gambling platform or payment destination.

    ```json theme={null}
    {
      "changeType": "ADD",
      "occurredDate": "2025-03-06T21:33:04.559Z",
      "entity": {
        "id": "23dd4532-0aec-4794-88ea-ebe2aa330da3",
        "schema": "PLATFORM",
        "attributes": {
          "name": "YET_ANOTHER_CASINO",
          "services": ["CASINO", "SPORTS"],
          "urls": ["https://yet-another-casino.bet"]
        }
      }
    }
    ```
  </Accordion>

  <Accordion title="UPDATE - Entity modified">
    Indicates changes to an existing entity's attributes.

    ```json theme={null}
    {
      "changeType": "UPDATE",
      "occurredDate": "2025-03-06T22:15:30.000Z",
      "entity": {
        "id": "a2a0cb2f-ff94-4cfd-b71d-316e513682ba",
        "schema": "MERCHANT",
        "attributes": {
          "platformId": "23dd4532-0aec-4794-88ea-ebe2aa330da3",
          "cardNetwork": "MASTERCARD",
          "mid": "123456789012345",
          "name": "fake-merchant.io",
          "mcc": "6051",
          "isImpactful": false
        }
      }
    }
    ```
  </Accordion>

  <Accordion title="OBSOLETE - Entity obsoleted">
    Indicates that a payment destination is no longer active.

    ```json theme={null}
    {
      "changeType": "OBSOLETE",
      "occurredDate": "2025-03-06T23:45:12.000Z",
      "entity": {
        "id": "cad6f951-125a-4bd1-a46c-7ad2c4f0b661",
        "schema": "BANK_ACCOUNT",
        "attributes": {
          "platformId": "23dd4532-0aec-4794-88ea-ebe2aa330da3",
          "bankId": "123456",
          "bankIdType": "GBDSC",
          "accountId": "98765432",
          "accountIdType": "ACCOUNT_NUMBER",
          "accountHolderName": "Yet Another Casino Group Ltd"
        }
      }
    }
    ```
  </Accordion>
</AccordionGroup>

### Delta file example

Here's an example delta file showing various change types:

```jsonl gamgem-delta-20250306213304.jsonl theme={null}
{"changeType":"ADD","occurredDate":"2025-03-06T21:33:04.559Z","entity":{"id":"23dd4532-0aec-4794-88ea-ebe2aa330da3","schema":"PLATFORM","attributes":{"name":"YET_ANOTHER_CASINO","services":["CASINO","SPORTS"],"urls":["https://yet-another-casino.bet"]}}}
{"changeType":"UPDATE","occurredDate":"2025-03-06T22:15:30.000Z","entity":{"id":"a2a0cb2f-ff94-4cfd-b71d-316e513682ba","schema":"MERCHANT","attributes":{"platformId":"23dd4532-0aec-4794-88ea-ebe2aa330da3","cardNetwork":"MASTERCARD","mid":"123456789012345","name":"fake-merchant.io","mcc":"6051","isImpactful":false}}}
{"changeType":"OBSOLETE","occurredDate":"2025-03-06T23:45:12.000Z","entity":{"id":"cad6f951-125a-4bd1-a46c-7ad2c4f0b661","schema":"BANK_ACCOUNT","attributes":{"platformId":"23dd4532-0aec-4794-88ea-ebe2aa330da3","bankId":"123456","bankIdType":"GBDSC","accountId":"98765432","accountIdType":"ACCOUNT_NUMBER","accountHolderName":"Yet Another Casino Group Ltd"}}}
```

## Entry ordering

Both file types guarantee specific ordering to enable sequential line-by-line processing:

<Tabs>
  <Tab title="Snapshot order" icon="camera">
    1. **Platform entities first**: All `PLATFORM` entities appear before any payment destination entities
    2. **Payment destinations second**: `MERCHANT`, `BANK_ACCOUNT`, and `CRYPTO_WALLET` entities follow, in any order
  </Tab>

  <Tab title="Delta order" icon="git-branch">
    1. **Chronological order**: All changes are ordered by `occurredDate` (earliest first)
    2. **Same timestamp handling**: When multiple changes have identical timestamps, Platform changes are ordered before payment destination changes
  </Tab>
</Tabs>

<Info>
  You can process each line immediately without needing to look ahead or buffer entities, as all dependencies are resolved by the guaranteed ordering.
</Info>
