apyhub
DEVELOPER TOOLS · SMART GENERATION

Convert JSON to Zod Schema API

What it does

JSON to Zod Schema converts JSON input into a Zod schema you can use in TypeScript projects. Send a raw JSON body, an uploaded JSON file, or a public JSON URL, and get back generated Zod code as either a downloadable .ts file, a pre-signed S3 URL, or a raw explain payload.

Use the mode query parameter to choose annotated, clean, or explain output. The strict option controls whether the generator applies strict schema behavior. For file-based and URL-based flows, you can also set output when the endpoint returns a downloadable file or S3 link.

The service accepts only non-empty JSON objects. URL-based endpoints require a publicly accessible resource that serves JSON or a .json file path, and file-based endpoints require an uploaded JSON file. The raw-body endpoint accepts application/json and also parses text/plain when it contains JSON.

Use JSON to Zod Schema when you need to bootstrap validation from sample payloads, document an API response shape, or turn an existing config object into reusable runtime validation.

▣ ENDPOINT 01 / 09
POST
Convert JSON from URL to Zod schema (downloadable file)
https://api.eu.apyverse.com/apyhub/json-to-zod-schema/json-url-zod-file

QUICKSTART

GUIDE

Quickstart

Convert a JSON URL into a downloadable Zod schema file by sending the source URL in the request body.

curl -X POST "https://api.eu.apyverse.com/apyhub/json-to-zod-schema/json-url-zod-file?mode=annotated&output=sample-output&strict=false" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/data.json"}'

What you'll get back

Returns a binary file download: a Zod schema .ts file by default, or a JSON explain payload when mode=explain.

(binary file)
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. The URL must return a content-type of application/json, text/plain, application/octet-stream, or binary/octet-stream, or the Content-Disposition / URL path must include ".json". The JSON content must be a non-empty object.

About this endpoint

What it does

Converts the JSON document retrieved from a public URL into a Zod schema file. The response is a downloadable binary file, with the file contents depending on the selected mode.

Query Parameter(s)

AttributeTypeMandatoryDescription
modeENUMNoConversion output mode.<br>Allowed values: annotated, clean, explain.<br>Default: annotated.
outputStringNoOutput name for the generated schema.<br>Default: sample-output.<br>Example: my-schema.
strictENUMNoStrictness flag as a string.<br>Allowed values: true, false.<br>Default: false.

Request Body

ParameterTypeMandatoryDescription
urlStringYesPublicly accessible URL pointing to a JSON resource.<br>The URL must return application/json, text/plain, application/octet-stream, or binary/octet-stream, or the Content-Disposition / URL path must include .json.<br>The JSON content must be a non-empty object.

Response

Returns a binary file download. The output schema declares a top-level string with binary format: a downloadable Zod schema .ts file, or a JSON explain payload .json when mode=explain.

ParameterTypeMandatoryDescription
binary contentStringYesDownloadable response body.<br>File type: Zod schema .ts file, or .json explain payload when mode=explain.

Query parameters

Name
Type
Description
modeOPTIONAL
string
annotated · clean · explain
DEFAULT annotated
outputOPTIONAL
string
DEFAULT sample-output
strictOPTIONAL
string
true · false
DEFAULT false

Body

Name
Type
Description
bodyREQUIRED
object
▣ ENDPOINT 02 / 09
POST
Convert JSON from URL to Zod schema (S3 signed URL)
https://api.eu.apyverse.com/apyhub/json-to-zod-schema/json-url-zod-url

QUICKSTART

GUIDE

Quickstart

Send the URL of a public JSON resource to generate a Zod schema.

curl -X POST "https://api.eu.apyverse.com/apyhub/json-to-zod-schema/json-url-zod-url" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/data.json"
  }'

What you'll get back

Returns a JSON object with a data string field — a pre-signed S3 URL for downloading the generated schema file.

{
  "data": "https://s3.amazonaws.com/..."
}
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. The URL must return a content-type of application/json, text/plain, application/octet-stream, or binary/octet-stream, or the Content-Disposition / URL path must include ".json". The JSON content must be a non-empty object.

About this endpoint

What it does

Converts JSON fetched from the URL you provide into a Zod schema and returns a pre-signed S3 download URL for the generated file. The output file is a .ts schema file by default, or a .json file when mode is explain.

Query Parameter(s)

