# Tegegn Image Bucket API Documentation

> High-performance image storage and public hosting server API. Designed for web applications, mobile backends, and AI agents.

## Base URL
https://images.tegegn.com.et

## Endpoints

### 1. Upload Image
- **Path**: `/upload.php`
- **Method**: `POST`
- **Content-Type**: `multipart/form-data`
- **Request Parameters**:
  - `image` (file, required): The image binary file. Supported formats: `jpg`, `jpeg`, `png`, `webp`, `gif`, `svg`, `ico`. Max size: 15MB.
  - `folder` (string, optional): Subfolder for categorization (e.g. `avatars`, `tattoos`, `products`). Defaults to `YYYY/MM`.
- **Response Format**: JSON
  ```json
  {
    "success": true,
    "data": {
      "url": "https://images.tegegn.com.et/uploads/tattoos/1726754000_photo_a1b2c3d4.jpg",
      "relative_path": "uploads/tattoos/1726754000_photo_a1b2c3d4.jpg",
      "filename": "1726754000_photo_a1b2c3d4.jpg",
      "original_name": "photo.jpg",
      "size_bytes": 142050,
      "mime_type": "image/jpeg",
      "extension": "jpg",
      "uploaded_at": "2026-09-19T13:48:00+00:00"
    }
  }
  ```

### 2. Delete Image
- **Path**: `/delete.php`
- **Method**: `POST` or `DELETE`
- **Content-Type**: `application/json`
- **Request Parameters**:
  - `url` (string, optional): Full URL of the image to delete.
  - `path` (string, optional): Relative path of the image (e.g. `uploads/tattoos/photo.jpg`).
- **Response Format**: JSON
  ```json
  {
    "success": true,
    "message": "File deleted successfully",
    "path": "uploads/tattoos/1726754000_photo_a1b2c3d4.jpg"
  }
  ```

### 3. Image Delivery & Caching
- **Accessing Images**: Images are publicly accessible over HTTPS via the returned `url`.
- **Caching**: 1-year immutable browser caching (`Cache-Control: max-age=31536000, public, immutable`).
- **CORS**: Enabled (`Access-Control-Allow-Origin: *`).

## Machine-Readable Specs
- OpenAPI 3.0: `https://images.tegegn.com.et/openapi.json` or `https://images.tegegn.com.et/docs.php?format=openapi`
- LLM Text Format: `https://images.tegegn.com.et/llms.txt` or `https://images.tegegn.com.et/docs.php?format=markdown`
