Docs
Live demo
POST/api/v2/targets/{id}/accounts/adopt

Adopt a discovered target-local account for an identity. Adoption is full adoption: Principal creates a policy from operator-confirmed rules and manages credentials for the adopted account.

Parameters

Path1 required of 1
idstringpathrequired

Target ID (UUID)

Request body application/json · AdoptTargetAccountRequest

Required3 of 5 fields
account_keyTargetAccountKeyRequestrequired
8 fields
enginestringrequired
postgresmysqlkubernetesclickhousemongodb
role_namestring
user_namestring
user_hoststring
subject_kindstring
ServiceAccountUserGroup
namestring
namespacestring
auth_sourcestring

Authentication database of a MongoDB user

identityAdoptIdentitySpecrequired

Discriminated by mode. When mode=existing, only identity_id is read. When mode=create_static, external_id and display_name are required and the server creates a service-kind identity carrying adoption metadata before linking the target account.

5 fields
modestringrequired
existingcreate_static
identity_idstring

Existing identity to map to. Required when mode=existing.

external_idstring

External id for the new static identity. Required when mode=create_static.

display_namestring

Human-readable label for the new static identity. Required when mode=create_static.

descriptionstring

Optional description for the new static identity.

rulesarray of PolicyRuleRequestrequired

Confirmed rows. On PostgreSQL a row identical to a previewed one is imported, any other is the rule's own.

2 fields
permissionsarray of stringrequired
min items 1
resourcesarray of stringrequired
min items 1
Optional2 fields
credential_ownershipstring
principal_managed
membershipsarray of PolicyMembershipRequest

Memberships the operator confirmed from the preview (PostgreSQL). An absent field takes over every live membership of the account. An empty array takes over none.

4 fields
rolestringrequired

Parent role the account is a member of.

min length 1 · max length 255
admin_optionboolean
inheritboolean
setboolean

Responses

200

Existing adoption returned

TargetAccountLinkResponse · 11 fields
idstring
target_idstring
identity_idstring
enginestring
8 fields
enginestring
role_namestring
user_namestring
user_hoststring
subject_kindstring
namestring
namespacestring
auth_sourcestring
ownership_statestring
credential_ownershipstring
adopted_atstring
9 fields
ownership_statestringrequired
unmanagedprincipal_createdadoptedorphaned
credential_ownershipstring
externalprincipal_managedunknown
link_idstring
4 fields
idstring
external_idstring
kindstring
display_namestring

Human label of the identity. Empty when the identity has no human name.

adopted_atstring
4 fields
idstring
external_idstring
kindstring
display_namestring

Human label of the identity. Empty when the identity has no human name.

The rule that created a Principal-created account.

3 fields
idstringrequired
namestring

Canonical display name of the rule. Empty when the rule was deleted.

deletedboolean

True when the target no longer has the rule.

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
created_atstring
updated_atstring
201

Account adopted

TargetAccountLinkResponse · 11 fields
idstring
target_idstring
identity_idstring
enginestring
8 fields
enginestring
role_namestring
user_namestring
user_hoststring
subject_kindstring
namestring
namespacestring
auth_sourcestring
ownership_statestring
credential_ownershipstring
adopted_atstring
9 fields
ownership_statestringrequired
unmanagedprincipal_createdadoptedorphaned
credential_ownershipstring
externalprincipal_managedunknown
link_idstring
4 fields
idstring
external_idstring
kindstring
display_namestring

Human label of the identity. Empty when the identity has no human name.

adopted_atstring
4 fields
idstring
external_idstring
kindstring
display_namestring

Human label of the identity. Empty when the identity has no human name.

The rule that created a Principal-created account.

3 fields
idstringrequired
namestring

Canonical display name of the rule. Empty when the rule was deleted.

deletedboolean

True when the target no longer has the rule.

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
created_atstring
updated_atstring
409

The account can't be adopted: among other conflicts, a cut-off password change of the identity's own account on the target waits for a check (rotation.check_required), and the account to adopt may be that same account. Check the change on the identity's credentials card first.

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

↑ ↓ to moveEnter to openEsc to close