BYTETOOLS

Swagger Validator API

Free Swagger/OpenAPI validator API with no key: check any OpenAPI or Swagger specification for schema errors by URL. Returns structured messages. Tested.

No API key requiredCORS enabledHTTPSFree tier

Endpoint tested and returned HTTP 200 on 2026-08-20

What is the Swagger Validator API?

The Swagger Validator API is a free, key-free service that validates an OpenAPI or Swagger specification against the official schema, returning structured error messages for any problems found.

An invalid OpenAPI specification breaks code generation, documentation rendering and client SDKs, often with confusing downstream errors. Validating the spec directly gives you a clear answer about where the problem actually is.

The success case is quietly counterintuitive: a valid specification returns `{"schemaValidationMessages": []}` — an empty array rather than any explicit confirmation. Code that checks for a success flag will find nothing; check the array length instead.

Quick facts

Base URL
https://validator.swagger.io/validator
Authentication
No API key required.
Rate limit
No published limit; intended for interactive and CI use.
Pricing
Free, provided by SmartBear.
CORS
Enabled — callable directly from browser JavaScript
Official docs
Read the docs

How to use the Swagger Validator API

Every request below was executed against the live API on 2026-08-20, and the response shown is the real body it returned — not an illustration.

1. Validate an OpenAPI specification

GET https://validator.swagger.io/validator/debug?url=https%3A%2F%2Fpetstore.swagger.io%2Fv2%2Fswagger.json

curl
curl 'https://validator.swagger.io/validator/debug?url=https%3A%2F%2Fpetstore.swagger.io%2Fv2%2Fswagger.json'
JavaScript (fetch)
const res = await fetch("https://validator.swagger.io/validator/debug?url=https%3A%2F%2Fpetstore.swagger.io%2Fv2%2Fswagger.json");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);
Python (requests)
import requests

res = requests.get("https://validator.swagger.io/validator/debug?url=https%3A%2F%2Fpetstore.swagger.io%2Fv2%2Fswagger.json", timeout=20)
res.raise_for_status()
print(res.json())
Response — HTTP 200
{
  "schemaValidationMessages": []
}

Parameters

ParameterTypeRequiredDescription
debug?url=stringOptionalValidate a spec at a public URL, returning JSON messages. url=https%3A%2F%2Fpetstore.swagger.io%2Fv2%2Fswagger.json
?url=stringOptionalReturns a validity badge image instead of JSON. url=...
(POST body)bodyOptionalPOST the spec directly when it is not publicly hosted. {...}

Response fields

schemaValidationMessagesarray
Validation problems. An EMPTY array means the spec is valid.
...levelstring
error or warning.
...messagestring
What is wrong.
...schemaPath / instancePathstring
Where in the specification the problem occurs.

What you can build with the Swagger Validator API

  • Gate CI on OpenAPI specification validity
  • Debug why code generation from a spec is failing
  • Add a validity badge to API documentation
  • Check a third-party spec before building a client against it

Common errors and how to fix them

Empty response means success

A valid spec returns an empty messages array.

Fix: Check schemaValidationMessages.length === 0 rather than looking for a success flag.

Cannot validate a private spec by URL

The validator must be able to fetch it.

Fix: POST the specification body directly instead of passing a URL.

Warnings treated as failures

Some messages are level: warning.

Fix: Filter on level === 'error' if warnings should not fail your build.

Swagger Validator API — frequently asked questions

Is the Swagger validator API free?

Yes, free with no API key, provided by SmartBear.

How do I know if my spec is valid?

A valid specification returns an empty schemaValidationMessages array. There is no explicit success flag, so check the array length.

Can I validate a spec that isn't publicly accessible?

Yes, POST the specification body directly rather than passing a URL — the validator cannot fetch private endpoints.

Does it validate both Swagger 2.0 and OpenAPI 3?

Yes, it detects the version from the specification and validates against the appropriate schema.

Tools that pair with this API

Swagger Validator is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-20; always check the official documentation before relying on this API in production, as terms and limits can change.