grant_access
Give users, roles, or your whole organization run access to a Flight you own, for example so viewers can run it from a Dive app. The SQL equivalent is GRANT RUN ON FLIGHT.
Description
Only a Flight's owner can grant run on it; an Admin who tries gets Only the owner of this Flight can add grants. A run always uses the owner's token and secrets, whoever starts it. When you ask your AI agent to share a Dive that runs Flights, it recommends which Flights to grant and to whom, and grants only after you confirm.
A user grantee needs the MotherDuck username, not an email address. For a group of people, grant to a role.
Input parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
resource_type | string | Yes | "flight". |
id | string (UUID) | Yes | The Flight UUID. |
grantees | object[] | Yes | 1 to 100 grantees, each { "type": "user" | "role" | "organization", "name": string }. Omit name for the organization, or pass null; any other name for an organization grantee is an error. An unknown name fails the whole call. |
permission | string | No | "run", the only permission a Flight supports and the default. |
Output schema
On success:
{
"success": true,
"resource_type": "flight",
"id": string,
"permission": "run",
"grantees": [{ "type": string, "name": string }]
}
grantees echoes the grantees you passed. An organization grantee has no name.
On failure, only the error:
{
"success": false,
"error": string
}
Example usage
{
"resource_type": "flight",
"id": "7b1e2c3d-0000-4000-8000-000000000001",
"grantees": [{ "type": "role", "name": "order_approvers" }]
}
A typical prompt:
Let the order_approvers role run the decide_order Flight.
Related
revoke_access— Removerunaccess.GRANT RUN ON FLIGHT— SQL equivalent, plusSHOW GRANTS ON FLIGHT.- Build Dive apps