---
title: "Upload a picture (JPEG, PNG, WebP, GIF, AVIF or SVG, at most 10 MB) as the request body. Raster pictures become WebP files at three widths without metadata; an SVG is cleaned of scripts and outside references. A member may add 40 pictures per 10 minutes (a site 120 per hour), two at once; 429 with Retry-After past that or while the server is busy with other pictures"
method: POST
path: "/builder/sessions/{sessionId}/assets"
tags: ["Builder"]
---

# Upload a picture (JPEG, PNG, WebP, GIF, AVIF or SVG, at most 10 MB) as the request body. Raster pictures become WebP files at three widths without metadata; an SVG is cleaned of scripts and outside references. A member may add 40 pictures per 10 minutes (a site 120 per hour), two at once; 429 with Retry-After past that or while the server is busy with other pictures

`POST /builder/sessions/{sessionId}/assets`

## Request

- Base URL: `https://hostingsurge.com/api/v1`
- URL: `https://hostingsurge.com/api/v1/builder/sessions/{sessionId}/assets`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `__Host-hs_session`

## Path parameters

- `sessionId` string, uuid, required

## Query parameters

- `filename` string
- `alt` string

## Response `201`

Stored

- object
  - `uploadId` string, uuid, required
  - `src` string, required: The picture's address on the site, e.g. /assets/team-3f2a9c1d.webp
  - `width` integer, required
  - `height` integer, required
  - `alt` string, nullable, required
  - `source` 'upload' | 'openverse' | 'ai', required
  - `license` object, nullable, required
  - `variants` object[], required
    - `src` string, required
    - `width` integer, required
  - `createdAt` string, required: ISO-8601 timestamp

## Other responses

- `400`: Invalid request (code invalid_request; details.reason: invalid, unmappable, not_found, secret_detected, unsupported, too_large, unreadable)
- `401`: Missing or invalid session/token (code unauthorized)
- `403`: Authenticated but not permitted (code forbidden)
- `404`: Not found or not visible to the caller (code not_found)
- `409`: Refused for now (code conflict; details.reason: turn_running while the AI changes the site, stale when the files changed since the editor loaded them (details.version: the current one), previewing_version, archived, in_use)
- `413`: Too large
- `429`: Too many changes at once (code rate_limited); see Retry-After
- `501`: Not available on this server (code not_configured)

---

[API](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api.md) · [All operations](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hostingsurge/apis/hostingsurge-platform-api/revisions/4d08337cdff1?raw)
