---
title: "Crop an image"
method: POST
path: "/api/crop-image"
tags: ["Images"]
---

# Crop an image

`POST /api/crop-image`

## Request

- Base URL: `https://api.sponsorunited.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.sponsorunited.com/api/crop-image`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/sponsorunited/apis/sponsorunited-api/docs/api/crop-image/post.ts> (a function with typed inputs; its response is checked against the schema)

Accepts a base64-encoded image, optionally duplicates it if shared across items, uploads the cropped version to S3, and updates the image record.

## Request body

- CropImageRequest: Request schema for cropping an image
  - `file` string, required: Base64-encoded image data URI (must start with data:image/)
  - `type` string, nullable: The upload type category
  - `id` integer, nullable: The image ID
  - `item_image_id` integer, nullable: The item image ID (triggers duplication if image is used on multiple items)

## Response `200`

Updated image record

- object

## Other responses

- `422`: Validation error

---

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