Generator Utilities

Generate Token

Generates cryptographically secure random tokens for API keys, session IDs, or secrets. Access via MCP in Cursor/Windsurf or GET /v1/generate/token. Returns base64-encoded tokens with customizable length. Uses secure randomness sources, making it perfect for authentication systems where Claude or other AI agents need to create proper tokens instead of guessing formats.

API Endpoint

GET /v1/generate/token

Code Examples

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

response = requests.get('https://tinyfn.io/v1/generate/token',
    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 generator tools:

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

Learn more about MCP setup →

FAQ

How do I generate a secure API token with this tool?

Call GET /v1/generate/token with optional length parameter. Returns cryptographically secure base64-encoded token suitable for API authentication.

What's the difference between this and Math.random() for tokens?

This uses cryptographically secure randomness while Math.random() is predictable. Always use secure generators for authentication tokens, passwords, or secrets.

Can I customize the token length and format?

Yes, specify byte length via parameters. Output is base64-encoded by default, providing URL-safe characters suitable for most authentication systems.

How do MCP agents use this for authentication workflows?

AI agents in Cursor or Claude Code can generate proper tokens for API integrations, avoiding hardcoded or weak credentials in generated code.

Is this suitable for production password reset tokens?

Yes, the cryptographic security meets production standards. Ensure appropriate token expiration and single-use policies in your application logic.

Try Generate Token Now

Get your free API key and start using Generate Token in seconds.

Get Free API Key