apyhub
Back
▣ DEVELOPER TOOLS · SMART GENERATION

Convert JSON to Prisma Schema API

Hosted on ApyHub

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.

▣ ENDPOINT 01 / 09
POST
Convert JSON at URL → pre-signed S3 URL for .prisma file
https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-url-prisma-url

QUICKSTART

GUIDE

Quickstart

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

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.

{
  "data": "https://s3.amazonaws.com/bucket/uuid_sample-output.prisma?..."
}
TRY ITLIVE · 50 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
Publicly accessible URL pointing to a JSON resource.

About this endpoint

What it does

Converts the JSON resource available at the provided URL into a Prisma schema file and returns a pre-signed S3 URL where the generated .prisma file can be downloaded.

Query Parameter(s)

AttributeTypeDescription
outputStringOutput file name prefix. Default: sample-output.
providerENUMTarget database provider. Allowed values: postgresql, mysql, sqlite, mongodb. Default: postgresql.
rootModelNameStringRoot model name to use in the generated Prisma schema.

Request Body

ParameterTypeDescription
urlStringPublicly accessible URL pointing to a JSON resource. Format: URI.

Response

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

ParameterTypeDescription
dataStringPre-signed S3 URL to the converted file. Format: URI.
▣ ENDPOINT 02 / 09
POST
Convert uploaded JSON file → Prisma schema
https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-file-prisma-raw

QUICKSTART

GUIDE

Quickstart

Upload a JSON file to generate a Prisma schema.

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.

{
  "meta": {
    "enumCount": 0,
    "fieldCount": 0,
    "modelCount": 1
  },
  "enums": [],
  "models": [],
  "schema": "model User {\n  id Int @id @default(autoincrement())\n}",
  "warnings": [],
  "confidence": 0.98
}
TRY ITLIVE · 50 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.
body*
JSON file to convert (MIME type must be application/json).

About this endpoint

What it does

Converts an uploaded JSON file into a Prisma schema and returns the result as a JSON object. The request uploads a JSON file and can optionally specify the Prisma provider and a root model name.

Query Parameter(s)

AttributeTypeDescription
providerENUMPrisma provider to target. Allowed values: postgresql, mysql, sqlite, mongodb. Default: postgresql.
rootModelNameStringRoot Prisma model name. Example: User.

Request Body

ParameterTypeDescription
fileBinaryJSON file to convert. The MIME type must be application/json.

Response

Returns a JSON object with meta object, enums array, models array, schema string, warnings array, and confidence number fields. The schema field contains the full Prisma schema text, while the other fields provide counts, structured model data, warnings, and a confidence score.

ParameterTypeDescription
metaObjectSummary counts for the generated schema.
meta.enumCountIntegerNumber of enums detected in the generated Prisma schema.
meta.fieldCountIntegerNumber of fields detected in the generated Prisma schema.
meta.modelCountIntegerNumber of models detected in the generated Prisma schema.
enumsObject ArrayArray of enum objects included in the generated result.
modelsObject ArrayArray of model objects included in the generated result.
schemaStringThe full Prisma schema text.
warningsString ArrayArray of warning messages produced during conversion.
confidenceNumberConfidence score for the generated schema, returned as a float.

Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.

▣ ENDPOINT 03 / 09
POST
Convert uploaded JSON file → pre-signed S3 URL for .prisma file
https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-file-prisma-url

QUICKSTART

GUIDE

Quickstart

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

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.

{
  "data": "https://s3.amazonaws.com/bucket/uuid_sample-output.prisma?..."
}
TRY ITLIVE · 50 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.
body*
JSON file to convert (MIME type must be application/json).

About this endpoint

What it does

Converts an uploaded JSON file into a Prisma schema and returns a pre-signed S3 URL for the generated .prisma file. The request accepts the JSON file in the body plus optional query parameters to control the output name, database provider, and root model name.

Query Parameter(s)

AttributeTypeDescription
outputStringOutput name used in the generated file URL. Default: sample-output.
providerENUMDatabase provider to target. Allowed values: postgresql, mysql, sqlite, mongodb. Default: postgresql.
rootModelNameStringRoot model name to use in the generated schema.

Request Body

ParameterTypeDescription
fileBinaryJSON file to convert. MIME type must be application/json.

Response

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

ParameterTypeDescription
dataStringPre-signed S3 URL to the converted file. Format: URI.

Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.

▣ ENDPOINT 04 / 09
POST
Convert raw JSON body → downloadable .prisma file
https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-raw-prisma-file

QUICKSTART

GUIDE

Quickstart

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

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.

