mol.la

mol.la

Developers

Last updated 2 October 2026

mol.la exposes a small public HTTP API for link creation and stats. Requests and responses are JSON. Base URL in production is https://mol.la. A machine-readable contract is available as an OpenAPI 3.1 spec, and the same links are listed in the API catalog and llms.txt.

Create short link

POST /api/v1/links

Headers:

  • Content-Type: application/json
  • Idempotency-Key: <uuid> (recommended)

Body:

{
  "long_url": "https://example.com/article",
  "alias": "my-link",
  "expires_in": 86400
}

alias and expires_in are optional. expires_in range is 60 to 157680000 seconds.

Success response (201):

{
  "short_code": "abc1234",
  "short_url": "https://mol.la/abc1234",
  "long_url": "https://example.com/article",
  "created_at": "2026-09-20T00:00:00Z",
  "expires_at": "2026-09-21T00:00:00Z"
}

Read stats

GET /api/v1/links/{short_code}/stats

Success response (200):

{
  "short_code": "abc1234",
  "short_url": "https://mol.la/abc1234",
  "clicks": 42,
  "created_at": "2026-09-20T00:00:00Z",
  "last_click_at": "2026-09-20T12:30:00Z"
}

Redirect behavior

Visiting GET /{short_code} returns HTTP 302 to the destination URL when active. Every visit counts as a click, so read /stats rather than following a link to inspect it.

Error model

Errors return JSON:

{
  "error": "INVALID_URL",
  "message": "long_url must be an absolute http or https URL of at most 2048 characters, without credentials.",
  "docs_url": "https://mol.la/app/developers/"
}

Branch on error, which is stable; message is for people and may change. Anonymous link creation is limited to 10 requests per minute per IP. A 429 response carries a Retry-After header in seconds.

Error codes:

  • INVALID_URL
  • INVALID_ALIAS
  • INVALID_EXPIRY
  • ALIAS_TAKEN
  • IDEMPOTENCY_CONFLICT
  • RATE_LIMITED
  • TEMPORARILY_UNAVAILABLE
  • NOT_FOUND
  • INVALID_REQUEST
  • METHOD_NOT_ALLOWED

cURL examples

curl -X POST "https://mol.la/api/v1/links" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 7f1df4f4-9989-4e7a-8fd0-e2f012345678" \
  -d '{"long_url":"https://example.com/article","alias":"my-link"}'
curl "https://mol.la/api/v1/links/abc1234/stats"