Schema Sniff
Auto-detect schema of JSON, XML, or CSV payloads. Returns JSON Schema draft-07.
/api/schema
Data Processing
Why Schema Sniff?
Stop manually writing JSON schemas. Send any payload—JSON, XML, or CSV—and get a complete JSON Schema draft-07 definition back. Perfect for API documentation, data validation setup, and integrating with legacy systems that lack schema definitions.
What It Does
Schema Sniff analyzes your data payload and automatically generates a complete JSON Schema draft-07 definition. It intelligently detects data types, identifies nested structures, and handles polymorphic fields with ease.
Whether you're working with simple flat objects or deeply nested hierarchies, Schema Sniff examines your data structure and produces a schema that accurately represents the shape of your data. It supports automatic format detection for timestamps, emails, URLs, and UUIDs.
Key Features
- Multi-format support — Accepts JSON, XML, and CSV inputs
- Nested structure handling — Recursively analyzes objects and arrays
- Polymorphic detection — Handles fields with varying types across records
- Format inference — Auto-detects date, email, URL, and UUID patterns
- JSON Schema draft-07 — Industry-standard schema format
Code Examples
curl -X POST https://api.atomicapis.dev/api/schema \
-H "X-RapidAPI-Proxy-Secret: YOUR_SECRET" \
-H "Content-Type: application/json" \
-d '{
"payload": "{\"name\":\"John\",\"age\":30}",
"format": "json"
}'
const response = await fetch('https://api.atomicapis.dev/api/schema', {
method: 'POST',
headers: {
'X-RapidAPI-Proxy-Secret': 'YOUR_SECRET',
'Content-Type': 'application/json'
},
body: JSON.stringify({
payload: '{"name":"John","age":30}',
format: 'json'
})
});
const schema = await response.json();
console.log(schema);
import requests
response = requests.post(
'https://api.atomicapis.dev/api/schema',
headers={
'X-RapidAPI-Proxy-Secret': 'YOUR_SECRET',
'Content-Type': 'application/json'
},
json={
'payload': '{"name":"John","age":30}',
'format': 'json'
}
)
schema = response.json()
print(schema)
using System.Net.Http.Json;
var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-RapidAPI-Proxy-Secret", "YOUR_SECRET");
var request = new
{
payload = "{\"name\":\"John\",\"age\":30}",
format = "json"
};
var response = await client.PostAsJsonAsync(
"https://api.atomicapis.dev/api/schema",
request
);
var schema = await response.Content.ReadFromJsonAsync<JsonElement>();
Console.WriteLine(schema);
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
payload
Required
|
string | Yes | The data payload to analyze as a string (JSON, XML, or CSV content). |
format
Optional
|
string | No | The format of the input data. Options: "json", "xml", "csv", "auto" (default: "auto") |
Pro Tip: When using format: "auto", the API automatically detects the input format based on content analysis. For best results with XML or CSV, explicitly specify the format.
Response Format
The API returns a JSON object containing the detected format, a field count, and a JSON Schema draft-07 definition describing the structure of your input data:
{
"detectedFormat": "json",
"fieldCount": 2,
"schema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"name": {
"type": "string"
},
"age": {
"type": "integer"
}
},
"required": ["name", "age"]
}
}
Use Cases
API Documentation Generation
Automatically generate JSON schemas for your API request/response models. Perfect for OpenAPI/Swagger documentation that stays in sync with your actual data structures.
Data Validation Setup
Quickly bootstrap validation schemas for form inputs, API payloads, or database records. Use the generated schema with libraries like Ajv, Joi, or Yup.
Legacy System Integration
Extract and document schemas from legacy systems that lack proper API documentation. Convert XML or CSV exports into modern JSON Schema definitions.
Build Constraints
Nested Structure Handling
Recursively processes deeply nested objects and arrays. Supports unlimited nesting depth for both JSON and XML inputs.
Polymorphic Structures
Handles fields with varying types across array elements. Merges object schemas by computing the union of properties, and resolves mixed primitive types by selecting the most common type.
AOT-Safe Implementation
Uses JsonValue.Create() for dynamic JSON manipulation, ensuring compatibility with Ahead-of-Time (AOT) compilation in .NET.
Performance Limits
Maximum payload size: 2MB. Schema generation completes in under 100ms for typical payloads.
Error Codes
| Code | Status | Description | Resolution |
|---|---|---|---|
INVALID_FORMAT |
400 | The specified format doesn't match the data structure | Verify format parameter or use "auto" |
PAYLOAD_TOO_LARGE |
400 | Data payload exceeds 2MB limit | Reduce payload size or split into chunks |
PARSE_ERROR |
400 | Unable to parse the input data | Check data format and encoding |
RATE_LIMITED |
429 | Too many requests | Wait before retrying or upgrade plan |
Related APIs
MCP Integration MCP Ready
What is MCP?
Model Context Protocol (MCP) allows AI assistants like Claude to call this API as a native tool during conversation. Instead of writing HTTP requests, the AI invokes the tool directly — no API keys or boilerplate needed on the client side.
Tool Details
SchemaSniffTools
InferSchema()
Description
Auto-detects and infers schema from a JSON payload