---
title: Convert JSON to Mongoose Schema API
slug: convert-json-to-mongoose-schema
url: https://apyhub.com/apyhub/service/convert-json-to-mongoose-schema
provider: ApyHub
categories: [Developer Tools, Smart Generation]
tags: [mongoose, json-to-code, schema-generation, mongodb, typescript, developer-tools]
auth: api_key
---

# Convert JSON to Mongoose Schema API

Generate Mongoose schema code from JSON bodies, files, or URLs. Returns JS or TS output plus inference metadata for review.

## Endpoints

| Method | Path | Description | Atoms |
| --- | --- | --- | --- |
| POST | `/convert/json-url/mongoose-url` | What it does Converts JSON fetched from a publicly accessible URL into a Mongoose schema file and r… | 50 |
| POST | `/convert/json-file/mongoose-raw` | What it does Converts an uploaded JSON file into a generated Mongoose schema and returns the result… | 50 |
| POST | `/convert/json-file/mongoose-url` | What it does Uploads a JSON file and converts its contents into a Mongoose schema, then returns a p… | 50 |
| POST | `/convert/json-raw/mongoose-raw` | What it does Converts the provided JSON input into a generated Mongoose schema source string. It re… | 50 |
| POST | `/convert/json-raw/mongoose-url` | What it does Converts the provided raw JSON data into a Mongoose schema and returns a pre-signed S3… | 50 |
| POST | `/convert/json-url/mongoose-raw` | What it does Converts the JSON document found at a public URL into a generated Mongoose schema. It… | 50 |
| POST | `/convert/json-file/mongoose-file` | What it does Uploads a JSON file and converts it into a downloadable Mongoose schema file. The resp… | 50 |
| POST | `/convert/json-raw/mongoose-file` | What it does Converts the provided JSON input into a Mongoose schema file and returns it as a downl… | 50 |
| POST | `/convert/json-url/mongoose-file` | What it does Converts a JSON document fetched from a publicly accessible URL into a downloadable Mo… | 50 |

## About

## What it does
JSON to Mongoose Schema converts JSON objects or uploaded JSON files into Mongoose schema code. Send a JSON payload from the request body, a wrapped body with `json` and optional `config`, an uploaded `.json` file, or a public JSON URL, and get back generated schema output.

You can choose whether the result is returned directly as a JSON object, as a downloadable file, or as a pre-signed S3 URL. The generation options exposed by the service include `strict`, `timestamps`, `versionKey`, `detectEnums`, `rootModelName`, `useTypescript`, and `detectObjectId`. Those options let you control schema defaults, model naming, TypeScript output, and how object-like identifiers are inferred.

The JSON result endpoints return the generated `schema` string along with `warnings`, `assumptions`, `confidence`, and `meta`. The `meta` object includes `fieldCount`, `nestedLevels`, `hasArrays`, `hasMixedTypes`, and `sourceSampleSize`, which helps you review how much structure was inferred from the input sample.

Use JSON to Mongoose Schema when you need to bootstrap a model from fixture data, API responses, seed files, or a sample document before you refine validators and constraints by hand.

## Usage

Authenticate with an ApyHub API key in the `apy-token` header.
Full docs and a live playground: https://apyhub.com/apyhub/service/convert-json-to-mongoose-schema