AttributeTypeMandatoryDescription
modeENUMNoConversion output style.<br>Allowed values: annotated, clean, explain.<br>Default: annotated.
outputStringNoOutput name for the generated schema.<br>Default: sample-output.<br>Example: my-schema.
strictENUMNoStrictness flag for the conversion.<br>Allowed values: true, false.<br>Default: false.

Request Body

ParameterTypeMandatoryDescription
urlStringYesPublicly accessible URL pointing to a JSON resource. The URL must return a content-type of application/json, text/plain, application/octet-stream, or binary/octet-stream, or the Content-Disposition / URL path must include .json.<br>The JSON content must be a non-empty object.

Response

Returns a JSON object with a data string field containing a pre-signed S3 URL for downloading the generated file. The URL points to the converted schema file as .ts output, or .json output when mode is explain.

ParameterTypeMandatoryDescription
dataStringYesPre-signed S3 URL to the converted file.<br>S3 pre-signed URL for downloading the generated .ts schema file (or .json file when mode is explain).

Query parameters

Name
Type
Description
modeOPTIONAL
string
annotated · clean · explain
DEFAULT annotated
outputOPTIONAL
string
DEFAULT sample-output
strictOPTIONAL
string
true · false
DEFAULT false

Body

Name
Type
Description
bodyREQUIRED
object
▣ ENDPOINT 03 / 09
POST
Convert uploaded JSON file to Zod schema (downloadable file)
https://api.eu.apyverse.com/apyhub/json-to-zod-schema/json-file-zod-file

QUICKSTART

GUIDE

Quickstart

Upload a JSON file to generate a Zod schema file.

curl -X POST "https://api.eu.apyverse.com/apyhub/json-to-zod-schema/json-file-zod-file" \
  -H "apy-token: $APY_TOKEN" \
  -F "file=@/path/to/input.json"

What you'll get back

Returns a downloadable file as a binary response: a .ts Zod schema file by default, or a .json explain payload when mode=explain.

(binary file)
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. The uploaded file must have mimetype application/json and must contain a non-empty JSON object.

About this endpoint

What it does

Converts an uploaded JSON file into a downloadable Zod schema file. The response is a binary file: a .ts Zod schema by default, or a .json explain payload when mode=explain.

Query Parameter(s)

AttributeTypeMandatoryDescription
modeENUMNoAllowed values: annotated, clean, explain.<br>Default: annotated.
outputStringNoDefault: sample-output.<br>Example: my-schema.
strictENUMNoAllowed values: true, false.<br>Default: false.

Request Body

ParameterTypeMandatoryDescription
fileStringYesJSON file to convert. The uploaded file must have mimetype application/json and must contain a non-empty JSON object.

Response

Returns a downloadable binary file. The output is a string with binary format: a Zod schema .ts file by default, or a .json explain payload when mode=explain.

ParameterTypeMandatoryDescription
valueStringYesDownloadable Zod schema (.ts) file, or a JSON explain payload (.json) when mode=explain.

Notes

The mode query parameter changes the file type of the successful response: annotated and clean return a Zod schema file, while explain returns a JSON payload.

Query parameters

Name
Type
Description
modeOPTIONAL
string
annotated · clean · explain
DEFAULT annotated
outputOPTIONAL
string
DEFAULT sample-output
strictOPTIONAL
string
true · false
DEFAULT false

Body

Name
Type
Description
bodyREQUIRED
object

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 uploaded JSON file to Zod schema (S3 signed URL)
https://api.eu.apyverse.com/apyhub/json-to-zod-schema/json-file-zod-url

QUICKSTART

GUIDE

Quickstart

Upload a JSON file to convert it into a Zod schema, then download the generated file from the returned URL.

curl -X POST "https://api.eu.apyverse.com/apyhub/json-to-zod-schema/json-file-zod-url?mode=annotated&output=my-schema&strict=false" \
  -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 for the converted file.

{
  "data": "https://s3.amazonaws.com/..."
}
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. The uploaded file must have mimetype application/json and must contain a non-empty JSON object.

About this endpoint

What it does

Converts an uploaded JSON file into a Zod schema and returns a pre-signed S3 URL where the generated file can be downloaded. The request accepts one JSON file upload and optional query parameters that control the output mode, file name, and strictness.

Query Parameter(s)

