> 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/devx/5.5/user-guide/cli/admin/schemas.md).

# Schemas

## View all schemas <a href="#view-all-schemas" id="view-all-schemas"></a>

View the current schemas registered:

```bash
lenses-cli schemas --unwrap [--output json/table/yaml [--query] [--no-pretty]]
```

{% hint style="info" %}
The *--unwrap* flag is optional, prints only the names separated by new line
{% endhint %}

## View a schema <a href="#view-a-schema" id="view-a-schema"></a>

Schemas can be filtered by name:

```bash
lenses-cli schema --name="sea_vessel_position_reports-value"
```

## View schema versions <a href="#view-schema-versions" id="view-schema-versions"></a>

Schemas versions can be viewed filtered by name:

```bash
lenses-cli schema versions --name="sea_vessel_position_reports-value"
# view by version
lenses-cli schema --name="sea_vessel_position_reports-value" --version="latest"
```

## View schema compatibility levels <a href="#view-schema-compatibility-levels" id="view-schema-compatibility-levels"></a>

Schema compatibility levels can be viewed and filtered by name:

```bash
lenses-cli schema compatibility --name="register1
```

## Delete schemas <a href="#delete-schemas" id="delete-schemas"></a>

Delete all versions of a schema by name:

```bash
lenses-cli schema delete --name="coyote_test_02"
```

## Delete schemas by version <a href="#delete-schemas-by-version" id="delete-schemas-by-version"></a>

Delete a specific version of a schema:

```bash
# (defaults to "latest" if not passed)
lenses-cli schema delete-version --name="register1" --version=2
```

## Change the compatibility of a Schema <a href="#change-compatibility-of-a-schema" id="change-compatibility-of-a-schema"></a>

Change the compatibility level of a schema:

```bash
lenses-cli schema compatibility  set FULL --name="register1"
```

## Register a schema <a href="#register-a-schema" id="register-a-schema"></a>

Register a new schema for a name/subject by the command line or file:

```bash
lenses-cli schema register \
  --name="schemaName" \
  --avro="{ \"type\": \"string\" }"
```

Register by file:

```bash
lenses-cli schema register ./schema.yaml
```

**schema.yaml**:

```yaml
name: schemaName
avroSchema: |-
  {
    "type": "record",
    "name": "evolution",
    "namespace": "io.lenses",
    "doc": "This is a sample AVRO schema to get you started. Please edit",
    "fields": [
      {
       "name": "name",
       "type": "string"
      },
      {
       "name": "number1",
       "type": "int"
      },
      {
       "name": "number2",
       "type": "float"
      }
    ]
   }  
```


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.lenses.io/latest/devx/5.5/user-guide/cli/admin/schemas.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
