# JavaScript Schema Registry API for Data Transforms

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [streaming-full.txt](https://docs.redpanda.com/streaming-full.txt)

---
title: JavaScript Schema Registry API for Data Transforms
latest-redpanda-tag: v25.1.1
latest-console-tag: v3.7.3
latest-operator-version: v26.1.4
# EOL = End-of-Life (support lifecycle status)
page-is-nearing-eol: "false"
page-is-past-eol: "true"
page-eol-date: April 7, 2026
latest-connect-version: 4.93.0
docname: data-transforms/js/js-sdk-sr
page-component-name: streaming
page-version: "25.1"
page-component-version: "25.1"
page-component-title: Streaming
page-relative-src-path: data-transforms/js/js-sdk-sr.adoc
page-edit-url: https://github.com/redpanda-data/docs/edit/v/25.1/modules/reference/pages/data-transforms/js/js-sdk-sr.adoc
description: Work with Schema Registry in data transforms using JavaScript.
page-git-created-date: "2024-07-31"
page-git-modified-date: "2025-04-08"
support-status: past end-of-life
---

<!-- Source: https://docs.redpanda.com/streaming/25.1/reference/data-transforms/js/js-sdk-sr.md -->

This page contains the API reference for the Schema Registry client library of the data transforms JavaScript SDK.

## [](#functions)Functions

### [](#newClient)newClient()

newClient (): <<SchemaRegistryClient, \`SchemaRegistryClient\`>>

Returns a client interface for interacting with Redpanda Schema Registry.

#### [](#returns)Returns

[`SchemaRegistryClient`](#SchemaRegistryClient)

#### [](#example)Example

```js
import { newClient, SchemaFormat } from "@redpanda-data/sr";

var sr_client = newClient();
const schema = {
  type: "record",
  name: "Example",
  fields: [
    { "name": "a", "type": "long", "default": 0 },
    { "name": "b", "type": "string", "default": "" }
  ]
};

const subj_schema = sr_client.createSchema(
  "avro-value",
  {
    schema: JSON.stringify(schema),
    format: SchemaFormat.Avro,
    references: [],
  }
);
```

### [](#decodeSchemaID)decodeSchemaID()

decodeSchemaID  (\`buf\`): <<DecodeResult, \`DecodeResult\`>>

#### [](#parameters)Parameters

-   `buf`: `string`, `ArrayBuffer`, or `Uint8Array`


#### [](#returns-2)Returns

[`DecodeResult`](#DecodeResult) in the same type as the given argument.

## [](#interfaces)Interfaces

### [](#DecodeResult)DecodeResult

The result of a [`decodeSchemaID`](#decodeSchemaID) function.

#### [](#properties)Properties

-   `id` (read only): The decoded schema ID

-   `rest` (read only): The remainder of the input buffer after stripping the encoded ID.


### [](#reference)Reference

#### [](#properties-2)Properties

-   `name`: `string`

-   `subject`: `string`

-   `version`: `number`


### [](#schema)Schema

#### [](#properties-3)Properties

-   `format` (read only): [`SchemaFormat`](#SchemaFormat)

-   `references` (read only): [`Reference`](#reference)

-   `schema` (read only): `string`


### [](#SchemaRegistryClient)SchemaRegistryClient

Client interface for interacting with Redpanda Schema Registry.

#### [](#methods)Methods

-   `createSchema(subject (string), [schema](#schema))`: [`SubjectSchema`](#SubjectSchema)

-   `lookupLatestSchema(subject (string))`: [`SubjectSchema`](#SubjectSchema)

-   `lookupSchemaById(id (number))`: [`Schema`](#schema)

-   `lookupSchemaByVersion(subject (string), version (number))`: [`SubjectSchema`](#SubjectSchema)


### [](#SubjectSchema)SubjectSchema

#### [](#properties-4)Properties

-   `id` (read only): `number`

-   `schema` (read only): [`Schema`](#schema)

-   `subject` (read only): `string`

-   `version` (read only): `number`


## [](#enumerations)Enumerations

### [](#SchemaFormat)SchemaFormat

#### [](#enumeration-members)Enumeration members

-   Avro: `0`

-   Protobuf: `1`

-   JSON: `2`


## [](#suggested-reading)Suggested reading

[JavaScript API for Data Transforms](https://docs.redpanda.com/streaming/25.1/reference/data-transforms/js/js-sdk/)