---
title: "Replace the sky in an exterior photo"
method: POST
path: "/api/sky_blue"
tags: ["Image enhancement"]
---

# Replace the sky in an exterior photo

`POST /api/sky_blue`

## Request

- Base URL: `https://app.pedra.ai`
- URL: `https://app.pedra.ai/api/sky_blue`
- Auth: none required

Swaps a dull or overcast sky for a chosen style. Costs 1 credit. Responds in ~10s.

## Request body

- object
  - `apiKey` string, required: Account API key, sent in the request body. Get one at https://app.pedra.ai under Settings → API.
  - `imageUrl` string, required: A publicly accessible HTTPS image URL or a base64 data URI (`data:image/png;base64,...`). Remote URLs are fetched within ~20s; use base64 for auth-walled or short-lived presigned URLs.
  - `skyStyle` 'sunny' | 'sunny-no-reflections' | 'sunrise' | 'dawn' | 'night': Target sky look.
  - `preserveAspectRatio` boolean: By default, the output comes back at whatever size the AI model produces, which may not match the aspect ratio or resolution of your photo. Set to true to get the result at the exact width and height of the input image: it is center-cropped to the original aspect ratio (never stretched) and resized to the original resolution.
  - `propertyId` string: Optional id of the property (from /api/list_properties or /api/create_property) this photo/video belongs to. When set, the result is saved into that property's gallery (or, for create_video, its Videos tab) — visible and editable from the app — instead of only being returned as a URL.
  - `name` string: Optional name for the original photo (e.g. its file name). Requires `propertyId`. If the photo isn't in that property yet, it is saved there under this name in the same call (no need to call add_images_to_property first) and returned as `source.name`. A photo already in the property keeps its current name. Never drawn on the image.

## Response `200`

Success. `output` is a single generated image.

- ImageObjectResult: Success response whose `output` is a single result image.
  - `message` string
  - `output` object
    - `url` string: URL of the generated image.
  - `source` object: The original photo this result was made from. Present when `propertyId` was sent and the input photo is already in that property, or when `name` was sent too (the photo is then saved into the property).
    - `imageId` string
    - `name` string, nullable

## Other responses

- `400`: Invalid request — bad or unreachable image URL, missing required field, or validation error.
- `403`: Not enough credits for the requested generation.
- `404`: Missing, invalid, or revoked API key.
- `405`: Wrong HTTP method — all endpoints accept POST (credits also accepts GET).

---

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