Update Platform OAuth grant ceilings
const url = 'https://api-dev.mindflow.io/v1/organizations/%24CURRENT_ORGANIZATION_ID/oauth/grants/example';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"scope":"all","maximumRole":"environmentAuditor","environmentIds":["$CURRENT_ENVIRONMENT_ID"],"environmentRoles":{"additionalProperty":"environmentAuditor"},"flowScope":"all","flowMaximumRole":"flowAuditor","flowIds":["example"],"flowRoles":{"additionalProperty":"flowAuditor"},"includeOrganizationAdmin":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://api-dev.mindflow.io/v1/organizations/%24CURRENT_ORGANIZATION_ID/oauth/grants/example \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "scope": "all", "maximumRole": "environmentAuditor", "environmentIds": [ "$CURRENT_ENVIRONMENT_ID" ], "environmentRoles": { "additionalProperty": "environmentAuditor" }, "flowScope": "all", "flowMaximumRole": "flowAuditor", "flowIds": [ "example" ], "flowRoles": { "additionalProperty": "flowAuditor" }, "includeOrganizationAdmin": true }'Updates environments, flows, and role ceilings on an existing grant without revoking tokens.
Request body matches POST /oauth/configure except there is no bindToken. The grant owner or an organization
administrator for the grant’s organization may call this.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Opaque id of the organization that owns the resource. In a playbook step this can be filled from the current organization when the caller leaves it unset.
Example
ORGA-57b858ed-ec60-4507-b2ef-ea58244ac742Request Bodyrequired
Section titled “Request Bodyrequired”object
object
object
Responses
Section titled “Responses”Grant ceilings were updated; existing tokens keep working with the new limits. Returns the updated grant.
One active Platform OAuth grant (approval) that lets an OAuth client act for a user in one organization.
object
Unique identifier of the grant.
OAuth client id that holds this grant.
Display name of the OAuth client.
Organization the grant is pinned to.
Mindflow user who owns this grant.
When the grant was created, as ISO 8601 UTC.
When the grant metadata last changed (consent or token refresh), as ISO 8601 UTC.
When this approval expires, as ISO 8601 UTC. After this instant, tokens from the approval are rejected.
Whether the grant owner consented to organization-admin elevation (stored on the approval).
Whether org-admin elevation is effective right now (consent plus live organization admin role on this org).
Environment ceiling stored on this approval.
object
Whether the grant covers all accessible environments, an explicit list, or none.
Environment role ceiling for scope: all, and the summary / fallback ceiling when rolesById omits an id.
One of environmentAuditor, environmentOperator, environmentOwner.
Environment ids included when scope is selected. Omitted when scope is all.
Optional map of environment id to environment role ceiling when scope is selected. Ids without an entry
use maximumRole.
object
Environment role ceiling for that environment id.
Flow ceiling stored on this approval.
object
Whether the grant covers all accessible flows, an explicit list, or none.
Flow role ceiling for scope: all, and the summary / fallback ceiling when rolesById omits an id.
One of flowAuditor, flowEditor, flowOwner.
Flow ids included when scope is selected. Omitted when scope is all.
Optional map of flow id to flow role ceiling when scope is selected. Ids without an entry use
maximumRole.
object
Flow role ceiling for that flow id.
Example
{ "grantId": "2b08e096f6f48c7e918a5f238d254ce7", "clientId": "UJu3PB7RPORHyi0mXo8frl-NSQ58Tfh2mjjSj4xHlrY", "clientName": "Cursor", "organizationId": "$CURRENT_ORGANIZATION_ID", "userId": "USER-57b858ed-ec60-4507-b2ef-ea58244ac742", "createdAt": "2026-03-20T15:30:45.123Z", "updatedAt": "2026-03-21T09:12:00.456Z", "expiresAt": "2026-03-20T09:46:40.000Z", "environments": { "scope": "all", "environmentIds": [ "$CURRENT_ENVIRONMENT_ID" ] }, "flows": { "scope": "all", "flowIds": [ "PLAY-17a64601-40bb-4304-90f8-08ebf6ae3c19" ] }}Headers
Section titled “Headers”Example
1000Maximum number of requests allowed in the current window. Present when this response is rate limited.
Example
42Number of requests still allowed in the current window. 0 means the next call can return 429 until the window resets.
Example
2026-03-20T15:31:00.000ZTime when the current window resets, as ISO 8601 UTC. After this time, X-RateLimit-Remaining starts over.
Example
30HTTP Retry-After value in seconds. Wait at least this long before retrying a 429 response.
Example
*CORS Access-Control-Allow-Origin value. Origin allowed to read this response from a browser. * means any origin may read it.
The request was invalid. Common causes include:
- Invalid timestamp format.
- Using
cursorwithbeforeorafter. - Missing
limitwhen usingbeforeorafter. - Invalid field names in the
fieldsparameter.
See the error response for specific details about what went wrong.
object
URI reference identifying the problem type. When absent, “about:blank” per RFC 9457 Section 3.1.1.
Short, human-readable summary of the problem type (RFC 9457 Section 3.1.3).
HTTP status code for this occurrence (advisory; same as response status) (RFC 9457 Section 3.1.2).
Human-readable explanation specific to this occurrence (RFC 9457 Section 3.1.4).
URI reference identifying the specific occurrence (RFC 9457 Section 3.1.5).
Always BAD_REQUEST on this response. Read detail for which value to change, then send a corrected request.
Example
{ "type": "about:blank", "title": "Bad Request", "status": 400, "detail": "The request body or query is invalid.", "code": "BAD_REQUEST"}Headers
Section titled “Headers”Example
1000Maximum number of requests allowed in the current window. Present when this response is rate limited.
Example
42Number of requests still allowed in the current window. 0 means the next call can return 429 until the window resets.
Example
2026-03-20T15:31:00.000ZTime when the current window resets, as ISO 8601 UTC. After this time, X-RateLimit-Remaining starts over.
Example
30HTTP Retry-After value in seconds. Wait at least this long before retrying a 429 response.
Example
*CORS Access-Control-Allow-Origin value. Origin allowed to read this response from a browser. * means any origin may read it.
Authentication failed. The request lacks valid credentials or the provided credentials are invalid.
Ensure you have:
- A valid API key or token.
- Proper authentication headers.
- Required permissions.
object
URI reference identifying the problem type. When absent, “about:blank” per RFC 9457 Section 3.1.1.
Short, human-readable summary of the problem type (RFC 9457 Section 3.1.3).
HTTP status code for this occurrence (advisory; same as response status) (RFC 9457 Section 3.1.2).
Human-readable explanation specific to this occurrence (RFC 9457 Section 3.1.4).
URI reference identifying the specific occurrence (RFC 9457 Section 3.1.5).
Always MISSING_OR_INVALID_TOKEN on this response. Branch on this value, not on detail.
Example
{ "type": "about:blank", "title": "Unauthorized", "status": 401, "detail": "The bearer token is missing or invalid.", "code": "MISSING_OR_INVALID_TOKEN"}Headers
Section titled “Headers”Example
1000Maximum number of requests allowed in the current window. Present when this response is rate limited.
Example
42Number of requests still allowed in the current window. 0 means the next call can return 429 until the window resets.
Example
2026-03-20T15:31:00.000ZTime when the current window resets, as ISO 8601 UTC. After this time, X-RateLimit-Remaining starts over.
Example
30HTTP Retry-After value in seconds. Wait at least this long before retrying a 429 response.
Example
*CORS Access-Control-Allow-Origin value. Origin allowed to read this response from a browser. * means any origin may read it.
The requested resource was not found.
object
URI reference identifying the problem type. When absent, “about:blank” per RFC 9457 Section 3.1.1.
Short, human-readable summary of the problem type (RFC 9457 Section 3.1.3).
HTTP status code for this occurrence (advisory; same as response status) (RFC 9457 Section 3.1.2).
Human-readable explanation specific to this occurrence (RFC 9457 Section 3.1.4).
URI reference identifying the specific occurrence (RFC 9457 Section 3.1.5).
Always NOT_FOUND on this response. The resource is not available to this caller.
Example
{ "type": "about:blank", "title": "Not Found", "status": 404, "detail": "The resource was not found.", "code": "NOT_FOUND"}Headers
Section titled “Headers”Example
1000Maximum number of requests allowed in the current window. Present when this response is rate limited.
Example
42Number of requests still allowed in the current window. 0 means the next call can return 429 until the window resets.
Example
2026-03-20T15:31:00.000ZTime when the current window resets, as ISO 8601 UTC. After this time, X-RateLimit-Remaining starts over.
Example
30HTTP Retry-After value in seconds. Wait at least this long before retrying a 429 response.
Example
*CORS Access-Control-Allow-Origin value. Origin allowed to read this response from a browser. * means any origin may read it.
Too many requests. The request rate limit has been exceeded.
Please wait until the rate limit window resets before making additional requests.
object
URI reference identifying the problem type. When absent, “about:blank” per RFC 9457 Section 3.1.1.
Short, human-readable summary of the problem type (RFC 9457 Section 3.1.3).
HTTP status code for this occurrence (advisory; same as response status) (RFC 9457 Section 3.1.2).
Human-readable explanation specific to this occurrence (RFC 9457 Section 3.1.4).
URI reference identifying the specific occurrence (RFC 9457 Section 3.1.5).
Always RATE_LIMIT_EXCEEDED on this response. Wait Retry-After seconds before retrying.
Example
{ "type": "about:blank", "title": "Too Many Requests", "status": 429, "detail": "The request rate limit has been exceeded.", "code": "RATE_LIMIT_EXCEEDED"}Headers
Section titled “Headers”Example
1000Maximum number of requests allowed in the current window. Present when this response is rate limited.
Example
42Number of requests still allowed in the current window. 0 means the next call can return 429 until the window resets.
Example
2026-03-20T15:31:00.000ZTime when the current window resets, as ISO 8601 UTC. After this time, X-RateLimit-Remaining starts over.
Example
30HTTP Retry-After value in seconds. Wait at least this long before retrying a 429 response.
Example
*CORS Access-Control-Allow-Origin value. Origin allowed to read this response from a browser. * means any origin may read it.
Internal server error. The server encountered an unexpected condition that prevented it from fulfilling the request.
Please try again later or contact support if the problem persists.
object
URI reference identifying the problem type. When absent, “about:blank” per RFC 9457 Section 3.1.1.
Short, human-readable summary of the problem type (RFC 9457 Section 3.1.3).
HTTP status code for this occurrence (advisory; same as response status) (RFC 9457 Section 3.1.2).
Human-readable explanation specific to this occurrence (RFC 9457 Section 3.1.4).
URI reference identifying the specific occurrence (RFC 9457 Section 3.1.5).
Always INTERNAL_ERROR on this response. Retry later. Do not retry a create in a tight loop.
Example
{ "type": "about:blank", "title": "Internal Server Error", "status": 500, "detail": "The request could not be completed.", "code": "INTERNAL_ERROR"}Headers
Section titled “Headers”Example
1000Maximum number of requests allowed in the current window. Present when this response is rate limited.
Example
42Number of requests still allowed in the current window. 0 means the next call can return 429 until the window resets.
Example
2026-03-20T15:31:00.000ZTime when the current window resets, as ISO 8601 UTC. After this time, X-RateLimit-Remaining starts over.
Example
30HTTP Retry-After value in seconds. Wait at least this long before retrying a 429 response.
Example
*CORS Access-Control-Allow-Origin value. Origin allowed to read this response from a browser. * means any origin may read it.