Skip to main content

Management API: WebBroker API Management

You're reading API Gateway 1.1.0. The newest release is 1.2.0. Go to the newest release

Create a new WebBrokerAPI​

POST /webbroker-apis

Code samples


curl -X POST http://localhost:9090/api/management/v0.9/webbroker-apis \
-u {username}:{password} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d @payload.json

Add a new WebBrokerAPI to the Gateway. WebBrokerAPI provides bidirectional streaming between WebSocket clients and Kafka brokers with per-connection isolation.

Payload

{
"apiVersion": "gateway.api-platform.wso2.com/v1alpha1",
"kind": "WebBrokerApi",
"metadata": {
"name": "stock-trading-v1.0"
},
"spec": {
"displayName": "Stock Trading WebBroker API",
"version": "v1.0",
"context": "/stock-trading/$version",
"receiver": {
"name": "websocket-receiver",
"type": "websocket"
},
"broker": {
"name": "kafka-driver",
"type": "kafka",
"properties": {
"brokers": [
"kafka-broker-1:9092",
"kafka-broker-2:9092"
]
}
},
"allChannels": {
"on_connection_init": {
"policies": []
},
"on_produce": {
"policies": []
},
"on_consume": {
"policies": []
}
},
"channels": {
"prices": {
"produceTo": {
"topic": "stock.prices"
},
"consumeFrom": {
"topic": "stock.prices"
},
"on_connection_init": {
"policies": []
},
"on_produce": {
"policies": []
},
"on_consume": {
"policies": []
}
}
}
}
}

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`, `developer`

Parameters​

NameInTypeRequiredDescription
bodybodyWebBrokerApiRequesttruenone

Example responses

201 Response

{
"apiVersion": "gateway.api-platform.wso2.com/v1alpha1",
"kind": "WebBrokerApi",
"metadata": {
"name": "stock-trading-v1.0"
},
"spec": {
"displayName": "Stock Trading WebBroker API",
"version": "v1.0",
"context": "/stock-trading/$version",
"receiver": {
"name": "websocket-receiver",
"type": "websocket"
},
"broker": {
"name": "kafka-driver",
"type": "kafka",
"properties": {
"brokers": [
"kafka-broker-1:9092",
"kafka-broker-2:9092"
]
}
},
"allChannels": {
"on_connection_init": {
"policies": []
},
"on_produce": {
"policies": []
},
"on_consume": {
"policies": []
}
},
"channels": {
"prices": {
"produceTo": {
"topic": "stock.prices"
},
"consumeFrom": {
"topic": "stock.prices"
},
"on_connection_init": {
"policies": []
},
"on_produce": {
"policies": []
},
"on_consume": {
"policies": []
}
}
}
},
"status": {
"id": "stock-trading-v1.0",
"state": "deployed",
"createdAt": "2026-04-24T07:21:13Z",
"updatedAt": "2026-04-24T07:21:13Z",
"deployedAt": "2026-04-24T07:21:13Z"
}
}

Responses​

StatusMeaningDescriptionSchema
201CreatedWebBrokerAPI created successfullyWebBrokerApi
400Bad RequestInvalid configuration (validation failed)ErrorResponse
409ConflictConflict - WebBroker API with same name and version already existsErrorResponse
500Internal Server ErrorInternal server errorErrorResponse

List all WebBrokerAPIs​

GET /webbroker-apis

Code samples


curl -X GET http://localhost:9090/api/management/v0.9/webbroker-apis \
-u {username}:{password} \
-H 'Accept: application/json'

List WebBrokerAPIs registered in the Gateway, optionally filtered by name, version, or status.

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`, `developer`

Parameters​

NameInTypeRequiredDescription
displayNamequerystringfalseFilter by WebBroker API display name
versionquerystringfalseFilter by WebBroker API version
statusquerystringfalseFilter by deployment status

Enumerated Values​

ParameterValue
statusdeployed
statusundeployed

Example responses

200 Response

