# Update Metadata

#### `PUT /public/v1/datacatalog/connections/{connection_id}/streams/{stream_name}/metadata`

Updates metadata for a specific data stream in the catalog.

You can perform either a full update or a partial update by sending only the fields you want to change.

***

## Request

### Path Parameters

| Parameter       | Type   | Description                                | Required |
| --------------- | ------ | ------------------------------------------ | -------- |
| `connection_id` | string | ID of the connection (e.g., Kafka cluster) | Yes      |
| `stream_name`   | string | Name of the stream (e.g., Kafka topic)     | Yes      |

### Body Parameters

| Field           | Type          | Description                             | Required |
| --------------- | ------------- | --------------------------------------- | -------- |
| `tags`          | string\[]     | Labels for categorizing the stream      | Optional |
| `ownerId`       | string        | User ID of the stream owner             | Optional |
| `domainId`      | string (UUID) | Domain identifier                       | Optional |
| `documentation` | string        | Rich text documentation (HTML format)   | Optional |
| `updatedBy`     | string        | User ID of the person making the update | Optional |
| `updatedAt`     | long          | Unix timestamp in milliseconds          | Optional |

***

### Example — Full Update

```bash
curl --location --request PUT 'https://your-instance.com/public/v1/datacatalog/connections/42/streams/spacecraft.telemetry.raw/metadata' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <your-api-key>' \
--data-raw '{
  "metadata": {
    "tags": ["spacecraft", "telemetry", "raw-data"],
    "ownerId": "sarah.connor@skynet.com",
    "domainId": "9f83cc67-d3da-4432-b0b7-0d08e7b41d86",
    "documentation": "<h1>Spacecraft Telemetry Stream</h1><p>This stream contains raw telemetry data from our spacecraft fleet, including:</p><ul><li>Position data</li><li>System health metrics</li><li>Environmental readings</li></ul>",
    "updatedBy": "sarah.connor@skynet.com",
    "updatedAt": 1707347405000
  }
}'
```

***

### Example — Partial Update

```bash
curl --location --request PUT 'https://your-instance.com/public/v1/datacatalog/connections/42/streams/spacecraft.telemetry.raw/metadata' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <your-api-key>' \
--data '{
  "metadata": {
    "tags": ["spacecraft", "telemetry", "processed"],
    "documentation": "<h1>Spacecraft Telemetry Stream</h1><p>Updated: This stream now contains processed telemetry data.</p>"
  }
}'
```

Partial updates only modify the specified fields without affecting other metadata.

***

## Response

**HTTP Status Code:** `200 OK`\
**Response Body:** _The change (object)_

***

## Best Practices

* Use **partial updates** when possible to avoid overwriting existing metadata unintentionally.
* Include **meaningful documentation** in HTML format to describe the data stream clearly.
* Keep **tags** consistent across related streams for better searchability and organization.

***

## Possible Errors

| Status Code | Description      | Solution                              |
| ----------- | ---------------- | ------------------------------------- |
| 400         | Invalid request  | Check your request payload format     |
| 401         | Unauthorized     | Verify your API key                   |
| 404         | Stream not found | Confirm connection ID and stream name |
