Skip to main content
POST
/
short-link
Create short link
curl --request POST \
  --url https://api.h0p.co/short-link \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "domain": "links.example.com",
  "slug": "summer-sale",
  "destination": {
    "type": "link",
    "value": "https://example.com/products/summer-sale",
    "threatTypes": null
  },
  "tags": [
    "marketing",
    "sale"
  ],
  "folderId": "01933eb8-541f-7000-a9f4-e4eee80ff04e",
  "maxClicks": 1000,
  "expiresAt": "2024-12-31T23:59:59Z"
}
'
{
  "domain": {
    "id": "01933eb8-541f-7000-a9f4-e4eee80ff04e",
    "domain": "links.example.com",
    "isPrimary": true,
    "isVerified": true,
    "createdAt": "2024-01-15T10:30:00Z"
  },
  "rules": [
    {
      "priority": 0,
      "destination": {
        "type": "link",
        "value": "https://example.com",
        "threatTypes": null
      },
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "countries": [
        "US",
        "CA",
        "GB"
      ],
      "languages": [
        "en",
        "fr",
        "es-MX"
      ],
      "osTypes": [
        "ios",
        "android"
      ]
    }
  ],
  "qrCode": {
    "options": {
      "data": "https://example.com/abc123",
      "type": "svg",
      "width": 300,
      "height": 300,
      "margin": 4,
      "image": "https://example.com/logo.png",
      "imageOptions": {
        "hideBackgroundDots": true,
        "imageSize": 0.4,
        "crossOrigin": "anonymous",
        "margin": 10
      },
      "dotsOptions": {
        "type": "rounded",
        "color": "#000000",
        "gradient": {
          "type": "linear",
          "colorStops": [
            {
              "offset": 0,
              "color": "#3B82F6"
            },
            {
              "offset": 1,
              "color": "#8B5CF6"
            }
          ],
          "rotation": 45
        },
        "roundSize": true
      },
      "cornersSquareOptions": {
        "type": "square",
        "color": "#3B82F6",
        "gradient": {
          "type": "linear",
          "colorStops": [
            {
              "offset": 0,
              "color": "#3B82F6"
            },
            {
              "offset": 1,
              "color": "#8B5CF6"
            }
          ],
          "rotation": 45
        }
      },
      "cornersDotOptions": {
        "type": "dot",
        "color": "#8B5CF6",
        "gradient": {
          "type": "linear",
          "colorStops": [
            {
              "offset": 0,
              "color": "#3B82F6"
            },
            {
              "offset": 1,
              "color": "#8B5CF6"
            }
          ],
          "rotation": 45
        }
      },
      "backgroundOptions": {
        "round": 0.1,
        "color": "#FFFFFF"
      }
    },
    "imageId": "01933eb8-541f-7000-a9f4-e4eee80ff04e"
  },
  "destination": {
    "type": "link",
    "value": "https://example.com",
    "threatTypes": null
  },
  "metaTags": {
    "title": "Amazing Product Launch 2024",
    "description": "Be the first to discover our revolutionary new product.",
    "imageId": "01933eb8-541f-7000-a9f4-e4eee80ff04e",
    "image": {
      "id": "01933eb8-541f-7000-a9f4-e4eee80ff04e",
      "key": "meta-tag/01933eb8-541f-7000-a9f4-e4eee80ff04e.png"
    }
  },
  "tags": [
    {
      "id": "01933eb8-541f-7000-a9f4-e4eee80ff04e",
      "name": "social-media",
      "color": "#10B981"
    }
  ],
  "id": "01933eb8-541f-7000-a9f4-e4eee80ff04e",
  "organizationId": "01933eb8-541f-7000-a9f4-e4eee80ff04e",
  "isActive": true,
  "qrCodeId": "01933eb8-541f-7000-a9f4-e4eee80ff04e",
  "domainId": "01933eb8-541f-7000-a9f4-e4eee80ff04e",
  "folderId": "01933eb8-541f-7000-a9f4-e4eee80ff04e",
  "slug": "summer-sale",
  "originUrl": "https://links.example.com/summer-sale",
  "expiresAt": "2024-12-31T23:59:59Z",
  "maxClicks": 1000,
  "currentClicks": 247,
  "hasPassword": false,
  "cloaking": false,
  "destinationId": "01933eb8-541f-7000-a9f4-e4eee80ff04e",
  "createdAt": "2024-01-15T10:30:00Z",
  "updatedAt": "2024-01-16T14:20:00Z"
}

Authorizations

x-api-key
string
header
required

API Key authentication for programmatic access.

How to use:

  1. Create an API key from your dashboard settings
  2. Include the key in the x-api-key header with each request
  3. API keys have granular permissions (domains, shortLinks, files, stats, apiKeys)

