ServiceNow Communities API GuideSummaryThis article contains the features of the APIs for the Communities and guides the user how to use the end points APIs. 1) How to create a post/blog on communities using APIs end point via Rest Api Explorer or any third party application (postman) : In REST API Explorer, navigate to: Namespace sn_communities API Name Community Version v1 Endpoint Forums – Post content of given content type in query parameter (POST) 📍 Below endpoint is used to create content such as Questions and Blogs.🔗 API Endpoint: POST /api/sn_communities/v1/community/forums/{forum_id}/contents?content_type={ContentTypeName}Example:🔷 Question → ?content_type=Question🔷 Blog → ?content_type=Blog🔷 The forum_id should be passed in the path parameter, as shown in REST API Explorer.💡 Required Request Payload:Please include the following fields in the request body:title,description,forum_id,topics,content_typeExample Payload for Blog content type:{"title": "Your Blog Title","description": "Your detailed blog content goes here.","forum_id": "0090493d87848732172005d1254022244b016","topics": ["lpo909032172005d125g653678e87244b0e7"],"content_type": {"name": "Blog","value": "g9089aa0dbd26600b1f6673678eaf96192e"}}⚡️ Topic Mapping Behavior:The mapping between content and Topics is handled automatically during content creation.The topics field accepts an array of Topic sys_id values."topics": ["lpo909032172005d125g653678e87244b0e7"]🚨 Important Validations:Please ensure the following:👉 The forum_id in the payload matches the one used in the endpoint path👉 The content_type query parameter matches content_type.name👉 The content_type.value contains the correct content type sys_id🤝 Example content type values:Question → 5a2fcaa0dbd26600b1f6f78eaf9619a8 →(sys_id)Blog → cc3fcaa0dbd26600b1f6f78eaf96192e →(sys_id) ‼️ Role Required for the user to in order for the APIs to work : sn_communities.community_user role ❓ When the user creates the post via Postman or any other third party application, we often encounter an error - "Sorry, the content you are trying to view is currently unavailable."⚡️ When a user creates a post, the system stores the creator’s profile details, which are later displayed in the community post (ex: “Created by XXX”).If the post is created by a user who does not have a valid community profile record (sn_community_profile), the page is unable to fetch the required user details, which leads to the error you are currently seeing. ⚡️ The sn_community_profile record is automatically created when a user accepts the Terms & Conditions upon their first login to the community portal. Only after accepting the Terms & Conditions will the user have an active community profile, which is required to create and display posts.⚡️ If the Terms & Conditions step is bypassed, the community profile is never created, and any post made by that user will fail to display correctly, as the profile details needed to render the post are missing. ⚡️ Additional check : Test this using a proper community user account that has the sn_communities.community_user role along with both sn_communities_profile and live_profile records.Alternatively, you may also test using the same user account that was used in the ServiceNow REST API Explorer. -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------2) Can we put in Images, HTML tables within the body of the payload?🎯 Yes - fully supported OOB.The body/description field for Blog, Question, Video, and Event content types is of type "translated_html", which natively stores and renders HTML content.📍 For Images - How it actually works (two-step process): The OOB portal does NOT simply pass an image URL in the body HTML. It uses a two-step process involving a community-specific processor and an "imageArray" mechanism. The image must be uploaded first, and then the returned sys_id is used in the content creation payload.⭐️ Step 1 - Upload the image via Community Processor:The community application has its own processor endpoint for uploading images:POST : https://<instance>/sn_communities_processor.do?sysparm_type=ngk_attachments&sys_id=-1&table=kb&action=add&doc_check=falseThis is a Java-based processor that handles community-specific attachment validations such as file type checks, file size limits, and virus scanning.The request must be sent as a multipart/form-data POST (NOT JSON). The image file is sent as binary data in the form field named "attachFile".‼️ Query parameters on the URL: sysparm_type=ngk_attachmentsTells the processor this is a community attachment uploadsys_id=-1Indicates this is a temporary/orphaned attachment (not yet linked to any content)table=kbThe image is initially stored as an attachment on the kb table as a temporary locationaction=addUpload actiondoc_check=false Not a document upload ‼️ Form fields (all sent as multipart form-data parts): attachments_modified "true" (Text field)sysparm_table"kb" (Text field - target table for temporary storage)sysparm_sys_id "-1" (Text field - temporary record ID)sysparm_nostack"yes" (Text field)sysparm_encryption_context "" (Text field - leave empty)sysparm_ck "<user_token>" (Text field - CSRF token from the user session)attachFile<binary file> (File field - THIS IS WHERE THE ACTUAL IMAGE DATA GOES. 🔷 In Postman, set this field type to "File" and select the image file from your filesystem. The browser/client sends the raw binary content of the image in this field.)‼️ Required headers: Content-Type multipart/form-data (Postman sets this automatically when you select form-data body type)X-File-Extensionpng (or jpg, gif, jpeg, etc. - must match the actual file extension of the uploaded image) The processor receives the binary image data from the "attachFile" field, performs community-specific validations, creates a sys_attachment record on the platform with the image content, and returns a JSON response containing the sys_id of the created attachment record.🎯 Response example:{"sys_id":"790999086ibgdff2043106a7fffffffffff5b","content_type":"image/png","file_name":"filename.png"}⭐️ Step 2 - Use the returned sys_id in the content creation POST:The sys_id from Step 1 is used in TWO places in the content creation request:a) In the body HTML - reference the image using the .iix format:<img src="/<sys_id>.iix" style="max-width: 100%; max-height: 480px;"/>(Note: images use the ".iix" extension format which is a community-specific route that serves the attachment content)b) In the imageArray field - pass the sys_id so the server can re-link the attachment:"imageCheck": 1"imageArray": ["<sys_id>"]👉 Both are required:- The body HTML with /<sys_id>.iix is what renders the image when the post is displayed- The imageArray tells the server to re-link the attachment from the temporary location (kb/-1) to the actual content record.⚙️ Sample Payload: {"title": "Your Title Here","description": "Your description here.","forum_id": "6ssb87e3369038dcdscrt5465465","topics": ["aed3e787273690389dedrgre3597"],"content_type": {"name": "Blog","value": "frt526600b1f6f78egtg6562e"},"body": "<p>Your blog content here.</p><img src='https://your-instance.service-now.com/sys_attachment.do?sys_id=YOUR_ATTACHMENT_SYS_ID' alt='Image description'/><table border='1'><thead><tr><th>Column 1</th><th>Column 2</th></tr></thead><tbody><tr><td>Row 1 Data</td><td>Row 1 Data</td></tr><tr><td>Row 2 Data</td><td>Row 2 Data</td></tr></tbody></table>"}------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3) What is the maximum length of a Forum post? The max length is defined at the dictionary level and enforced by the platform. It varies by content type: Content TypeTable NameField NameMax LengthData TypeBlogsn_communities_blogdescription10,000translated_htmlQuestionkb_social_qa_questionquestion_details65,000translated_htmlEventsn_communities_eventdescription10,000translated_htmlVideosn_communities_video_as_contentdescription10,000translated_htmlDocumentsn_communities_documentdescription2,000stringForum Descsn_communities_forumdescription4,000stringTopic Descsn_communities_topicdescription4,000string ‼️ Key points:👉 This is the raw character count including HTML markup - so if the body contains HTML tags, those count toward the limit.👉 There is no additional server-side validation in the REST API code; it is enforced at the database/dictionary level by the platform.👉 If the limit is exceeded, the platform will truncate or reject the insert. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4) Forum Subscribe/Unsubscribe with Activity Subscriptions API & New Post Notifications. There is subscribe button on the forums page and not the follow button.👉 When user clicks on the subscribe/unsubscribe the below APIs are invokedSubscribe to forum: POST/api/now/v1/actsub/subscriptions/{forum_sys_id}/subscribeBODY{"type": "6P09987823200ace49a661741"} 👉 Unsubscribe from forum: DELETE/api/now/v1/actsub/subscriptions/{forum_sys_id}/unsubscribeBODY{"type": "98IU898890ace49a661U798Dc4"} 👉 The type value "6P09987823200ace49a661741" is the "Forums" subscribable object type registered by Communities in sn_actsub_subscribable_object👉 The notification is sent for all the new post created in the forum to the subscribed users OOB, But that also depends on how a user's Notification and Subscriptions preferences are configured. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 🚨 Notes:1. Community Profile: The user making API calls must have a valid sn_communities_profile record. This is normally created when a user accepts Terms and Conditions on the portal.2. Live Profile: The user must have a live_profile record (used for activity subscriptions and subscriber identification).3. Role: The user must have the sn_communities.community_user role.🚀 Tip for exploring and testing the APIs :1. Open the Community portal on a dev/temp instance in Chrome/Any other browser.2. Open Developer Tools (right-click, Inspect), go to the Network tab.3. Filter by "Fetch/XHR" to only see API calls (hides CSS, JS, images, etc.).4. Perform the action on the portal (e.g. upload an image, post content, click Subscribe). Open the request to view what request it sent and what response the API got back from the server5. Right-click the network request, select "Copy as cURL".6. Import the cURL into Postman to see the exact request format and play around with it.