Tags | Integrations | API |
This documentation is for Stack Overflow for Teams Enterprise. Free, Basic, and Business users can access their documentation here. Find your plan.
Overview
NOTE: Though Stack Overflow still supports API v2.3, we encourage all users to migrate to the improved API v3. Learn more about API v3.
The Stack Overflow for Teams API enables you to interact with your Stack Overflow for Teams Enterprise (SOE) site programmatically with external scripts, reporting tools and automated workflows. For general information about API v2.3, including using the API to write data, throttling, and troubleshooting, read the API v2.3 Overview article.
In addition to these support articles, API v2.3 is fully documented on your SOE site at https://[your_site].stackenterprise.co/api/docs.
THIS ARTICLE APPLIES TO STACK OVERFLOW FOR TEAMS ENTERPRISE ONLY.
Other Stack Overflow for Teams users should read this article instead. Find your plan.
API v2.3 access and authentication
The base URL for API v2.3 calls is https://[your_site].stackenterprise.co/api/2.3. You'll need to authenticate each API call with an API key (read-only) or OAuth-generated access token (read/write). You can learn more about creating API keys and access tokens on your site at https://[your_site].stackenterprise.co/api/docs/authentication.
API documentation sandbox
The best way to learn how to use API v2.3 is through the API documentation sandbox. Start by accessing the Stack Overflow API v2.3 documentation at https://[your_site].stackenterprise.co/api/docs. The top of the page has general information about the API; further down the page you'll find the specific API endpoints (queries) you can access.
Click one of the endpoint links (for example: questions) to see more information about that API query. You can also access the documentation for a specific endpoint directly like this: https://[your_site].stackenterprise.co/api/docs/questions.
Scroll to the bottom of the page to the "Try It" area. You can use this tool to test out API v2.3 calls with your API access key.
Click Run and the API query should return question data, displayed beneath the API URL.
Use the additional "Try It" fields and pull-down menus to control the API query and the data it returns. You can also add other fields to the return data by clicking [edit] in the upper-right filter area. When you're done testing, you can use the generated URL as a starting point for creating your own automated API calls.
API call examples
Here are two examples of API v2.3 calls.
CURL API call
curl --header "X-API-Key: [your_access_key]" 'https://[your_site].stackenterprise.co/api/2.3/questions?order=desc&sort=activity&team=[team_slug]' | gunzip
PowerShell API call
powershell (Invoke-WebRequest 'https://[your_site].stackenterprise.co/api/2.3/questions?order=desc&sort=activity&team=[team_slug]' -Headers @{"X-API-Key"="[your_access_key]"}).Content | ConvertFrom-Json | ConvertTo-Json
If you need further support or have questions, contact your site administrator.