Show examples in:
JavascriptHTTP
Endpoint info
Available examples
Dashboard API > OAuth application

Update site access settings for an authorized application

Warning: Experimental API

Please note that the Dashboard API is an experimental, prerelease API. This API method is considered unstable, and should be avoided in production environments and automations. Changes may occur at any time without warning.

Body parameters

typestringRequired

Must be exactly "oauth_application".

attributes.site_access_modeenumRequired

Whether the application can access all projects or only selected ones

Example:"selected"
allOptional

The application can access all projects

selectedOptional

The application can only access selected projects

relationships.granted_sites.dataOptional

Projects to grant access to (required when site_access_mode is 'selected')

Type:Array&#x3C;<a href="/docs/content-management-api/resources/site">ResourceLinkage&#x3C;"site"></a>>

Returns

Returns a resource object of type oauth_application.

Examples

PUT https://site-api.datocms.com/oauth_applications/:field_id_or_api_key HTTP/1.1
Authorization: Bearer YOUR-API-TOKEN
Accept: application/json
X-Api-Version: 3
Content-Type: application/vnd.api+json
{
"data": {
"id": "312",
"type": "oauth_application",
"attributes": {
"site_access_mode": "selected"
}
}
}
Terminal window
curl -g 'https://site-api.datocms.com/oauth_applications/:field_id_or_api_key' \
-X PUT \
-H "Authorization: Bearer YOUR-API-TOKEN" \
-H "Accept: application/json" \
-H "X-Api-Version: 3" \
-H "Content-Type: application/vnd.api+json" \
--data-binary '{"data":{"id":"312","type":"oauth_application","attributes":{"site_access_mode":"selected"}}}'
await fetch(
"https://site-api.datocms.com/oauth_applications/:field_id_or_api_key",
{
method: "PUT",
headers: {
Authorization: "Bearer YOUR-API-TOKEN",
Accept: "application/json",
"X-Api-Version": "3",
"Content-Type": "application/vnd.api+json",
},
body: JSON.stringify({
data: {
id: "312",
type: "oauth_application",
attributes: { site_access_mode: "selected" },
},
}),
},
);
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: cache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit: 30
X-RateLimit-Remaining: 28
{
"data": {
"type": "oauth_application",
"id": "312",
"attributes": {
"name": "Netlify OAuth application",
"created_at": "2018-11-20 12:06:49.803166",
"site_access_mode": "all",
"read_sites_permission_cap": "unrestricted",
"mcp_client": null
},
"relationships": {
"granted_sites": {
"data": [
{
"type": "site",
"id": "155"
}
]
}
}
}
}