Validate
Standard · 1 creditCheck whether a string is valid for a given format — from cron expressions to JSON Schema to semver.
POST /api/validate
Section titled “POST /api/validate”Request
Section titled “Request”| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | json, yaml, toml, cron, json_schema, regex, semver, email, url |
input | string | Yes | The string to validate |
options | object | No | Type-specific options |
Response
Section titled “Response”| Field | Type | Description |
|---|---|---|
valid | boolean | Whether the input passed validation |
description | string | Human-readable explanation |
errors | array | Validation errors — each has message, and optionally line, column, path |
details | object | Type-specific extra info |
Examples
Section titled “Examples”Cron expression
Section titled “Cron expression”curl -X POST https://morso.dev/api/validate \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"type": "cron", "input": "*/5 * * * *"}'{ "valid": true, "description": "Every 5 minutes", "errors": []}Invalid YAML
Section titled “Invalid YAML”curl -X POST https://morso.dev/api/validate \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"type": "yaml", "input": "key: value\n bad indent"}'{ "valid": false, "description": "Invalid YAML", "errors": [ { "message": "mapping values are not allowed in this context", "line": 2, "column": 6 } ]}Semver
Section titled “Semver”curl -X POST https://morso.dev/api/validate \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"type": "semver", "input": "1.2.3-beta.1"}'{ "valid": true, "description": "Valid semantic version", "errors": []}Invalid email
Section titled “Invalid email”curl -X POST https://morso.dev/api/validate \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"type": "email", "input": "not-an-email@"}'{ "valid": false, "description": "Invalid email address", "errors": [ { "message": "missing domain after @" } ]}