URL/Slug Utilities

Is Valid Slug

Validates URL slugs against standard web conventions — lowercase letters, numbers, hyphens only, no leading/trailing hyphens. Use via MCP in Cursor or Windsurf for content validation, or call GET /v1/slug/is-valid-slug with your string. Returns boolean true/false with detailed validation info. Perfect for CMS systems and SEO-friendly URL generation.

API Endpoint

GET /v1/slug/is-valid-slug

Code Examples

curl "https://tinyfn.io/v1/slug/is-valid-slug" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/slug/is-valid-slug', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/slug/is-valid-slug',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's url/slug tools:

{
  "mcpServers": {
    "tinyfn-slug": {
      "url": "https://tinyfn.io/mcp/slug",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

What makes a valid URL slug?

Valid slugs contain only lowercase letters, numbers, and hyphens. They cannot start or end with hyphens, have consecutive hyphens, or include spaces, uppercase letters, or special characters.

How do I validate slugs in my MCP-enabled editor?

Call the is-valid-slug tool from Cursor, Windsurf, or other MCP clients. Pass your string and get instant validation with specific error details if invalid.

Does this tool fix invalid slugs or just check them?

It only validates — returns true/false with error details. Use TinyFn's create-slug tool to generate valid slugs from arbitrary strings.

What's the difference between slug validation and URL validation?

Slug validation checks URL path segments (like 'my-blog-post'), while URL validation checks complete URLs with protocols, domains, and parameters.

Can I validate empty strings or very long slugs?

Empty strings return false. Very long slugs may be valid by format but could hit web server limits — check your specific platform's requirements.

Try Is Valid Slug Now

Get your free API key and start using Is Valid Slug in seconds.

Get Free API Key