at1.to API

URL Shortening Service - Developer Documentation

Overview

Base URL: https://at1.to

Content-Type: application/json

Authentication: None required

Interactive Docs: Swagger UI

Redirect to Original URL

GET /{code}

Redirects to the original URL using the short code. Automatically increments visit counter.

Parameters:

  • code (string, required) - The 8-character short code

Response:

  • 301 Redirect - Redirects to original URL
  • 404 Not Found - Short code doesn't exist

Example:

GET https://at1.to/abc123XY → Redirects to https://example.com/very-long-url

Get Statistics

GET /api/v1/stats

Retrieves overall statistics for the service.

Response:

{ "totalLinks": 1250, "totalVisits": 45678 }

Try it out:

Batch Create Short Links

POST /api/v1/batch

Creates multiple short links in a single request. Maximum 100 URLs per request.

Request Body:

{ "urls": [ "https://example.com/page1", "https://example.com/page2", "https://example.com/page3" ] }

Response:

{ "message": "تم معالجة 3 رابط بنجاح", "results": [ { "originalUrl": "https://example.com/page1", "shortLink": "https://at1.to/abc123XY", "isNew": true } ], "summary": { "total": 3, "existing": 1, "new": 2 } }

Status Codes:

200 OK - Success
400 Bad Request - Invalid input
500 Error - Server error

Try it out:

Code Examples

JavaScript (fetch)

// Create short link const response = await fetch('https://at1.to/api/v1/', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ url: 'https://example.com/my-url' }) }); const data = await response.json(); console.log(data.shortLink); // Get statistics const stats = await fetch('https://at1.to/api/v1/stats'); const statsData = await stats.json(); console.log(statsData);

cURL

# Create short link curl -X POST https://at1.to/api/v1/ \ -H "Content-Type: application/json" \ -d '{"url": "https://example.com/my-url"}' # Get statistics curl https://at1.to/api/v1/stats # Batch create curl -X POST https://at1.to/api/v1/batch \ -H "Content-Type: application/json" \ -d '{"urls": ["https://example.com/1", "https://example.com/2"]}'

Python (requests)

import requests # Create short link response = requests.post('https://at1.to/api/v1/', json={'url': 'https://example.com/my-url'}) data = response.json() print(data['shortLink']) # Get statistics stats = requests.get('https://at1.to/api/v1/stats') print(stats.json())