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

# Update Data Block Details

> Update the details and metadata of an existing data block.

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

Updates the metadata of an existing data block, such as its reference value or storage location. Use this when you need to change the region where the data is stored (for GDPR compliance) or update the reference used for searching.

## Error Responses

| HTTP Status | Error Code | Description                                                                                                 |
| ----------- | ---------- | ----------------------------------------------------------------------------------------------------------- |
| 400         | -125       | Validation error. The request body is missing or contains invalid fields.                                   |
| 401         | -1003      | Not authenticated. The API key is missing or invalid.                                                       |
| 403         | -1003      | Not authorized. The authenticated user does not own this data block or lacks the `CanWriteData` permission. |
| 404         | -160       | Data block not found. No data block exists with the specified ID.                                           |
| 500         | -150       | Internal system error.                                                                                      |

## Parameter Constraints

| Parameter           | Constraint                                                                                                                                                               |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `Reference`         | Must match the pattern `[a-zA-Z0-9_\-@#=\"']{0,64}`. Letters, digits, underscore, hyphen, at-sign, hash, equals, double-quote, and single-quote only. Max 64 characters. |
| `DataBlockLocation` | One of: `US`, `IN`, `KR`, `SG`, `AU`, `JP`, `CA`, `DE`, `IE`, `GB`, `FR`, `BR`.                                                                                          |

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

### Path Parameters

<ParamField path="id" type="string" required>
  The ID of the data block returned in the [create method](/api-reference/additional/create-data-block).
</ParamField>

### Request Body

<ParamField body="Reference" type="string">
  A reference value which can then be used to query for this card token.
</ParamField>

<ParamField body="DataBlockLocation" type="string" default="null">
  The location to store this data block. Available locations: **US**, **IN**, **KR**, **SG**, **AU**, **JP**, **CA**, **CN**, **DE**, **IE**, **GB**, **FR**, **BR**. For the default location (Ireland), enter `null`.
</ParamField>

<RequestExample>
  ```javascript Node.js theme={null}
  const dataBlockId = '22222222';

  const response = await fetch(`https://service.pcibooking.net/api/dataBlock/${dataBlockId}`, {
    method: 'PUT',
    headers: {
      'Authorization': 'APIKEY your-api-key',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      Reference: 'updated_ref_001',
      DataBlockLocation: 'US'
    })
  });

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

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

  data_block_id = '22222222'

  response = requests.put(
      f'https://service.pcibooking.net/api/dataBlock/{data_block_id}',
      headers={
          'Authorization': 'APIKEY your-api-key',
          'Content-Type': 'application/json'
      },
      json={
          'Reference': 'updated_ref_001',
          'DataBlockLocation': 'US'
      }
  )

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

## Response

<ResponseExample>
  ```json 200 theme={null}
  {
      "UserId": "Nadya",
      "OwnerId": "Frodo",
      "Id": "22222222",
      "Reference": "my reference",
      "ContentType": null,
      "DataSize": null,
      "CreationTime": "2019-01-16T11:21:25.3241104Z",
      "LastAccessedTime": null,
      "LastModifiedTime": null,
      "DataBlockLocation": "DE"
  }
  ```

  ```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>
