# dev.yk.gy

> dev.yk.gy is a free URL shortener. Give it a long http(s) URL and it returns a 7-character short URL (https://dev.yk.gy/AbC1234) that redirects with HTTP 302. No account or API key is needed.

To shorten a URL for a user, make ONE HTTP GET request and read the JSON response:

    GET https://dev.yk.gy/api/shorten?url=<percent-encoded URL>

Example: https://dev.yk.gy/api/shorten?url=https%3A%2F%2Fexample.com%2Fsome%2Flong%2Fpage

Response (JSON): {"code":"AbC1234","short_url":"https://dev.yk.gy/AbC1234","url":"https://example.com/some/long/page","created":true}

Give the user the value of "short_url". Add "&format=text" to get only the short URL as plain text.

Rules:
- The "url" value must be percent-encoded (encode "&", "?", "#", "=" inside it).
- Only http:// and https:// URLs are accepted.
- Every new URL is checked with Google Safe Browsing; dangerous URLs are refused (HTTP 422, "unsafe_url").
- Localhost, private IP addresses, this service's own short URLs and other URL shorteners are refused (HTTP 400).
- The same URL always returns the same short URL ("created": false), so retrying is safe.
- Rate limited per client; on HTTP 429 wait for the Retry-After seconds.
- Errors are JSON: {"error":{"code":"...","message":"..."}} (messages are in Japanese).
- This service is in alpha: it may be unstable, and short URLs and data may be deleted without notice.

## API

- [GET /api/shorten](https://dev.yk.gy/api/shorten?url=https%3A%2F%2Fexample.com%2F): create (or reuse) a short URL; query parameters "url" (required) and "format" ("json" default, or "text")
- [POST /api/shorten](https://dev.yk.gy/openapi.json): same, with a JSON body {"url":"..."} and Content-Type: application/json
- [OpenAPI 3.1 schema](https://dev.yk.gy/openapi.json): for ChatGPT custom GPT Actions and other tool frameworks
- [MCP server](https://dev.yk.gy/mcp): remote MCP (Streamable HTTP, no authentication) with one tool, "shorten_url"; add it as a custom connector in ChatGPT or Claude

## Optional

- [Web UI](https://dev.yk.gy/): Japanese single-page UI for humans
