---
title: "Generate a JSON schema from sample"
method: POST
path: "/groups/{groupId}/apps/{appId}/services/{serviceId}/commands/generate_schema"
tags: ["services"]
---

# Generate a JSON schema from sample

`POST /groups/{groupId}/apps/{appId}/services/{serviceId}/commands/generate_schema`

Sample a subset of documents in a collection to generate a JSON schema.

## Request body

- object
  - `database_name` string, required — The name of the database that contains the collection.
  - `collection_name` string, required — The name of the collection to sample and generate a schema for.
  - `limit` integer, required — The maximum number of documents to include in the sample.

## Response `200`

Successfully generated schema

- object
  - `schema` object — The generated JSON schema

---

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