> ## 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 Blocks

> 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](https://developers.pcibooking.net/capture-cards/overview.md) for card data.

## 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 [retrieve](https://developers.pcibooking.net/api-reference/additional/get-data-block-details.md) or [update](https://developers.pcibooking.net/api-reference/additional/update-data-block-details.md) the metadata (reference, location), search across your data blocks by reference, and [delete](https://developers.pcibooking.net/api-reference/additional/delete-data-block.md) blocks you no longer need.

## Storage Locations

When creating a data block, you choose where the data is stored. If you do not choose, the data is stored in your account's country if it is in this list, otherwise in Ireland. Available locations:

| Code | Location |
| - | - |
| `IE` | Ireland |
| `US` | United States |
| `DE` | Germany |
| `GB` | United Kingdom |
| `FR` | France |
| `CA` | Canada |
| `AU` | Australia |
| `SG` | Singapore |
| `JP` | Japan |
| `KR` | South Korea |
| `IN` | India |
| `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

> [card] [Create a Data Block](https://developers.pcibooking.net/api-reference/additional/create-data-block.md)
>
> Create a new data block and get its token ID.

> [card] [Upload Content](https://developers.pcibooking.net/api-reference/additional/upload-data-block-content.md)
>
> Upload content to an existing data block.

> [card] [Download Content](https://developers.pcibooking.net/api-reference/additional/download-data-block-content.md)
>
> Download the content of a data block.

> [card] [Search Data Blocks](https://developers.pcibooking.net/api-reference/additional/search-data-blocks.md)
>
> Find data blocks by reference.

> [card] [Get Data Block Details](https://developers.pcibooking.net/api-reference/additional/get-data-block-details.md)
>
> Retrieve a data block's metadata.

> [card] [Update Data Block Details](https://developers.pcibooking.net/api-reference/additional/update-data-block-details.md)
>
> Update a data block's reference or location.

> [card] [Delete Data Block](https://developers.pcibooking.net/api-reference/additional/delete-data-block.md)
>
> Permanently delete a data block.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.