Skip to main content
POST
https://snip.sa
/
api
/
urls
curl -X POST https://snip.sa/api/urls \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key_here" \
  -d '{
    "originalUrl": "https://example.com/very-long-url",
    "customCode": "mylink",
    "title": "My Custom Link",
    "tags": ["marketing", "campaign"]
  }'
{
  "success": true,
  "message": "URL created successfully",
  "data": {
    "url": {
      "_id": "507f1f77bcf86cd799439011",
      "originalUrl": "https://example.com/very-long-url",
      "shortCode": "abc123",
      "customCode": "mylink",
      "title": "My Custom Link",
      "tags": ["marketing", "campaign"],
      "clickCount": 0,
      "isActive": true,
      "createdAt": "2024-01-15T10:30:00.000Z"
    },
    "domain": {
      "id": "base",
      "fullDomain": "laghhu.link",
      "shortUrl": "https://laghhu.link"
    }
  }
}

Request Body

originalUrl
string
required
The long URL to shorten (must be valid HTTP/HTTPS URL)
customCode
string
Custom short code (alphanumeric, case-sensitive, 3-50 characters)
title
string
Title for the shortened URL (max 200 characters)
description
string
Description of the link (max 500 characters)
tags
array
Array of tags for organization
expiresAt
string
ISO 8601 date when the link expires
password
string
Password protection for the link
domainId
string
Domain ID to use (“base” for default domain)
utm
object
UTM parameters for tracking
restrictions
object
Access restrictions
redirectType
number
default:"302"
HTTP redirect type (301 or 302)
curl -X POST https://snip.sa/api/urls \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key_here" \
  -d '{
    "originalUrl": "https://example.com/very-long-url",
    "customCode": "mylink",
    "title": "My Custom Link",
    "tags": ["marketing", "campaign"]
  }'
{
  "success": true,
  "message": "URL created successfully",
  "data": {
    "url": {
      "_id": "507f1f77bcf86cd799439011",
      "originalUrl": "https://example.com/very-long-url",
      "shortCode": "abc123",
      "customCode": "mylink",
      "title": "My Custom Link",
      "tags": ["marketing", "campaign"],
      "clickCount": 0,
      "isActive": true,
      "createdAt": "2024-01-15T10:30:00.000Z"
    },
    "domain": {
      "id": "base",
      "fullDomain": "laghhu.link",
      "shortUrl": "https://laghhu.link"
    }
  }
}