Skip to main content

Management API: WebSub 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 WebSubAPI​

POST /websub-apis

Code samples


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

Add a new WebSubAPI to the Gateway.

Payload

{
"apiVersion": "gateway.api-platform.wso2.com/v1alpha1",
"kind": "WebSubApi",
"metadata": {
"name": "github-events-v1.0"
},
"spec": {
"displayName": "GitHub Events",
"version": "v1.0",
"context": "/github-events/$version",
"channels": [
{
"name": "issues",
"method": "SUB"
},
{
"name": "pull_requests",
"method": "SUB"
}
]
}
}

Authentication​

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

Parameters​

NameInTypeRequiredDescription
bodybodyWebSubAPIRequesttruenone

Example responses

201 Response

{
"apiVersion": "gateway.api-platform.wso2.com/v1alpha1",
"kind": "WebSubApi",
"metadata": {
"name": "github-events-v1.0"
},
"spec": {
"displayName": "GitHub Events",
"version": "v1.0",
"context": "/github-events/$version",
"channels": [
{
"name": "issues",
"method": "SUB"
},
{
"name": "pull_requests",
"method": "SUB"
}
]
},
"status": {
"id": "github-events-v1.0",
"state": "deployed",
"createdAt": "2026-04-24T07:21:13Z",
"updatedAt": "2026-04-24T07:21:13Z",
"deployedAt": "2026-04-24T07:21:13Z"
}
}

Responses​

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

List all WebSubAPIs​

GET /websub-apis

Code samples


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

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

Authentication​

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

Parameters​

NameInTypeRequiredDescription
displayNamequerystringfalseFilter by WebSub API display name
versionquerystringfalseFilter by WebSub API version
contextquerystringfalseFilter by WebSub API context/path
statusquerystringfalseFilter by deployment status

Enumerated Values​

ParameterValue
statusdeployed
statusundeployed

Example responses

200 Response

