---
title: "Update a schema"
method: PUT
path: "/groups/{groupId}/apps/{appId}/schemas/{schemaId}"
tags: ["schemas"]
---

# Update a schema

`PUT /groups/{groupId}/apps/{appId}/schemas/{schemaId}`

Replace an existing [schema](https://www.mongodb.com/docs/atlas/app-services/schemas) with a new one.

## Request body

- FullSchema
  - `metadata` SchemaMetadata — Metadata that describes which linked collection the schema applies to.
    - `data_source` string — The data source name.
    - `database` string — The database name.
    - `collection` string — The collection name.
  - `schema` SchemaDefinition — A valid [schema](https://www.mongodb.com/docs/atlas/app-services/schemas) for the collection.
    - `bsonType` 'object' | 'array' | 'string' | 'number' | 'int' | 'long' | 'double' | 'decimal' | 'date' | 'timestamp' | 'bool' | 'null' | 'regex' | 'objectId' | 'binary' | 'uuid' | 'function' | 'javascript' | 'symbol' | 'minKey' | 'maxKey' — The [BSON type](https://www.mongodb.com/docs/atlas/app-services/schemas/types/#std-label-schema-types) of the field.
    - `title` string — A human-readable title for the schema.
    - `required` string[] — For `object` schemas, an array of field names that are required in instances of the object.
    - `properties` object — An object where each field name is a property in the schema. The corresponding value is a [schema](https://www.mongodb.com/docs/atlas/app-services/schemas/types/#std-label-schema-types) definition for that field.
  - `relationships` SchemaRelationships — Relationships to foreign collections. Each field name is a property in the schema. The corresponding value is a [relationship](https://www.mongodb.com/docs/atlas/app-services/schemas/relationships/) definition for that field.

## Response `204`

No Content

## Changes

- **2024-04-16** (v3) `4d3b5277aa31` — 1 breaking, 1 info
  - removed the enum value `undefined` of the request property `schema/bsonType`
  - added the new `null` enum value to the request property `schema/bsonType`
- **2024-02-20** (v3) `e2240dd053bd` — 1 warning, 5 info
  - removed the request property `_id`
  - added the new optional request property `schema/bsonType`
  - added the new optional request property `schema/properties`
  - added the new optional request property `schema/required`
  - …2 more

[Change history](https://skmtc.dev/mongodb/apis/mongodb-atlas-app-services-admin-api/changes/groups/:groupId/apps/:appId/schemas/:schemaId/put.md)

---

[API](https://skmtc.dev/mongodb/apis/mongodb-atlas-app-services-admin-api.md) · [All operations](https://skmtc.dev/mongodb/apis/mongodb-atlas-app-services-admin-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/mongodb/mongodb-atlas-app-services-admin-api/revisions/1365ab72bc03/schema)
