# POST /apps/:app_id/shares

**Resource:** [Apps](./apps.md)  
**MCP tool:** `share_app`  
**Scopes:** `apps:write`  
**Write operation:** yes

Share an app with everyone on the team, a role, one team member or a Client Portal, optionally giving them one view of it and letting them add and change rows. An app is only visible to people it is shared with once it is published. Workspace admins only.

## Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `app_id` | path | string | yes | The app's id. |
| `target_type` | body | string | yes | Who gets it: "everyone" (all team members), "role" (a role), "user" (one team member), "portal" (one Client Portal) or "portal_template" (every Client Portal made from one portal template). |
| `target_id` | body | string | no | Who: for "role" the role key ("admin", "editor", "viewer") or a custom role's id (list_roles); for "user" the user id; for "portal" the portal id; for "portal_template" the portal template id. Leave out for "everyone". |
| `audience_id` | body | string | no | Which version of the app they get: a version id from list_app_audiences. Required once the app has versions. A team version can be given to everyone, a role or a user; a client version to a portal or a portal template. One person gets one version: the most specific share wins (a person over a role over everyone, one portal over every portal from its template). |
| `view_key` | body | string | no | Older shares only (apps without versions): which view of the app this audience gets. Not allowed together with audience_id, because a version lists its own pages. |
| `can_write_rows` | body | boolean | no | Older shares only (apps without versions): true lets them add and change rows. Default false. With audience_id this is set on the version instead. |
| `can_see_all_rows` | body | boolean | no | Older shares only (apps without versions): true lets them see every row of "own" tables. Default false. With audience_id this is set on the version instead. |
| `require_approval` | body | boolean | no | Optional. Set true to route this write into the approval queue for human review instead of executing it immediately (returns 202 + an approval_id). Works even when your key/token has permission to execute directly. |

## Request example

```bash
curl -X POST   "https://api.trustpager.com/functions/v1/api/v1/apps/:app_id/shares"   -H "Authorization: Bearer YOUR_API_KEY"   -H "Content-Type: application/json"   -d '{"target_type":"...","target_id":"...","audience_id":"..."}'
```

---
Base URL: `https://api.trustpager.com/functions/v1/api/v1` — Auth: `Authorization: Bearer YOUR_API_KEY`