Skip to main content

Create a new link

POST 

/links

Create a new link for the authenticated project.

Request

Query Parameters

    projectSlug stringrequired

    The slug for the project to create links for. E.g. for app.zli.bz/acme, the projectSlug is acme.

Body

required

Details of the link to create.

    domain string

    The domain of the short link. If not provided, the primary domain for the project will be used (or zli.cx if the project has no domains).

    key string

    The short link slug. If not provided, a random 7-character slug will be generated.

    url stringrequired

    The destination URL of the short link.

    archived boolean

    Default value: false

    Whether the short link is archived.

    expiresAt date-timenullable

    The date and time when the short link will expire in ISO-8601 format. Must be in the future.

    password stringnullable

    The password required to access the destination URL of the short link.

    proxy boolean

    Default value: false

    Whether the short link uses Custom Social Media Cards feature.

    title stringnullable

    The title of the short link generated via api.zli.bz/metatags. Will be used for Custom Social Media Cards if proxy is true.

    description stringnullable

    The description of the short link generated via api.zli.bz/metatags. Will be used for Custom Social Media Cards if proxy is true.

    image stringnullable

    The image of the short link generated via api.zli.bz/metatags. Will be used for Custom Social Media Cards if proxy is true.

    rewrite boolean

    Default value: false

    Whether the short link uses link cloaking.

    ios stringnullable

    The iOS destination URL for the short link for iOS device targeting.

    android stringnullable

    The Android destination URL for the short link for Android device targeting.

    geo objectnullable

    Geo targeting information for the short link in JSON format {[COUNTRY]: https://example.com }. Learn more: https://zli.cx/geo

    property name* uri
    publicStats boolean

    Default value: false

    Whether the short link's stats are publicly accessible.

    tagId cuidnullable

    The unique id of the tag assigned to the short link.

    comments stringnullable

    The comments for the short link.

Responses

The created link

Schema
    id cuid

    The unique ID of the short link.

    domain string

    The domain of the short link. If not provided, the primary domain for the project will be used (or zli.cx if the project has no domains).

    key string

    The short link slug. If not provided, a random 7-character slug will be generated.

    url string

    The destination URL of the short link.

    archived boolean

    Default value: false

    Whether the short link is archived.

    expiresAt date-timenullable

    The date and time when the short link will expire in ISO-8601 format. Must be in the future.

    password stringnullable

    The password required to access the destination URL of the short link.

    proxy boolean

    Default value: false

    Whether the short link uses Custom Social Media Cards feature.

    title stringnullable

    The title of the short link generated via api.zli.bz/metatags. Will be used for Custom Social Media Cards if proxy is true.

    description stringnullable

    The description of the short link generated via api.zli.bz/metatags. Will be used for Custom Social Media Cards if proxy is true.

    image stringnullable

    The image of the short link generated via api.zli.bz/metatags. Will be used for Custom Social Media Cards if proxy is true.

    rewrite boolean

    Default value: false

    Whether the short link uses link cloaking.

    ios stringnullable

    The iOS destination URL for the short link for iOS device targeting.

    android stringnullable

    The Android destination URL for the short link for Android device targeting.

    geo objectnullable

    Geo targeting information for the short link in JSON format {[COUNTRY]: https://example.com }. Learn more: https://zli.cx/geo

    property name* uri
    publicStats boolean

    Default value: false

    Whether the short link's stats are publicly accessible.

    tagId cuidnullable

    The unique id of the tag assigned to the short link.

    comments stringnullable

    The comments for the short link.

    shortLink string

    The full URL of the short link, including the https protocol (e.g. https://zli.cx/try).

    qrCode string

    The full URL of the QR code for the short link (e.g. https://api.zli.bz/qr?url=https://zli.cx/try).

    utm_source stringnullable

    The UTM source of the short link.

    utm_medium stringnullable

    The UTM medium of the short link.

    utm_campaign stringnullable

    The UTM campaign of the short link.

    utm_term stringnullable

    The UTM term of the short link.

    utm_content stringnullable

    The UTM content of the short link.

    userId cuid

    The user ID of the creator of the short link.

    projectId cuid

    The project ID of the short link.

    clicks number

    The number of clicks on the short link.

    lastClicked date-timenullable

    The date and time when the short link was last clicked.

    createdAt date-time

    The date and time when the short link was created.

    updatedAt date-time

    The date and time when the short link was last updated.

Loading...