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

# Convert JSON to Mongoose Schema API

Convert raw JSON, a JSON URL, or an uploaded file into Mongoose schema code. Returns JS or TS output with inference metadata, warnings, and confidence.

## Endpoints

| Method | Path | Description | Atoms |
| --- | --- | --- | --- |
| POST | `/convert/json-raw/mongoose-raw` | What it does Converts the provided raw JSON input into a generated Mongoose schema source string, a… | 50 |
| POST | `/convert/json-raw/mongoose-file` | What it does Converts the supplied JSON payload into a Mongoose schema file and returns it as a dow… | 50 |
| POST | `/convert/json-url/mongoose-file` | What it does Converts a JSON file fetched from a publicly accessible URL into a downloadable Mongoo… | 50 |
| POST | `/convert/json-url/mongoose-url` | What it does Converts a JSON document fetched from a public URL into a Mongoose schema file and ret… | 50 |
| POST | `/convert/json-file/mongoose-url` | What it does Uploads a JSON file and generates a Mongoose schema from its contents, then returns a… | 50 |
| POST | `/convert/json-raw/mongoose-url` | What it does Converts raw JSON input into a Mongoose schema and returns a pre-signed S3 download UR… | 50 |
| POST | `/convert/json-url/mongoose-raw` | What it does Converts JSON fetched from a publicly accessible URL into a generated Mongoose schema.… | 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-file` | What it does Converts an uploaded JSON file into a downloadable Mongoose schema file. The uploaded… | 50 |

## About

## What it does
JSON to Mongoose Schema converts a JSON object, array of objects, or uploaded JSON file into Mongoose schema source code. Send raw JSON or a JSON URL, and get back a generated schema ready to review and use in a Node.js project.

Use the raw endpoints when you want the schema as structured output with inference metadata, warnings, assumptions, and a confidence score. The result includes the generated `schema` string plus `meta` such as field count, nesting depth, array detection, mixed-type detection, and sample size. That makes it easier to audit what was inferred before you commit it to your models.

If you prefer a file, the file endpoints return a downloadable `.js` or `.ts` schema. You can also fetch JSON from a public URL or upload a JSON file directly. Query and body config options let you control `strict`, `timestamps`, `versionKey`, `detectEnums`, `rootModelName`, `useTypescript`, and `detectObjectId` so the generated output matches your project conventions.

JSON to Mongoose Schema is useful when you need to turn sample API responses, imported records, or fixture data into a starting model without hand-writing every field. It speeds up schema scaffolding, while still leaving room for manual validation rules and application-specific constraints.

## Usage

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