TRY ITLIVE · 50 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
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 generation options. The body must have exactly the keys json and (optionally) config, where json is an object or array: { "json": { "id": 1, "name": "Alice" }, "config": { "rootModelName": "User", "provider": "postgresql" } } Body config values are merged with query parameters; body config takes precedence.
body*
Any valid non-empty JSON object as the raw body.

About this endpoint

What it does

Converts the supplied JSON content into a downloadable Prisma schema (.prisma) file. The request body can be sent either as a plain JSON object/array or in the wrapped { json, config } format, and query/body config options are used to control generation.

Query Parameter(s)

AttributeTypeDescription
outputStringOutput filename/base name. Default: sample-output.
providerStringPrisma provider. Allowed values: postgresql, mysql, sqlite, mongodb. Default: postgresql.
rootModelNameStringRoot model name. Example: User.

Request Body

ParameterTypeDescription
jsonObject / Object ArrayThe JSON data to convert. Must be a non-empty object or array.
configObjectInline generation options. Supports provider and rootModelName; values here override query parameters.
config.providerENUMPrisma provider. Allowed values: postgresql, mysql, sqlite, mongodb. Default: postgresql.
config.rootModelNameStringRoot model name. Example: User.

Response

Returns a downloadable Prisma schema file as a binary response. The response body is a single binary string representing the generated .prisma file.

ParameterTypeDescription
stringStringBinary file content for the generated Prisma schema (.prisma).
▣ ENDPOINT 05 / 09
POST
Convert raw JSON body → Prisma schema
https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-raw-prisma-raw

QUICKSTART

GUIDE

Quickstart

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

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).

{
  "meta": {
    "enumCount": 0,
    "fieldCount": 2,
    "modelCount": 1
  },
  "enums": [],
  "models": [],
  "schema": "model User {\n  id Int\n  name String\n}",
  "warnings": [],
  "confidence": 1
}
TRY ITLIVE · 50 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
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 generation options. The body must have exactly the keys json and (optionally) config, where json is an object or array: { "json": { "id": 1, "name": "Alice" }, "config": { "rootModelName": "User", "provider": "postgresql" } } Body config values are merged with query parameters; body config takes precedence.
body*
Any valid non-empty JSON object as the raw body.

About this endpoint

What it does

Converts the supplied JSON data into a Prisma schema and returns the generated result as a JSON object. The request can be sent either as a raw JSON body or as a wrapped body with json data plus optional config overrides.

Query Parameter(s)

AttributeTypeDescription
providerENUMDatabase provider used for schema generation. Allowed values: postgresql, mysql, sqlite, mongodb. Default: postgresql.
rootModelNameStringRoot model name used during generation.

Request Body

ParameterTypeDescription
idNumberRaw JSON data to convert when sending a plain object body. Any valid non-empty JSON object is accepted.
nameStringRaw JSON data to convert when sending a plain object body. Any valid non-empty JSON object is accepted.
jsonObjectJSON data to convert in wrapped format. Must be a non-empty object or array.
configObjectOptional inline generation options that override query parameters. Supported fields: provider, rootModelName.

Response

Returns a JSON object with meta as an object, enums as an array, models as an array, schema as a string, warnings as an array, and confidence as a number. The schema field contains the full Prisma schema text.

ParameterTypeDescription
metaObjectSummary metadata for the generated schema. Contains enumCount, fieldCount, and modelCount as integer fields.
enumsObject ArrayGenerated enums. Each item is an object.
modelsObject ArrayGenerated models. Each item is an object.
schemaStringThe full Prisma schema text.
warningsString ArrayGeneration warnings, if any.
confidenceNumberFloat confidence score for the generated output.
▣ ENDPOINT 06 / 09
POST
Convert raw JSON body → pre-signed S3 URL for .prisma file
https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-raw-prisma-url

QUICKSTART

GUIDE

Quickstart

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

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.

{
  "data": "https://s3.amazonaws.com/bucket/uuid_sample-output.prisma?..."
}
TRY ITLIVE · 50 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
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 generation options. The body must have exactly the keys json and (optionally) config, where json is an object or array: { "json": { "id": 1, "name": "Alice" }, "config": { "rootModelName": "User", "provider": "postgresql" } } Body config values are merged with query parameters; body config takes precedence.
body*
Any valid non-empty JSON object as the raw body.

About this endpoint

What it does

Converts the provided JSON payload into a Prisma schema and returns a pre-signed S3 URL for the generated .prisma file. You can send the JSON either directly as the raw request body or wrapped in a json field with optional inline generation settings.

Query Parameter(s)

AttributeTypeDescription
outputStringOutput name used when generating the .prisma file. Default: sample-output.
providerENUMDatabase provider for schema generation. Allowed values: postgresql, mysql, sqlite, mongodb. Default: postgresql.
rootModelNameStringRoot model name used during generation. Example: User.

