链接已复制到剪贴板!

API文档

请先登录获取API密钥

您需要登录后才能使用API功能。

登录
API文档
基础信息
  • API端点: https://4a.al/api.php
  • 请求方式: GET/POST
  • 响应格式: JSON
请求参数
参数 必填 说明
api_key 您的API密钥
url 是* 需要缩短的URL(批量请求时使用urls[]数组)
expire_time 预设有效期:1h, 1d, 7d, 30d, never
custom_expire_time 自定义有效期(格式:YYYY-MM-DD HH:MM:SS)
passwd 访问密码
custom_alias 自定义短网址后缀(3-20位字母数字)
示例请求
单个URL(GET):
https://4a.al/api.php?api_key=YOUR_API_KEY&url=https://example.com&expire_time=7d&passwd=123456
单个URL(POST):
POST https://4a.al/api.php
Content-Type: application/x-www-form-urlencoded

api_key=YOUR_API_KEY&url=https://example.com&custom_alias=mylink&expire_time=never
批量URL(POST):
POST https://4a.al/api.php
Content-Type: application/x-www-form-urlencoded
# 每次最多20条
api_key=YOUR_API_KEY&urls[]=https://example.com/1&urls[]=https://example.com/2&passwd=mypassword
响应示例
成功响应(单个URL):
{
    "success": true,
    "urlid": "AbCdEf",
    "short_url": "https://4a.al/AbCdEf",
    "message": "创建成功",
    "oldurl": "https://example.com",
    "expire_time": "1746168888",
    "has_password": true
}
错误响应:
{
    "success": false,
    "message": "无效的URL格式"
}