Skip to main content

Documentation

Home Getting Started User Guides API Reference Image Processing Integration Guides Best Practices Resources Support AI Integration Playground URL Builder

Quickstart

On This Page

Upload an image once, then transform it on the fly via its URL. This page gets you from zero to a working transformed image in a few minutes — with curl and with the official SDK — and ends with a copy-pasteable agent recipe.

You need an API key (vc_live_...) and your subdomain. Don't know your subdomain? Ask the API: GET /api/v1/whoami (see step 0 of the recipe).

curl

cURL
# 1. Upload (multipart; field name "image" or "file")
curl -X POST "https://<subdomain>.viucraft.com/upload" \
  -H "X-API-Key: vc_live_..." \
  -F "image=@photo.png"

Real 201 Created response:

JSON
{
  "image_id": "550e8400-e29b-41d4-a716-446655440000",
  "url": "https://<subdomain>.viucraft.com/550e8400-e29b-41d4-a716-446655440000.png",
  "filename": "photo.png",
  "folder": "/",
  "metadata": { "width": 1200, "height": 800, "format": "png", "file_size": 528421, "color_space": "srgb", "has_alpha": false },
  "created_at": "2026-06-16T09:44:35+00:00",
  "storage": { "used": 235748582, "limit": 21474836480, "used_percent": 1.1 }
}

image_id is the permanent handle — store it. (Field-by-field reference.)

cURL
# 2. Transform on delivery (no second API call — the URL IS the transform)
curl "https://<subdomain>.viucraft.com/resize-800-600/sharp-1.2/q-85/550e8400-e29b-41d4-a716-446655440000.webp" -o out.webp

# 3. Delete when done
curl -X DELETE "https://<subdomain>.viucraft.com/api/images/550e8400-e29b-41d4-a716-446655440000" \
  -H "X-API-Key: vc_live_..."   # -> 204 No Content

The extension is mandatory on delivery URLs. Full grammar: Delivery & Transform URL Grammar.

SDK (viucraft)

cURL
npm install viucraft
Ts
import { ViucraftClient } from "viucraft";

const client = new ViucraftClient({ apiKey, subdomain });   // built-in auth, timeout, 429-retry

const { image_id } = await client.images.upload(blob);      // Blob | File

const url = client.image(image_id)
  .resize(800, 600)
  .setFormat("webp")                                        // handles the mandatory extension
  .toURL();
// -> https://<subdomain>.viucraft.com/resize_width_800_height_600/<image_id>.webp

await client.images.delete(image_id);                       // 204

Zero-dependency, typed, dual ESM+CJS, Node ≥18. Source: https://github.com/BStorm-IT/viucraft-js

Agent recipe (whoami → upload → build URL → delete)

A complete, dependency-free flow for an autonomous agent. Discover the tenant first so URLs can be built without a human.

cURL
KEY="vc_live_..."

# 0. Who am I? Learn your subdomain + capabilities from just the key.
WHO=$(curl -s "https://api.viucraft.com/api/v1/whoami" -H "X-API-Key: $KEY")
SUB=$(echo "$WHO" | python3 -c "import sys,json;print(json.load(sys.stdin)['subdomain'])")
BASE="https://$SUB.viucraft.com"

# 1. Upload
ID=$(curl -s -X POST "$BASE/upload" -H "X-API-Key: $KEY" -F "image=@photo.png" \
     | python3 -c "import sys,json;print(json.load(sys.stdin)['image_id'])")

# 2. Build a transform URL (pure string assembly — no API call)
URL="$BASE/resize-1200-630/q-82/$ID.webp"
echo "Open Graph image: $URL"

# 3. Clean up
curl -s -X DELETE "$BASE/api/images/$ID" -H "X-API-Key: $KEY"

AI agents can also drive this over MCP — see MCP Server for the whoami / upload_image / transform_image / delete_image tools.

Next

Was this helpful?

On This Page