Subscription and event examples Proposal
Requests, responses, and events for webhook delivery with verification and a worked signature, for following a signal, and for reading or streaming events.
The examples use a fictional provider, provider.example, and reserved example values. ACCESS_TOKEN stands for an OAuth 2.0 access token. Request paths are relative to the base URL of the provider, https://{host}/capacity/v1.
Subscribe with webhook delivery#
Create the subscription#
Follow a requirement, report any change, deliver to a webhook.
Send the following request:
POST /subscriptions
Authorization: Bearer ACCESS_TOKEN
Content-Type: application/json
Idempotency-Key: 2f8e6b1d-90c4-4a7e-b3d2-5c1a9e7f0d46The request body is:
{
"name": "Frankfurt liquid cooling",
"notifyOn": "ANY_CHANGE",
"requirement": {
"locations": [
{
"level": "METRO",
"code": "FR"
}
],
"demand": {
"cabinets": {
"count": 20
},
"density": {
"target": 40,
"unit": "KW"
}
},
"timeframe": {
"neededForService": "2027-Q4"
},
"desiredFeatures": [
{
"feature": "LIQUID_COOLING",
"required": true
}
]
},
"delivery": {
"type": "WEBHOOK",
"url": "https://customer.example/hooks/capacity"
}
}The new subscription with its signing secret, waiting for verification. The provider responds with status 201:
ETag: "sub-0002-1"The response body is:
{
"name": "Frankfurt liquid cooling",
"notifyOn": "ANY_CHANGE",
"requirement": {
"locations": [
{
"level": "METRO",
"code": "FR"
}
],
"demand": {
"cabinets": {
"count": 20
},
"density": {
"target": 40,
"unit": "KW"
}
},
"timeframe": {
"neededForService": "2027-Q4"
},
"desiredFeatures": [
{
"feature": "LIQUID_COOLING",
"required": true
}
]
},
"delivery": {
"type": "WEBHOOK",
"url": "https://customer.example/hooks/capacity",
"signingSecret": "whsec_example_0123456789abcdef"
},
"subscriptionId": "sub-0002",
"state": "PENDING_VERIFICATION",
"createdAt": "2026-11-18T11:00:00Z",
"updatedAt": "2026-11-18T11:00:00Z"
}Receive the verification event and echo the challenge#
The verification event sent to a new webhook endpoint.
The provider sends the following request to your webhook:
POST https://customer.example/hooks/capacity
Content-Type: application/cloudevents+json
OpenCapacity-Signature: t=<unix seconds>,v1=<hex>The request body is:
{
"specversion": "1.0",
"id": "evt-sub-0002-000001",
"source": "https://provider.example/capacity/v1",
"type": "org.opencapacity.subscription.verification",
"subject": "sub-0002",
"time": "2026-11-18T11:00:01Z",
"datacontenttype": "application/json",
"data": {
"subscriptionId": "sub-0002",
"sequence": 1,
"challenge": "c7f3a1d09b2e4f58"
}
}Your endpoint responds with status 200.
The response body is:
{
"challenge": "c7f3a1d09b2e4f58"
}Receive the first answer#
The first answer event after activation.
The provider sends the following request to your webhook:
POST https://customer.example/hooks/capacity
Content-Type: application/cloudevents+json
OpenCapacity-Signature: t=<unix seconds>,v1=<hex>The request body is:
{
"specversion": "1.0",
"id": "evt-sub-0002-000002",
"source": "https://provider.example/capacity/v1",
"type": "org.opencapacity.answer.updated",
"subject": "sub-0002",
"time": "2026-11-18T11:00:05Z",
"datacontenttype": "application/json",
"data": {
"subscriptionId": "sub-0002",
"sequence": 2,
"reason": "INITIAL",
"answer": {
"answerId": "ans-0301",
"generatedAt": "2026-11-18T11:00:05Z",
"validUntil": "2026-11-19T11:00:05Z",
"grade": "POSSIBLE",
"results": [
{
"location": {
"level": "METRO",
"code": "FR"
},
"grade": "POSSIBLE",
"timing": {
"status": "PLANNED",
"availableForService": "2028-Q1"
},
"supportedFeatures": [
{
"feature": "LIQUID_COOLING",
"support": "POSSIBLE",
"required": true
}
],
"reasons": [
"TIMING"
]
}
]
}
}
}Your endpoint responds with status 200. The response has no body.
Receive a change of detail#
The service date moved earlier and the grade did not change.
The provider sends the following request to your webhook:
POST https://customer.example/hooks/capacity
Content-Type: application/cloudevents+json
OpenCapacity-Signature: t=<unix seconds>,v1=<hex>The request body is:
{
"specversion": "1.0",
"id": "evt-sub-0002-000003",
"source": "https://provider.example/capacity/v1",
"type": "org.opencapacity.answer.updated",
"subject": "sub-0002",
"time": "2026-12-04T09:20:00Z",
"datacontenttype": "application/json",
"data": {
"subscriptionId": "sub-0002",
"sequence": 3,
"reason": "DETAIL_CHANGE",
"answer": {
"answerId": "ans-0318",
"generatedAt": "2026-12-04T09:20:00Z",
"validUntil": "2026-12-05T09:20:00Z",
"grade": "POSSIBLE",
"results": [
{
"location": {
"level": "METRO",
"code": "FR"
},
"grade": "POSSIBLE",
"timing": {
"status": "PLANNED",
"availableForService": "2027-Q4"
},
"supportedFeatures": [
{
"feature": "LIQUID_COOLING",
"support": "AVAILABLE",
"required": true
}
],
"reasons": [
"TIMING"
]
}
]
}
}
}Your endpoint responds with status 200. The response has no body.
Receive a refresh#
The previous answer expired and nothing else changed.
The provider sends the following request to your webhook:
POST https://customer.example/hooks/capacity
Content-Type: application/cloudevents+json
OpenCapacity-Signature: t=<unix seconds>,v1=<hex>The request body is:
{
"specversion": "1.0",
"id": "evt-sub-0002-000004",
"source": "https://provider.example/capacity/v1",
"type": "org.opencapacity.answer.updated",
"subject": "sub-0002",
"time": "2026-12-05T09:20:00Z",
"datacontenttype": "application/json",
"data": {
"subscriptionId": "sub-0002",
"sequence": 4,
"reason": "REFRESH",
"answer": {
"answerId": "ans-0325",
"generatedAt": "2026-12-05T09:20:00Z",
"validUntil": "2026-12-06T09:20:00Z",
"grade": "POSSIBLE",
"results": [
{
"location": {
"level": "METRO",
"code": "FR"
},
"grade": "POSSIBLE",
"timing": {
"status": "PLANNED",
"availableForService": "2027-Q4"
},
"supportedFeatures": [
{
"feature": "LIQUID_COOLING",
"support": "AVAILABLE",
"required": true
}
],
"reasons": [
"TIMING"
]
}
]
}
}
}Your endpoint responds with status 200. The response has no body.
Receive a grade change and verify its signature#
The grade changed from POSSIBLE to AVAILABLE.
The provider sends the following request to your webhook:
POST https://customer.example/hooks/capacity
Content-Type: application/cloudevents+json
OpenCapacity-Signature: t=1797090300,v1=7da0d91c52ad8495a2987048f83a553177ffa5d31bb3864c3a3244e20a344991The request body is:
{
"specversion": "1.0",
"id": "evt-sub-0002-000005",
"source": "https://provider.example/capacity/v1",
"type": "org.opencapacity.answer.updated",
"subject": "sub-0002",
"time": "2026-12-12T15:45:00Z",
"datacontenttype": "application/json",
"data": {
"subscriptionId": "sub-0002",
"sequence": 5,
"reason": "GRADE_CHANGE",
"answer": {
"answerId": "ans-0340",
"generatedAt": "2026-12-12T15:45:00Z",
"validUntil": "2026-12-13T15:45:00Z",
"grade": "AVAILABLE",
"results": [
{
"location": {
"level": "METRO",
"code": "FR"
},
"grade": "AVAILABLE",
"timing": {
"status": "PLANNED",
"availableForSale": "NOW",
"availableForService": "2027-Q4"
},
"supportedFeatures": [
{
"feature": "LIQUID_COOLING",
"support": "AVAILABLE",
"required": true
}
]
}
]
}
}
}To verify the signature of this event, calculate the HMAC-SHA256 of the signed string with the signing secret, as a hex string, and compare it with the v1 value of the OpenCapacity-Signature header:
| Item | Value |
|---|---|
| Signing secret | whsec_example_0123456789abcdef |
Timestamp, t | 1797090300 |
| Signed string | 1797090300.<raw body> |
Result, v1 | 7da0d91c52ad8495a2987048f83a553177ffa5d31bb3864c3a3244e20a344991 |
The raw body is the request body exactly as sent, with no added whitespace:
{"specversion":"1.0","id":"evt-sub-0002-000005","source":"https://provider.example/capacity/v1","type":"org.opencapacity.answer.updated","subject":"sub-0002","time":"2026-12-12T15:45:00Z","datacontenttype":"application/json","data":{"subscriptionId":"sub-0002","sequence":5,"reason":"GRADE_CHANGE","answer":{"answerId":"ans-0340","generatedAt":"2026-12-12T15:45:00Z","validUntil":"2026-12-13T15:45:00Z","grade":"AVAILABLE","results":[{"location":{"level":"METRO","code":"FR"},"grade":"AVAILABLE","timing":{"status":"PLANNED","availableForSale":"NOW","availableForService":"2027-Q4"},"supportedFeatures":[{"feature":"LIQUID_COOLING","support":"AVAILABLE","required":true}]}]}}}Your endpoint responds with status 200. The response has no body.
Pause the subscription#
The whole subscription with paused set to true.
Send the following request:
PUT /subscriptions/sub-0002
Authorization: Bearer ACCESS_TOKEN
Content-Type: application/json
If-Match: "sub-0002-2"The request body is:
{
"name": "Frankfurt liquid cooling",
"notifyOn": "ANY_CHANGE",
"requirement": {
"locations": [
{
"level": "METRO",
"code": "FR"
}
],
"demand": {
"cabinets": {
"count": 20
},
"density": {
"target": 40,
"unit": "KW"
}
},
"timeframe": {
"neededForService": "2027-Q4"
},
"desiredFeatures": [
{
"feature": "LIQUID_COOLING",
"required": true
}
]
},
"delivery": {
"type": "WEBHOOK",
"url": "https://customer.example/hooks/capacity"
},
"paused": true
}State PAUSED: no events are delivered. The provider responds with status 200:
ETag: "sub-0002-3"The response body is:
{
"name": "Frankfurt liquid cooling",
"notifyOn": "ANY_CHANGE",
"requirement": {
"locations": [
{
"level": "METRO",
"code": "FR"
}
],
"demand": {
"cabinets": {
"count": 20
},
"density": {
"target": 40,
"unit": "KW"
}
},
"timeframe": {
"neededForService": "2027-Q4"
},
"desiredFeatures": [
{
"feature": "LIQUID_COOLING",
"required": true
}
]
},
"delivery": {
"type": "WEBHOOK",
"url": "https://customer.example/hooks/capacity"
},
"paused": true,
"subscriptionId": "sub-0002",
"state": "PAUSED",
"createdAt": "2026-11-18T11:00:00Z",
"updatedAt": "2026-12-13T10:00:00Z",
"lastSequence": 5
}Receive notice that the provider suspended delivery#
The provider stopped delivery after repeated failures.
The provider sends the following request to your webhook:
POST https://customer.example/hooks/capacity
Content-Type: application/cloudevents+json
OpenCapacity-Signature: t=<unix seconds>,v1=<hex>The request body is:
{
"specversion": "1.0",
"id": "evt-sub-0002-000006",
"source": "https://provider.example/capacity/v1",
"type": "org.opencapacity.subscription.updated",
"subject": "sub-0002",
"time": "2026-12-20T03:10:00Z",
"datacontenttype": "application/json",
"data": {
"subscriptionId": "sub-0002",
"sequence": 6,
"subscriptionState": "SUSPENDED"
}
}Your endpoint responds with status 200. The response has no body.
Change the webhook URL#
The whole subscription with a new webhook URL.
Send the following request:
PUT /subscriptions/sub-0002
Authorization: Bearer ACCESS_TOKEN
Content-Type: application/json
If-Match: "sub-0002-4"The request body is:
{
"name": "Frankfurt liquid cooling",
"notifyOn": "ANY_CHANGE",
"requirement": {
"locations": [
{
"level": "METRO",
"code": "FR"
}
],
"demand": {
"cabinets": {
"count": 20
},
"density": {
"target": 40,
"unit": "KW"
}
},
"timeframe": {
"neededForService": "2027-Q4"
},
"desiredFeatures": [
{
"feature": "LIQUID_COOLING",
"required": true
}
]
},
"delivery": {
"type": "WEBHOOK",
"url": "https://customer.example/hooks/capacity-v2"
}
}A changed URL returns the subscription to PENDING_VERIFICATION. The provider responds with status 200:
ETag: "sub-0002-5"The response body is:
{
"name": "Frankfurt liquid cooling",
"notifyOn": "ANY_CHANGE",
"requirement": {
"locations": [
{
"level": "METRO",
"code": "FR"
}
],
"demand": {
"cabinets": {
"count": 20
},
"density": {
"target": 40,
"unit": "KW"
}
},
"timeframe": {
"neededForService": "2027-Q4"
},
"desiredFeatures": [
{
"feature": "LIQUID_COOLING",
"required": true
}
]
},
"delivery": {
"type": "WEBHOOK",
"url": "https://customer.example/hooks/capacity-v2"
},
"subscriptionId": "sub-0002",
"state": "PENDING_VERIFICATION",
"createdAt": "2026-11-18T11:00:00Z",
"updatedAt": "2026-12-21T09:00:00Z",
"lastSequence": 6
}Delete the subscription#
Send the following request:
DELETE /subscriptions/sub-0002
Authorization: Bearer ACCESS_TOKENThe provider responds with status 204. The response has no body.
Follow a signal#
Create a subscription that follows a signal#
Follow a signal and deliver events to a webhook.
Send the following request:
POST /subscriptions
Authorization: Bearer ACCESS_TOKEN
Content-Type: application/jsonThe request body is:
{
"name": "Frankfurt 2027",
"signalId": "sig-0001",
"notifyOn": "GRADE_CHANGE",
"delivery": {
"type": "WEBHOOK",
"url": "https://customer.example/hooks/capacity"
}
}The provider responds with status 201. The response has no body.
Receive a grade change for the signal#
The grade for a subscribed requirement changed.
The provider sends the following request to your webhook:
POST https://customer.example/hooks/capacity
Content-Type: application/cloudevents+json
OpenCapacity-Signature: t=<unix seconds>,v1=<hex>The request body is:
{
"specversion": "1.0",
"id": "evt-000017",
"source": "https://provider.example/capacity/v1",
"type": "org.opencapacity.answer.updated",
"subject": "sub-0001",
"time": "2026-12-02T08:15:00Z",
"datacontenttype": "application/json",
"data": {
"subscriptionId": "sub-0001",
"sequence": 17,
"reason": "GRADE_CHANGE",
"answer": {
"answerId": "ans-0042",
"generatedAt": "2026-12-02T08:15:00Z",
"validUntil": "2026-12-03T08:15:00Z",
"grade": "AVAILABLE",
"results": [
{
"location": {
"level": "METRO",
"code": "FR"
},
"grade": "AVAILABLE",
"supportedFeatures": [
{
"feature": "LIQUID_COOLING",
"support": "AVAILABLE",
"required": true
}
]
}
]
}
}
}Your endpoint responds with status 200. The response has no body.
Receive notice that the signal was withdrawn#
Sent to a subscription that follows a signal, when the customer withdraws the signal.
The provider sends the following request to your webhook:
POST https://customer.example/hooks/capacity
Content-Type: application/cloudevents+json
OpenCapacity-Signature: t=<unix seconds>,v1=<hex>The request body is:
{
"specversion": "1.0",
"id": "evt-sub-0001-000018",
"source": "https://provider.example/capacity/v1",
"type": "org.opencapacity.signal.updated",
"subject": "sub-0001",
"time": "2026-12-10T08:00:01Z",
"datacontenttype": "application/json",
"data": {
"subscriptionId": "sub-0001",
"sequence": 18,
"signalId": "sig-0001",
"signalState": "WITHDRAWN"
}
}Your endpoint responds with status 200. The response has no body.
Subscribe and read or stream the events#
Create the subscription#
Follow a requirement and read the events yourself.
Send the following request:
POST /subscriptions
Authorization: Bearer ACCESS_TOKEN
Content-Type: application/jsonThe request body is:
{
"name": "Amsterdam small footprint",
"notifyOn": "GRADE_CHANGE",
"requirement": {
"locations": [
{
"level": "METRO",
"code": "AM"
}
],
"demand": {
"cabinets": {
"count": 6
},
"density": {
"max": 10,
"unit": "KVA"
}
},
"timeframe": {
"neededForService": "2027-02"
}
},
"delivery": {
"type": "PULL"
}
}A PULL subscription is ACTIVE at once. The provider responds with status 201:
ETag: "sub-0003-1"The response body is:
{
"name": "Amsterdam small footprint",
"notifyOn": "GRADE_CHANGE",
"requirement": {
"locations": [
{
"level": "METRO",
"code": "AM"
}
],
"demand": {
"cabinets": {
"count": 6
},
"density": {
"max": 10,
"unit": "KVA"
}
},
"timeframe": {
"neededForService": "2027-02"
}
},
"delivery": {
"type": "PULL"
},
"subscriptionId": "sub-0003",
"state": "ACTIVE",
"createdAt": "2026-11-18T12:00:00Z",
"updatedAt": "2026-11-18T12:00:00Z",
"lastSequence": 1
}Read events as a page#
Send the following request:
GET /subscriptions/sub-0003/events?limit=2
Authorization: Bearer ACCESS_TOKEN
Accept: application/jsonTwo events and a cursor. The provider responds with status 200.
The response body is:
{
"data": [
{
"specversion": "1.0",
"id": "evt-sub-0003-000001",
"source": "https://provider.example/capacity/v1",
"type": "org.opencapacity.answer.updated",
"subject": "sub-0003",
"time": "2026-11-18T12:00:02Z",
"datacontenttype": "application/json",
"data": {
"subscriptionId": "sub-0003",
"sequence": 1,
"reason": "INITIAL",
"answer": {
"answerId": "ans-0401",
"generatedAt": "2026-11-18T12:00:02Z",
"validUntil": "2026-11-19T12:00:02Z",
"grade": "UNAVAILABLE",
"results": [
{
"location": {
"level": "METRO",
"code": "AM"
},
"grade": "UNAVAILABLE",
"supportedFeatures": [],
"reasons": [
"SPACE"
]
}
]
}
}
},
{
"specversion": "1.0",
"id": "evt-sub-0003-000002",
"source": "https://provider.example/capacity/v1",
"type": "org.opencapacity.answer.updated",
"subject": "sub-0003",
"time": "2026-11-27T07:30:00Z",
"datacontenttype": "application/json",
"data": {
"subscriptionId": "sub-0003",
"sequence": 2,
"reason": "GRADE_CHANGE",
"answer": {
"answerId": "ans-0422",
"generatedAt": "2026-11-27T07:30:00Z",
"validUntil": "2026-11-28T07:30:00Z",
"grade": "POSSIBLE",
"results": [
{
"location": {
"level": "METRO",
"code": "AM"
},
"grade": "POSSIBLE",
"supportedFeatures": [],
"reasons": [
"SPACE"
]
}
]
}
}
}
],
"pagination": {
"limit": 2,
"next": "ZXZ0LTAwMDM"
}
}Stream events#
Send the following request:
GET /subscriptions/sub-0003/events
Authorization: Bearer ACCESS_TOKEN
Accept: text/event-streamThe provider responds with status 200:
Content-Type: text/event-streamThe response is a server-sent event stream:
id: 1
event: org.opencapacity.answer.updated
data: {"specversion":"1.0","id":"evt-sub-0003-000001","source":"https://provider.example/capacity/v1","type":"org.opencapacity.answer.updated","subject":"sub-0003","time":"2026-11-18T12:00:02Z","datacontenttype":"application/json","data":{"subscriptionId":"sub-0003","sequence":1,"reason":"INITIAL","answer":{"answerId":"ans-0401","generatedAt":"2026-11-18T12:00:02Z","validUntil":"2026-11-19T12:00:02Z","grade":"UNAVAILABLE","results":[{"location":{"level":"METRO","code":"AM"},"grade":"UNAVAILABLE","supportedFeatures":[],"reasons":["SPACE"]}]}}}
id: 2
event: org.opencapacity.answer.updated
data: {"specversion":"1.0","id":"evt-sub-0003-000002","source":"https://provider.example/capacity/v1","type":"org.opencapacity.answer.updated","subject":"sub-0003","time":"2026-11-27T07:30:00Z","datacontenttype":"application/json","data":{"subscriptionId":"sub-0003","sequence":2,"reason":"GRADE_CHANGE","answer":{"answerId":"ans-0422","generatedAt":"2026-11-27T07:30:00Z","validUntil":"2026-11-28T07:30:00Z","grade":"POSSIBLE","results":[{"location":{"level":"METRO","code":"AM"},"grade":"POSSIBLE","supportedFeatures":[],"reasons":["SPACE"]}]}}}Reconnect after the stream dropped#
Send the following request:
GET /subscriptions/sub-0003/events
Authorization: Bearer ACCESS_TOKEN
Accept: text/event-stream
Last-Event-ID: 2The provider responds with status 200:
Content-Type: text/event-streamThe response is a server-sent event stream:
id: 3
event: org.opencapacity.answer.updated
data: {"specversion":"1.0","id":"evt-sub-0003-000003","source":"https://provider.example/capacity/v1","type":"org.opencapacity.answer.updated","subject":"sub-0003","time":"2026-12-03T13:10:00Z","datacontenttype":"application/json","data":{"subscriptionId":"sub-0003","sequence":3,"reason":"GRADE_CHANGE","answer":{"answerId":"ans-0437","generatedAt":"2026-12-03T13:10:00Z","validUntil":"2026-12-04T13:10:00Z","grade":"AVAILABLE","results":[{"location":{"level":"METRO","code":"AM"},"grade":"AVAILABLE","supportedFeatures":[]}]}}}Related pages#
- For every field and value, see OpenCapacity 1.0 reference.
- For how a provider grades an answer, see Graded disclosure.
- For signal and subscription states, see Signals and subscriptions.