> For the complete documentation index, see [llms.txt](https://docs.lenses.io/latest/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lenses.io/latest/k2k/configuration-reference/schema-registry-connectivity-authentication.md).

# Schema Registry connectivity and authentication

Source and target Schema Registry connections.

Records serialized with Avro, Protobuf, or JSON Schema depend on subjects registered in Schema Registry. Consumers on the target Kafka cluster cannot deserialize replicated data unless K2K can reach both registries—therefore we configure `source.registry` and `target.registry` when [schema migration](https://docs.lenses.io/latest/k2k/configuration-reference/schema-migration.md) is enabled.

Schema Registry is optional. Skip this guide if your pipeline replicates data that does not use Schema Registry. When registry access is required, each side needs its own URL and credentials. K2K passes standard Schema Registry client properties through `registry.config`, prefixed with `schema.registry`.

## Prerequisites

* [License accepted](https://docs.lenses.io/latest/k2k/configuration-reference/licenses.md)
* [Kafka connectivity and authentication](https://docs.lenses.io/latest/k2k/configuration-reference/kafka-connectivity-authentication.md) configured
* Schema Registry endpoints for the source Kafka cluster and target Kafka cluster (when schema migration or schema-aware replication is required)

## Example

Use this pipeline configuration:

```yaml
name: "my_pipeline"
source:
  kafka:
    common:
      "bootstrap.servers": "source:9092"
  registry:
    config:
      "schema.registry.url": "https://source-sr:8081"
      "schema.registry.basic.auth.credentials.source": "USER_INFO"
      "schema.registry.basic.auth.user.info": "user:password"
target:
  kafka:
    common:
      "bootstrap.servers": "target:9092"
  registry:
    config:
      "schema.registry.url": "https://target-sr:8081"
replication:
  - source:
      topic: "orders.*"
  - sink:
      topic: source
      partition: source
```

## Configuration keys

### Source

| Key                      | Description                       | Required    | Default | Used by    |
| ------------------------ | --------------------------------- | ----------- | ------- | ---------- |
| `source.registry`        | Source Schema Registry connection | Conditional | (none)  | Replicator |
| `source.registry.config` | Schema Registry client properties | Conditional | `{}`    | Replicator |

### Target

| Key                      | Description                       | Required    | Default | Used by    |
| ------------------------ | --------------------------------- | ----------- | ------- | ---------- |
| `target.registry`        | Target Schema Registry connection | Conditional | (none)  | Replicator |
| `target.registry.config` | Schema Registry client properties | Conditional | `{}`    | Replicator |

`source.registry` and `target.registry` are required when [schema migration](https://docs.lenses.io/latest/k2k/configuration-reference/schema-migration.md) is enabled.

## Client properties

Any standard Schema Registry client property can be set under `registry.config`, prefixed with `schema.registry` (for example `schema.registry.url`). For the full property list, see the [Schema Registry client configuration reference](https://docs.confluent.io/platform/current/schema-registry/sr-client-configs.html#configuration-reference-for-sr-clients-on-product).

Commonly used keys:

| Key                                             | Description                                           |
| ----------------------------------------------- | ----------------------------------------------------- |
| `schema.registry.url`                           | Schema Registry URL                                   |
| `schema.registry.basic.auth.credentials.source` | Basic auth source (`USER_INFO`, `SASL_INHERIT`, etc.) |
| `schema.registry.basic.auth.user.info`          | Credentials as `user:password`                        |
| `schema.registry.ssl.truststore.location`       | Truststore path for TLS                               |
| `schema.registry.ssl.truststore.password`       | Truststore password                                   |

For secrets in connection settings, see [Secrets and templates](https://docs.lenses.io/latest/k2k/configuration-reference/secrets-and-templates.md).

## Advanced

### Schema Registry headers

Add custom HTTP headers to Schema Registry requests. Useful when a proxy or gateway requires additional headers.

| Key                       | Description                                           | Required | Default | Used by    |
| ------------------------- | ----------------------------------------------------- | -------- | ------- | ---------- |
| `source.registry.headers` | HTTP headers added to source Schema Registry requests | No       | `{}`    | Replicator |
| `target.registry.headers` | HTTP headers added to target Schema Registry requests | No       | `{}`    | Replicator |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.lenses.io/latest/k2k/configuration-reference/schema-registry-connectivity-authentication.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
