mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
docs: section-prefix tool API endpoints
This commit is contained in:
+4
-4
@@ -235,13 +235,13 @@ Two-phase workflow: analyze (detect face + remove background) then generate (cro
|
||||
|
||||
### Phase 1: Analyze
|
||||
|
||||
`POST /api/v1/tools/passport-photo/analyze`
|
||||
`POST /api/v1/tools/image/passport-photo/analyze`
|
||||
|
||||
Accepts an image file (multipart). Returns face landmark data, a base64 preview, and image dimensions.
|
||||
|
||||
### Phase 2: Generate
|
||||
|
||||
`POST /api/v1/tools/passport-photo/generate`
|
||||
`POST /api/v1/tools/image/passport-photo/generate`
|
||||
|
||||
Accepts a JSON body with the Phase 1 results plus generation settings:
|
||||
|
||||
@@ -370,7 +370,7 @@ Fixes "fake transparent" PNGs where the background was removed but left behind f
|
||||
| `removeWatermark` | boolean | `false` | Apply watermark removal pre-processing (median filter) |
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/transparency-fixer \
|
||||
curl -X POST http://localhost:1349/api/v1/tools/image/transparency-fixer \
|
||||
-H "Authorization: Bearer <token>" \
|
||||
-F "file=@fake-transparent.png" \
|
||||
-F 'settings={"defringe":30,"outputFormat":"png"}'
|
||||
@@ -401,7 +401,7 @@ Analyzes the image and applies automatic corrections for exposure, contrast, whi
|
||||
| `corrections.denoise` | boolean | `true` | Apply denoising |
|
||||
| `deepEnhance` | boolean | `false` | Enable AI noise removal via SCUNet (requires `upscale-enhance` bundle) |
|
||||
|
||||
An additional analysis endpoint is available at `POST /api/v1/tools/image-enhancement/analyze` which returns the detected corrections without applying them.
|
||||
An additional analysis endpoint is available at `POST /api/v1/tools/image/image-enhancement/analyze` which returns the detected corrections without applying them.
|
||||
|
||||
### Content-Aware Resize (Seam Carving)
|
||||
|
||||
|
||||
+21
-19
@@ -25,7 +25,7 @@ curl -X POST http://localhost:1349/api/auth/login \
|
||||
# Returns: {"token":"<session-token>"}
|
||||
|
||||
# Use token
|
||||
curl http://localhost:1349/api/v1/tools/resize \
|
||||
curl http://localhost:1349/api/v1/tools/image/resize \
|
||||
-H "Authorization: Bearer <session-token>"
|
||||
```
|
||||
|
||||
@@ -42,7 +42,7 @@ curl -X POST http://localhost:1349/api/v1/api-keys \
|
||||
# Returns: {"key":"si_<96 hex chars>","id":"...","name":"my-script"}
|
||||
|
||||
# Use the key
|
||||
curl http://localhost:1349/api/v1/tools/resize \
|
||||
curl http://localhost:1349/api/v1/tools/image/resize \
|
||||
-H "Authorization: Bearer si_<your-key>"
|
||||
```
|
||||
|
||||
@@ -87,19 +87,21 @@ Every tool follows the same pattern:
|
||||
|
||||
```bash
|
||||
# Single file
|
||||
curl -X POST http://localhost:1349/api/v1/tools/<toolId> \
|
||||
curl -X POST http://localhost:1349/api/v1/tools/<section>/<toolId> \
|
||||
-H "Authorization: Bearer <token>" \
|
||||
-F "file=@input.jpg" \
|
||||
-F 'settings={"width":800,"height":600}'
|
||||
|
||||
# Batch (returns ZIP)
|
||||
curl -X POST http://localhost:1349/api/v1/tools/<toolId>/batch \
|
||||
curl -X POST http://localhost:1349/api/v1/tools/<section>/<toolId>/batch \
|
||||
-H "Authorization: Bearer <token>" \
|
||||
-F "files=@a.jpg" \
|
||||
-F "files=@b.jpg" \
|
||||
-F 'settings={...}'
|
||||
```
|
||||
|
||||
`<section>` is one of `image`, `video`, `audio`, `pdf`, or `files`.
|
||||
|
||||
- Upload is `multipart/form-data`.
|
||||
- `settings` is a JSON string with tool-specific options.
|
||||
- **Fast tools** (200) return JSON: `{"jobId":"...","downloadUrl":"/api/v1/download/<jobId>/<filename>","originalSize":1234,"processedSize":567}`. Fetch the processed file from `downloadUrl`.
|
||||
@@ -331,7 +333,7 @@ All AI tools run on your hardware (CPU or NVIDIA GPU). No internet required.
|
||||
|
||||
Capture a webpage as an image. Unlike other tools, this endpoint accepts `application/json` instead of multipart form data (no file upload needed).
|
||||
|
||||
**Endpoint:** `POST /api/v1/tools/html-to-image`
|
||||
**Endpoint:** `POST /api/v1/tools/image/html-to-image`
|
||||
|
||||
**Content-Type:** `application/json`
|
||||
|
||||
@@ -348,7 +350,7 @@ Capture a webpage as an image. Unlike other tools, this endpoint accepts `applic
|
||||
**Example:**
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/html-to-image \
|
||||
curl -X POST http://localhost:1349/api/v1/tools/image/html-to-image \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"url": "https://snapotter.com", "format": "png", "devicePreset": "desktop"}'
|
||||
@@ -367,28 +369,28 @@ curl -X POST http://localhost:1349/api/v1/tools/html-to-image \
|
||||
|
||||
### Tool Sub-Routes
|
||||
|
||||
Some tools expose additional endpoints beyond the standard `POST /api/v1/tools/<toolId>`:
|
||||
Some tools expose additional endpoints beyond the standard `POST /api/v1/tools/<section>/<toolId>`:
|
||||
|
||||
| Method | Path | Description |
|
||||
|--------|------|-------------|
|
||||
| `POST` | `/api/v1/tools/remove-background/effects` | Apply background effects (color/gradient/blur/shadow) without re-running AI. Uses cached mask from initial removal. |
|
||||
| `POST` | `/api/v1/tools/edit-metadata/inspect` | Read existing EXIF/IPTC/XMP metadata from an image |
|
||||
| `POST` | `/api/v1/tools/strip-metadata/inspect` | Inspect metadata fields before stripping |
|
||||
| `POST` | `/api/v1/tools/passport-photo/analyze` | Phase 1: AI face detection + background removal. Returns face landmarks and cached data. |
|
||||
| `POST` | `/api/v1/tools/passport-photo/generate` | Phase 2: Crop, resize, and tile using cached analysis. No AI re-run. |
|
||||
| `POST` | `/api/v1/tools/gif-tools/info` | Get GIF metadata (frame count, dimensions, duration) |
|
||||
| `POST` | `/api/v1/tools/pdf-to-image/info` | Get PDF metadata (page count, dimensions) |
|
||||
| `POST` | `/api/v1/tools/pdf-to-image/preview` | Generate a preview of a specific PDF page |
|
||||
| `POST` | `/api/v1/tools/svg-to-raster/batch` | Batch convert multiple SVGs to raster |
|
||||
| `POST` | `/api/v1/tools/image-enhancement/analyze` | Analyze image quality and return enhancement recommendations |
|
||||
| `POST` | `/api/v1/tools/optimize-for-web/preview` | Lightweight preview for live parameter tuning. Returns optimized image with size headers. |
|
||||
| `POST` | `/api/v1/tools/image/remove-background/effects` | Apply background effects (color/gradient/blur/shadow) without re-running AI. Uses cached mask from initial removal. |
|
||||
| `POST` | `/api/v1/tools/image/edit-metadata/inspect` | Read existing EXIF/IPTC/XMP metadata from an image |
|
||||
| `POST` | `/api/v1/tools/image/strip-metadata/inspect` | Inspect metadata fields before stripping |
|
||||
| `POST` | `/api/v1/tools/image/passport-photo/analyze` | Phase 1: AI face detection + background removal. Returns face landmarks and cached data. |
|
||||
| `POST` | `/api/v1/tools/image/passport-photo/generate` | Phase 2: Crop, resize, and tile using cached analysis. No AI re-run. |
|
||||
| `POST` | `/api/v1/tools/image/gif-tools/info` | Get GIF metadata (frame count, dimensions, duration) |
|
||||
| `POST` | `/api/v1/tools/pdf/pdf-to-image/info` | Get PDF metadata (page count, dimensions) |
|
||||
| `POST` | `/api/v1/tools/pdf/pdf-to-image/preview` | Generate a preview of a specific PDF page |
|
||||
| `POST` | `/api/v1/tools/image/svg-to-raster/batch` | Batch convert multiple SVGs to raster |
|
||||
| `POST` | `/api/v1/tools/image/image-enhancement/analyze` | Analyze image quality and return enhancement recommendations |
|
||||
| `POST` | `/api/v1/tools/image/optimize-for-web/preview` | Lightweight preview for live parameter tuning. Returns optimized image with size headers. |
|
||||
|
||||
## Batch Processing
|
||||
|
||||
Apply any tool to multiple files at once. Returns a ZIP archive.
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:1349/api/v1/tools/compress/batch \
|
||||
curl -X POST http://localhost:1349/api/v1/tools/image/compress/batch \
|
||||
-H "Authorization: Bearer <token>" \
|
||||
-F "files=@a.jpg" \
|
||||
-F "files=@b.jpg" \
|
||||
|
||||
Reference in New Issue
Block a user