# Permission Description and Scope

This document describes how a primary account configures data permissions for sub-accounts to control the data scope that sub-accounts can view and operate on each Astraflow feature page.

Sub-accounts that already have project permissions can still view all API Keys under the project and their associated data by default, without needing re-authorization. Only configure according to this document when you need to restrict a sub-account's data scope or when you need to use the "Share API Key" feature.

## Scope of Application

Astraflow's data permissions are based on API Key granularity and apply to the following four pages:

| **Page** | **Content Controlled by Data Permissions** |
|----------|-------------------------------------------|
| API Key Management | API Key list, API Key details, sharing relationships |
| Model Logs | Invocation logs generated by each API Key, log analysis tasks |
| Model Monitoring | Invocation volume, Token, latency, cache, and other monitoring metrics generated by each API Key |
| Project Cost | Costs incurred by each API Key |

Each page's data permissions are controlled by their respective APIs. The policy templates in [API Key, Model Logs, and Model Monitoring Permission Configuration](api-key-log-monitor.md) already include all interfaces for the API Key Management, Model Logs, and Model Monitoring pages. When using the templates directly, the API Keys visible to the sub-account in API Key Management will determine the data shown in Model Logs and Model Monitoring.

Project Cost is a new feature and requires separate authorization (see Scenarios 2 and 3 in [Consumer Center and Project Cost Permission Configuration](billing-and-project-cost.md)). This page is not enabled automatically along with existing pages such as Consumer Center and API Key Management, and does not inherit their authorization or data scope. A sub-account must have both the page access permission (`uai_modelverse:CheckMenuProjectCost`) and the cost query permission for the corresponding data scope to enter the page and view data; until configured, the Project Cost menu is hidden from the sub-account.

If you need to customize policies, please configure the interfaces for each page separately according to the [API Permission Comparison: "All" vs "My" Data](../api-permission-comparison.md), and keep the data scope consistent across pages.

> Whether a page can be entered is controlled by [Page Access Permission](../page-access-permission.md). Data permissions are configured separately from page access permissions, and both must be satisfied. A sub-account needs both page access permission and data permission to view the corresponding data.

## Data Permission Description

### The "All" and "My" Views

The API Key Management page is divided into "All" and "My" views based on data scope:

- **All**: All API Keys under the current project.
- **My**: API Keys created by the current account under the current project, and API Keys shared to the current account by other accounts.

The primary account can configure data permissions for sub-accounts according to the following table:

| **Configuration Goal** | **Visible Scope in API Key Management** | **Permitted Operations** |
|------------------------|----------------------------------------|--------------------------|
| Manage all API Keys under the project | Both "All" and "My" | Create, edit, delete any API Key in the project, share and manage sharing relationships |
| Manage only own created and shared API Keys | Only "My", "All" not shown | Own created API Keys can be created, edited, deleted, shared; shared API Keys are view-only |

### API Key Sharing

- API Keys can be shared with **sub-accounts within the same project**.
- The recipient can view the API Key and its data in Model Logs, Model Monitoring, and the "My" view of Project Cost, but cannot edit, delete, or share it again.
- Existing API Keys are uniformly owned by the primary account, with the creator displayed as "root". The primary account can share existing keys with sub-accounts to make them visible (API key plaintext is not displayed). API Keys created after the new version goes live will record the actual creator.
