Create a short link
Creates a short URL. Anonymous callers share rate limits with the web create form. Session cookie and API key are optional for basic create; higher capacity may require an API key when issued. Request body must include exactly one of url or longUrl (OpenAPI oneOf). Optional alias / customSlug: if both are sent they must match (case-insensitive); otherwise 409 FIELD_CONFLICT. User aliases are folded to lowercase before persistence. An OAuth access token is not an API key here: presenting one is 401 and does not fall through to anonymous create.
Request
- Base URL: https://xn--s7y.xn--3ds443g
- URL: https://xn--s7y.xn--3ds443g/v1/links
- Auth: one of:
- none
- HTTP bearer
- API key in cookie duan_session
Headers
Client-generated key. Scope = authenticated user or API key, or anonymous client id (X-Duan-Client-Id / sealed anon cookie) — not IP-only. TTL=24h; same key+body replays; same key+different body → 409 IDEMPOTENCY_CONFLICT; concurrent same key → 409 IDEMPOTENCY_IN_PROGRESS + Retry-After. Concurrent reuse of the same key is safe; on IDEMPOTENCY_IN_PROGRESS wait Retry-After and retry with the same key.
Sealed anonymous_client_id (agents). Omit on first request — server mints and echoes the same header (+ Set-Cookie duan_anon) on the response that entered idempotency scope, including 409 and 503. Resend on subsequent anon calls. Not a credential.
Optional correlation id. The server echoes it back (X-Request-Id response header and request_id) only if it matches [A-Za-z0-9._-]{1,128}; any other value is ignored and a fresh id is returned.
Request body
Example request
{
"source": "agent"
}Response
Idempotent replay of a prior successful create (see Idempotency-Replayed)
Example response
{
"short_url": "https://短.在线/a7x",
"short_url_ascii": "https://xn--s7y.xn--3ds443g/a7x"
}Changes
No recorded changes to this operation across all 1 revision of this API.