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

# Data Block Tokenization

> Store, retrieve, and manage arbitrary data securely using PCI Booking's Data Block service.

The Data Block service lets you store any non-card data securely in PCI Booking's infrastructure. Each data block gets a unique token ID, and the content is stored in a GDPR-compliant location of your choice.

Data blocks can hold text, JSON, XML, images, PDFs, or any other content up to 50 MB per block.

<Warning>
  Data blocks are **not** PCI compliant. Do not store credit card information in data blocks. Use PCI Booking's [card tokenization](/capture-cards/overview) for card data.
</Warning>

## How It Works

A data block has two parts: **metadata** (reference, location, timestamps) and **content** (the actual data). You create and manage them separately:

1. **Create** a data block to get a token ID. At this point you set the storage location and an optional reference for searching later.
2. **Upload** content to the data block using the token ID.
3. **Download** the content whenever you need it.

You can also update the metadata (reference, location), search across your data blocks by reference, and delete blocks you no longer need.

## Storage Locations

When creating a data block, you choose where the data is stored. Available locations:

| Code | Location          |
| ---- | ----------------- |
| `IE` | Ireland (default) |
| `US` | United States     |
| `DE` | Germany           |
| `GB` | United Kingdom    |
| `FR` | France            |
| `CA` | Canada            |
| `AU` | Australia         |
| `SG` | Singapore         |
| `JP` | Japan             |
| `KR` | South Korea       |
| `IN` | India             |
| `CN` | China             |
| `BR` | Brazil            |

## Common Workflow

### Store a document

```bash theme={null}
# 1. Create the data block (metadata only)
curl -X POST https://service.pcibooking.net/api/dataBlock \
  -H "Authorization: APIKEY your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "Reference": "booking-12345",
    "DataBlockLocation": "DE"
  }'
# Response includes the token ID, e.g. "Id": "22222222"

# 2. Upload the content
curl -X PUT https://service.pcibooking.net/api/datablock/22222222/data \
  -H "Authorization: APIKEY your-api-key" \
  -H "Content-Type: application/pdf" \
  --data-binary @invoice.pdf
```

### Retrieve a document

```bash theme={null}
# Download by token ID
curl https://service.pcibooking.net/api/datablock/22222222/data \
  -H "Authorization: APIKEY your-api-key" \
  -o invoice.pdf
```

### Find data blocks by reference

```bash theme={null}
curl "https://service.pcibooking.net/api/dataBlock?reference=booking-12345" \
  -H "Authorization: APIKEY your-api-key"
```

## Metadata Fields

Each data block tracks the following metadata:

| Field               | Description                                                             |
| ------------------- | ----------------------------------------------------------------------- |
| `Id`                | The unique token ID for this data block.                                |
| `Reference`         | Your custom reference string for searching.                             |
| `DataBlockLocation` | The storage region code.                                                |
| `ContentType`       | The MIME type of the uploaded content. Set automatically on upload.     |
| `DataSize`          | The size of the uploaded content in bytes. Set automatically on upload. |
| `CreationTime`      | When the data block was created.                                        |
| `LastModifiedTime`  | When the content was last uploaded or replaced.                         |
| `LastAccessedTime`  | When the content was last downloaded.                                   |
| `UserId`            | The API user who created the data block.                                |
| `OwnerId`           | The account that owns the data block.                                   |

## Next Steps

<CardGroup cols={2}>
  <Card title="Create a Data Block" icon="code" href="/api-reference/additional/create-data-block">
    Create a new data block and get its token ID.
  </Card>

  <Card title="Upload Content" icon="code" href="/api-reference/additional/upload-data-block-content">
    Upload content to an existing data block.
  </Card>

  <Card title="Download Content" icon="code" href="/api-reference/additional/download-data-block-content">
    Download the content of a data block.
  </Card>

  <Card title="Search Data Blocks" icon="code" href="/api-reference/additional/search-data-blocks">
    Find data blocks by reference.
  </Card>
</CardGroup>
