---
title: "Create a short link"
method: POST
path: "/api/v1/shorten"
tags: ["Links"]
---

# Create a short link

`POST /api/v1/shorten`

## Request

- Base URL: `https://workers.miniurl.com`
- URL: `https://workers.miniurl.com/api/v1/shorten`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer
  - HTTP bearer

Works with gt_, mk_, and scoped at_ Agent tokens. With gt_, only url is applied; alias, domain, password, expiration, and activated_at are ignored and returned in meta.notices. OAuth Agents may send dry_run=true to preview a redirect without writing it.

## Headers

- `Idempotency-Key` string

## Request body

- ShortenRequest
  - `url` string, uri, required
  - `alias` string: 4-64 characters on miniurl.com; 1-64 characters on a verified custom domain.
  - `domain` string
  - `password` string
  - `expiration` string, date-time
  - `activated_at` string, date-time
  - `dry_run` boolean: OAuth Agent only: validate policy, safety, alias, and domain availability without creating the link.

## Response `200`

Short link created

- CreateLinkResponse
  - `success` boolean, required
  - `data` LinkRecord, required
    - `short_url` string, required
    - `alias` string, required
    - `full_url` string, required
    - `domain` string, required
    - `manage_code` string, nullable
    - `created_at` string, date-time, required
    - `expires_at` string, date-time, nullable
    - `has_password` boolean
    - `clicks` integer
    - `last_clicked_at` string, date-time, nullable
  - `meta` Meta
    - `account_type` string
    - `hint` string
    - `usage` object
    - `notices` object[]
    - `limitations` string[]
    - `upgrade` object

## Other responses

- `400`: Invalid input or malformed JSON
- `401`: Missing, invalid, expired, or wrong bearer token for this endpoint
- `403`: Requires a registered account or a higher plan
- `409`: Conflict such as alias taken or email already registered
- `429`: Rate limit, token quota, or plan quota exceeded

---

[API](https://skmtc.dev/miniurl/apis/miniurl-agent-first-api.md) · [All operations](https://skmtc.dev/miniurl/apis/miniurl-agent-first-api/llms.txt) · [OpenAPI document](https://skmtc.dev/miniurl/apis/miniurl-agent-first-api/revisions/1d12196927db?raw)
