Skip to main content

Platform API: Gateway policies

Custom gateway policy management operations

Get synced custom policies for the current organization​

GET /gateway-custom-policies

Code samples


curl -X GET https://localhost:9243/api/v0.9/gateway-custom-policies \
-H 'Authorization: Bearer {access_token}' \
-H 'Accept: application/json'

Returns all custom policies synced to the current organization (from the JWT organization claim).

Authentication​

This operation requires a Bearer JWT access token in the Authorization header. Required scopes (the token must carry at least one of): `ap:gateway_custom_policy:read`, `ap:gateway_custom_policy:manage`

Parameters​

NameInTypeRequiredDescription
limitqueryintegerfalseMaximum number of items to return per page.
offsetqueryintegerfalseZero-based index of the first item to return.

Example responses

200 Response

{
"count": 0,
"list": [
{
"uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"organizationUuid": "bc554ded-7e40-44a7-b397-48480793ad03",
"name": "rate-limit-custom",
"version": "1.0.0",
"description": "Custom rate limiting policy",
"policyDefinition": {},
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z"
}
],
"pagination": {
"total": 10,
"offset": 0,
"limit": 10
}
}

401 Response

{
"status": "error",
"code": "UNAUTHORIZED",
"message": "Authorization header is required, or the token is invalid or expired."
}

500 Response

{
"status": "error",
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred.",
"trackingId": "4f1c6f2e-8a4b-4c93-b1de-9f2f6f0c2a11"
}

Responses​

StatusMeaningDescriptionSchema
200OKList of custom policiesCustomPolicyListResponse
401UnauthorizedUnauthorized. Authentication credentials are missing or invalid.Error
500Internal Server ErrorInternal Server Error.Error

Sync a custom policy from the gateway manifest​

POST /gateway-custom-policies/sync

Code samples


curl -X POST https://localhost:9243/api/v0.9/gateway-custom-policies/sync?gatewayId=prod-gateway-01&policyName=set-wso2-headers&policyVersion=1.0.0 \
-H 'Authorization: Bearer {access_token}' \
-H 'Accept: application/json'

Syncs a custom policy from the gateway manifest into the organization's custom policy registry. Version-based rules apply:

  • New major version: creates a new policy record (e.g. v1.x.x and v2.x.x coexist).
  • New minor version (same major): updates the existing record (e.g. v1.1.0 → v1.2.0).
  • Patch version change (same major.minor): not allowed.
  • Downgrade: not allowed. Policy names are case-insensitive. After syncing, the policy can be applied to APIs in the organization.

Authentication​

This operation requires a Bearer JWT access token in the Authorization header. Required scopes (the token must carry at least one of): `ap:gateway_custom_policy:create`, `ap:gateway_custom_policy:manage`

Parameters​

NameInTypeRequiredDescription
gatewayIdquerystringtrueHandle (URL-friendly slug) of the gateway whose manifest contains the policy
policyNamequerystringtrueName of the custom policy (case-insensitive)
policyVersionquerystringtrueVersion of the custom policy in MAJOR.MINOR.PATCH format

Example responses

200 Response

{
"uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"organizationUuid": "bc554ded-7e40-44a7-b397-48480793ad03",
"name": "rate-limit-custom",
"version": "1.0.0",
"description": "Custom rate limiting policy",
"policyDefinition": {},
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z"
}

400 Response

{
"status": "error",
"code": "VALIDATION_FAILED",
"message": "The request failed validation.",
"errors": [
{
"field": "<name of the offending field>",
"message": "<reason this field failed validation>"
}
]
}

401 Response

{
"status": "error",
"code": "UNAUTHORIZED",
"message": "Authorization header is required, or the token is invalid or expired."
}

403 Response

{
"status": "error",
"code": "FORBIDDEN",
"message": "You do not have permission to perform this action."
}

404 Response

{
"status": "error",
"code": "NOT_FOUND",
"message": "The specified resource does not exist."
}

409 Response

{
"status": "error",
"code": "CONFLICT",
"message": "The request conflicts with the current state of the resource."
}

422 Response

{
"status": "error",
"code": "POLICY_INVALID_STATE",
"message": "The policy is not a custom policy, or its manifest is unavailable."
}

500 Response

{
"status": "error",
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred.",
"trackingId": "4f1c6f2e-8a4b-4c93-b1de-9f2f6f0c2a11"
}

Responses​

