> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bytebase.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Just-in-Time Access

Just-in-Time (JIT) access grants database access only when it's needed and only for a limited time, instead of leaving standing permissions in place. A member requests access, an approver reviews it, and the grant expires automatically — so unused privileges never accumulate, every grant is tied to a stated reason, and each use is recorded for audit.

Bytebase offers two ways to request access just-in-time, one per [permission model](https://docs.bytebase.com/security/database-permission/overview.md):

* **Request a role** — a time-boxed [role](https://docs.bytebase.com/security/database-permission/request.md) (e.g. `SQL Editor Read User`) for a broad range of permissions on the selected databases.
* **Request an access grant** — a limited, elevated privilege: run one approved read-only statement, optionally unmasked or exported. See [Access Grants](https://docs.bytebase.com/security/database-permission/grant.md).

![The two just-in-time approaches converge on expiring, audited access](https://mintcdn.com/dbx/dNrS70r5dBbeNYZn/content/docs/security/database-permission/just-in-time/two-approaches.svg?fit=max\&auto=format\&n=dNrS70r5dBbeNYZn\&q=85\&s=fb60ac385e8f26c22034c248055db072)

Either way, the request goes through an [approval flow](https://docs.bytebase.com/change-database/approval.md) and is recorded in the [audit log](https://docs.bytebase.com/security/audit-log.md).

## Choose an approach

| | Time-boxed role | Access grant |
| - | - | - |
| **You get** | a project role on the selected databases | permission to run one approved read-only statement |
| **Granularity** | the role's permissions, scoped to databases, schemas, and tables | a single statement, plus optional **Unmask** and **Export** |
| **Duration** | any expiration date within the [maximum role expiration](https://docs.bytebase.com/security/database-permission/request.md#maximum-role-expiration) | 1 hour – 7 days presets or a custom date, capped by the [maximum access grant expiration](https://docs.bytebase.com/security/database-permission/grant.md#expiration) |
| **Project setting** | **Allow request role** | **Allow access grants** |
| **Approval source** | **Request Role** | **Request Access Grant** |
| **Best for** | ongoing work that needs repeated access | one-off production reads, incident lookups, ad-hoc exports |

Each approach has its own project setting and approval source — the setting turns on role requests or access grants, not the workflow itself. Set them up where each mechanism is documented: [Enable role requests](https://docs.bytebase.com/security/database-permission/request.md#enable-role-requests) and [Enable access grants](https://docs.bytebase.com/security/database-permission/grant.md#enable-access-grants).

## Interactive demo

Follow one developer through both approaches: a denied query, a time-boxed role, a one-statement access grant, and the audit trail they leave.

[![Bytebase just-in-time access interactive demo: Denied, Request Role, Access Grant, Audit](https://mintcdn.com/dbx/l2aZgmfCIGILHT83/images/demo/jit-access.webp?fit=max\&auto=format\&n=l2aZgmfCIGILHT83\&q=85\&s=4d5a269c7d1737efb86703eee5d33be2)](https://www.bytebase.com/demo/jit-access/)

## Expiration and audit

Both approaches end the same way: the access expires on its own — a role binding at its expiration date, an access grant when its approved window (counted from approval) runs out — and the [audit log](https://docs.bytebase.com/security/audit-log.md) records every query and export along with the role or grant that authorized it.

For the full request flows, see [Roles](https://docs.bytebase.com/security/database-permission/request.md) and [Access Grants](https://docs.bytebase.com/security/database-permission/grant.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.