---
title: "Preview FAP mask for a resource and role"
method: POST
path: "/api/data-access/preview"
tags: ["DataAccess"]
---

# Preview FAP mask for a resource and role

`POST /api/data-access/preview`

## Request

- Base URL: `https://api.agentstack.tech` (the document declares no server; this is the origin it was published from)
- URL: `https://api.agentstack.tech/api/data-access/preview`
- Auth: one of:
  - API key in header `X-API-Key`
  - HTTP bearer

**Auth:** **read** on `project_id`. Supports `draft_resource_policy` for Dashboard editor (unsaved rules). Dotted mode lists path_rules rows.

## Query parameters

- `project_id` integer, required: Project ID

## Headers

- `Idempotency-Key` string

## Request body

- PreviewBody: Body for POST /preview
  - `resource` string, required: Resource key (e.g., 'orders')
  - `user_role` string, required: Role to preview
  - `permissions_bitmap` integer
  - `user_id` integer
  - `resource_owner_id` integer, nullable
  - `sample_data` object, nullable: Optional sample dict — permitted field values will be shown
  - `draft_resource_policy` object, nullable: If set, preview uses this resource policy (current editor draft) instead of stored config — matches Dashboard UI before Save.
  - `draft_default_access` string, nullable: When draft_resource_policy is set, project default_access for preview.
  - `draft_globals` object, nullable: When set, preview uses these globals (e.g. nested_path_mode) with draft policy.

## Response `200`

Per-field read/write + optional values from sample_data

- unknown

## Other responses

- `400`: Bad Request
- `401`: Not authenticated
- `403`: Insufficient project access (read / admin / owner)
- `404`: Not Found
- `409`: Conflict
- `422`: Validation Error
- `429`: Too Many Requests
- `500`: Internal Server Error

---

[API](https://skmtc.dev/agentstack/apis/agentstack-core-api.md) · [All operations](https://skmtc.dev/agentstack/apis/agentstack-core-api/llms.txt) · [OpenAPI document](https://skmtc.dev/agentstack/apis/agentstack-core-api/revisions/8ecf3406e74a?raw)
