Skip to content
⌘K
InboxNew request

How to upload images to help center articles using the API

Updated by Plain

Upload the file with createWorkspaceFileUploadUrl, then reference it in the article's contentHtml with the data-workspace-file-id attribute. Plain fills in the src URL.

  1. Call createWorkspaceFileUploadUrl with visibility: PUBLIC. The mutation returns a workspaceFileId, a presigned uploadFormUrl and a set of uploadFormFields.
  2. Make a multipart POST to the uploadFormUrl. Add all returned uploadFormFields as form fields first, then your file as the file field last. A successful upload returns HTTP 204.
  3. In your upsertHelpCenterArticle call, add an <img> tag to contentHtml with data-workspace-file-id instead of src.
<img data-workspace-file-id="wf_01ABC123" alt="Description of image" />

When the article is saved, Plain moves the file to public storage. Once published, the image is served from a stable public URL that does not expire.

Why createWorkspaceFileDownloadUrl returns a 403

You do not need createWorkspaceFileDownloadUrl. It returns a signed URL for the file while it is still pending. A file only becomes public once an article references it with data-workspace-file-id, so using the download URL as an img src will always return a 403.

Limits

  • Maximum file size: 50 MB
  • Supported formats: JPEG, PNG, GIF, WebP, SVG

Self-hosted images

You can also use standard <img src="https://..."> tags in contentHtml to host images yourself. Plain does not restrict or proxy external image URLs, and no content security policy blocks them in the published help center.