Documentation Index
Fetch the complete documentation index at: https://docs.apinizer.com/llms.txt
Use this file to discover all available pages before exploring further.
Endpoint
PATCH /apiops/projects/{projectName}/apiProxies/{apiProxyName}/settings/custom-message/
Authentication
Requires a Personal API Access Token.
Authorization: Bearer YOUR_TOKEN
Request
| Header | Value | Required |
|---|
| Authorization | Bearer | Yes |
| Content-Type | application/json | Yes |
Path Parameters
| Parameter | Type | Required | Description |
|---|
| projectName | string | Yes | Project name |
| apiProxyName | string | Yes | API Proxy name |
Request Body
Full JSON Body Example
{
"buildCustomMessage": true,
"customMessageTemplate": "{\"status\": \"ok\", \"message\": \"Service is running\"}",
"customMessageContentType": "application/json",
"customMessageHttpStatusCode": 200,
"deploy": false,
"deployTargetEnvironmentNameList": []
}
Request Body Fields
| Field | Type | Required | Default | Description |
|---|
| buildCustomMessage | boolean | No | false | Enable custom response message building |
| customMessageTemplate | string | No | - | Response body template (supports variables) |
| customMessageContentType | string | No | - | Content-Type header for the custom response |
| customMessageHttpStatusCode | integer | No | - | HTTP status code for the custom response |
| deploy | boolean | No | false | If true, deploy the API proxy after saving changes |
| deployTargetEnvironmentNameList | array[string] | No | - | List of environment names to deploy to (required when deploy=true) |
Note: All fields are optional. Only provided fields are updated.
Response
Success Response (200 OK)
When deploy=true is specified:
{
"success": true,
"deploymentResult": {
"success": true,
"deploymentResults": [
{
"environmentName": "production",
"success": true,
"message": "Deployment successful"
}
]
}
}
Response Fields
| Field | Type | Description |
|---|
| success | boolean | Indicates if the request was successful |
| deploymentResult | object | Only present when deploy=true |
| deploymentResult.success | boolean | Overall deployment success status |
| deploymentResult.deploymentResults | array | Per-environment deployment results |
Error Response (401 Unauthorized)
{
"error": "unauthorized_client",
"error_description": "Invalid token"
}
Error Response (404 Not Found)
{
"error": "not_found",
"error_description": "ApiProxy (name: MyAPI) was not found!"
}
cURL Example
Example 1: Enable Custom JSON Response
curl -X PATCH \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/settings/custom-message/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"buildCustomMessage": true,
"customMessageTemplate": "{\"status\": \"ok\", \"version\": \"1.0\"}",
"customMessageContentType": "application/json",
"customMessageHttpStatusCode": 200
}'
Example 2: Enable Custom XML Response
curl -X PATCH \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/settings/custom-message/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"buildCustomMessage": true,
"customMessageTemplate": "<response><status>ok</status><message>Service healthy</message></response>",
"customMessageContentType": "application/xml",
"customMessageHttpStatusCode": 200
}'
Example 3: Disable Custom Message (Resume Normal Routing)
curl -X PATCH \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/settings/custom-message/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"buildCustomMessage": false
}'
Example 4: Save and Deploy
curl -X PATCH \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAPI/settings/custom-message/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"buildCustomMessage": true,
"customMessageTemplate": "{\"status\": \"ok\"}",
"customMessageContentType": "application/json",
"deploy": true,
"deployTargetEnvironmentNameList": ["production"]
}'
Notes and Warnings
- Custom Message Mode: When
buildCustomMessage=true, the gateway returns the custom response template instead of routing to backend
- Template Variables: The template supports Apinizer variables (e.g.,
${request_httpMethod}, ${request_uri}) that are resolved at runtime
- Content Type: Set
customMessageContentType to match your template format (e.g., application/json, application/xml, text/plain)
- HTTP Status Code: The
customMessageHttpStatusCode overrides the default 200 status code
- Use Cases: Health check endpoints, mock responses, maintenance responses, API versioning redirects
- Deploy: When
deploy=true, the API proxy is automatically deployed to the specified environments after saving
Permissions
User must have API_MANAGEMENT + MANAGE permission in the project.