AttributeTypeMandatoryDescription
modeStringNoOutput mode. Allowed values: annotated, clean, explain. Default: annotated.
outputStringNoOutput name. Default: sample-output.
strictStringNoStrictness flag. Allowed values: true, false. Default: false.

Request Body

ParameterTypeMandatoryDescription
fileStringYesJSON file to convert. Must be uploaded as binary data, have mimetype application/json, and contain a non-empty JSON object.

Response

Returns a JSON object with a data string field containing a URI to a pre-signed S3 URL for downloading the generated file. The file is a .ts schema file by default, or a .json file when mode is explain.

ParameterTypeMandatoryDescription
dataStringYesPre-signed S3 URL to the converted file.

Query parameters

Name
Type
Description
modeOPTIONAL
string
annotated · clean · explain
DEFAULT annotated
outputOPTIONAL
string
DEFAULT sample-output
strictOPTIONAL
string
true · false
DEFAULT false

Body

Name
Type
Description
bodyREQUIRED
object

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

▣ ENDPOINT 05 / 09
POST
Convert JSON from URL to Zod schema (raw text or explain JSON)
https://api.eu.apyverse.com/apyhub/json-to-zod-schema/json-url-zod-raw

QUICKSTART

GUIDE

Quickstart

Generate a Zod schema from a JSON URL by sending the source URL in the request body.

curl -X POST "https://api.eu.apyverse.com/apyhub/json-to-zod-schema/json-url-zod-raw?mode=annotated&strict=false" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/data.json"}'

What you'll get back

Returns a JSON object with optional top-level fields: meta (an object), schema (a string), and assumptions (an array of strings).

  • meta.mode is the requested mode, and meta.strict is a boolean indicating whether strict mode was applied.
  • schema contains the generated Zod schema as a string.
  • assumptions lists human-readable assumptions used during generation.
{
  "meta": {
    "mode": "annotated",
    "strict": false
  },
  "schema": "z.object({ ... })",
  "assumptions": ["..."]
}
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. The URL must return a content-type of application/json, text/plain, application/octet-stream, or binary/octet-stream, or the Content-Disposition / URL path must include ".json". The JSON content must be a non-empty object.

About this endpoint

What it does

Converts the JSON content fetched from a public URL into a Zod schema. The request sends the URL to inspect, and the response returns the generated schema text, along with metadata and assumptions when mode=explain.

Request Body

ParameterTypeMandatoryDescription
urlStringYesPublicly accessible URL pointing to a JSON resource. The URL must return a content-type of application/json, text/plain, application/octet-stream, or binary/octet-stream, or the Content-Disposition / URL path must include .json. The JSON content must be a non-empty object.

Query Parameter(s)

AttributeTypeMandatoryDescription
modeENUMNoControls the output format. Allowed values: annotated, clean, explain. Default: annotated.
strictENUMNoControls whether strict mode is applied. Allowed values: true, false. Default: false.

Response

Returns a JSON object with optional meta, schema, and assumptions fields. The documented output schema corresponds to the mode=explain response shape; meta is an object, schema is a string containing the generated Zod schema, and assumptions is an array of strings.

ParameterTypeMandatoryDescription
metaObjectNoMetadata about the request options. Contains mode and strict when present.
meta.modeENUMNoMode used for generation. Allowed values: annotated, clean, explain.
meta.strictBooleanNoWhether strict mode was applied.
schemaStringNoThe generated Zod schema as a string, without annotations.
assumptionsString ArrayNoHuman-readable list of assumptions applied during schema generation.

Query parameters

Name
Type
Description
modeOPTIONAL
string
annotated · clean · explain
DEFAULT annotated
strictOPTIONAL
string
true · false
DEFAULT false

Body

Name
Type
Description
bodyREQUIRED
object
▣ ENDPOINT 06 / 09
POST
Convert uploaded JSON file to Zod schema (raw text or explain JSON)
https://api.eu.apyverse.com/apyhub/json-to-zod-schema/json-file-zod-raw

QUICKSTART

GUIDE

Quickstart

Upload a JSON file to generate a Zod schema in the default annotated mode.

curl -X POST "https://api.eu.apyverse.com/apyhub/json-to-zod-schema/json-file-zod-raw?mode=annotated&strict=false" \
  -H "apy-token: $APY_TOKEN" \
  -F "file=@/path/to/input.json"

What you'll get back

