pack.page

API Documentation


Last revised: 26 April, 2025

This documentation outlines how to interact with the pack.page API for creating and managing shortened links for users with custom domain deployments.

API Test Tool

Fill out the form below to generate sample code to integrate into your project.

cURL Command

# Click "Generate Code" to create a cURL command

Python Code

# Click "Generate Code" to create Python code

JavaScript Code

# Click "Generate Code" to create JavaScript code

1. Authentication

Authentication is required for private domain endpoints. Include your API key in the request header:

X-API-Key: your_api_key_here

Note: Your API key is specific to your custom domain and is provided during domain setup. Keep your API key secure and never expose it in client-side code.

2. Creating a Short Link

Endpoint

POST https://your-domain.com/ify

Headers

Content-Type: application/json
X-API-Key: your_api_key_here

Request Body

{
  "url": "https://example.com/very/long/path/to/shorten",
  "mode": 1,               // Optional: 0=1hr, 1=2days, 2=2weeks, 3=6months
  "keyboard": "qwerty",    // Optional: keyboard layout for link generation
  "passphrase": "secret",  // Optional: for bookmarking links
  "friendly_name": "Example Link"  // Optional: requires passphrase
}

Response (200 OK)

"https://your-domain.com/a1b2c3"

Error Responses

Status Code Description
400 Invalid URL or parameters
403 Invalid API key
404 Domain not found

Sample Code (Python)

import requests
import json

url = "https://your-domain.com/ify"
api_key = "your_api_key_here"

headers = {
    "Content-Type": "application/json",
    "X-API-Key": api_key
}

payload = {
    "url": "https://example.com/very/long/path/to/shorten",
    "mode": 2,
    "keyboard": "qwerty"
}

response = requests.post(url, headers=headers, data=json.dumps(payload))

if response.status_code == 200:
    shortened_url = response.json()
    print(f"Shortened URL: {shortened_url}")
else:
    print(f"Error: {response.status_code} - {response.text}")

Sample Code (JavaScript)

fetch('https://your-domain.com/ify', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'X-API-Key': 'your_api_key_here'
    },
    body: JSON.stringify({
        url: 'https://example.com/very/long/path/to/shorten',
        mode: 2,
        keyboard: 'qwerty'
    })
})
.then(response => {
    if (response.ok) {
        return response.json();
    }
    throw new Error(`HTTP error ${response.status}`);
})
.then(shortenedUrl => {
    console.log('Shortened URL:', shortenedUrl);
})
.catch(error => {
    console.error('Error:', error);
});

Sample Code (cURL)

curl -X POST https://pack.page/ify \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key_here" \
  -d '{
    "url": "https://example.com/very/long/path/to/shorten",
    "mode": 2,
    "keyboard": "qwerty"
  }'

3. Rate Limits

To ensure fair usage and service stability as outlined in our terms of service, the following rate limits apply:

  • 5 requests per minute
  • 30 requests per hour

Note: Enterprise customers with custom domains may request adjusted rate limits by contacting support.

For information about custom domain deployment, please contact us at [email protected] and a member of our brainpolo team will be in touch shortly.

pack.page