Teams
Discussion
Starting with the release of Stack Overflow For Teams, the Stack Exchange API exposes read-only access to data stored in private Teams. In order to access Teams, you must do the following:
-
Obtain an
access_token
with theaccess_team|team-url
scope (see Authentication for more details)team-url
is the root url of the Team (without protocol), and must be obtained from the user- For example, a Team for pickled cucumber enthusiasts might have a
team-url
ofstackoverflow.com/c/pickles
- The full query parameter for the example Pickles team might be
?scope=access_team|stackoverflow.com/c/pickles
and url encoded as?scope=access_team%7cstackoverflow.com%2fc%2fpickles
-
Send this
access_token
in theX-API-Access-Token
header on all requests to the API- For security reasons passing
access_token
as a query parameter is not supported when accessing Team data - Any
access_token
passed as a query parameter while trying to access team data will be invalidated
- For security reasons passing
-
Add the
?team=team-url
query parameter to all requests to the API- Using the example Pickles team from above, the full query parameter might be
?team=stackoverflow.com/c/pickles
and url encoded as?team=stackoverflow.com%2fc%2fpickles
- Using the example Pickles team from above, the full query parameter might be
-
The
?site=site-name
is still required for all methods that are site-specific, even when accessing Team data- The full query parameter will be
?site=stackoverflow
when accessing Teams data
- The full query parameter will be
In addition to all write methods, the following methods (and their /me
equivalents) are not supported when specifying a Team with ?team=
:
- /events
- /users/{id}/network-activity
- /users/{id}/notifications
- /users/{id}/notifications/unread
- /users/{id}/inbox
- /users/{id}/inbox/unread
- /inbox
- /inbox/unread
- /notifications
- /notifications/unread
- /sites
- /users/{ids}/associated
- /users/{ids}/merges
An access_token
obtained with an access_team|team-url
scope cannot be used to access public Stack Overflow data. An access_token
for public Stack Overflow can be obtained by using the /access-tokens/exchange
method with exchange_type=team_for_public
. The obtained access_token
will have the same scopes and expiration as the original access_token
except for the access_team
scope.