General Information
Policy Type
Endpoints
List Policies
Add Policy
Update Policy
Delete Policy
List Policies
Endpoint
Request
Headers
| Header | Value |
|---|---|
| Authorization | Bearer {token} |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| projectName | string | Yes | Project name |
| apiProxyName | string | Yes | API Proxy name |
Response
Success Response (200 OK)
cURL Example
Add Policy
Endpoint
Request
Headers
| Header | Value |
|---|---|
| Authorization | Bearer {token} |
| Content-Type | application/json |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| projectName | string | Yes | Project name |
| apiProxyName | string | Yes | API Proxy name |
| policyName | string | Yes | Policy name |
Request Body
Full JSON Body Example - Standard Encryption
Full JSON Body Example - Multiple Parts
Full JSON Body Example - With Embedded Key
Request Body Fields
operationMetadata
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| targetScope | string | Yes | - | Policy scope: ALL or ENDPOINT |
| targetEndpoint | string | No* | - | Endpoint path (required if targetScope=ENDPOINT) |
| targetEndpointHTTPMethod | string | No* | - | HTTP method (required if targetScope=ENDPOINT) |
| targetPipeline | string | Yes | - | Pipeline: REQUEST, RESPONSE, or ERROR |
| deploy | boolean | No | true | Whether to deploy after adding policy |
| deployTargetEnvironmentNameList | array | No | [] | List of environment names to deploy to |
| order | integer | No | null | Policy execution order (starts from 1) |
ALL- Policy applies to all endpointsENDPOINT- Policy applies only to specified endpoint
REQUEST- Executes in request pipeline (encrypts outgoing requests)RESPONSE- Executes in response pipeline (encrypts outgoing responses)ERROR- Executes in error pipeline
GET,POST,PUT,DELETE,PATCH,OPTIONS,HEAD
policy
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| type | string | Yes | - | Policy type: policy-ws-security-encrypt |
| description | string | No | - | Policy description |
| active | boolean | No | true | Whether policy is active |
| mustUnderstand | boolean | No | true | WS-Security header mustUnderstand attribute |
| encPartList | array | No | [] | Encryption parts list. See WsSecurityToTargetPart |
| encEmbeddedKeyName | string | No | null | Embedded key name for encryption (used when encKeyIdType=EMBEDDED_KEY_INFO) |
| encKeyIdType | string | No | null | Encryption key identifier type. See EnumWsSecurityKeyIdentifierType |
| encSymEncAlgorithm | string | No | null | Symmetric encoding algorithm for encryption. See EnumWsSecuritySymmetricEncodingAlgorithm |
| encKeyEncAlgorithm | string | No | null | Key encryption algorithm. See EnumWsSecurityKeyEncryptionAlgorithm |
| encKeyStoreName | string | Yes | - | Encryption keystore name |
EnumWsSecurityKeyIdentifierType (encKeyIdType)
BINARY_SECURITY_TOKEN- Binary Security TokenISSUER_NAME_AND_SERIAL_NUMBER- Issuer Name and Serial NumberX509_CERTIFICATE- X509 Certificate (recommended)SUBJECT_KEY_IDENTIFIER- Subject Key IdentifierTHUMBPRINT_SHA1_IDENTIFIER- Thumbprint SHA1 IdentifierEMBEDDED_KEY_INFO- Embedded Key Info (requires encEmbeddedKeyName)EMBED_SECURITY_TOKEN_REFERENCE- Embed Security Token ReferenceCUSTOM_KEY_INFO- Custom Key Info
EnumWsSecuritySymmetricEncodingAlgorithm (encSymEncAlgorithm)
AES_128_CBC- AES-128-CBC (http://www.w3.org/2001/04/xmlenc#aes128-cbc)AES_192_CBC- AES-192-CBC (http://www.w3.org/2001/04/xmlenc#aes192-cbc)AES_256_CBC- AES-256-CBC (http://www.w3.org/2001/04/xmlenc#aes256-cbc) (recommended)
EnumWsSecurityKeyEncryptionAlgorithm (encKeyEncAlgorithm)
RSA- RSA v1.5 (http://www.w3.org/2001/04/xmlenc#rsa-1_5) (legacy)OAEP- RSA-OAEP (http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p) (recommended, more secure)
Note
encKeyStoreNameis required.- If
encKeyIdType: EMBEDDED_KEY_INFO,encEmbeddedKeyNameshould be provided.
WsSecurityToTargetPart (encPartList)
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| name | string | Yes | - | Part name (e.g., “Body”, “UsernameToken”) |
| namespace | string | Yes | - | Part namespace URI |
| encodeType | string | Yes | - | Encode type. See EnumWsSecurityEncryptionPartEncodeType |
EnumWsSecurityEncryptionPartEncodeType (encodeType)
CONTENT- Encrypt content onlyELEMENT- Encrypt entire element
Common Part Names and Namespaces
- Body:
name: "Body",namespace: "http://schemas.xmlsoap.org/soap/envelope/" - UsernameToken:
name: "UsernameToken",namespace: "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" - Timestamp:
name: "Timestamp",namespace: "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
Response
Success Response (200 OK)
cURL Example
Update Policy
Endpoint
Request
Headers
| Header | Value |
|---|---|
| Authorization | Bearer {token} |
| Content-Type | application/json |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| projectName | string | Yes | Project name |
| apiProxyName | string | Yes | API Proxy name |
| policyName | string | Yes | Policy name |
Request Body
Full JSON Body Example
Response
Success Response (200 OK)
Delete Policy
Endpoint
Request
Headers
| Header | Value |
|---|---|
| Authorization | Bearer {token} |
| Content-Type | application/json |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| projectName | string | Yes | Project name |
| apiProxyName | string | Yes | API Proxy name |
| policyName | string | Yes | Policy name |
Request Body
Full JSON Body Example
Response
Success Response (200 OK)
Notes and Warnings
-
Encryption Algorithms:
AES_128_CBC,AES_192_CBC,AES_256_CBC- Symmetric encryption algorithmsAES_256_CBCis recommended for stronger security
-
Key Encryption:
RSA- RSA v1.5 (legacy, less secure)OAEP- RSA-OAEP (recommended, more secure)
-
Key Identifier Types:
X509_CERTIFICATE- Most common and recommendedEMBEDDED_KEY_INFO- Use embedded key (requiresencEmbeddedKeyName)
-
Parts:
CONTENT- Encrypt only the content (preserves element structure)ELEMENT- Encrypt entire element (more secure)
-
Key Store:
- Encryption keystore must be configured in Apinizer
- Keystore must contain appropriate certificates/keys
- Key identifier type must match keystore content
- Performance: Encryption adds significant cryptographic processing overhead. Use for necessary security only.
-
Pipeline:
REQUESTpipeline encrypts outgoing requestsRESPONSEpipeline encrypts outgoing responses
- Error Handling: Invalid keystore, missing keys, or configuration errors cause policy to fail
-
Deployment: Policy changes require deployment to take effect. Set
deploy: trueor deploy manually.
Related Documentation
- List Policies - List all policies
- Add Policy - General policy addition guide
- Update Policy - General policy update guide
- Delete Policy - General policy deletion guide
- WS Security Decrypt Policy - Decrypt WS-Security content

