pydo.databases.create_kafka_schema()

Generated on 4 Jun 2026 from pydo version v0.35.0

Usage

client.databases.create_kafka_schema(
    database_cluster_uuid="9cc10173-e9ea-4176-9dbc-a4cee4c4ff30",
    body={
        "subject_name": "customer-schema",
        "schema_type": "AVRO",
        "schema": "{your_schema}",
    },
)
Returns JSONRaises HttpResponseError

Description

To create a Kafka schema for a database cluster, send a POST request to /v2/databases/{database_cluster_uuid}/schema-registry.

Parameters

database_cluster_uuid string required

A unique identifier for a database cluster.

subject_name string required

Example: customer-schema

The name of the schema subject.

schema_type string required

The type of the schema.

One of: AVRO, JSON, PROTOBUF

schema string required

Example: { "type": "record", "name": "Customer", "fields": [ {"name": "id", "type": "int"}, {"name": "name", "type": "string"} ] }

The schema definition in the specified format.

Request Sample

Show Request Sample
import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

req = {
  "subject_name": "customer-schema",
  "schema_type": "AVRO",
  "schema": "{\n  \"type\": \"record\",\n  \"name\": \"Customer\",\n  \"fields\": [\n    {\"name\": \"id\", \"type\": \"string\"},\n    {\"name\": \"name\", \"type\": \"string\"},\n    {\"name\": \"email\", \"type\": \"string\"},\n    {\"name\": \"created_at\", \"type\": \"long\"}\n  ]\n}\n"
}

resp = client.databases.create_kafka_schema(database_cluster_uuid="9cc10173-e9ea-4176-9dbc-a4cee4c4ff30", body=req)

Response Example

Show Response Example
{
  "schema_id": 12345,
  "subject_name": "customer-schema",
  "schema_type": "AVRO",
  "schema": "{\n  \"type\": \"record\",\n  \"name\": \"Customer\",\n  \"fields\": [  \n    {\"name\": \"id\", \"type\": \"int\"},\n    {\"name\": \"name\", \"type\": \"string\"}\n  ]\n} "
}

More Information

See /v2/databases/{database_cluster_uuid}/schema-registry in the API reference for additional detail on responses, headers, parameters, and more.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.