---
title: Convert JSON to Prisma Schema API
slug: convert-json-to-prisma-schema
url: https://apyhub.com/apyhub/service/convert-json-to-prisma-schema
provider: ApyHub
categories: [Output Kit]
tags: [prisma, json-conversion, schema-generation, database-modeling, developer-tools]
auth: api_key
version: 1.0.0
service_type: sync
endpoints: 9
atoms: 50
mcp: true
alias: converter-json-prisma
---

# Convert JSON to Prisma Schema API

Convert JSON from a body, file, or URL into Prisma schema text or a .prisma file. Supports PostgreSQL, MySQL, SQLite, and MongoDB providers.

## Endpoints

| Method | URL | Description | Atoms |
| --- | --- | --- | --- |
| POST | `https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-url-prisma-url` | What it does Converts the JSON resource available at the provided URL into a Prisma schema file and… | 50 |
| POST | `https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-file-prisma-raw` | What it does Converts an uploaded JSON file into a Prisma schema and returns the result as a JSON o… | 50 |
| POST | `https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-file-prisma-url` | What it does Converts an uploaded JSON file into a Prisma schema and returns a pre-signed S3 URL fo… | 50 |
| POST | `https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-raw-prisma-file` | What it does Converts the supplied JSON content into a downloadable Prisma schema (.prisma) file. T… | 50 |
| POST | `https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-raw-prisma-raw` | What it does Converts the supplied JSON data into a Prisma schema and returns the generated result… | 50 |
| POST | `https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-raw-prisma-url` | What it does Converts the provided JSON payload into a Prisma schema and returns a pre-signed S3 UR… | 50 |
| POST | `https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-file-prisma-file` | What it does Converts an uploaded JSON file into a downloadable Prisma schema file (.prisma). The r… | 50 |
| POST | `https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-url-prisma-file` | What it does Converts the JSON file available at the provided URL into a downloadable Prisma schema… | 50 |
| POST | `https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-url-prisma-raw` | What it does Converts the JSON document at the provided URL into a Prisma schema and returns the ge… | 50 |

## Endpoint reference

### Convert JSON at URL → pre-signed S3 URL for .prisma file

`POST https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-url-prisma-url` · 50 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `url` | body | string (uri) | yes | Publicly accessible URL pointing to a JSON resource. Example: `https://assets.apyhub.com/samples/sample.json`. |
| `output` | query | string | no | Default: `sample-output`. Example: `my-schema`. |
| `provider` | query | string | no | One of: postgresql, mysql, sqlite, mongodb. Default: `postgresql`. |
| `rootModelName` | query | string | no | Example: `User`. |

#### Quickstart

Convert a JSON file from a public URL into a Prisma schema by sending the source URL in the request body.

```bash
curl -X POST "https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-url-prisma-url?output=my-schema&provider=postgresql" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://assets.apyhub.com/samples/sample.json"}'
```

#### What you'll get back

Returns a JSON object with a `data` string field containing a pre-signed S3 URL to the converted `.prisma` file.

```json
{
  "data": "https://s3.amazonaws.com/bucket/uuid_sample-output.prisma?..."
}
```

### Convert uploaded JSON file → Prisma schema 

`POST https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-file-prisma-raw` · 50 atoms · accepts `multipart/form-data` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `file` | body | string (binary) | yes | JSON file to convert (MIME type must be application/json). |
| `provider` | query | string | no | One of: postgresql, mysql, sqlite, mongodb. Default: `postgresql`. |
| `rootModelName` | query | string | no | Example: `User`. |

#### Quickstart

Upload a JSON file to generate a Prisma schema.

```bash
curl -X POST "https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-file-prisma-raw" \
  -H "apy-token: $APY_TOKEN" \
  -F "file=@/path/to/file.json"
```

#### What you'll get back

Returns a JSON object with `meta`, `enums`, `models`, `schema`, `warnings`, and `confidence` fields. `meta` is an object with `enumCount`, `fieldCount`, and `modelCount`; `schema` is the full Prisma schema text; the other top-level fields contain the generated schema details and any warnings.

```json
{
  "meta": {
    "enumCount": 0,
    "fieldCount": 0,
    "modelCount": 1
  },
  "enums": [],
  "models": [],
  "schema": "model User {\n  id Int @id @default(autoincrement())\n}",
  "warnings": [],
  "confidence": 0.98
}
```

