Create a WebSocket API, add an integration, and wire the $connect route to it.
1 workflow3 source APIs1 provider
View SpecView on GitHubAPI GatewayAmazon Web ServicesCloudRESTHTTPWebSocketServerlessMCPAgent CoreDeveloper PortalDeveloper ToolsReal-TimeArazzoWorkflows
arazzo: 1.0.1
info:
title: AWS API Gateway Build a WebSocket API
summary: Create a WebSocket API, add an integration, and wire the $connect route to it.
description: >-
The Amazon API Gateway V2 build flow for a WebSocket API. The workflow
creates a WebSocket-protocol API with a route selection expression, creates a
backend integration, and wires the $connect route to that integration so
clients can establish connections. Because createApi collides with the V1
description it is addressed through the V2 source. Every step spells out its
request inline so the flow can be read and executed without opening the
underlying OpenAPI description.
version: 1.0.0
sourceDescriptions:
- name: apisApi
url: ../openapi/aws-api-gateway-apis-api-openapi.yml
type: openapi
- name: integrationsApi
url: ../openapi/aws-api-gateway-integrations-api-openapi.yml
type: openapi
- name: routesApi
url: ../openapi/aws-api-gateway-routes-api-openapi.yml
type: openapi
workflows:
- workflowId: build-websocket-api
summary: Stand up a WebSocket API with an integration and a connect route.
description: >-
Creates a WebSocket API, an integration, and a route bound to the
integration for connection handling.
inputs:
type: object
required:
- name
- routeSelectionExpression
- integrationUri
- routeKey
properties:
name:
type: string
description: Name of the WebSocket API.
routeSelectionExpression:
type: string
description: Route selection expression (e.g. "$request.body.action").
description:
type: string
description: Optional description for the API.
integrationType:
type: string
description: Type of integration (AWS, AWS_PROXY, HTTP, HTTP_PROXY, MOCK).
integrationUri:
type: string
description: Integration target URI.
payloadFormatVersion:
type: string
description: Payload format version for the integration.
routeKey:
type: string
description: Route key for the route (e.g. "$connect").
steps:
- stepId: createApi
description: Create the WebSocket API with a route selection expression.
operationId: $sourceDescriptions.apisApi.createApi
requestBody:
contentType: application/json
payload:
Name: $inputs.name
ProtocolType: WEBSOCKET
RouteSelectionExpression: $inputs.routeSelectionExpression
Description: $inputs.description
successCriteria:
- condition: $statusCode == 201
outputs:
apiId: $response.body#/ApiId
apiEndpoint: $response.body#/ApiEndpoint
- stepId: CreateIntegration
description: Create the backend integration that handles connection events.
operationId: $sourceDescriptions.integrationsApi.CreateIntegration
parameters:
- name: ApiId
in: path
value: $steps.createApi.outputs.apiId
requestBody:
contentType: application/json
payload:
IntegrationType: $inputs.integrationType
IntegrationUri: $inputs.integrationUri
PayloadFormatVersion: $inputs.payloadFormatVersion
successCriteria:
- condition: $statusCode == 201
outputs:
integrationId: $response.body#/IntegrationId
- stepId: CreateRoute
description: Wire the route key to the integration target.
operationId: $sourceDescriptions.routesApi.CreateRoute
parameters:
- name: ApiId
in: path
value: $steps.createApi.outputs.apiId
requestBody:
contentType: application/json
payload:
RouteKey: $inputs.routeKey
Target: integrations/$steps.CreateIntegration.outputs.integrationId
successCriteria:
- condition: $statusCode == 201
outputs:
routeId: $response.body#/RouteId
outputs:
apiId: $steps.createApi.outputs.apiId
apiEndpoint: $steps.createApi.outputs.apiEndpoint
integrationId: $steps.CreateIntegration.outputs.integrationId
routeId: $steps.CreateRoute.outputs.routeId
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.