Request Body

ParameterTypeDescription
jsonObject / String ArrayWrapped format only. The JSON data to convert. Must be a non-empty object or array.
configObjectWrapped format only. Optional inline generation options. Body config values are merged with query parameters and take precedence over them.
config.providerENUMWrapped format only. Database provider for schema generation. Allowed values: postgresql, mysql, sqlite, mongodb. Default: postgresql.
config.rootModelNameStringWrapped format only. Root model name used during generation. Example: User.

Response

Returns a JSON object with a data string field containing a pre-signed S3 URI for the generated .prisma file.

ParameterTypeDescription
dataStringPre-signed S3 URL to the converted file. Format: URI.
▣ ENDPOINT 07 / 09
POST
Convert uploaded JSON file → downloadable .prisma file
https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-file-prisma-file

QUICKSTART

GUIDE

Quickstart

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

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.

TRY ITLIVE · 50 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.
body*
JSON file to convert (MIME type must be application/json).

About this endpoint

What it does

Converts an uploaded JSON file into a downloadable Prisma schema file (.prisma). The request sends the source JSON file and optional query parameters to control the output name, target provider, and root model name.

Query Parameter(s)

AttributeTypeDescription
outputStringOutput name. Default: sample-output.
providerStringDatabase provider. Allowed values: postgresql, mysql, sqlite, mongodb. Default: postgresql.
rootModelNameStringRoot model name.

Request Body

ParameterTypeDescription
fileBinaryJSON file to convert. MIME type must be application/json.

Response

Returns a downloadable Prisma schema file (.prisma) as a binary response. The success response is a single binary payload with no JSON wrapper.

ParameterTypeDescription
fileStringDownloadable Prisma schema (.prisma) file.

Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.

▣ ENDPOINT 08 / 09
POST
Convert JSON at URL → downloadable .prisma file
https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-url-prisma-file

QUICKSTART

GUIDE

Quickstart

Generate a Prisma schema file from a public JSON URL.

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).

TRY ITLIVE · 50 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
Publicly accessible URL pointing to a JSON resource.

About this endpoint

What it does

Converts the JSON file available at the provided URL into a downloadable Prisma schema (.prisma) file. You send the source JSON URL in the request body and can control the output name and target provider through query parameters.

Query Parameter(s)

AttributeTypeDescription
outputStringOutput name for the generated file. Default: sample-output.
providerENUMTarget Prisma provider. Allowed values: postgresql, mysql, sqlite, mongodb. Default: postgresql.
rootModelNameStringRoot model name to use in the generated schema.

Request Body

ParameterTypeDescription
urlStringPublicly accessible URL pointing to a JSON resource. Must be a URI.

Response

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

ParameterTypeDescription
fileStringBinary file content for the generated Prisma schema (.prisma).
▣ ENDPOINT 09 / 09
POST
Convert JSON at URL → Prisma schema
https://api.eu.apyhub.com/apyhub/convert-json-to-prisma-schema/json-url-prisma-raw

QUICKSTART

GUIDE

Quickstart

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

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.

{
  "meta": {
    "enumCount": 0,
    "fieldCount": 0,
    "modelCount": 0
  },
  "enums": [],
  "models": [],
  "schema": "string",
  "warnings": [],
  "confidence": 0
}
TRY ITLIVE · 50 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
Publicly accessible URL pointing to a JSON resource.

About this endpoint

What it does

Converts the JSON document at the provided URL into a Prisma schema and returns the generated result as a JSON object. You can optionally choose the target provider and set a root model name for the generated schema.

Query Parameter(s)

AttributeTypeDescription
providerENUMTarget Prisma provider. Allowed values: postgresql, mysql, sqlite, mongodb. Default: postgresql.
rootModelNameStringRoot model name to use for generation.

Request Body

ParameterTypeDescription
urlStringPublicly accessible URL pointing to a JSON resource. Format: URI.

Response

Returns a JSON object with meta object, enums array, models array, schema string, warnings array, and confidence number fields. The schema field contains the full Prisma schema text.

ParameterTypeDescription
metaObjectSummary counts for the generated schema.
meta.enumCountIntegerNumber of enums in the generated output.
meta.fieldCountIntegerNumber of fields in the generated output.
meta.modelCountIntegerNumber of models in the generated output.
enumsObject ArrayGenerated enums.
modelsObject ArrayGenerated models.
schemaStringThe full Prisma schema text.
warningsString ArrayGeneration warnings, if any.
confidenceNumberConfidence score for the generated schema.
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.