Schema Generator

Schema Generator API

Development

Generate schemas in any programming language instantly. Convert data structures to TypeScript, Python, Java, and more with AI-powered analysis.

Authentication

Send your API key in the Authorization header as a Bearer token (Authorization: Bearer YOUR_API_KEY) or in the X-API-Key header.

Rate Limit

10 requests per minute

Endpoints

1 endpoint available

Overview

Send sample data (usually JSON) and a target language, and get back type definitions for it: a TypeScript interface, JSON Schema, Python class, Go struct and so on.

Notes

  • data is up to 20,000 characters. Send a representative sample, not a whole dataset.
  • language must be one of the listed values and defaults to typescript.
  • schema is code only, though the model sometimes wraps it in a markdown code fence.

This endpoint calls an AI model, so it uses the AI rate limit: 10 requests per minute and 200 requests per day per API key. Output is generated by a model and can be wrong, so review it before you use it.

Endpoints

POST
https://opentools.ca/api/v1/tools/schema-generator
Generate type definitions from sample data

Request Body

Content-Type: application/json

ParameterTypeRequiredDescription
data
string
Required
Sample data to describe, usually JSON. 1-20,000 characters.
language
string
Enum: typescript, json-schema, python, java, csharp, go, rust, kotlin, swift, php
OptionalTarget language for the schema.Default: typescript

Response Example

{
  "success": true,
  "language": "typescript",
  "schema": "interface User {\n  id: number;\n  name: string;\n  email: string;\n  tags: string[];\n}"
}

Error Codes

400
Invalid JSON or a field failed validation (missing, empty, too long, or not an allowed value). details lists each problem.
401
Missing or invalid API key
403
API key is inactive or expired, or the request IP is not allowed for this key
429
Rate limit exceeded (10 per minute or 200 per day per key)
500
Internal server error, including a failed AI model call

Code Examples

curl -X POST https://opentools.ca/api/v1/tools/schema-generator \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "data": "{\"id\": 1, \"name\": \"Ada\", \"email\": \"ada@example.com\", \"tags\": [\"admin\"]}",
    "language": "typescript"
  }'

Ready to get started?

Create an API key to start using the Schema Generator API.

Rather use it in your browser? Open the Schema Generator