3.2 PVWA REST API Administration & Lifecycle Automation
Key Takeaways
- The PVWA REST API exposes enterprise automation endpoints under /PasswordVault/API/, utilizing standard HTTP verbs and JSON payloads to execute programmatic PAM governance.
- API authentication begins with an explicit POST request to the Logon endpoint, issuing a session token string that must be passed in the HTTP Authorization header for all subsequent API calls.
- Credential lifecycle actions (Verify, Change, and Reconcile) can be triggered on demand via POST /PasswordVault/API/Accounts/{id}/<Action>, queuing tasks directly in the Vault for the Central Policy Manager (CPM).
- Enterprise automation scripts must incorporate pagination parameters (limit and offset) and exponential backoff retry logic to prevent memory exhaustion and request timeouts on the PVWA IIS worker process.
3.2 PVWA REST API Administration & Lifecycle Automation
In modern enterprise IT environments, privileged access governance cannot be handled exclusively through manual mouse clicks in a browser. Enterprise onboarding pipelines, CI/CD toolchains, Identity Governance and Administration (IGA) solutions, and Security Information and Event Management (SIEM) systems require programmatic interfaces to manage privileged accounts dynamically. The CyberArk Password Vault Web Access (PVWA) REST API provides a comprehensive, RESTful web service interface for automating all core PAM operational lifecycles.
REST API Framework & Architecture
The PVWA REST API is hosted directly within the IIS web application stack under the URI path https://<PVWA-FQDN>/PasswordVault/API/. It complies with standard REST principles:
- Transport Protocol: All transactions occur strictly over HTTPS using TLS 1.2 or TLS 1.3.
- Data Interchange Format: Request payloads and response bodies are formatted as structured JSON (JavaScript Object Notation).
- HTTP Verbs: Resource manipulation uses standard HTTP methods—
GETfor reading resources,POSTfor creating resources or triggering actions,PUTfor complete resource updates,PATCHfor partial attribute updates, andDELETEfor resource decommissioning. - Interactive Documentation: Interactive Swagger/OpenAPI documentation is available directly through the web browser at
https://<PVWA-FQDN>/PasswordVault/Swagger/, enabling administrators to test endpoints and inspect JSON schemas interactively.
Authentication Models & Session Token Lifecycle
Before executing any administrative action against the REST API, an automation client must establish an authenticated session. Unlike traditional web portals that maintain state via ASP.NET cookies, the PVWA REST API utilizes a stateless token-based authentication model.
The Logon Endpoint
An authentication request is initiated by sending an HTTP POST request to the logon endpoint:
- Generic / CyberArk Authentication:
POST https://<PVWA-FQDN>/PasswordVault/API/Auth/Logon - External Identity Providers: Specialized sub-routes exist for enterprise identity sources, such as
/PasswordVault/API/Auth/LDAP/Logon,/PasswordVault/API/Auth/Radius/Logon, and/PasswordVault/API/Auth/SAML/Logon.
The request body contains the user credentials formatted as JSON:
{
"username": "pam_admin",
"password": "SecureMasterSecret123!",
"concurrentSession": true
}
Setting "concurrentSession": true allows the administrative identity to execute concurrent automation jobs without terminating other active sessions.
Session Token Handling
Upon successful verification against the Vault, the Logon endpoint returns an HTTP 200 status with a session token string (a Base64-encoded encrypted ticket). For all subsequent API calls, the client must include this token in the standard HTTP request header:
Authorization: <SessionTokenString>
Note: Depending on the CyberArk version and endpoint framework, tokens are supplied directly as Authorization: <token> or formatted with the Bearer scheme (Authorization: Bearer <token>).
Session Lifespan and Logoff
The session token remains valid as long as activity occurs within the timeout window defined by the PVWA session configuration. If inactive, the token expires, and subsequent API calls return an HTTP 401 Unauthorized status. When automation scripts finish their routines, they should always invoke POST https://<PVWA-FQDN>/PasswordVault/API/Auth/Logoff with the active token to immediately release Vault memory and prevent session table exhaustion.
Core Resource Operations: Accounts, Safes, Users, and Platforms
The PVWA REST API provides extensive coverage across the entire PAM object hierarchy.
1. Account Lifecycle Management
- Searching and Listing Accounts:
GET https://<PVWA-FQDN>/PasswordVault/API/Accounts?search=svc_sql&safeName=Database_SafesRetrieves account objects matching search terms or filtering parameters. Attributes returned include account IDs, addresses, platform IDs, safe names, and secret management statuses. - Onboarding Accounts:
POST https://<PVWA-FQDN>/PasswordVault/API/AccountsCreates a new privileged account object. Required body attributes includename,address,userName,platformId,safeName, andsecret. - Retrieving Secrets:
POST https://<PVWA-FQDN>/PasswordVault/API/Accounts/{id}/Secret/RetrieveRetrieves the cleartext password or SSH key. If the account's platform enforces ticketing or dual-control reasons, the JSON payload must supply theReasonandTicketingSystemparameters.
2. Safe Governance
- Creating Safes:
POST https://<PVWA-FQDN>/PasswordVault/API/Safesprovisions new enterprise Safes, defining attributes likemanagingCPM,numberOfDaysRetention, anddescription. - Managing Safe Members:
POST https://<PVWA-FQDN>/PasswordVault/API/Safes/{safeName}/Membersassigns users or directory groups with granular permission flags (e.g.,useAccounts,retrieveAccounts,listAccounts,addAccounts,updateAccountContent, andinitiateCPMRotations).
3. Platforms and User Administration
- Platform Duplication:
POST https://<PVWA-FQDN>/PasswordVault/API/Platforms/{platformId}/Duplicateallows programmatic cloning of parent platforms to create customized target policies. - User Management:
POST https://<PVWA-FQDN>/PasswordVault/API/Usersenables automated provisioning of internal emergency breakout accounts or local operators.
Triggering Asynchronous CPM Operations via REST API
One of the most powerful capabilities of the PVWA REST API is programmatically initiating password lifecycle operations through the Central Policy Manager (CPM):
- Verify Credentials:
POST /PasswordVault/API/Accounts/{id}/Verify - Change Credentials:
POST /PasswordVault/API/Accounts/{id}/Change - Reconcile Credentials:
POST /PasswordVault/API/Accounts/{id}/Reconcile
The Asynchronous Execution Model
It is critical for certification candidates to recognize that CPM actions triggered via the REST API execute asynchronously:
- The automation script sends the
POST /Accounts/{id}/Changerequest. - PVWA validates the caller's Safe permissions (
Initiate CPM account management operations). - PVWA writes an immediate action flag to the account object stored in the Digital Vault.
- PVWA immediately returns an HTTP 200 OK status to the client, confirming that the request was successfully placed.
- The CPM scans the Vault on its periodic search cycle (determined by
Intervalparameters), detects the pending change flag, and invokes its target plug-in engine (such asPMTerminal.exeor.NETplug-ins) to alter the password on the remote system. - The automation script must poll
GET /PasswordVault/API/Accounts/{id}to inspect account status properties (such aslastModifiedandlastSuccessChange) to verify whether the background operation succeeded.
Enterprise Automation Best Practices & Error Handling
When developing scripts (whether using PowerShell with the popular open-source psPAS module or custom Python scripts via the requests library), administrators must implement robust design patterns:
Pagination Best Practices
In environments containing tens of thousands of accounts, executing an unconstrained GET /PasswordVault/API/Accounts will trigger intense CPU and memory utilization on the IIS host and may result in an HTTP 504 Gateway Timeout. Administrators must use the limit and offset query parameters to page through records in controlled batches (e.g., ?limit=100&offset=0, ?limit=100&offset=100).
Eliminating Hardcoded Credentials
Automation scripts executing PAM administration must never contain hardcoded Vault credentials. Best practice dictates using CyberArk's Application Access Manager (AAM) Credential Provider to retrieve the script's own administrative credentials dynamically from memory prior to calling the PVWA REST API.
Standard HTTP Response Codes
| HTTP Code | Description | Architectural Meaning in PVWA |
|---|---|---|
| 200 OK | Success | Request processed successfully (e.g., GET queries, action queueing) |
| 201 Created | Created | Resource successfully created (e.g., account or Safe onboarding) |
| 400 Bad Request | Invalid Input | Malformed JSON payload or missing mandatory parameters (e.g., missing address) |
| 401 Unauthorized | Authentication Failure | Missing, invalid, or expired session token in the Authorization header |
| 403 Forbidden | Permission Denied | Authenticated user lacks required Safe permissions or Vault authorizations |
| 404 Not Found | Resource Missing | Specified Account ID, Safe name, or Platform ID does not exist in the Vault |
| 409 Conflict | Object Conflict | Account or Safe name already exists, or the account object is currently locked |
How must an automated script authenticate subsequent calls to the PVWA REST API after successfully invoking the Logon endpoint?
An administrator executes an automated script that sends a POST request to /PasswordVault/API/Accounts/1234/Change and receives an immediate HTTP 200 response. What does this response signify?
When querying an enterprise vault with over 50,000 managed credentials via the PVWA REST API, which practice prevents IIS worker process memory exhaustion and gateway timeouts?