L K J Beta
Share a website
← Back to LKJ

Create a TV link with an AI agent

An assistant that can make HTTPS requests can turn a public website address into an LKJ four-digit code, then give you the code to enter on your TV. The agent API needs no account, API key or browser challenge.

Ask your agent: “Use LKJ to create a four-digit code for this website so I can open it on my TV.” The agent needs an HTTP request tool or an integration that supports POST requests. A read-only search tool can find LKJ but cannot create a code.

Remote MCP connection

For MCP clients, connect to https://lkj.cx/mcp with Streamable HTTP and no authentication. The current MCP revision and stateless 2025 Streamable HTTP clients are supported. The agent connection guide explains the use cases and client requirements. The server description lists the canonical endpoint.

Call create_short_link with a public url and a fresh random UUID request_id. Reuse both values for a retry. get_service_info reads capabilities and whether agent creation is enabled without creating a code. A tool error includes http_status and, for a limit response, retry_after_seconds. Tools and JSON API share quotas, idempotency keys, moderation, checks, pause controls and expiry. No new allowance is granted by switching transport or domain.

{"name":"create_short_link","arguments":{"url":"https://example.com/","request_id":"GENERATE-A-FRESH-RANDOM-UUID"}}

Tool arguments above are an illustration; replace the placeholder with your own generated UUID. This creates a public, temporary link. MCP hosts choose how they obtain user consent for tool calls.

One request

Send POST https://lkj.cx/api/v1/links with Content-Type: application/json, a fresh random UUID in the Idempotency-Key header, and a JSON body containing only the website address:

{"url":"https://example.com/"}

Use an identifying User-Agent for your client. For example:

request_id=$(python3 -c 'import uuid; print(uuid.uuid4())')
curl https://lkj.cx/api/v1/links \
  -H 'Content-Type: application/json' \
  -H 'User-Agent: My-Link-Assistant/1.0' \
  -H "Idempotency-Key: $request_id" \
  --data '{"url":"https://example.com/"}'

This shell example uses Python 3 to generate the UUID. Keep request_id unchanged if retrying the same request after a timeout; generate a new one for a different link. Both LKJ domains accept the same endpoint and share the same limits and codes.

What the agent receives

A JSON response contains code, short_url, tv_url, tv_home_url, expires_at, expires_in_seconds, expiry_policy, instructions and safety_note. Treat the code as text so leading zeros are retained.

Give the user the code and complete preview link, including its v parameter. Never strip that version suffix from a saved or shared link. Explain: Open lkj.st in the TV’s web browser, enter the four digits, review the destination, then choose Open website. The TV needs a browser. LKJ shares an address; it does not cast video or sign in to the destination.

Retries and expiry

On a timeout or lost response, retry the same JSON and Idempotency-Key. A successful retry returns the original code instead of making another. Successful request keys are retained for at least 24 hours; never reuse one for another URL. A replay may return 410 if its code has expired, been removed or been blocked. Only create a fresh key when the user still wants a new code.

Codes expire after one hour without an Open website request. A preview, HEAD request or API retry does not extend that hour. Do not follow the final opening route just to keep a code alive.

Code reuse and saved links

LKJ uses unused four-digit numbers first. Once all have been issued, it recycles the oldest normally expired code only after at least 30 days past expiry. Active, blocked and removed codes are not recycled. There is no scheduled deadline that forces an active link off. If no eligible number exists, creation pauses until capacity is available.

Copied URLs include ?v= followed by the link version. Preserve this suffix: a saved URL for an old version returns expired instead of opening a replacement. A bare four-digit code identifies the current use of that number, so the recipient must review the hostname. Older unversioned saved URLs cannot be pinned retrospectively.

Beta fair use

New API attempts are limited to five per network per UTC day, plus shared beta capacity. Shared networks can share an allowance. Retries of completed requests do not consume another daily allowance, although short-term request limits still apply. Concurrent first attempts and unsuccessful destination checks can consume allowance. For 429 responses, obey Retry-After rather than generating new keys or rotating addresses.

400/415 means correct the request; 403 means a cross-origin browser request is forbidden; 409 means a key was used for another URL; 410 means the original code is unavailable; 422 means the destination is blocked; 503 means creation or checks are temporarily unavailable. The browser form continues to use its browser check. This API is for server-side agents, with no cross-origin browser access.

Public links and honest checks

Only submit public websites the user wants to share. Never send private documents, account-access tokens, personal data or password resets. Codes can be guessed. The API uses LKJ’s existing destination and domain checks; their results do not guarantee safety. See privacy and checks and the TV guide.

Agent connection and use cases · Download the OpenAPI specification · Agent summary