APIドキュメント

ZIPN API を使用して、プログラムで URL を短縮します。

概要

ゲストは24時間に3件まで無料で作成できます。

認証(APIキー)

ログイン後、プロフィールでAPIキーを作成し、リクエストヘッダーに入れて送信してください。リンクは自分のコードのアドレスで期限なしに作成され、ダッシュボードで編集や統計の確認ができます。

Authorization: Bearer sk_short_...

URLを短縮する

POST /api/v1/shorten

リクエストパラメータ:

パラメータ必須説明
original_url✅短縮する元の URL
custom_code❌カスタム短縮コード(省略した場合は自動生成)
expire_duration❌有効期限: 24h, 48h, 1week, 1month
code_id❌APIキー使用時:使う自分のコードID(未入力時は基本コード)。temp を指定すると一時アドレスで作成され、ダッシュボードで管理されます。

リクエストの例:

curl -X POST https://zipn.app/api/v1/shorten \
  -H "Content-Type: application/json" \
  -d '{
    "original_url": "https://example.com/very-long-url",
    "custom_code": "example",
    "expire_duration": "1week"
  }'

成功の応答 (201):

{
  "status": "success",
  "message": "URL shortened successfully.",
  "data": {
    "short_url": "https://zipn.app/example/",
    "original_url": "https://example.com/very-long-url",
    "code": "example",
    "expiration_date": "2026-04-21T10:00:00.000Z"
  }
}

APIキーでのリクエスト:

curl -X POST https://zipn.app/api/v1/shorten \
  -H "Authorization: Bearer sk_short_..." \
  -H "Content-Type: application/json" \
  -d '{
    "original_url": "https://example.com/very-long-url",
    "custom_code": "example"
  }'

APIキー使用時の成功レスポンス (201):

{
  "status": "success",
  "message": "URL shortened successfully.",
  "data": {
    "short_url": "https://zipn.app/mycode/example/",
    "original_url": "https://example.com/very-long-url",
    "code": "example",
    "expiration_date": "2126-03-28T10:00:00.000Z",
    "username": "mycode",
    "user_code_id": 12,
    "is_temp": false
  }
}

エラー応答:

{
  "status": "error",
  "message": "This short code is already in use."
}

API情報の取得

GET /api/v1/shorten

エンドポイント情報と利用可能なパラメータを返します。