How can I add the alt-Texts for Images over the api?
Hi, @Torsten_Utz
Thanks for your question. The documentation does not provide a method to do this via our Files API. This has to be set in-app via the Files Manager. Hey @Anton @Jnix284 @alyssamwilie am I missing an option here?
Thank you! — Jaycee
@Jaycee_Lewis @Torsten_Utz I’m not aware of a solution via API, only directly in the File Manager or when it’s used as an asset on a website page the most of the modules have overwrites for the alt text.
Hey @Jnix284 just want to confirm that there is still no solution via the Files API for setting the alt text on images.
Hey @LMacKenzie4,
Thanks for following up here!
I’m also re-tagging @Jnix284 for visibility.
Shane, Senior Community Moderator
Thanks for the flag @STierney, happy to help @LMacKenzie4 !
TL;DR correct, still not possible.
Here’s the answer from our Docs Assistant (super helpful for nuanced questions like this):
Based on my review of the Files API guide and the OpenAPI spec, the Files API does not support setting alt text on images. The API handles file upload, replacement, privacy settings, and metadata like name, size, and encoding — but alt text is not among the available properties. Alt text for images is typically managed within the content tools (e.g., CMS pages, emails) where the image is used, not at the file level.
Thanks for help @Jnix284
— Jaycee
Hey @Torsten_Utz,
never tried this since - as @Jnix284 mentioned correctly - the Alt-text most like will be overwritten/handled on page-level while editing the page so it’s quite uncommon to provide it in the file-manager, but this shouldn’t mean it’s not reasonable. You can try editing your API call like this:
{
"extension": "string",
"access": "PUBLIC_INDEXABLE",
"parentFolderId": "string",
"encoding": "string",
"type": "string",
"isUsableInContent": true,
"url": "string",
"expiresAt": 0,
"createdAt": "2025-01-27T23:45:15.324Z",
"archivedAt": "2025-01-27T23:45:15.324Z",
"archived": true,
"path": "string",
"size": 0,
"name": "string",
"width": 0,
"id": "string",
"defaultHostingUrl": "string",
"updatedAt": "2025-01-27T23:45:15.324Z",
"height": 0,
"options": {
"alt": "Your alt text description here"
}
}
hope this helps,
best,
Anton
This is awesome @Anton, I’m excited to see that there is a way to manage alt tags via the API ![]()
![]()
![]()
Hello @Anton,
I tried it via the nodejs client. And it does not add the alt-Text to the images.
Thats the code I used:
const options = { access: "PUBLIC_INDEXABLE", overwrite: true, duplicateValidationStrategy: "NONE", alt: "ALT-TEXT", }; try { const apiResponse: HubSpotUploadFileResponse = await this.hubSpotClient.files.filesApi.upload(file, undefined, urlPre + folderpath, file.name, undefined, JSON.stringify(options), undefined); console.log("uploaded file: " + folderpath + "/" + file.name); return apiResponse; } catch (e) { throw e; }
Am I doing something wrong?