Image block
A standalone image with an optional title row.
image renders a single image, from either a public URL (image_url) or a file in the workspace
(slack_file): exactly one of the two is required. Use it to show a screenshot, photo, or diagram
inline in a message, modal, or App Home surface. See Limits for its field
lengths.
Fields
typestring
Always image.
stringimage_url?string
A public URL to a GIF, JPEG, PNG, or BMP. Mutually exclusive with slack_file.
stringslack_file?{ id?: string; url?: string }
A file already uploaded to Slack, referenced by id or internal url. Mutually exclusive with image_url.
{ id?: string; url?: string }alt_textstring
A plain-text summary for screen readers. Doesn't render on screen.
stringtitle?PlainTextElement
A caption shown above the image. Plain text only; mrkdwn isn't supported.
PlainTextElementblock_id?string
A unique identifier, up to 255 characters.
stringExamples
Without a title
With no title, Slack still reserves the title row’s height for the expand caret, so the image sits
at the same vertical offset either way.
Hovering the image shows Slack’s actions in its top-right corner: Open in new window, and a
More actions menu with Copy link (copies the image URL) and Hide image (collapses it as
the caret does). They stay in the page: none of them calls onAction.
With a title
Slack files
This preview has no resolvers.slackFile, so it renders the alt-text fallback. With one, the file
shows like an image_url, at most 400 x 400:
<BlockKitProvider
resolvers={{
slackFile: (file) => (file.id ? { url: `/api/slack/files/${file.id}` } : undefined),
}}
>
Downloading a Slack file takes the bot token, so the URL slackFile returns is a route on your own
server, never Slack’s url_private and never a URL with a token in its query string. The route:
- Checks that the visitor may see the file, the way the rest of your app checks access.
- Looks the file up with
files.info(thefiles:readscope; the bot has to be able to see the file). - Fetches its
url_privatewith the bot token in anAuthorizationheader, only when that URL is onhttps://files.slack.com, and without following redirects. - Streams the body back if it’s an image, with your own cache headers.
The examples include this route for
Next.js and Hono. A payload whose slack_file only has a url carries the file id in it (F… after
the team id), so slackFile can pass that on instead.
