Skip to content
Browse this section

API

Work with the API

Discover Mossy's API through its generated OpenAPI specification.

Mossy’s API is available under /api/v1 in server deployments (Node and Cloudflare). Static deployments do not expose an API.

The URL version changes only for breaking API contract changes, independently of Mossy releases. New tools and backward-compatible additions remain under v1. There is no unversioned API alias; use /api/v1 explicitly.

OpenAPI specification

Download the OpenAPI 3.1 specification, or fetch it from your own deployment:

curl https://mossy.tools/api/v1/openapi.json

The specification is generated from the same route definitions and Valibot schemas used by the API. It includes query and path parameters, request formats, response formats, and framework errors. Its relative server URL (/api/v1) works with your own hostname when self-hosting.

For example, generate a token with:

curl 'https://mossy.tools/api/v1/token-generator/token?length=32'

Query values are strings on the wire. Boolean parameters accept only lowercase true or false; empty values, other spellings, and 1/0 return 400 for these parameters. Omit an optional parameter to use its default. The specification describes defaults and additional validation restrictions.

Malformed or invalid requests return 400; missing or unsupported content types on routes accepting a body return 415; unexpected server errors return 500. These errors are JSON, regardless of a tool’s response formats. Unmatched paths or methods return 404 with { "error": "Not found" }.