Hi,
Is it possible to upload a bulk of tags for existing blogposts?
If I go to settings and upload blogposts (CSV), than I also have to upload content.
I only want to upload tags for all blogposts.
Thanks!
Leanne
Hi,
Is it possible to upload a bulk of tags for existing blogposts?
If I go to settings and upload blogposts (CSV), than I also have to upload content.
I only want to upload tags for all blogposts.
Thanks!
Leanne
Hello @Afd-mark
You can do this using the HubSpot API or by using a third-party tool that integrates with HubSpot.
Using the API, you can use the Blog Posts API to update the tags for multiple blog posts at once. Here’s an example API call in Python:
import requests
import json
# Set up authentication credentials
api_key = 'YOUR_API_KEY'
headers = {'Authorization': 'Bearer ' + api_key}
# Set up data for API call
post_id_list = [123, 456, 789] # list of blog post IDs to update tags for
tag_list = ['tag1', 'tag2', 'tag3'] # list of tags to add to blog posts
# Loop through blog post IDs and add tags
for post_id in post_id_list:
url = f'https://api.hubapi.com/blogs/v3/blog-posts/{post_id}/tags'
data = {'tags': tag_list}
response = requests.put(url, headers=headers, json=data)
if response.status_code == 200:
print(f'Successfully updated tags for blog post {post_id}')
else:
print(f'Error updating tags for blog post {post_id}: {response.text}')
Alternatively, you can use a third-party tool like Excel or Google Sheets to update the tags in bulk by exporting your blog posts as a CSV file, adding a new column for tags, and then re-importing the CSV file with the updated tag information. When you re-import the CSV file, make sure to map the tags column to the appropriate field in HubSpot (in this case, the “tags” field for blog posts).
Mentioend api Endpoint returns “Request failed with status code 404”. Can you share documentation link to refer request payload and endpoint.