Skip to main content
Write API

How to use the API to write data.

Joel Bradley avatar
Written by Joel Bradley
Updated over 3 weeks ago

Tags | Integrations | API |

Applies to: Enterprise

This documentation is for Stack Overflow for Teams Enterprise. Free, Basic, and Business users can access their documentation here. Find your plan.


Overview

In both API v2 and API v3, Stack Overflow Enterprise (SOE) includes a number of write-capable endpoints. These endpoints alter your data, and should be used deliberately and carefully.

Authentication

The Stack Overflow Enterprise API offers user authentication via OAuth 2.0 for read-write access. There are two flows: an explicit grant for server-side applications, and an implicit flow for browser-based access.

You can access API documentation, including authentication details, with the following links:

API v2.3

API v3

  • Interactive API v3 documentation at https://[your_site]/api/v3

Creating and deploying any write-capable API integration is at your own risk. We encourage you to first contact your site administrator to discuss your objectives and planned implementation. Note also that the site credits all API write actions to the user that the API key belongs to, so don't share your write-enabled API key with other users.

Adding content by API

Content added with API automation can feel machine-generated or otherwise out of place, and may cause users to lose connection and stop contributing.

Examples of API integrations that may have detrimental effects on engagement include:

  • Adding all entries to some other system (like an error logger or chat system) as new "questions" on the site.

  • Allowing users to add new questions without their understanding of the system or where content will end up.

  • 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 API integrations that ensure users understand where their content/contributions will be posted and require an explicit user action before posting.

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 especially important to remember HTML encoding when using the API to update a post by reading, editing, and writing. Since the API encodes HTML entities during the read operation and the write operation, entities will be double-encoded if you don't perform an HTML decode after the initial read. Double-encoded HTML entities (such as ") will often break the display of the post.


If you need further support or have questions, contact your site administrator.

Did this answer your question?