{
"status": "success",
"count": 3,
"apis": [
{
"apiVersion": "gateway.api-platform.wso2.com/v1alpha1",
"kind": "WebBrokerApi",
"metadata": {
"name": "stock-trading-v1.0"
},
"spec": {
"displayName": "Stock Trading WebBroker API",
"version": "v1.0",
"context": "/stock-trading/$version",
"receiver": {
"name": "websocket-receiver",
"type": "websocket"
},
"broker": {
"name": "kafka-driver",
"type": "kafka",
"properties": {
"brokers": [
"kafka-broker-1:9092",
"kafka-broker-2:9092"
]
}
},
"allChannels": {
"on_connection_init": {
"policies": []
},
"on_produce": {
"policies": []
},
"on_consume": {
"policies": []
}
},
"channels": {
"prices": {
"produceTo": {
"topic": "stock.prices"
},
"consumeFrom": {
"topic": "stock.prices"
},
"on_connection_init": {
"policies": []
},
"on_produce": {
"policies": []
},
"on_consume": {
"policies": []
}
}
}
},
"status": {
"id": "stock-trading-v1.0",
"state": "deployed",
"createdAt": "2026-04-24T07:21:13Z",
"updatedAt": "2026-04-24T07:21:13Z",
"deployedAt": "2026-04-24T07:21:13Z"
}
}
]
}

Responses​

StatusMeaningDescriptionSchema
200OKList of WebBrokerAPIsInline
500Internal Server ErrorInternal server errorErrorResponse

Response Schema​

Status Code 200

NameTypeRequiredRestrictionsDescription
statusstringfalsenonenone
countintegerfalsenonenone
apis[allOf]falsenonenone

allOf

NameTypeRequiredRestrictionsDescription
anonymousWebBrokerApiRequestfalsenonenone
apiVersionstringtruenoneAPI specification version
kindstringtruenoneAPI type
metadataMetadatatruenonenone
namestringtruenoneUnique handle for the resource
labelsobjectfalsenoneLabels are key-value pairs for organizing and selecting APIs. Keys must not contain spaces.
additionalPropertiesstringfalsenonenone
annotationsobjectfalsenoneAnnotations are arbitrary non-identifying metadata. Use domain-prefixed keys.
additionalPropertiesstringfalsenonenone
specWebBrokerApiDatatruenonenone
displayNamestringtruenoneHuman-readable API name (must be URL-friendly - only letters, numbers, spaces, hyphens, underscores, and dots allowed)
versionstringtruenoneSemantic version of the API
contextstringtruenoneBase path for all API routes (must start with /, no trailing slash)
receiverWebBrokerApiReceivertruenoneWebSocket receiver configuration
namestringtruenoneReceiver name
typestringtruenoneReceiver type
propertiesobjectfalsenoneAdditional receiver properties
brokerWebBrokerApiBrokertruenoneMessage broker driver configuration
namestringtruenoneBroker driver name
typestringtruenoneBroker driver type
propertiesobjecttruenoneBroker driver properties (e.g., bootstrap servers)
allChannelsWebBrokerApiAllChannelPoliciesfalsenoneProtocol mediation policies applied to all channels
on_connection_initWebBrokerApiPolicyGroupfalsenoneGroup of policies
policies[Policy]falsenoneList of policies to apply
namestringtruenoneName of the policy
versionstringtruenoneVersion of the policy. Only major-only version is allowed (e.g., v0, v1). Full semantic version (e.g., v1.0.0) is not accepted and will be rejected. The Gateway Controller resolves the major version to the single matching full version installed in the gateway image.
executionConditionstringfalsenoneExpression controlling conditional execution of the policy
paramsobjectfalsenoneArbitrary parameters for the policy (free-form key/value structure)
on_produceWebBrokerApiPolicyGroupfalsenoneGroup of policies
on_consumeWebBrokerApiPolicyGroupfalsenoneGroup of policies
channelsobjecttruenoneMap of WebSocket channels for bidirectional streaming with Kafka (key is channel name)
additionalPropertiesWebBrokerApiChannelfalsenoneWebSocket channel configuration with Kafka topic mapping
produceToWebBrokerApiProduceConfigfalsenoneConfiguration for producing messages from WebSocket to Kafka
topicstringtruenoneKafka topic to produce messages to
consumeFromWebBrokerApiConsumeConfigfalsenoneConfiguration for consuming messages from Kafka to WebSocket
topicstringtruenoneKafka topic to consume messages from
on_connection_initWebBrokerApiPolicyGroupfalsenoneGroup of policies
on_produceWebBrokerApiPolicyGroupfalsenoneGroup of policies
on_consumeWebBrokerApiPolicyGroupfalsenoneGroup of policies
vhostsobjectfalsenoneCustom virtual hosts/domains for the API
mainstringtruenoneCustom virtual host/domain for production traffic
sandboxstringfalsenoneCustom virtual host/domain for sandbox traffic
deploymentStatestringfalsenoneDesired deployment state - 'deployed' (default) or 'undeployed'. When set to 'undeployed', the API is removed from router traffic but configuration and policies are preserved for potential redeployment.