Returns a JSON object with optional top-level meta, schema, and assumptions fields.

  • meta is an object with mode and strict, describing the request options used.
  • schema is a string containing the generated Zod schema.
  • assumptions is an array of strings listing any assumptions made during generation.
{
  "meta": {
    "mode": "annotated",
    "strict": false
  },
  "schema": "z.object({ ... })",
  "assumptions": ["..."]
}
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. The uploaded file must have mimetype application/json and must contain a non-empty JSON object.

About this endpoint

What it does

Converts an uploaded JSON file into a Zod schema. The request sends a JSON file plus optional generation options, and the response returns the generated schema and related metadata when mode=explain.

Query Parameter(s)

AttributeTypeMandatoryDescription
modeENUMNoGeneration mode.<br>Allowed values: annotated, clean, explain.<br>Default: annotated.
strictENUMNoWhether strict mode is applied.<br>Allowed values: true, false.<br>Default: false.

Request Body

ParameterTypeMandatoryDescription
fileStringYesJSON file to convert. The uploaded file must use mimetype application/json and must contain a non-empty JSON object.

Response

Returns a JSON object with meta, schema, and assumptions top-level fields. meta is an object containing the selected mode and a boolean strict flag, schema is the generated Zod schema as a string, and assumptions is an array of strings listing assumptions made during generation. The schema description indicates this response is returned when mode=explain.

ParameterTypeMandatoryDescription
metaObjectNoMetadata about the request options.<br>mode: annotated, clean, or explain.<br>strict: boolean indicating whether strict mode was applied.
schemaStringNoThe generated Zod schema as a string, without annotations.
assumptionsString ArrayNoHuman-readable list of assumptions applied during schema generation.

Query parameters

Name
Type
Description
modeOPTIONAL
string
annotated · clean · explain
DEFAULT annotated
strictOPTIONAL
string
true · false
DEFAULT false

Body

Name
Type
Description
bodyREQUIRED
object

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

▣ ENDPOINT 07 / 09
POST
Convert raw JSON body to Zod schema (raw text or explain JSON)
https://api.eu.apyverse.com/apyhub/json-to-zod-schema/json-raw-zod-raw

QUICKSTART

GUIDE

Quickstart

Send a JSON object to generate a Zod schema string from it.

curl -X POST "https://api.eu.apyverse.com/apyhub/json-to-zod-schema/json-raw-zod-raw" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"Ada Lovelace","age":36}'

What you'll get back

Returns a JSON object with optional meta, schema, and assumptions fields. meta is an object containing the request mode and whether strict mode was applied, schema is the generated Zod schema as a string, and assumptions is an array of strings describing any assumptions made during generation.

{
  "meta": {
    "mode": "annotated",
    "strict": false
  },
  "schema": "z.object({...})",
  "assumptions": [
    "..."
  ]
}
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*
Any non-empty JSON object sent as the request body with Content-Type application/json (or text/plain, which is also accepted and parsed). The body must not be empty.

About this endpoint

What it does

Converts a non-empty JSON request body into a Zod schema representation. The endpoint accepts the body as application/json or text/plain, and the response shape varies by the mode query parameter.

Query Parameter(s)

AttributeTypeMandatoryDescription
modeENUMNoAllowed values: annotated, clean, explain.<br>Default: annotated.
strictENUMNoAllowed values: true, false.<br>Default: false.

Request Body

ParameterTypeMandatoryDescription
bodyObjectYesAny non-empty JSON object sent as the request body. The body must not be empty. Additional properties are allowed.

Response

Returns a JSON object. When mode=explain, the object can include meta (Object), schema (String), and assumptions (String Array) fields.

ParameterTypeMandatoryDescription
metaObjectNoMetadata about the request options. Contains mode (annotated, clean, or explain) and strict (Boolean).
schemaStringNoThe generated Zod schema as a string, without annotations.
assumptionsString ArrayNoHuman-readable list of assumptions applied during schema generation.

Query parameters

Name
Type
Description
modeOPTIONAL
string
annotated · clean · explain
DEFAULT annotated
strictOPTIONAL
string
true · false
DEFAULT false

Body

Name
Type
Description
bodyREQUIRED
object
Any non-empty JSON object sent as the request body with Content-Type application/json (or text/plain, which is also accepted and parsed). The body must not be empty.
▣ ENDPOINT 08 / 09
POST
Convert raw JSON body to Zod schema (downloadable file)
https://api.eu.apyverse.com/apyhub/json-to-zod-schema/json-raw-zod-file

