---
title: "Add grant to a data-access role"
method: POST
path: "/v4/data-access/roles/{role_id}/grants"
tags: ["v4", "Data Access"]
---

# Add grant to a data-access role

`POST /v4/data-access/roles/{role_id}/grants`

## Path parameters

- `role_id` union, required
  - string, uuid
  - string

## Request body

- CreateDataAccessGrantRequest
  - `schemaPattern` string, required — Glob pattern for schema names
  - `tablePattern` string, required — Glob pattern for table names

## Response `201`

Success

- SuccessResponseDataAccessGrant
  - `success` true, required — Flag for it request was successful
  - `data` DataAccessGrant, required — An allowlist entry that maps a data-access role to a set of visible tables. Uses glob-style patterns: ``*`` matches everything, ``sales_*`` matches tables prefixed with ``sales_``. Role with no grants has no access; a grant of ``schema_pattern='*', table_pattern='*'`` means full access.
    - `id` union — Unique grant identifier (DB-generated)
      - string, uuid
      - string
    - `roleId` union, required — Parent data-access role
      - string, uuid
      - string
    - `schemaPattern` string, required — Glob pattern matched against the DuckLake schema name
    - `tablePattern` string, required — Glob pattern matched against the table name
    - `createdAt` string, date-time, nullable — Creation timestamp (DB-generated)
  - `meta` ResponseMeta
    - `requestId` string — Unique request identifier for tracing
    - `timestamp` string, date-time — Response timestamp (UTC)
    - `durationMs` integer, nullable — Request processing time in milliseconds

## Other responses

- `401` — Auth Invalid Token
- `403` — Forbidden Insufficient Permissions
- `404` — Resource Not Found
- `409` — Resource Conflict
- `422` — Validation Failed
- `426` — Business Quota Exceeded
- `500` — Internal Error

---

[API](https://skmtc.dev/definite/apis/defapi.md) · [All operations](https://skmtc.dev/definite/apis/defapi/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/definite/defapi/revisions/3943d8deb3be/schema)
