Skip to main content
Version: 25.03

DB Viewer - Databases List

Endpoint​

/o/db

Overview​

Returns the list of databases and collections available to the current user in DB Viewer.

  • Global admins get all available MongoDB databases.
  • Non-admin users get only collections they can access for their assigned apps.

Authentication​

Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.

Permissions​

Requires DB Viewer access (dbviewer read right for app-scoped users).

Request Parameters​

ParameterTypeRequiredDescription
api_keyStringConditionalRequired if auth_token is not provided.
auth_tokenStringConditionalRequired if api_key is not provided.
app_idStringNoRestricts output to collections accessible for that app (when user has access).

Examples​

List accessible databases​

/o/db?api_key=YOUR_API_KEY

List databases scoped to one app​

/o/db?api_key=YOUR_API_KEY&app_id=6991c75b024cb89cdc04efd2

Response​

Success Response​

[
{
"name": "countly",
"collections": {
"members (Users)": "members",
"apps (Applications)": "apps",
"sessions": "sessions",
"events": "events"
}
},
{
"name": "countly_drill",
"collections": {
"drill_events": "drill_events"
}
}
]

Response Fields​

FieldTypeDescription
[]ArrayList of accessible databases.
[].nameStringDatabase name.
[].collectionsObjectMap of pretty collection labels to actual collection names.

Error Responses​

  • 404
{
"result": "Database not found."
}

Standard authentication and authorization errors from user validation can also be returned.

Behavior​

  • When db/dbs, collection, document, aggregation, and action=get_indexes are all omitted, this endpoint runs in database-list mode.
  • MongoDB collections system.indexes and sessions_* are excluded.
  • Collection entries are filtered by user access (dbviewer rights and app scoping).
  • Collection names are transformed into UI-friendly labels in the collections object keys.
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly.appsApp lookup for name mapping and app filteringReads app IDs and names used to generate readable collection labels and app-scoped filtering.