Topolo Docs Topolo Platform
Open workspace

Push Subscriptions Create

Registers the caller’s browser push endpoint in local D1. An existing endpoint returns success without refreshing its stored keys.

Outcome

Registers the caller’s browser push endpoint in local D1. An existing endpoint returns success without refreshing its stored keys.

Before you start

  • Verify the intended environment, authenticated identity and explicitly authorized ownership context.
  • Discover the published notifications:write permission and any required resource grant.
  • Approve the actual effects before confirming the unchanged planned request. Fixture identifiers, recipients and provider responses authorize no live operation.

Discover the target

topolo whoami --json
topolo actions get app_topolo_one.push_subscriptions.create --detail --json
  • endpoint: Actual browser push endpoint owned by the caller; never reuse fixture endpoints.

Request

POST /api/push/subscriptions

Inspect and test this action.

Input fields

FieldRequiredMeaningConstraints
endpointRequiredActual browser push endpoint owned by the caller; never reuse fixture endpoints.{"type":"string","minLength":1}
keysRequiredFresh browser subscription p256dh and auth keys. Existing endpoint registration does not update stored keys.{"type":"object","properties":{"p256dh":{"type":"string","minLength":1},"auth":{"type":"string","minLength":1}},"required":["p256dh","auth"],"additionalProperties":false}

Inspect nested fields.

Interpret the response

On creation retain subscriptionId. Existing-endpoint HTTP 200 can omit it. Registration alone does not prove browser permission or notification delivery.

Inspect the declared output schema and captured variants.

Worked examples

Actual exported One Worker with local Miniflare D1/KV. Authentication, application discovery, checkout, billing and remote widget providers are controlled synthetic responses; outbound access is sealed. No live provider outcome is established.

Save the reviewed input below as payload.json; substitute discovered identifiers and bind credential/resource context separately. CLI:

topolo actions validate app_topolo_one.push_subscriptions.create --data @payload.json --json
topolo actions plan app_topolo_one.push_subscriptions.create --data @payload.json --json
topolo actions call app_topolo_one.push_subscriptions.create --data @payload.json --confirm --detail --json

MCP planning and execution use the same reviewed input:

{
  "tool": "topolo_prepare_action",
  "arguments": {
    "actionId": "app_topolo_one.push_subscriptions.create",
    "input": {
      "endpoint": "https://push.example.com/abc",
      "keys": {
        "p256dh": "p256dh-key",
        "auth": "auth-key"
      }
    }
  }
}
{
  "tool": "topolo_call_action",
  "arguments": {
    "actionId": "app_topolo_one.push_subscriptions.create",
    "input": {
      "endpoint": "https://push.example.com/abc",
      "keys": {
        "p256dh": "p256dh-key",
        "auth": "auth-key"
      }
    },
    "confirm": true,
    "detail": true
  }
}

Refused request · HTTP 401 · auth_error

Input · payload.json:

{
  "endpoint": "https://push.example.com/abc",
  "keys": {
    "p256dh": "p256dh-key",
    "auth": "auth-key"
  }
}

Captured response:

{
  "error": "Token validation failed"
}

Authenticate using the required credential type for this action; service-only actions require the registered Auth service identity.

Successful response · HTTP 201

Input · payload.json:

{
  "endpoint": "https://push.example.com/abc",
  "keys": {
    "p256dh": "p256dh-key",
    "auth": "auth-key"
  }
}

Captured response:

{
  "success": true,
  "subscriptionId": "3633079e-0675-445d-920c-48f2d791adda",
  "message": "Push subscription created successfully"
}

On creation retain subscriptionId. Existing-endpoint HTTP 200 can omit it. Registration alone does not prove browser permission or notification delivery.

Successful response · HTTP 200

Input · payload.json:

{
  "endpoint": "https://push.example.com/abc",
  "keys": {
    "p256dh": "p256dh-key",
    "auth": "auth-key"
  }
}

Captured response:

{
  "success": true,
  "message": "Subscription already exists"
}

On creation retain subscriptionId. Existing-endpoint HTTP 200 can omit it. Registration alone does not prove browser permission or notification delivery.

Refused request · HTTP 401 · invalid_token

Input · payload.json:

{
  "endpoint": "https://push.example.com/abc",
  "keys": {
    "p256dh": "p256dh-key",
    "auth": "auth-key"
  }
}

Captured response:

{
  "error": "INVALID_TOKEN",
  "message": "Token validation failed"
}

Authenticate with a valid credential for the selected environment.

Verify the result

  • On creation retain subscriptionId. Existing-endpoint HTTP 200 can omit it. Registration alone does not prove browser permission or notification delivery.

Errors and recovery

  • auth_error (HTTP 401): Authenticate using the required credential type for this action; service-only actions require the registered Auth service identity.
  • invalid_token (HTTP 401): Authenticate with a valid credential for the selected environment.

These are observed local refusals; inspect the raw error body because one SDK code can represent several handler messages. Preserve the request id when available.

Recovery boundary

Delete the same caller-owned endpoint to remove this registration; delivery already in flight remains a separate outcome.

Evidence

Actual exported One Worker with local Miniflare D1/KV. Authentication, application discovery, checkout, billing and remote widget providers are controlled synthetic responses; outbound access is sealed. No live provider outcome is established.