StatusMeaningDescriptionSchema
200OKCustom policy synced successfullyCustomPolicyResponse
400Bad RequestBad Request. Invalid request or validation error.Error
401UnauthorizedUnauthorized. Authentication credentials are missing or invalid.Error
403ForbiddenForbidden. The authenticated user does not have permission to access this resource.Error
404Not FoundNot Found. The specified resource does not exist.Error
409ConflictConflict. The request conflicts with the current state of the resource.Error
422Unprocessable EntityPolicy is not a custom policy or manifest is unavailableError
500Internal Server ErrorInternal Server Error.Error

Get a specific custom policy version​

GET /gateway-custom-policies/{gatewayCustomPolicyId}/versions/{version}

Code samples


curl -X GET https://localhost:9243/api/v0.9/gateway-custom-policies/{gatewayCustomPolicyId}/versions/{version} \
-H 'Authorization: Bearer {access_token}' \
-H 'Accept: application/json'

Returns a custom policy by its UUID and version for the current organization.

Authentication​

This operation requires a Bearer JWT access token in the Authorization header. Required scopes (the token must carry at least one of): `ap:gateway_custom_policy:read`, `ap:gateway_custom_policy:manage`

Parameters​

NameInTypeRequiredDescription
gatewayCustomPolicyIdpathstring(uuid)trueUUID of the custom policy record
versionpathstringtrueVersion of the custom policy (e.g. "1.0.0")

Example responses

200 Response

{
"uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"organizationUuid": "bc554ded-7e40-44a7-b397-48480793ad03",
"name": "rate-limit-custom",
"version": "1.0.0",
"description": "Custom rate limiting policy",
"policyDefinition": {},
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z"
}

401 Response

{
"status": "error",
"code": "UNAUTHORIZED",
"message": "Authorization header is required, or the token is invalid or expired."
}

404 Response

{
"status": "error",
"code": "NOT_FOUND",
"message": "The specified resource does not exist."
}

500 Response

{
"status": "error",
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred.",
"trackingId": "4f1c6f2e-8a4b-4c93-b1de-9f2f6f0c2a11"
}

Responses​

StatusMeaningDescriptionSchema
200OKCustom policy retrieved successfullyCustomPolicyResponse
401UnauthorizedUnauthorized. Authentication credentials are missing or invalid.Error
404Not FoundNot Found. The specified resource does not exist.Error
500Internal Server ErrorInternal Server Error.Error

Delete a specific custom policy version​

DELETE /gateway-custom-policies/{gatewayCustomPolicyId}/versions/{version}

Code samples


curl -X DELETE https://localhost:9243/api/v0.9/gateway-custom-policies/{gatewayCustomPolicyId}/versions/{version} \
-H 'Authorization: Bearer {access_token}' \
-H 'Accept: application/json'

Deletes a custom policy by its UUID and version. The policy must not be in use by any APIs.

Authentication​

This operation requires a Bearer JWT access token in the Authorization header. Required scopes (the token must carry at least one of): `ap:gateway_custom_policy:delete`, `ap:gateway_custom_policy:manage`

Parameters​

NameInTypeRequiredDescription
gatewayCustomPolicyIdpathstring(uuid)trueUUID of the custom policy record
versionpathstringtrueVersion of the custom policy (e.g. "1.0.0")

Example responses

401 Response

{
"status": "error",
"code": "UNAUTHORIZED",
"message": "Authorization header is required, or the token is invalid or expired."
}

403 Response

{
"status": "error",
"code": "FORBIDDEN",
"message": "You do not have permission to perform this action."
}

404 Response

{
"status": "error",
"code": "NOT_FOUND",
"message": "The specified resource does not exist."
}

409 Response

{
"status": "error",
"code": "CONFLICT",
"message": "The request conflicts with the current state of the resource."
}

500 Response

{
"status": "error",
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred.",
"trackingId": "4f1c6f2e-8a4b-4c93-b1de-9f2f6f0c2a11"
}

Responses​

StatusMeaningDescriptionSchema
204No ContentCustom policy deleted successfullyNone
401UnauthorizedUnauthorized. Authentication credentials are missing or invalid.Error
403ForbiddenForbidden. The authenticated user does not have permission to access this resource.Error
404Not FoundNot Found. The specified resource does not exist.Error
409ConflictConflict. The request conflicts with the current state of the resource.Error
500Internal Server ErrorInternal Server Error.Error

Was this page helpful?