"use client"; import Link from "next/link"; export default function ApiDocsPage() { return (
{/* Header */}
Ana Sayfa
{/* Title */}

API Dokümantasyonu

Image Manipulation API - REST API Kullanım Kılavuzu

{/* Content */}
{/* Base URL */}

Base URL

https://v2.beyhano.com.tr
{/* Authentication */}

Authentication

İki yöntem desteklenir: JWT (login/register ile alınan token) veya hesabınız için oluşturduğunuz API anahtarı ( img_ ile başlar). İkisi de aynı header ile gönderilir:

Authorization: Bearer <jwt_token_veya_img_..._api_key>

API anahtarını web arayüzünde profil sayfasından oluşturabilirsiniz; isteğe bağlı gün sınırı koyabilir veya süresiz bırakabilirsiniz. Admin, kullanıcı anahtarlarının süresini panelden güncelleyebilir.

{/* Endpoints */}

Endpoints

{/* Register */}
POST /api/v1/auth/register

Yeni kullanıcı kaydı oluşturur ve JWT token döner.

{`{
  "email": "user@example.com",
  "password": "minimum8karakter",
  "name": "Kullanıcı Adı"
}`}
                
{/* Login */}
POST /api/v1/auth/login

Mevcut kullanıcı ile giriş yapar ve JWT token döner.

{`{
  "email": "user@example.com",
  "password": "minimum8karakter"
}`}
                
{/* API Keys */}
GET /api/v1/api-keys

Oturum veya Bearer ile: kendi API anahtarlarınızı listeler (tam değer dönmez).

POST /api/v1/api-keys

Body:{" "} {`{ "name": "Etiket", "expiresInDays": 30 }`} {" "} — expiresInDays yok/null/0 ise süresiz. Yanıtta tam anahtar yalnızca bir kez gelir.

{/* Upload Image */}
POST /api/v1/images/upload

Resim yükler, belirtilen boyut/kalite/formatta işler ve kaydeder. (multipart/form-data)

file (required): Resim dosyası (max 10MB)
width (optional): Genişlik (px), default: 800
height (optional): Yükseklik (px), default: 600
quality (optional): Kalite (1-100), default: 90
format (optional): jpeg, png, webp, avif
{/* List Images */}
GET /api/v1/images

Kullanıcının tüm resimlerini listeler.

{/* Delete Image */}
DELETE /api/v1/images/:id

Belirtilen ID'ye sahip resmi siler.

{/* Example Code */}

Örnek Kullanım (JavaScript)

{`// 1. Kayıt ol
const registerResponse = await fetch(
  'https://image.beyhano.com.tr/api/v1/auth/register',
  {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      email: 'user@example.com',
      password: 'securepassword123',
      name: 'Kullanıcı'
    })
  }
);
const { data } = await registerResponse.json();
const token = data.accessToken;

// 2. Resim yükle
const formData = new FormData();
formData.append('file', fileInput.files[0]);
formData.append('width', '1920');
formData.append('quality', '85');
formData.append('format', 'webp');

const uploadResponse = await fetch(
  'https://image.beyhano.com.tr/api/v1/images/upload',
  {
    method: 'POST',
    headers: { 'Authorization': \`Bearer \${token}\` },
    body: formData
  }
);
const uploadData = await uploadResponse.json();
console.log('URL:', uploadData.data.image.url);`}
              
{/* Features */}

Özellikler ve Limitler

✅ Desteklenen Formatlar

  • • JPEG / JPG
  • • PNG
  • • WebP
  • • AVIF
  • • GIF

⚙️ Limitler

  • • Max dosya: 10MB
  • • Max boyut: 10000x10000 px
  • • Token süresi: 7 gün
  • • HTTPS zorunlu (production)
{/* Download Full Docs */}

Detaylı Dokümantasyon

Tüm endpoint'ler, hata kodları ve örnekler için tam dokümantasyonu indirin.

GitHub'da Görüntüle
); }