POST /v1/overlay
POST /v1/overlay is the only endpoint you need.
- Send
assetto bake the overlay into an image or video. - Omit
assetand sendwidth+heightto get a transparent PNG overlay only.
Request
Section titled “Request”Method: POST
URL: https://snapchat-text-overlay-api.com/v1/overlay
Content-Type: multipart/form-data
Form fields
Section titled “Form fields”| Field | Type | Required | Description |
|---|---|---|---|
asset | file | No | Image (JPEG, PNG, WebP) or video (MP4, MOV, WebM) |
width | number | Conditional | Required when asset is omitted |
height | number | Conditional | Required when asset is omitted |
text | string | * | Single caption text, max 180 characters |
overlays | string | * | JSON array of overlay objects |
Either text or overlays is required.
Overlays format
Section titled “Overlays format”[ { "text": "night one in miami", "position": 40 }, { "text": "second line", "position": 55 }]Response
Section titled “Response”The response body is:
- a rendered PNG or MP4 when
assetis present - a transparent PNG when
assetis omitted
Headers
Section titled “Headers”| Header | Description |
|---|---|
content-type | image/png or video/mp4 |
content-length | File size in bytes |
content-disposition | inline; filename="uuid.ext" |
x-render-id | Unique render identifier |
x-source-type | image or video |
x-render-duration-ms | Render time in milliseconds |
Examples
Section titled “Examples”TypeScript
Section titled “TypeScript”const form = new FormData();form.append("asset", fileInput.files[0]);form.append("text", "night one in miami");
const resp = await fetch("https://snapchat-text-overlay-api.com/v1/overlay", { method: "POST", headers: { "x-api-key": "snap_live_your_key" }, body: form});
const blob = await resp.blob();Python
Section titled “Python”import requests
with open("photo.jpg", "rb") as f: resp = requests.post( "https://snapchat-text-overlay-api.com/v1/overlay", headers={"x-api-key": "snap_live_your_key"}, files={"asset": f}, data={"text": "late checkout energy"} )
with open("rendered.png", "wb") as out: out.write(resp.content)curl -X POST https://snapchat-text-overlay-api.com/v1/overlay \ -H "x-api-key: snap_live_your_key" \ -F "asset=@photo.jpg" \ -F "text=late checkout energy" \ --output rendered.pngTransparent PNG mode
Section titled “Transparent PNG mode”curl -X POST https://snapchat-text-overlay-api.com/v1/overlay \ -H "x-api-key: snap_live_your_key" \ -F "width=1080" \ -F "height=1920" \ -F "text=hello from overlay mode" \ --output overlay.png