---
title: "Before & After Image"
method: POST
path: "/api/v1/tools/before_after_image"
tags: ["Tools"]
---

# Before & After Image

`POST /api/v1/tools/before_after_image`

## Request

- Base URL: `https://pixly.app`
- URL: `https://pixly.app/api/v1/tools/before_after_image`
- Auth: one of:
  - HTTP bearer
  - OAuth 2 (authorization code, authorization URL `https://pixly.app/oauth/authorize`, token URL `https://pixly.app/api/oauth/token`, scopes: `tools`)

Free (no credits): one comparison image from a before and an after photo of the same place — e.g. an empty room and its virtual staging, a daylight shot and its dusk version, a room before and after a restyle. Side by side, stacked, or split by a line; original shape, square, 4:5 or 9:16. Write the labels in the user's language. Returns a finished image at once.

## Headers

- `Idempotency-Key` string

## Request body

- object
  - `beforeImageUrl` string: The BEFORE photo (e.g. the empty room, the daylight shot). Public https URL or data: URI; or beforeR2Path.
  - `beforeR2Path` string: Storage path of the before photo — the alternative to beforeImageUrl. For a Pixly result, its original photo is the job's source.
  - `afterImageUrl` string: The AFTER photo (e.g. the staged room, the dusk version). Public https URL or data: URI; or afterR2Path.
  - `afterR2Path` string: Storage path of the after photo — the alternative to afterImageUrl.
  - `layout` 'side' | 'stack' | 'vsplit' | 'diagonal': side = next to each other, stack = one above the other, vsplit = one frame split by a vertical line, diagonal = split by a slanted line.
  - `aspect` 'original' | '1:1' | '4:5' | '9:16': Shape of the image: original (follows the photos), 1:1 square, 4:5 Instagram post, 9:16 Stories/Reels.
  - `labels` boolean: Show the Before / After labels.
  - `beforeLabel` string: Label text for the before photo, in the user's language (default "Before").
  - `afterLabel` string: Label text for the after photo, in the user's language (default "After").

## Response `200`

Finished inline — resultUrls present (photo tools)

- Job
  - `jobId` string, required: Job id — pass to get_job to poll
  - `type` 'image_staging' | 'video_pair' | 'video_tour', required: Job family
  - `status` 'pending' | 'processing' | 'completed' | 'failed', required: Anything not completed/failed is still running
  - `creditsCharged` number, nullable, required: Credits debited for this job
  - `createdAt` string, date-time, required: Submission time
  - `completedAt` string, date-time: Present once finished
  - `resultUrls` string[]: Presigned download URLs (present when completed; valid 7 days)
  - `resultPaths` string[]: Storage path of each result, in resultUrls order — pass one as r2Path (or beforeR2Path, a photos[] item…) to run another tool on this result
  - `error` string: Failure reason; the message says whether the credit came back immediately or is in 24h refund review
  - `note` string: Hint for agents, e.g. poll again in a few seconds

## Other responses

- `202`: Accepted and running — poll GET /api/v1/jobs/{id} (video tools)
- `401`: Missing/invalid credential
- `402`: Out of credits, or no active subscription (error.required = credits needed) — POST /api/v1/checkout returns a payment link
- `409`: A request with the same Idempotency-Key is still running — retry in a few seconds for its result
- `410`: Source photo no longer available — re-upload
- `422`: Invalid input — error.issues lists the offending fields
- `429`: Rate limited — see Retry-After (120 req/min, 30/min for generations)

---

[API](https://skmtc.dev/pixly/apis/pixly-api.md) · [All operations](https://skmtc.dev/pixly/apis/pixly-api/llms.txt) · [OpenAPI document](https://skmtc.dev/pixly/apis/pixly-api/revisions/6f1aae1786ea?raw)
