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

# Search Data Blocks

> Search for data blocks by reference, with pagination support.

<Card title="Data Block Tokenization Guide" icon="book" href="/additional-functions/data-blocks">
  Store and manage arbitrary data securely with GDPR-compliant storage locations
</Card>

Searches for data blocks by their reference value, with pagination support. Use this to find specific data blocks when you know the reference you assigned at creation, or omit the reference to list all data blocks in your account.

## Error Responses

| HTTP Status | Error Code | Description                                                                                                                             |
| ----------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| 400         | -125       | Validation error. A query parameter is out of range or has an invalid format (e.g. `maxItems` above 50 or invalid `reference` pattern). |
| 401         | -1003      | Not authenticated. The API key is missing or invalid.                                                                                   |
| 403         | -1003      | Not authorized. The API key does not have the `CanRetrieveData` permission.                                                             |
| 500         | -150       | Internal system error.                                                                                                                  |

## Parameter Constraints

| Parameter   | Constraint                                                                                                      |
| ----------- | --------------------------------------------------------------------------------------------------------------- |
| `reference` | Must match the pattern `[a-zA-Z0-9_\-@#=\"']{0,64}` with an optional trailing `*` wildcard for prefix matching. |
| `maxItems`  | Integer from 1 to 50. Defaults to 20 if omitted.                                                                |
| `offset`    | Integer from 0 upward. Zero-based index of the first result to return.                                          |

<Info title="Sort order">
  The list of items returned to you will be sorted by the `create date` of the data block.
</Info>

## Parameters

### Headers

<ParamField header="Authorization" type="string" required>
  Your API key prefixed with `APIKEY`. Example: `APIKEY your-api-key`. See the [Authentication guide](/getting-started/authentication).
</ParamField>

### Query String

<ParamField query="reference" type="string">
  The `reference` value provided in the [create method](/api-reference/additional/create-data-block) or [update method](/api-reference/additional/update-data-block-details). If omitted, all data blocks in the system are returned.
</ParamField>

<ParamField query="maxItems" type="integer" default="20">
  The maximum number of items to return. Maximum allowed value is `50`.
</ParamField>

<ParamField query="offset" type="string">
  The zero-based offset from the first item ID to return (item IDs in PCI Booking are sequential).
</ParamField>

<RequestExample>
  ```javascript Node.js theme={null}
  const params = new URLSearchParams({
    reference: 'booking_*',
    maxItems: '10',
    offset: '0'
  });

  const response = await fetch(`https://service.pcibooking.net/api/dataBlock?${params}`, {
    headers: {
      'Authorization': 'APIKEY your-api-key'
    }
  });

  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://service.pcibooking.net/api/dataBlock',
      headers={
          'Authorization': 'APIKEY your-api-key'
      },
      params={
          'reference': 'booking_*',
          'maxItems': 10,
          'offset': 0
      }
  )

  print(response.json())
  ```
</RequestExample>

## Response

<ResponseExample>
  ```json 200 theme={null}
  [
      {
          "UserId": "Nadya",
          "OwnerId": "Frodo",
          "Id": "12345678",
          "Reference": "ref1",
          "ContentType": "application/json",
          "DataSize": 140415,
          "CreationTime": "2019-01-16T15:17:38.4483995Z",
          "LastAccessedTime": "2019-01-17T14:17:38.4493958Z",
          "LastModifiedTime": "2019-01-17T10:17:38.4493958Z",
          "DataBlockLocation": "IE"
      },
      {
          "UserId": "Nadya",
          "OwnerId": "Frodo",
          "Id": "11111111",
          "Reference": "ref2",
          "ContentType": "application/xml",
          "DataSize": 2524,
          "CreationTime": "2019-01-16T15:17:38.4493958Z",
          "LastAccessedTime": "2019-01-17T14:17:38.4493958Z",
          "LastModifiedTime": "2019-01-17T10:17:38.4493958Z",
          "DataBlockLocation": "US"
      },
      {
          "UserId": "Nadya",
          "OwnerId": "Frodo",
          "Id": "22222222",
          "Reference": "ref1",
          "ContentType": "image/png",
          "DataSize": 5413,
          "CreationTime": "2019-01-16T15:17:38.4493958Z",
          "LastAccessedTime": "2019-01-17T14:17:38.4493958Z",
          "LastModifiedTime": "2019-01-17T10:17:38.4493958Z",
          "DataBlockLocation": "IE"
      }
  ]
  ```

  ```json 400 theme={null}
  {
      "code": -125,
      "message": "Bad input data",
      "moreInfo": "...",
      "errorList": null
  }
  ```

  ```json 401 theme={null}
  {
      "code": -1003,
      "message": "Not authorized to access this resource",
      "moreInfo": "Bad or missing authorization data, expected APIKEY",
      "errorList": null
  }
  ```
</ResponseExample>