### Convert uploaded JSON file → pre-signed S3 URL for .prisma file

`POST https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-file-prisma-url` · 50 atoms · accepts `multipart/form-data` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `file` | body | string (binary) | yes | JSON file to convert (MIME type must be application/json). |
| `output` | query | string | no | Default: `sample-output`. Example: `my-schema`. |
| `provider` | query | string | no | One of: postgresql, mysql, sqlite, mongodb. Default: `postgresql`. |
| `rootModelName` | query | string | no | Example: `User`. |

#### Quickstart

Upload a JSON file to convert it into a Prisma schema, using the default PostgreSQL provider and sample output name.

```bash
curl -X POST "https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-file-prisma-url?output=my-schema&provider=postgresql&rootModelName=User" \
  -H "apy-token: $APY_TOKEN" \
  -F "file=@/path/to/file.json"
```

#### What you'll get back

Returns a JSON object with a `data` string field containing a pre-signed S3 URL to the converted Prisma file.

```json
{
  "data": "https://s3.amazonaws.com/bucket/uuid_sample-output.prisma?..."
}
```

### Convert raw JSON body → downloadable .prisma file

`POST https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-raw-prisma-file` · 50 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `body` | body | any | yes | The request body can be either:

Plain object — the entire body is treated as the JSON data to convert:
{ "id": 1, "name": "Alice" }

Wrapped format — use json for data and config for inline generati… |
| `output` | query | string | no | Default: `sample-output`. Example: `my-schema`. |
| `provider` | query | string | no | One of: postgresql, mysql, sqlite, mongodb. Default: `postgresql`. |
| `rootModelName` | query | string | no | Example: `User`. |

#### Quickstart

Convert a JSON object into a Prisma schema file with the default PostgreSQL provider.

```bash
curl -X POST "https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-raw-prisma-file" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"id":1,"name":"Alice"}'
```

#### What you'll get back

Returns a downloadable Prisma schema file as a binary response (`string` with `format: binary`). The response body is the generated `.prisma` file content.

### Convert raw JSON body → Prisma schema

`POST https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-raw-prisma-raw` · 50 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `body` | body | any | yes | The request body can be either:

Plain object — the entire body is treated as the JSON data to convert:
{ "id": 1, "name": "Alice" }

Wrapped format — use json for data and config for inline generati… |
| `provider` | query | string | no | One of: postgresql, mysql, sqlite, mongodb. Default: `postgresql`. |
| `rootModelName` | query | string | no | Example: `User`. |

#### Quickstart

Send your JSON data in the request body to generate a Prisma schema.

```bash
curl -X POST "https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-raw-prisma-raw" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"id":1,"name":"Alice"}'
```

#### What you'll get back

Returns a JSON object with these top-level fields: `meta` (object), `enums` (array), `models` (array), `schema` (string), `warnings` (array), and `confidence` (number).

```json
{
  "meta": {
    "enumCount": 0,
    "fieldCount": 2,
    "modelCount": 1
  },
  "enums": [],
  "models": [],
  "schema": "model User {\n  id Int\n  name String\n}",
  "warnings": [],
  "confidence": 1
}
```

### Convert raw JSON body → pre-signed S3 URL for .prisma file

`POST https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-raw-prisma-url` · 50 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `body` | body | any | yes | The request body can be either:

Plain object — the entire body is treated as the JSON data to convert:
{ "id": 1, "name": "Alice" }

Wrapped format — use json for data and config for inline generati… |
| `output` | query | string | no | Default: `sample-output`. Example: `my-schema`. |
| `provider` | query | string | no | One of: postgresql, mysql, sqlite, mongodb. Default: `postgresql`. |
| `rootModelName` | query | string | no | Example: `User`. |

#### Quickstart

Convert a small JSON object to a Prisma schema and download the generated file URL.

```bash
curl -X POST "https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-raw-prisma-url?output=my-schema&provider=postgresql&rootModelName=User" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"id":1,"name":"Alice"}'
```

#### What you'll get back

Returns a JSON object with a `data` string field containing a pre-signed S3 URL to the converted `.prisma` file.

