Restory
Agent API DocsSections and machine-readable references

Recipes

Agent Recipes

Copy-ready commands and request shapes for photo restoration, image generation, video generation, uploads, and polling.

Photo restoration

Use the CLI for local image files. Agents should submit the job, capture `imageRecordId`, and poll until completed.

restory restore --method fast --file ./old-photo.jpg
restory jobs:get <imageRecordId> --type image

Direct API clients can call the matching endpoint with an uploaded URL or a small data URL.

POST /api/restore-photo
Authorization: Bearer rst_...
Content-Type: application/json

{
  "imageUrl": "https://restory.b-cdn.net/images/user/photo.jpg",
  "originalFileName": "old-photo.jpg"
}

Image generation

Use current capability discovery before choosing model, resolution, aspect ratio, quality, or reference-image settings.

restory image:generate \
  --prompt "clean ecommerce hero image for a skincare product" \
  --model nano-banana-2 \
  --resolution 2K \
  --aspect-ratio 4:5
restory jobs:get <imageRecordId> --type image
POST /api/generate-image
Authorization: Bearer rst_...
Content-Type: application/json

{
  "prompt": "clean ecommerce hero image for a skincare product",
  "modelSlug": "nano-banana-2",
  "resolution": "2K",
  "aspectRatio": "4:5"
}

Video generation

Video generation is queued. Return the video record ID immediately, then poll for completed playback URLs.

restory video:generate \
  --prompt "slow cinematic push in, soft daylight" \
  --model seedance-2-0 \
  --image ./restored.jpg \
  --duration 8
restory jobs:get <videoRecordId> --type video
POST /api/generate-video
Authorization: Bearer rst_...
Content-Type: application/json

{
  "prompt": "slow cinematic push in, soft daylight",
  "modelSlug": "seedance-2-0",
  "imageUrl": "https://restory.b-cdn.net/images/user/restored.jpg",
  "duration": "8"
}

Upload references

Upload local references first when an endpoint needs reusable image, video, or audio URLs.

restory upload --type image --file ./reference.jpg
POST /api/upload-reference-media
Authorization: Bearer rst_...
Content-Type: multipart/form-data

file=<binary>
type=image

Poll results

Never assume generation is synchronous. Poll by type and use the returned `resultUrl` or media URL once status is completed.

restory jobs:get <imageRecordId> --type image
restory jobs:get <videoRecordId> --type video
restory gallery:list --type image --status completed --limit 10