API 문서
개요
301check.com은 애플리케이션에 직접 통합할 수 있는 무료 HTTP 리다이렉트 체인 API를 제공합니다. 가입 불필요, API 키 불필요 — POST 요청을 보내면 바로 결과를 받을 수 있습니다.
✨ API 특징
- 완전 무료, 가입 불필요
- 모든 HTTP 리다이렉트 유형 지원 (301/302/303/307/308)
- 전체 리다이렉트 체인 반환
- 응답 시간, 서버 IP, TLS 인증서 세부 정보 포함
- JSON 응답, 파싱 용이
lang파라미터를 통한 다국어 오류 메시지
엔드포인트
POST
https://www.301check.com/check.php
요청 형식
헤더
Content-Type: application/json
본문
{
"url": "https://example.com",
"lang": "en"
}
파라미터
url(필수) — 확인할 URL. HTTP와 HTTPS 모두 지원lang(선택) — 오류 메시지 언어:en또는zh. 기본값은Accept-Language에 의한 자동 감지
⚠️ URL 형식
URL에는 스킴(http:// 또는 https://)이 포함되어야 합니다. example.com처럼 도메인만 전달하면 API가 자동으로 http://를 추가합니다.
응답 형식
성공 시
{
"success": true,
"timestamp": "2026-02-22T10:00:00+08:00",
"inputUrl": "https://example.com",
"finalUrl": "https://www.example.com",
"totalRedirects": 1,
"totalTime": 0.390,
"loopDetected": false,
"maxRedirectsReached": false,
"redirects": [
{
"hop": 1,
"statusCode": 301,
"statusMessage": "Moved Permanently",
"type": "permanent",
"from": "https://example.com",
"to": "https://www.example.com",
"duration": 0.234,
"ip": "93.184.216.34",
"server": "nginx/1.18.0",
"tlsInfo": {
"protocol": "TLSv1.3",
"subject": "example.com",
"issuer": "Let's Encrypt",
"expires": "2026-04-01"
},
"headers": {
"server": "nginx/1.18.0",
"location": "https://www.example.com"
}
}
]
}
오류 시
{
"success": false,
"error": "Invalid URL. Please enter a valid HTTP or HTTPS URL."
}
코드 예제
cURL
curl -X POST https://www.301check.com/check.php \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com","lang":"en"}'
Python
import requests
resp = requests.post(
"https://www.301check.com/check.php",
json={"url": "https://example.com", "lang": "en"}
)
data = resp.json()
if data["success"]:
print(f"홉 수: {data['totalRedirects']}, 최종 URL: {data['finalUrl']}")
for hop in data["redirects"]:
print(f" {hop['hop']}. {hop['statusCode']} {hop['from']}")
else:
print("오류:", data["error"])
JavaScript
const res = await fetch('https://www.301check.com/check.php', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ url: 'https://example.com', lang: 'en' })
});
const data = await res.json();
if (data.success) {
console.log(`${data.totalRedirects}홉 → ${data.finalUrl}`);
data.redirects.forEach(h => console.log(` ${h.hop}. ${h.statusCode} ${h.from}`));
}
PHP
<?php
$ch = curl_init('https://www.301check.com/check.php');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode(['url' => 'https://example.com', 'lang' => 'en']),
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
echo $data['success'] ? $data['totalRedirects'] . "홉\n" : $data['error'] . "\n";
?>
요청 제한
- IP당: 10초에 5회 요청
- 초과 시: HTTP 429와 다국어 오류 메시지 반환
오류 처리
항상 success 필드를 확인하세요. 발생 가능한 오류 조건:
- 유효하지 않거나 누락된 URL
- 요청 제한 초과
- 연결 타임아웃 (15초)
- DNS 확인 실패
- 프라이빗/내부 IP 주소 차단
💡 팁
더 높은 요청 제한이나 엔터프라이즈 지원이 필요하신가요? 문의해 주세요: api@301check.com