mTLS Authentication Policy
General Information
Policy Type
policy-auth-mtls
Endpoints
List Policies
GET /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/
Add Policy
POST /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/{policyName}/
Update Policy
PUT /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/{policyName}/
Delete Policy
DELETE /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/{policyName}/
List Policies
Endpoint
GET /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/
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)
{
"status": "SUCCESS",
"resultList": [
{
"apiProxy": {
"name": "MyAPI",
"requestPolicyList": [
{
"type": "policy-auth-mtls",
"name": "mtls-auth-policy",
"description": "Authenticate clients using mTLS",
"active": true,
"validateCertificate": true,
"validateACLForIssuer": true
}
],
"responsePolicyList": [],
"errorPolicyList": []
}
}
],
"resultCount": 1
}
cURL Example
curl -X GET \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/policies/" \
-H "Authorization: Bearer YOUR_TOKEN"
Add Policy
Endpoint
POST /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/{policyName}/
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 - Full Validation
{
"operationMetadata": {
"targetScope": "ALL",
"targetPipeline": "REQUEST",
"deploy": true,
"deployTargetEnvironmentNameList": ["production"],
"order": 1
},
"policy": {
"type": "policy-auth-mtls",
"description": "mTLS authentication with full validation",
"active": true,
"validateCertificate": true,
"validateACLForIssuer": true
}
}
Full JSON Body Example - Certificate Validation Only
{
"operationMetadata": {
"targetScope": "ALL",
"targetPipeline": "REQUEST",
"deploy": true,
"deployTargetEnvironmentNameList": ["production"],
"order": 1
},
"policy": {
"type": "policy-auth-mtls",
"description": "mTLS authentication with certificate validation only",
"active": true,
"validateCertificate": true,
"validateACLForIssuer": false
}
}
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) |
Enum: targetScope
ALL- Policy applies to all endpointsENDPOINT- Policy applies only to specified endpoint
Enum: targetPipeline
REQUEST- Executes in request pipeline (authenticates request)RESPONSE- Executes in response pipelineERROR- Executes in error pipeline
Enum: targetEndpointHTTPMethod
GET,POST,PUT,DELETE,PATCH,OPTIONS,HEAD
policy
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| type | string | Yes | - | Policy type: policy-auth-mtls |
| description | string | No | - | Policy description |
| active | boolean | No | true | Whether policy is active |
| identitySource | string | No | SUBJECT_OR_ISSUER | Which certificate name the identity is resolved from |
| validateCertificate | boolean | No | true | Validate client certificate validity dates and intended usage |
| validateCertificatesIssuer | boolean | No | true | Validate the presented certificate chain against the Consumer's key store |
| validateACLForIssuer | boolean | No | true | Validate the Consumer's access permission, validity and address restrictions |
Note
-
identitySource: Determines which name on the client certificate the identity is resolved from. Allowed values:SUBJECT— resolve from the client certificate's own subject CN.ISSUER— resolve from the certificate's issuer CN, so all certificates signed by that authority map to a single Consumer.SUBJECT_OR_ISSUER(default) — try the subject CN first, fall back to the issuer CN.
The value must be consistent with the username of the Consumer you define, otherwise the request is rejected even when the certificate is valid. The identity is read only from the client's own certificate; names of intermediate or root certificates in the chain are never used as an identity.
-
validateCertificate: Whentrue, validates the certificate's validity dates and verifies that it was issued for client authentication purposes. -
validateCertificatesIssuer: Whentrue, validates the entire certificate chain presented by the client against the trusted certificates in the key store bound to the matched Consumer. If no key store is bound to the Consumer, the request is rejected. -
validateACLForIssuer: Whentrue, validates the matched Consumer's access permission for this API, its validity period and any address/location restrictions. -
All validations are enabled by default for maximum security.
-
This policy is supported only on HTTP/HTTPS API Proxies. It is not supported on gRPC or WebSocket API Proxies; if defined on either, the request fails with a 500 error instead of running the certificate checks.
Response
Success Response (200 OK)
{
"status": "SUCCESS",
"deploymentResult": {
"success": true,
"deploymentResults": [
{
"environmentName": "production",
"success": true,
"message": "Deployment successful"
}
]
}
}
cURL Example
curl -X POST \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/policies/mtls-auth-policy/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationMetadata": {
"targetScope": "ALL",
"targetPipeline": "REQUEST",
"deploy": true,
"deployTargetEnvironmentNameList": ["production"],
"order": 1
},
"policy": {
"type": "policy-auth-mtls",
"description": "mTLS authentication",
"active": true,
"validateCertificate": true,
"validateACLForIssuer": true
}
}'
Update Policy
Endpoint
PUT /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/{policyName}/
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
{
"operationMetadata": {
"targetScope": "ALL",
"targetPipeline": "REQUEST",
"deploy": true,
"deployTargetEnvironmentNameList": ["production", "staging"],
"order": 1
},
"policy": {
"type": "policy-auth-mtls",
"description": "Updated: mTLS authentication with enhanced certificate validation",
"active": true,
"validateCertificate": true,
"validateACLForIssuer": true
}
}
Note: Request body structure is the same as Add Policy. All fields should be provided for update.
Response
Success Response (200 OK)
{
"status": "SUCCESS",
"deploymentResult": {
"success": true,
"deploymentResults": [
{
"environmentName": "production",
"success": true,
"message": "Deployment successful"
}
]
}
}
Delete Policy
Endpoint
DELETE /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/{policyName}/
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
{
"operationMetadata": {
"targetScope": "ALL",
"targetPipeline": "REQUEST",
"deploy": false
}
}
Response
Success Response (200 OK)
{
"status": "SUCCESS",
"deploymentResult": {
"success": true,
"deploymentResults": []
}
}
Notes and Warnings
-
Identity Resolution:
identitySourceselects which certificate name the identity is resolved from:SUBJECT,ISSUERorSUBJECT_OR_ISSUER(default)- The resolved name must match the username of an enabled Consumer in Apinizer
- The identity is read only from the client's own certificate; intermediate and root certificate names in the chain are never used
-
Certificate Validation:
- When
validateCertificate: true, validates the certificate's validity dates and verifies it was issued for client authentication purposes - Certificate must be valid and not expired
- When
-
Trust Validation:
- When
validateCertificatesIssuer: true, validates the entire chain presented by the client against the key store bound to the matched Consumer - A key store must be bound to the Consumer; otherwise the request is rejected
- Runs before access control, so trust is proven before the client is considered authenticated
- When
-
Access Control:
- When
validateACLForIssuer: true, validates the matched Consumer's access permission for this API, its validity period and address/location restrictions - The API must be present in the Consumer's access list
- When
-
TLS Configuration:
- HTTPS and mTLS must be enabled in the environment settings where the policy is applied
- TLS must terminate on the gateway; if a load balancer or ingress terminates TLS, the client certificate does not reach the gateway
- Client certificates must be presented during TLS handshake
-
Protocol Support:
- Supported only on HTTP/HTTPS API Proxies
- Not supported on gRPC or WebSocket API Proxies; if defined on either, requests fail with a 500 error rather than the normal 401 authentication failure
-
Certificate Format:
- Supports X.509 certificates (PEM, DER formats)
- Certificate must include public key and signature
- Certificate chain validation requires intermediate and root CA certificates
-
Security:
- mTLS provides strong authentication based on PKI
- More secure than password-based authentication
- Requires proper certificate management
-
Performance: Certificate validation adds minimal overhead to TLS handshake
-
Pipeline:
REQUESTpipeline validates client certificate before processing request- Authentication failure results in 401 Unauthorized response
-
Error Handling: Invalid or missing certificates cause authentication 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
- Basic Authentication Policy - HTTP Basic Authentication
- JWT Authentication Policy - JWT Token Authentication