Prepare an image upload
Prepares the upload of one local image (PNG, JPEG, WebP, GIF or HEIC, at most 15 MB; no SVG) for a Help Center article, a changelog or a post. A HEIC photo (iPhone) is stored as JPEG, or PNG when it has transparency.
- Call this with the file name, the real
contentTypeand the exactsizein bytes. - Send the file with one PUT to
uploadUrlwithin 10 minutes, with the returnedheaders.curlCommanddoes it: replace<path>with the file path. No API key is needed for the PUT: the URL is the credential. A browser can send the PUT from any origin, so your server can prepare the upload and give onlyuploadUrlandheadersto your page. Never send your API key to a browser. - The PUT answers
{ key, imgHtml }. PutimgHtml(<img src="" data-featurebase-content-key="…">) into an article body (formatter: 'raw'or'default'), a changelog'shtmlContentor a post'scontentwithin 24 hours. Saving moves the image into that article, changelog or post.
One file per upload. Never send the image as base64 in a body.
PUT errors: 403 the token is not valid · 404 no such upload · 409 the file was already sent · 410 the URL expired (prepare again) · 411 no Content-Length · 400 the size is not the declared size · 413 larger than declared · 415 the Content-Type header or the bytes are not the declared image type (SVG is refused) · 400 a HEIC photo that cannot be converted · 429 too many uploads · 503 try again.
Body
The real type of the image. The bytes are checked against it. SVG is not accepted. A HEIC photo (image/heic, iPhone) is stored as JPEG, or PNG when it has transparency.
image/png, image/jpeg, image/webp, image/gif, image/heicimage/pngThe file name, e.g. billing-settings.png. Only used for the stored name.
1 - 200billing-settings.pngResponse
Created
The PUT as a curl command. Replace <path> with the local file path and run it in a shell.
curl -sS -X PUT --data-binary @<path> -H 'Content-Type: image/png' 'https://do.featurebase.app/v2/uploads/…'Still need help? Ask the team