Change an app's domain access
const url = 'https://api.nsin.ir/oauth/grants/example';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"domains":"all"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://api.nsin.ir/oauth/grants/example \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "domains": "all" }'Replaces the domain selection of an active grant. It takes effect on
the app’s key and tokens with their next request. Ids outside the
domains the user has a role on answer 400 invalid_request.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”Request Body required
Section titled “Request Body required ”object
Responses
Section titled “ Responses ”The updated row, in the shape of the list.
object
Which domains a client-bound credential (NSIN SSO) may touch. all
true means every domain, including ones added later. Otherwise
domain_ids is the selection as stored and domains names the live
ones among them; an empty selection is what a revoked grant leaves
behind. GET /whoami reports it for SSO tokens and app-minted keys.
object
object
Example generated
{ "client_id": "example", "name": "example", "first_party": true, "scope": "example", "created_at": "2026-04-15T12:00:00Z", "last_used_at": "2026-04-15T12:00:00Z", "domain_access": { "all": true, "domain_ids": [ 1 ], "domains": [ { "id": 1, "name": "example" } ] }}Malformed domains, or an id the user has no role on.
The RFC 6749 error shape, used by the NSIN SSO endpoints only. It is
deliberately different from Error: OAuth clients match on the machine
error code, and only show error_description to a developer.
object
The machine-readable code.
A human-readable explanation. Never match on this.
Example
{ "error": "invalid_grant", "error_description": "authorization code is invalid or expired"}Missing, malformed, revoked or expired API key — or the owning account is inactive.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "error": "invalid API key"}No active grant for this client.
The RFC 6749 error shape, used by the NSIN SSO endpoints only. It is
deliberately different from Error: OAuth clients match on the machine
error code, and only show error_description to a developer.
object
The machine-readable code.
A human-readable explanation. Never match on this.
Example
{ "error": "invalid_grant", "error_description": "authorization code is invalid or expired"}