---
title: "Export an image"
method: POST
path: "/exports/image"
tags: ["Exports"]
---

# Export an image

`POST /exports/image`

## Request

- Base URL: `https://api.grapesjs.com/v1`
- URL: `https://api.grapesjs.com/v1/exports/image`
- Auth: HTTP bearer

Renders a saved project page, HTML, or URL as an image. The response contains the export immediately when ready, or a processing export that can be fetched later.

## Request body

- CreateImageExportRequest
  - `source` union, required
    - ProjectExportSource
      - `projectId` string, required
      - `filePath` string
    - HtmlExportSource
      - `html` string, required
    - UrlExportSource
      - `url` string, uri, required
  - `output` ImageExportOutput, required
    - `type` 'png' | 'jpeg' | 'webp', required
    - `width` integer: Width of the browser viewport in CSS pixels. This controls responsive layout, not the exported image width. Use imageWidth to set the output image width.
    - `height` integer: Height of the browser viewport in CSS pixels. If omitted while width is provided, it is calculated using a 16:9 aspect ratio.
    - `fullPage` boolean: When true, capture the full scrollable page instead of only the viewport.
    - `imageWidth` integer: Target output image width in pixels. When deviceScaleFactor is omitted, the image is scaled to this width without changing the viewport.
    - `quality` integer: Image compression quality. This has no effect on PNG output.
    - `omitBackground` boolean: When true, capture a transparent background where the selected image format supports it.
    - `deviceScaleFactor` number: Device pixel ratio used to render the image. Overrides imageWidth when both are supplied.
    - `scrollPage` boolean: When true, scroll through the page before capture to trigger lazy-loaded content.
    - `selector` string: CSS selector for the specific element to capture.
  - `isPrivate` boolean: When true, store the output privately and return a short-lived URL. Public output URLs do not expire.

## Response `201`

Export completed during the request

- ExportResponse
  - `export` Export, required
    - `id` string, required
    - `format` 'pdf' | 'image', required
    - `status` 'processing' | 'ready' | 'failed', required
    - `isPrivate` boolean, required: Whether the output is stored privately.
    - `source` union, required
      - ProjectExportSource
        - `projectId` string, required
        - `filePath` string
      - HtmlExportSource
        - `html` string, required
      - UrlExportSource
        - `url` string, uri, required
    - `output` union, required
      - PdfExportOutput
        - `pageFormat` 'A3' | 'A4' | 'A5' | 'Letter' | 'Legal'
        - `landscape` boolean
        - `printBackground` boolean
      - ImageExportOutput
        - `type` 'png' | 'jpeg' | 'webp', required
        - `width` integer: Width of the browser viewport in CSS pixels. This controls responsive layout, not the exported image width. Use imageWidth to set the output image width.
        - `height` integer: Height of the browser viewport in CSS pixels. If omitted while width is provided, it is calculated using a 16:9 aspect ratio.
        - `fullPage` boolean: When true, capture the full scrollable page instead of only the viewport.
        - `imageWidth` integer: Target output image width in pixels. When deviceScaleFactor is omitted, the image is scaled to this width without changing the viewport.
        - `quality` integer: Image compression quality. This has no effect on PNG output.
        - `omitBackground` boolean: When true, capture a transparent background where the selected image format supports it.
        - `deviceScaleFactor` number: Device pixel ratio used to render the image. Overrides imageWidth when both are supplied.
        - `scrollPage` boolean: When true, scroll through the page before capture to trigger lazy-loaded content.
        - `selector` string: CSS selector for the specific element to capture.
    - `outputFile` ExportOutputFile, required
      - `url` string, nullable, required
      - `expiresAt` string, date-time, nullable, required: Expiration time for a private output URL. Null for public outputs and outputs that are not ready.
      - `mimeType` string, nullable, required
      - `size` integer, nullable, required
    - `error` string, nullable, required
    - `completedAt` string, date-time, nullable, required
    - `createdAt` string, date-time, required

## Other responses

- `202`: Export is still processing
- `400`: Invalid request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Resource not found
- `500`: Server error

---

[API](https://skmtc.dev/grapesjs/apis/studio-platform-api.md) - [All operations](https://skmtc.dev/grapesjs/apis/studio-platform-api/llms.txt) - [OpenAPI document](https://skmtc.dev/grapesjs/apis/studio-platform-api/revisions/acc4ffe35e2d?raw)
