Api
LoLo BG Remover
Remove image backgrounds using LoLo from the App Store actions flow
LoLo BG Remover API
LoLo is exposed as dedicated app action endpoints:
POST /api/v1/apps/lolo
POST /api/v1/apps/lolo/batchIt accepts an image, runs background removal through the LoLo Rust microservice, and returns a transparent PNG.
Authentication and Org Scope
- Send
Authorization: Bearer <token>. - Organization is derived from the authenticated token (same model used by other app endpoints).
- Request is rejected if
lolo-image-toolsis not installed for the organization.
Request Formats
Multipart (recommended)
Content-Type: multipart/form-data with a file field.
Octet Stream
Content-Type: application/octet-stream with raw bytes and optional X-File-Name.
Query Parameters
| Parameter | Type | Allowed values |
|---|---|---|
model | string | u2net, u2netp, isnet-general-use, isnet-anime, silueta, u2net-human-seg |
quality | string | fast, balanced, high |
size | integer | 64..2048 |
Validation Rules
Validation is enforced in UI and server:
- Max upload bytes:
LOLO_MAX_UPLOAD_BYTES(default10MB) - Min dimensions:
LOLO_MIN_WIDTH/LOLO_MIN_HEIGHT(default64x64) - Max dimensions:
LOLO_MAX_WIDTH/LOLO_MAX_HEIGHT(default8192x8192) - Max pixels:
LOLO_MAX_PIXELS(default67,108,864) - Max files per batch request: hard limit
10(LOLO_MAX_FILES_PER_REQUEST, clamped to10) - Formats: PNG, JPEG, WebP
Successful Response
200 OKContent-Type: image/pngContent-Disposition: attachment; filename="<name>-bg-removed.png"
Metadata headers include:
X-LoLo-Source-Width,X-LoLo-Source-Height,X-LoLo-Input-BytesX-LoLo-Selected-Model,X-LoLo-Selected-Quality,X-LoLo-Selected-SizeX-LoLo-Model,X-LoLo-Inference-Ms,X-LoLo-Total-Ms,X-LoLo-Output-Bytes
Errors return JSON:
{ "error": "message", "code": 400 }Batch Endpoint
POST /api/v1/apps/lolo/batch- Use
multipart/form-dataand repeatfilesfields. - Returns
application/jsonwith one item per processed image. - Each item includes
image_base64(PNG), per-image metrics, selected options, andrequest_id. zip_filenameis returned for frontend bulk ZIP download naming.
cURL Example
curl -X POST "https://linkit.works/api/v1/apps/lolo?model=u2netp&quality=balanced&size=1024" \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "file=@/path/to/input.jpg" \
--output result.pngGo Client Example
package main
import (
"bytes"
"context"
"fmt"
"io"
"mime/multipart"
"net/http"
"os"
"time"
)
func removeBackground(ctx context.Context, baseURL, token, inPath, outPath string) error {
in, err := os.Open(inPath)
if err != nil {
return err
}
defer in.Close()
var body bytes.Buffer
writer := multipart.NewWriter(&body)
part, err := writer.CreateFormFile("file", "input.jpg")
if err != nil {
return err
}
if _, err = io.Copy(part, in); err != nil {
return err
}
if err = writer.Close(); err != nil {
return err
}
req, err := http.NewRequestWithContext(
ctx,
http.MethodPost,
baseURL+"/api/v1/apps/lolo?model=u2netp&quality=balanced&size=1024",
&body,
)
if err != nil {
return err
}
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Content-Type", writer.FormDataContentType())
client := &http.Client{Timeout: 45 * time.Second}
res, err := client.Do(req)
if err != nil {
return err
}
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
msg, _ := io.ReadAll(res.Body)
return fmt.Errorf("lolo failed: status=%d body=%s", res.StatusCode, string(msg))
}
out, err := os.Create(outPath)
if err != nil {
return err
}
defer out.Close()
_, err = io.Copy(out, res.Body)
return err
}For App Store actions UI, users can upload, control model/quality/size, preview output, and download the returned PNG directly.