Example:

curl -H "x-api-key: your-api-key-here" https://api.h0p.co/short-link/list

Types of API keys:

  • User keys: Linked to your user account (one per organization)
  • Bot keys: Autonomous machine users (one per organization)

Security notes:

  • Keep your API keys secure and never commit them to version control
  • API keys cannot access authentication endpoints (/auth/*)
  • Keys can be revoked at any time from the dashboard

Body

application/json

Short link configuration with destination and optional features

Short link creation/update request

destination
object
required

Main destination URL/email/phone

Example:
{
"type": "link",
"value": "https://example.com",
"threatTypes": null
}
domainId
string<uuid>

UUID of the domain to use

Example:

"01933eb8-541f-7000-a9f4-e4eee80ff04e"

domain
string

Domain name to use (alternative to domainId)

Example:

"links.example.com"

folderId
string<uuid> | null

UUID of folder to organize link

Example:

"01933eb8-541f-7000-a9f4-e4eee80ff04e"

tags
string[] | null

Array of tag names to associate

Maximum array length: 10
Required string length: 1 - 30
Example:
[
"marketing",
"campaign-2024",
"social-media"
]
slug
string

Custom slug for the short link

Required string length: 1 - 50
Pattern: ^(?![-_])[A-Za-z0-9-_]{1,50}(?<![-_])$
Example:

"summer-sale"

maxClicks
number | null

Maximum number of clicks before link expires

Required range: x > 1
Example:

1000

expiresAt
string<date-time> | null

Link expiration date/time

Example:

"2024-12-31T23:59:59Z"

password
string | null

Password to protect link access

Required string length: 5 - 25
Example:

"secretpass123"

cloaking
boolean

Hide destination URL in browser

Example:

false

enableDeepLinking
boolean

Enable automatic deep linking to mobile apps

Example:

true

rules
object[] | null

Smart routing rules array

qrCode
object

Custom QR code configuration for this link

metaTags
object

Custom Open Graph meta tags

Example:
{
"title": "Amazing Product Launch 2024",
"description": "Be the first to discover our revolutionary new product with exclusive early access.",
"imageId": "01933eb8-541f-7000-a9f4-e4eee80ff04e"
}

Response

Short link created successfully

Complete short link with all nested objects

domain
object
required

Domain details

rules
object[]
required

Smart routing rules with IDs

qrCode
object
required

QR code configuration

destination
object
required

Main destination configuration

Example:
{
"type": "link",
"value": "https://example.com",
"threatTypes": null
}
metaTags
object
required

Meta tags configuration

Example:
{
"title": "Amazing Product Launch 2024",
"description": "Be the first to discover our revolutionary new product.",
"imageId": "01933eb8-541f-7000-a9f4-e4eee80ff04e",
"image": {
"id": "01933eb8-541f-7000-a9f4-e4eee80ff04e",
"key": "meta-tag/01933eb8-541f-7000-a9f4-e4eee80ff04e.png"
}
}
tags
object[]
required

Associated tags

id
string<uuid>
required

Short link UUID

Example:

"01933eb8-541f-7000-a9f4-e4eee80ff04e"

organizationId
string<uuid>
required

Organization UUID

Example:

"01933eb8-541f-7000-a9f4-e4eee80ff04e"

isActive
boolean
required

Whether link is active

Example:

true

qrCodeId
string<uuid> | null
required

QR code configuration UUID

Example:

"01933eb8-541f-7000-a9f4-e4eee80ff04e"

domainId
string<uuid>
required

Domain UUID

Example:

"01933eb8-541f-7000-a9f4-e4eee80ff04e"

folderId
string<uuid> | null
required

Folder UUID

Example:

"01933eb8-541f-7000-a9f4-e4eee80ff04e"

slug
string
required

Short link slug

Example:

"summer-sale"

originUrl
string<uri>
required

Complete short URL

Example:

"https://links.example.com/summer-sale"

expiresAt
string<date-time> | null
required

Expiration timestamp

Example:

"2024-12-31T23:59:59Z"

maxClicks
number | null
required

Maximum click limit

Example:

1000

currentClicks
number
required

Current click count

Required range: x >= 0
Example:

247

hasPassword
boolean
required

Whether link is password protected

Example:

false

cloaking
boolean
required

Whether destination is hidden

Example:

false

destinationId
string<uuid>
required

Destination configuration UUID

Example:

"01933eb8-541f-7000-a9f4-e4eee80ff04e"

createdAt
string<date-time>
required

Creation timestamp

Example:

"2024-01-15T10:30:00Z"

updatedAt
string<date-time>
required

Last update timestamp

Example:

"2024-01-16T14:20:00Z"