Tags | Integrations | API |
Overview
The Stack Overflow API includes a number of write-capable endpoints. These endpoints alter your data, and should be used with extra care.
Write-access tokens
When you create API access tokens in Stack Overflow for Teams Enterprise (SOE) or Teams Business, you can give them write permissions. This allows the API token to submit questions and answers, vote, edit content, and more.
These tokens have access to the same data as the user that authenticated them, and they write and edit data as that user. For this reason, don't share your write-enabled API tokens with other users.
NOTE: Teams Basic offers read-only access, and cannot write data with the API.
Learn more about API write access and authentication:
API v3
Interactive API v3 documentation at https://[your_site]/api/v3
API v2.3
Documentation on your site at https://[your_site]/api/docs
Adding content by API
Stack Overflow for Teams users can use the write-enabled API v3 to add content to their site, but should proceed with caution when adding it automatically. Adding content with API automation requires extra care because the results can feel machine-generated or otherwise out of place. This may cause users to ignore new API-generated content and potentially lose engagement.
Examples of API integrations that may have detrimental effects on engagement include:
Adding all entries from some other system (like an error logger or chat system) as new questions on your Stack Overflow for Teams site.
Allowing users to add new questions through a different interface or site, without an understanding of the Stack Overflow for Teams site itself or how the content will appear.
Automatically posting the same boilerplate text as an answer to all questions.
All content on your site should feel appropriate and relevant, especially content added by API. To this end, we recommend write API integrations honor the following guidelines:
Require an explicit user action before posting any new content.
Ensure that users understand where their content/contributions will be posted.
Never use API automation to add the same content with every new post.
Be sure to contact your site administrator to discuss your objectives and planned implementation before using the API's write capabilities.
HTML decoding for write operations
When reading or writing a post, the API applies HTML encoding to the body and body_markdown data. This renders symbols such as the quote character into " and the > character into >. This encoding rarely affects simple text posts, but it can have a negative impact on complex posts with links, lists, and special symbols.
It's important to remember HTML encoding when using the API to update content by reading data, editing the data, and writing the data back by API. The API encodes HTML entities during the read operation and the write operation. Be sure to perform an HTML decode after the initial read, or entities will be double-encoded. Double-encoded HTML entities (such as ") will often break the display of the post.
Need help? Submit an issue or question through our support portal.