and

NameTypeRequiredRestrictionsDescription
anonymousobjectfalsenonenone
statusResourceStatusfalseread-onlyServer-managed lifecycle fields. Populated on responses.
idstringfalsenoneUnique identifier assigned by the server (equal to metadata.name)
statestringfalsenoneDesired deployment state reported by the server
createdAtstring(date-time)falsenoneTimestamp when the resource was first created (UTC)
updatedAtstring(date-time)falsenoneTimestamp when the resource was last updated (UTC)
deployedAtstring(date-time)falsenoneTimestamp when the resource was last deployed (omitted when undeployed)

Enumerated Values​

PropertyValue
apiVersiongateway.api-platform.wso2.com/v1alpha1
kindWebBrokerApi
deploymentStatedeployed
deploymentStateundeployed
statedeployed
stateundeployed

Get WebBrokerAPI by id​

GET /webbroker-apis/{id}

Code samples


curl -X GET http://localhost:9090/api/management/v0.9/webbroker-apis/{id} \
-u {username}:{password} \
-H 'Accept: application/json'

Get a WebBrokerAPI by its ID.

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`, `developer`

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier for the WebBroker API.

Detailed descriptions​

id: Unique public identifier for the WebBroker API.

Example responses

200 Response

{
"apiVersion": "gateway.api-platform.wso2.com/v1alpha1",
"kind": "WebBrokerApi",
"metadata": {
"name": "stock-trading-v1.0"
},
"spec": {
"displayName": "Stock Trading WebBroker API",
"version": "v1.0",
"context": "/stock-trading/$version",
"receiver": {
"name": "websocket-receiver",
"type": "websocket"
},
"broker": {
"name": "kafka-driver",
"type": "kafka",
"properties": {
"brokers": [
"kafka-broker-1:9092",
"kafka-broker-2:9092"
]
}
},
"allChannels": {
"on_connection_init": {
"policies": []
},
"on_produce": {
"policies": []
},
"on_consume": {
"policies": []
}
},
"channels": {
"prices": {
"produceTo": {
"topic": "stock.prices"
},
"consumeFrom": {
"topic": "stock.prices"
},
"on_connection_init": {
"policies": []
},
"on_produce": {
"policies": []
},
"on_consume": {
"policies": []
}
}
}
},
"status": {
"id": "stock-trading-v1.0",
"state": "deployed",
"createdAt": "2026-04-24T07:21:13Z",
"updatedAt": "2026-04-24T07:21:13Z",
"deployedAt": "2026-04-24T07:21:13Z"
}
}

Responses​

StatusMeaningDescriptionSchema
200OKWebBrokerAPI detailsWebBrokerApi
404Not FoundWebBrokerAPI not foundErrorResponse
500Internal Server ErrorInternal server errorErrorResponse

Delete a WebBrokerAPI​

DELETE /webbroker-apis/{id}

Code samples


curl -X DELETE http://localhost:9090/api/management/v0.9/webbroker-apis/{id} \
-u {username}:{password} \
-H 'Accept: application/json'

Delete a WebBrokerAPI from the Gateway.

Authentication​

This operation requires Basic Auth authentication. Required roles: `admin`, `developer`

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier of the WebBroker API to delete.

Detailed descriptions​

id: Unique public identifier of the WebBroker API to delete.

Example responses

200 Response

{
"status": "success",
"message": "WebBrokerAPI deleted successfully",
"id": "stock-trading-webbroker-api"
}

Responses​

StatusMeaningDescriptionSchema
200OKWebBrokerAPI deleted successfullyInline
404Not FoundWebBrokerAPI not foundErrorResponse
500Internal Server ErrorInternal server errorErrorResponse

Response Schema​

Status Code 200

NameTypeRequiredRestrictionsDescription
statusstringfalsenonenone
messagestringfalsenonenone
idstringfalsenonenone

Was this page helpful?