```json
{
  "data": "https://s3.amazonaws.com/bucket/uuid_sample-output.prisma?..."
}
```

### Convert uploaded JSON file → downloadable .prisma file

`POST https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-file-prisma-file` · 50 atoms · accepts `multipart/form-data` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `file` | body | string (binary) | yes | JSON file to convert (MIME type must be application/json). |
| `output` | query | string | no | Default: `sample-output`. Example: `my-schema`. |
| `provider` | query | string | no | One of: postgresql, mysql, sqlite, mongodb. Default: `postgresql`. |
| `rootModelName` | query | string | no | Example: `User`. |

#### Quickstart

Convert a JSON file into a Prisma schema by uploading the file and choosing the output format.

```bash
curl -X POST "https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-file-prisma-file?output=my-schema&provider=postgresql&rootModelName=User" \
  -H "apy-token: $APY_TOKEN" \
  -F "file=@/path/to/file.json"
```

#### What you'll get back

Returns a downloadable Prisma schema file as a binary `.prisma` response.

### Convert JSON at URL → downloadable .prisma file

`POST https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-url-prisma-file` · 50 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `url` | body | string (uri) | yes | Publicly accessible URL pointing to a JSON resource. Example: `https://assets.apyhub.com/samples/sample.json`. |
| `output` | query | string | no | Default: `sample-output`. Example: `my-schema`. |
| `provider` | query | string | no | One of: postgresql, mysql, sqlite, mongodb. Default: `postgresql`. |
| `rootModelName` | query | string | no | Example: `User`. |

#### Quickstart

Generate a Prisma schema file from a public JSON URL.

```bash
curl -X POST "https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-url-prisma-file?output=my-schema&provider=postgresql&rootModelName=User" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://assets.apyhub.com/samples/sample.json"}'
```

#### What you'll get back

Returns a downloadable Prisma schema file as binary content (`.prisma`).

### Convert JSON at URL → Prisma schema 

`POST https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-url-prisma-raw` · 50 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `url` | body | string (uri) | yes | Publicly accessible URL pointing to a JSON resource. Example: `https://assets.apyhub.com/samples/sample.json`. |
| `provider` | query | string | no | One of: postgresql, mysql, sqlite, mongodb. Default: `postgresql`. |
| `rootModelName` | query | string | no | Example: `User`. |

#### Quickstart

Convert a JSON file URL into a Prisma schema by sending the JSON URL in the request body.

```bash
curl -X POST "https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-url-prisma-raw?provider=postgresql" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://assets.apyhub.com/samples/sample.json"}'
```

#### What you'll get back

Returns a JSON object with `meta`, `enums`, `models`, `schema`, `warnings`, and `confidence` fields. `meta` is an object with `enumCount`, `fieldCount`, and `modelCount`; `schema` is a string containing the full Prisma schema text.

```json
{
  "meta": {
    "enumCount": 0,
    "fieldCount": 0,
    "modelCount": 0
  },
  "enums": [],
  "models": [],
  "schema": "string",
  "warnings": [],
  "confidence": 0
}
```

## About

## What it does
JSON to Prisma Schema converts JSON into a Prisma schema, either from a raw JSON payload, an uploaded JSON file, or a JSON resource at a public URL. You can get the result back as raw JSON, a downloadable `.prisma` file, or a pre-signed S3 URL to the generated file.

Use it when you need to turn example data or an existing JSON payload into a starting Prisma data model. The service accepts JSON as a request body, a binary JSON file, or a `url` pointing to a publicly accessible JSON resource. For generation options, it supports `provider` (`postgresql`, `mysql`, `sqlite`, or `mongodb`) and an optional `rootModelName`. Some endpoints also accept an `output` name for the generated file.

The raw response includes the generated `schema` text plus supporting `meta`, `enums`, `models`, `warnings`, and `confidence` fields. That makes it useful when you want to inspect or post-process the generated schema in your own pipeline. If you prefer file delivery, the file endpoints return the `.prisma` content directly, or a `data` URL pointing to the saved file.

A typical use case is bootstrapping a Prisma model from API fixtures, import samples, or a JSON export before you wire it into a database migration workflow.

## Usage

Base URL: `https://api.eu.apyhub.com` (default region — see
`GET https://apyhub.com/api/public/regions` for the rest).

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-prisma-schema
