Documentation / API Databases / Database Grants Endpoint

Database Grants Endpoint

Live GET endpoint for database access grants.

This endpoint returns database access grants as JSON. It is useful for dashboards, audits, provider portals, support checks, monitoring jobs, and automation that needs to observe PanelConfig state without opening the GUI.

Endpoint

FieldValue
AvailabilityAvailable in current source.
HTTP methodGET
Endpoint URL/api/v1/database-grants.php
AuthenticationBearer token required. The token must belong to an active user and must not be expired or revoked.
Published/recommended scope labeldatabases.read
Current scope enforcement noteThe source stores scope labels, but this endpoint file does not call a central scope-check helper in the inspected build.
Role/access levelActive authenticated user. Admin users see broader records where the endpoint code allows it; non-admin users are account-filtered on many resource endpoints.
Rate limit120 requests / 60 seconds
Primary data readdatabase_user_grants

Headers

HeaderRequiredValue
AuthorizationYesBearer pc_YOUR_TOKEN
AcceptRecommendedapplication/json

Path

None. This is a collection-style file endpoint in the current build.

Query

No formal query parameters are documented from the source for this endpoint. The route returns a recent list or computed summary based on the SQL query inside the file.

Request Body

No request body is used. Sending a JSON body to this GET endpoint is unnecessary.

Request

curl -s https://panel.example.com/api/v1/database-grants.php \
  -H "Authorization: Bearer pc_YOUR_TOKEN" \
  -H "Accept: application/json"

Success Response

{
  "success": true,
  "message": "PanelConfig API resource loaded.",
  "data": {
    "resource": "database-grants",
    "items": []
  },
  "timestamp": "2026-06-19T00:00:00+00:00"
}

Status Codes

StatusMeaning
200Request succeeded.
401Bearer token missing, invalid, expired, or attached to an inactive user.
403The token user is authenticated but not admin-capable where this endpoint requires an admin-capable user.
429Rate limit exceeded where the endpoint calls the rate-limit helper.
500Unexpected application, PHP, or database failure.

Records

This endpoint is read-only for the resource it returns. For authenticated endpoints, the auth helper updates api_tokens.last_used_at and inserts a row into api_requests when that table exists.

Audit Logging

Read endpoints do not call the audit helper for the returned resource. Use API request logs and token last-used timestamps to review API activity. Token creation itself is audited by the token creation helper.

Panel UI

PCAdmin → Database Access / PCUser → Database Access

PCCLI

Use PCCLI list or health commands where available for local server automation. Treat API and PCCLI output as complementary: API for remote JSON clients, PCCLI for on-server shell workflows.

Security Notes

  • Use HTTPS.
  • Do not expose bearer tokens in client-side code.
  • Create a separate token for each external system.
  • For admin-only endpoints, restrict which operator accounts can create and own tokens.

Troubleshooting

  • Run /api/v1/me.php first to confirm the token works.
  • Check the HTTP status code and the JSON message.
  • For empty items, verify that records exist and that the token user has account visibility.
  • For 429, reduce polling frequency and retry after the rate window.
Database Users Endpoint →