Docs
Live demo
GET/api/v2/targets/{id}/pg-roles
targets:readAPI token

Retrieve discovered PostgreSQL roles in the target. With refresh=true an organization admin starts discovery as POST /targets/{id}/discover does.

Parameters

Path and query1 required of 2
idstringpathrequired

Target ID (UUID)

refreshbooleanquery

Start discovery of the target. Organization admins only, a viewer gets 403

Responses

200

OK

ListPostgreSQLRolesResponse · 5 fields
instance_idstring
job_idstring

Included when refresh=true triggers async job

2 fields
as_ofstring

Timestamp of the discovery data

staleboolean

Whether the cache is considered stale

15 fields
adoptablebooleanrequired

True when Principal can take the account under management. Adoption refuses the rest. Whether it is already managed is in principal.ownership_state.

discovered_atstring
account_audiencestring
humansystem
system_reasonstring
identity_serviceprincipal_static_accountpostgres_predefined_rolepostgres_bootstrap_superuserpostgres_provider_rolepostgres_connection_rolemysql_reserved_accountmariadb_system_accountmariadb_public_rolemongodb_connection_usermongodb_internal_usermongodb_user_without_idkubernetes_service_accountkubernetes_system_subjectkubernetes_default_rbac
role_bypass_rlsboolean
role_can_loginboolean
role_conn_limitinteger
role_create_dbboolean
role_create_roleboolean
role_inheritboolean
role_namestring
role_replicationboolean
role_superboolean
updated_atstring
9 fields
ownership_statestringrequired
unmanagedprincipal_createdadoptedorphaned
credential_ownershipstring
externalprincipal_managedunknown
link_idstring
adopted_atstring

The rule that created a Principal-created account.

native_identity_statestring

Whether Principal recorded the account instance it created or adopted. Set only for PostgreSQL and MongoDB accounts Principal created or adopted. Principal removes the account, revokes its access or changes its password only when it is verified. Mismatch means the account was recreated outside Principal.

verifiedunverifiedmismatch
native_identity_sourcestring

How Principal recorded the account instance: created right after it created the account, adopted from discovery at adoption, or observed by the first discovery or apply that saw it.

createdadoptedobserved
target_idstring

V2 API field

202

Discovery started (refresh=true by an organization admin)

409

With refresh=true only. Discovery of the target is paused after failed runs (code target.operation_backoff_active), or the target is being deleted (code cleanup_in_progress), or discovery already runs on this target or waits for its next attempt (code operation.already_running: details.existing_job_id and resources with relation running_operation name that job, details.started_at is when it was started, resolution.code operation.view_running opens it). Nothing was queued.

Common errors: 400 401 403 404 429 504. They mean the same for every operation, see Errors.

↑ ↓ to moveEnter to openEsc to close