QUICKSTART

GUIDE

Quickstart

Send a JSON body to generate a downloadable Zod schema file from it.

curl -X POST "https://api.eu.apyverse.com/apyhub/json-to-zod-schema/json-raw-zod-file?output=sample-output&strict=false" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"Acme Inc","employees":42}'

What you'll get back

Returns a binary file response: a downloadable Zod schema .ts file by default, or a JSON explain payload when mode=explain.

(binary file)
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*
Any non-empty JSON object sent as the request body with Content-Type application/json (or text/plain, which is also accepted and parsed). The body must not be empty.

About this endpoint

What it does

Converts a raw JSON request body into a Zod schema and returns it as a downloadable file. The request body must be a non-empty JSON object, and the response is a binary file; when mode=explain, the output is a JSON explain payload instead.

Query Parameter(s)

AttributeTypeMandatoryDescription
modeENUMNoAllowed values: annotated, clean, explain.<br>Default: annotated.
outputStringNoOutput name. Default: sample-output. Example: my-schema.
strictENUMNoAllowed values: true, false.<br>Default: false.

Request Body

ParameterTypeMandatoryDescription
bodyObjectYesAny non-empty JSON object sent as the request body with Content-Type: application/json (or text/plain, which is also accepted and parsed). The body must not be empty. Additional properties are allowed.

Response

Returns a binary response: a downloadable Zod schema .ts file, or a JSON explain payload .json when mode=explain.

ParameterTypeMandatoryDescription
responseStringYesBinary file content in the response body. The exact payload depends on mode: .ts schema file by default, or .json explain output when mode=explain.

Query parameters

Name
Type
Description
modeOPTIONAL
string
annotated · clean · explain
DEFAULT annotated
outputOPTIONAL
string
DEFAULT sample-output
strictOPTIONAL
string
true · false
DEFAULT false

Body

Name
Type
Description
bodyREQUIRED
object
Any non-empty JSON object sent as the request body with Content-Type application/json (or text/plain, which is also accepted and parsed). The body must not be empty.
▣ ENDPOINT 09 / 09
POST
Convert raw JSON body to Zod schema (S3 signed URL)
https://api.eu.apyverse.com/apyhub/json-to-zod-schema/json-raw-zod-url

QUICKSTART

GUIDE

Quickstart

Convert a JSON payload into a Zod schema by sending the raw JSON in the request body.

curl -X POST "https://api.eu.apyverse.com/apyhub/json-to-zod-schema/json-raw-zod-url?mode=annotated&output=sample-output&strict=false" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"Acme Inc","employees":42,"active":true}'

What you'll get back

Returns a JSON object with a data string field containing a pre-signed S3 URL to download the generated schema file.

{
  "data": "https://s3.amazonaws.com/..."
}
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*
Any non-empty JSON object sent as the request body with Content-Type application/json (or text/plain, which is also accepted and parsed). The body must not be empty.

About this endpoint

What it does

Converts the raw JSON request body into a Zod schema file and returns a pre-signed S3 download URL for the generated output. The response contains the URL in a data string field; the file format depends on the selected mode.

Query Parameter(s)

AttributeTypeMandatoryDescription
modeStringNoOutput mode. Allowed values: annotated, clean, explain. Default: annotated.
outputStringNoOutput name. Default: sample-output.
strictStringNoStrictness flag. Allowed values: true, false. Default: false.

Request Body

ParameterTypeMandatoryDescription
bodyObjectYesAny non-empty JSON object. The body must not be empty. Content-Type application/json is accepted, and text/plain is also accepted and parsed. Additional properties are allowed.

Response

Returns a JSON object with a data string field containing a URI. This is a pre-signed S3 URL for downloading the generated file — a .ts schema file in normal modes, or a .json file when mode is explain.

ParameterTypeMandatoryDescription
dataStringYesPre-signed S3 URL to the converted file. The value is a URI.

Query parameters

Name
Type
Description
modeOPTIONAL
string
annotated · clean · explain
DEFAULT annotated
outputOPTIONAL
string
DEFAULT sample-output
strictOPTIONAL
string
true · false
DEFAULT false

Body

Name
Type
Description
bodyREQUIRED
object
Any non-empty JSON object sent as the request body with Content-Type application/json (or text/plain, which is also accepted and parsed). The body must not be empty.
▣ 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.