{
"status": "success",
"count": 5,
"apis": [
{
"apiVersion": "gateway.api-platform.wso2.com/v1alpha1",
"kind": "WebSubApi",
"metadata": {
"name": "github-events-v1.0"
},
"spec": {
"displayName": "GitHub Events",
"version": "v1.0",
"context": "/github-events/$version",
"channels": [
{
"name": "issues",
"method": "SUB"
},
{
"name": "pull_requests",
"method": "SUB"
}
]
},
"status": {
"id": "github-events-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 WebSubAPIsInline
500Internal Server ErrorInternal server errorErrorResponse

Response Schema​

Status Code 200

NameTypeRequiredRestrictionsDescription
statusstringfalsenonenone
countintegerfalsenonenone
apis[allOf]falsenonenone

allOf

NameTypeRequiredRestrictionsDescription
anonymousWebSubAPIRequestfalsenonenone
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
specWebhookAPIDatatruenonenone
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)
vhostsobjectfalsenoneCustom virtual hosts/domains for the API
mainstringtruenoneCustom virtual host/domain for production traffic
sandboxstringfalsenoneCustom virtual host/domain for sandbox traffic
allChannelsWebSubAllChannelPoliciesfalsenonePolicies applied to all channels, organized by event type.
on_subscriptionWebSubEventPoliciesfalsenonePolicies for a single event type.
policies[Policy]falsenoneList of policies applied for this event type.
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_unsubscriptionWebSubEventPoliciesfalsenonePolicies for a single event type.
on_message_receivedWebSubEventPoliciesfalsenonePolicies for a single event type.
on_message_deliveryWebSubEventPoliciesfalsenonePolicies for a single event type.
channelsobjectfalsenonePer-channel configuration keyed by channel name. Each key is a channel name and defines policies applied only to that channel.
additionalPropertiesWebSubChannelfalsenoneA single channel definition with optional per-channel policy overrides.
on_subscriptionWebSubEventPoliciesfalsenonePolicies for a single event type.
on_unsubscriptionWebSubEventPoliciesfalsenonePolicies for a single event type.
on_message_receivedWebSubEventPoliciesfalsenonePolicies for a single event type.
on_message_deliveryWebSubEventPoliciesfalsenonePolicies for a single event type.
deploymentStatestringfalsenoneDesired deployment state - 'deployed' (default) or 'undeployed'. When set to 'undeployed', the API is removed from router traffic but configuration, API keys, 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
kindWebSubApi
deploymentStatedeployed
deploymentStateundeployed
statedeployed
stateundeployed

Create a new API key for a WebSub API​

POST /websub-apis/{id}/api-keys

Code samples


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

Generate a new API key for a WebSub API in the Gateway. The key is a 32-byte random value encoded in hexadecimal, prefixed with apip_. Use the API Key policy on the API to validate incoming requests with this key.

Payload

{
"name": "my-production-key"
}

Authentication​

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

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier of the WebSub API to generate the key for
bodybodyAPIKeyCreationRequesttruenone

Example responses

201 Response

{
"status": "success",
"message": "API key generated successfully",
"remainingApiKeyQuota": 9,
"apiKey": {
"name": "my-production-key",
"displayName": "My Production Key",
"apiKey": "apip_1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"apiId": "reading-list-api-v1.0",
"status": "active",
"createdAt": "2026-04-01T10:30:00Z",
"createdBy": "admin",
"expiresAt": null,
"source": "local"
}
}

Responses​

StatusMeaningDescriptionSchema
201CreatedAPI key created successfullyAPIKeyCreationResponse
400Bad RequestInvalid configuration (validation failed)ErrorResponse
404Not FoundWebSub API not foundErrorResponse
409ConflictConflict (duplicate key or conflicting update)ErrorResponse
500Internal Server ErrorInternal server errorErrorResponse

Get the list of API keys for a WebSub API​

GET /websub-apis/{id}/api-keys

Code samples


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

List all API keys for a WebSub API in the Gateway.

Authentication​

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

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier of the WebSub API to retrieve the keys for

Example responses

200 Response

{
"apiKeys": [
{
"name": "my-production-key",
"displayName": "My Production Key",
"apiKey": "apip_1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"apiId": "reading-list-api-v1.0",
"status": "active",
"createdAt": "2026-04-01T10:30:00Z",
"createdBy": "admin",
"expiresAt": null,
"source": "local"
}
],
"totalCount": 3,
"status": "success"
}

Responses​

StatusMeaningDescriptionSchema
200OKList of API keysAPIKeyListResponse
404Not FoundWebSub API not foundErrorResponse
500Internal Server ErrorInternal server errorErrorResponse

Regenerate API key for a WebSub API​

POST /websub-apis/{id}/api-keys/{apiKeyName}/regenerate

Code samples


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

Regenerate an existing API key for a WebSub API in the Gateway. The previous key is revoked and replaced with a new 32-byte random value encoded in hexadecimal, prefixed with apip_.

Payload

{}

Authentication​

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

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier of the WebSub API
apiKeyNamepathstringtrueName of the API key to regenerate
bodybodyAPIKeyRegenerationRequesttruenone

Example responses

200 Response

{
"status": "success",
"message": "API key generated successfully",
"remainingApiKeyQuota": 9,
"apiKey": {
"name": "my-production-key",
"displayName": "My Production Key",
"apiKey": "apip_1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"apiId": "reading-list-api-v1.0",
"status": "active",
"createdAt": "2026-04-01T10:30:00Z",
"createdBy": "admin",
"expiresAt": null,
"source": "local"
}
}

Responses​

StatusMeaningDescriptionSchema
200OKAPI key rotated successfullyAPIKeyCreationResponse
400Bad RequestInvalid configuration (validation failed)ErrorResponse
404Not FoundWebSub API or API key not foundErrorResponse
500Internal Server ErrorInternal server errorErrorResponse

Update an API key for a WebSub API​

PUT /websub-apis/{id}/api-keys/{apiKeyName}

Code samples


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

Update an API key with a custom value instead of auto-generating one.

Payload

{
"name": "my-production-key"
}

Authentication​

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

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier of the WebSub API
apiKeyNamepathstringtrueName of the API key to update
bodybodyAPIKeyUpdateRequesttruenone

Example responses

200 Response

{
"status": "success",
"message": "API key generated successfully",
"remainingApiKeyQuota": 9,
"apiKey": {
"name": "my-production-key",
"displayName": "My Production Key",
"apiKey": "apip_1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"apiId": "reading-list-api-v1.0",
"status": "active",
"createdAt": "2026-04-01T10:30:00Z",
"createdBy": "admin",
"expiresAt": null,
"source": "local"
}
}

Responses​

StatusMeaningDescriptionSchema
200OKAPI key updated successfullyAPIKeyCreationResponse
400Bad RequestInvalid request (validation failed)ErrorResponse
404Not FoundWebSub API or API key not foundErrorResponse
409ConflictConflict (duplicate key or conflicting update)ErrorResponse
500Internal Server ErrorInternal server errorErrorResponse

Revoke an API key for a WebSub API​

DELETE /websub-apis/{id}/api-keys/{apiKeyName}

Code samples


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

Revoke an API key. Once revoked, it can no longer be used to authenticate requests.

Authentication​

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

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier of the WebSub API
apiKeyNamepathstringtrueName of the API key to revoke

Example responses

200 Response

{
"status": "success",
"message": "API key revoked successfully"
}

Responses​

StatusMeaningDescriptionSchema
200OKAPI key revoked successfullyAPIKeyRevocationResponse
400Bad RequestInvalid configuration (validation failed)ErrorResponse
404Not FoundWebSub API or API key not foundErrorResponse
500Internal Server ErrorInternal server errorErrorResponse

Get WebSubAPI by id​

GET /websub-apis/{id}

Code samples


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

Get a WebSubAPI by its ID.

Authentication​

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

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier for the WebSub API.

Detailed descriptions​

id: Unique public identifier for the WebSub API.

Example responses

200 Response

{
"apiVersion": "gateway.api-platform.wso2.com/v1alpha1",
"kind": "WebSubApi",
"metadata": {
"name": "github-events-v1.0"
},
"spec": {
"displayName": "GitHub Events",
"version": "v1.0",
"context": "/github-events/$version",
"channels": [
{
"name": "issues",
"method": "SUB"
},
{
"name": "pull_requests",
"method": "SUB"
}
]
},
"status": {
"id": "github-events-v1.0",
"state": "deployed",
"createdAt": "2026-04-24T07:21:13Z",
"updatedAt": "2026-04-24T07:21:13Z",
"deployedAt": "2026-04-24T07:21:13Z"
}
}

Responses​

StatusMeaningDescriptionSchema
200OKWebSubAPI detailsWebSubAPI
404Not FoundWebSubAPI not foundErrorResponse
500Internal Server ErrorInternal server errorErrorResponse

Update an existing WebSubAPI​

PUT /websub-apis/{id}

Code samples


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

Update an existing WebSubAPI in the Gateway.

Payload

{
"apiVersion": "gateway.api-platform.wso2.com/v1alpha1",
"kind": "WebSubApi",
"metadata": {
"name": "github-events-v1.0"
},
"spec": {
"displayName": "GitHub Events",
"version": "v1.0",
"context": "/github-events/$version",
"channels": [
{
"name": "issues",
"method": "SUB"
},
{
"name": "pull_requests",
"method": "SUB"
}
]
}
}

Authentication​

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

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier of the WebSub API to update.
bodybodyWebSubAPIRequesttruenone

Detailed descriptions​

id: Unique public identifier of the WebSub API to update.

Example responses

200 Response

{
"apiVersion": "gateway.api-platform.wso2.com/v1alpha1",
"kind": "WebSubApi",
"metadata": {
"name": "github-events-v1.0"
},
"spec": {
"displayName": "GitHub Events",
"version": "v1.0",
"context": "/github-events/$version",
"channels": [
{
"name": "issues",
"method": "SUB"
},
{
"name": "pull_requests",
"method": "SUB"
}
]
},
"status": {
"id": "github-events-v1.0",
"state": "deployed",
"createdAt": "2026-04-24T07:21:13Z",
"updatedAt": "2026-04-24T07:21:13Z",
"deployedAt": "2026-04-24T07:21:13Z"
}
}

Responses​

StatusMeaningDescriptionSchema
200OKWebSubAPI updated successfullyWebSubAPI
400Bad RequestInvalid configuration (validation failed)ErrorResponse
404Not FoundWebSubAPI not foundErrorResponse
500Internal Server ErrorInternal server errorErrorResponse

Delete a WebSubAPI​

DELETE /websub-apis/{id}

Code samples


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

Delete a WebSubAPI from the Gateway.

Authentication​

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

Parameters​

NameInTypeRequiredDescription
idpathstringtrueUnique public identifier of the WebSub API to delete.

Detailed descriptions​

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

Example responses

200 Response

{
"status": "success",
"message": "WebSubAPI deleted successfully",
"id": "weather-websub-api"
}

Responses​

StatusMeaningDescriptionSchema
200OKWebSubAPI deleted successfullyInline
404Not FoundWebSubAPI not foundErrorResponse
500Internal Server ErrorInternal server errorErrorResponse

Response Schema​

Status Code 200

NameTypeRequiredRestrictionsDescription
statusstringfalsenonenone
messagestringfalsenonenone
idstringfalsenonenone

Was this page helpful?