---
title: "Set / Update stream schema"
method: PATCH
path: "/streams/{owner}/{id}/{streamId}/schema"
tags: ["streams"]
---

# Set / Update stream schema

`PATCH /streams/{owner}/{id}/{streamId}/schema`

"Set or update a stream's schema.

The schema of a stream defines its primary key(s) and sort/sequence field.

data.world streams are append-only by default. Alternatively, if a primary key is specified, data.world
will replace records with the same primary key value. data.world will sort records by sequence field
value and will discard all but the last record appended for each given primary key value.

The `updateMethod` parameter specifies how data.world should handle existing records when schema is
updated. Currently, the only `updateMethod` supported is `TRUNCATED`. data.world will discard all
records when the schema is updated."

## Path parameters

- `owner` string, required
- `id` string, required
- `streamId` string, required

## Request body

- StreamSchemaPatchRequest
  - `primaryKeyFields` string[]
  - `sequenceField` string
  - `updateMethod` 'TRUNCATE', required

## Response `200`

default response

- SuccessMessage
  - `message` string

---

[API](https://skmtc.dev/data/apis/data-world-public-api.md) · [All operations](https://skmtc.dev/data/apis/data-world-public-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/data/data-world-public-api/revisions/0a0cb1f94dad/schema)
