---
title: "Check if a given schema is compatible with a stream."
method: POST
path: "/streams/{id}/compatibility"
tags: ["Stream Operations"]
---

# Check if a given schema is compatible with a stream.

`POST /streams/{id}/compatibility`

## Request

- Base URL: `https://replace-with-account.api.decodable.co/v1alpha2`
- URL: `https://replace-with-account.api.decodable.co/v1alpha2/streams/{id}/compatibility`
- Auth: one of:
  - HTTP bearer
  - OAuth 2
    - Authorization code: `https://auth.decodable.co/authorize?audience=https://api.decodable.co/`
    - Token URL: `https://auth.decodable.co/oauth/token` scopes: `write:preview`
- TypeScript: <https://skmtc.dev/decodable/apis/decodable-control-plane/docs/streams/:id/compatibility/post.ts> (a function with typed inputs; its response is checked against the schema)

Requires permission matching: `stream:read:default.<name>`.

## Request body

- union
  - object
    - `schema` object[], required: Record schema.
      - `name` string: The field name.
      - `type` string: The field type.
    - `schema_v2` SchemaV2: Record schema, version 2.
      - `fields` union[]: The fields in this schema.
        - union
          - PhysicalField: A physical field.
            - `kind` 'physical', required
            - `name` string
            - `type` string
          - ComputedField: A computed field.
            - `kind` 'computed', required
            - `name` string
            - `expression` string
          - MetadataField: A metadata field.
            - `kind` 'metadata', required
            - `name` string
            - `type` string
            - `key` string
      - `watermarks` object[]: Watermark expressions for this stream. At this time only one expression is supported.
        - `name` string
        - `expression` string
      - `constraints` object
        - `primary_key` string[]: Column names to use for primary key.
    - `side` 'LEFT' | 'RIGHT'
  - object
    - `schema` object[]: Record schema.
      - `name` string: The field name.
      - `type` string: The field type.
    - `schema_v2` SchemaV2, required: Record schema, version 2.
      - `fields` union[]: The fields in this schema.
        - union
          - PhysicalField: A physical field.
            - `kind` 'physical', required
            - `name` string
            - `type` string
          - ComputedField: A computed field.
            - `kind` 'computed', required
            - `name` string
            - `expression` string
          - MetadataField: A metadata field.
            - `kind` 'metadata', required
            - `name` string
            - `type` string
            - `key` string
      - `watermarks` object[]: Watermark expressions for this stream. At this time only one expression is supported.
        - `name` string
        - `expression` string
      - `constraints` object
        - `primary_key` string[]: Column names to use for primary key.
    - `side` 'LEFT' | 'RIGHT'

## Response `200`

A stream compatibility response.

- StreamCompatibility: A stream compatibility response.
  - `compatible` boolean, required: if the request schema is compatible
  - `error` string: error message if the schema is not compatible

## Other responses

- `400`: An invalid request was received.
- `403`: Access denied: requesting user lacks a required permission.
- `404`: The requested resource does not exist.
- `default`: An error has occurred.

---

[API](https://skmtc.dev/decodable/apis/decodable-control-plane.md) - [All operations](https://skmtc.dev/decodable/apis/decodable-control-plane/llms.txt) - [OpenAPI document](https://skmtc.dev/decodable/apis/decodable-control-plane/revisions/9718a3019da8?raw)
