Topolo Docs Topolo Platform
Open workspace

Create Success customer account

Create a new account in the authorized workspace with initial health 100, healthy status and risk threshold 40 unless specified. Repeated requests create new ids; name is not an idempotency key.

Outcome

Create a new account in the authorized workspace with initial health 100, healthy status and risk threshold 40 unless specified. Repeated requests create new ids; name is not an idempotency key.

Before you start

  • Verify the authenticated identity, exact environment and pinned approved organization context before preparing an action.
  • The published application permission is workspace:write. Discover a granted Success workspace and bind that exact resource. Supplied identifiers do not grant access.
  • Authorize the documented mirror, notification, metering, privacy or archival effects before CLI --confirm or MCP confirm:true. A GET request can initialize a local mirror.

Discover the target

topolo whoami --json
topolo actions get app_topolo_success.accounts.create --detail --json
topolo resources topolo-success --json
topolo workspaces list topolo-success --json
  • Select the exact granted workspace id as SUCCESS_WORKSPACE_ID. Fixture ids authorize no live operation.
  • Discover account ids through accounts.list or the reviewed accounts.create response.

Request

POST /api/accounts

Save action input as payload.json. Inspect the plan for the exact path, query and body. Set SUCCESS_WORKSPACE_ID from granted resource discovery.

Inspect and test this action in the signed action console, then perform the verification below.

Input fields

FieldRequiredTypeConstraints
nameRequiredstringCustomer account or milestone name; use the input constraints below. This is not an idempotency key.; {"minLength":1,"maxLength":160}
renewalAtOptionalstringOptional ISO instant; omitted creates null renewal_at. Scheduled upcoming-renewal notifications are a separate process.; {}
riskThresholdOptionalintegerScore threshold; defaults to 40. Later score at or below this value means at_risk; initial creation status is healthy.; {"minimum":0,"maximum":100}

Exact input schema:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160,
      "description": "Customer account or milestone name; use the input constraints below. This is not an idempotency key."
    },
    "renewalAt": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
      "description": "Optional ISO instant; omitted creates null renewal_at. Scheduled upcoming-renewal notifications are a separate process."
    },
    "riskThreshold": {
      "type": "integer",
      "minimum": 0,
      "maximum": 100,
      "description": "Score threshold; defaults to 40. Later score at or below this value means at_risk; initial creation status is healthy."
    }
  },
  "required": [
    "name"
  ],
  "additionalProperties": false
}

Effects

  • After static permission and platform workspace authorization, the route inserts the local identity-only workspace mirror if absent; even GET listing is a potential write.
  • Creates a new successacct id, owned by the calling user; renewal_at is null when omitted. Initial status is healthy even with a risk threshold of 100.
  • Creates no account-created notification outbox row in this handler. Duplicate names are allowed and retries can create duplicates.

Interpret the response

Use response path $.account.id for success_account. An empty list does not discover a target.

Save account.id and verify its workspace/organization, owner and chosen threshold. List accounts in the same resource context to verify persistence. Do not blindly replay a timed-out create.

The success schema below was checked against captured handler responses. Delegated Auth profile fields and sanitized notification payload fields can vary; exact outer envelopes and SQL row fields are source-reviewed. Error examples retain their actual refusal shapes.

Success schema:

{
  "type": "object",
  "properties": {
    "account": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Source-defined string field."
        },
        "organization_id": {
          "type": "string",
          "description": "Source-defined string field."
        },
        "workspace_id": {
          "type": "string",
          "description": "Source-defined string field."
        },
        "created_at": {
          "type": "string",
          "description": "Source-defined string field."
        },
        "updated_at": {
          "type": "string",
          "description": "Source-defined string field."
        },
        "name": {
          "type": "string",
          "description": "Source-defined string field."
        },
        "owner_user_id": {
          "type": "string",
          "description": "Source-defined string field."
        },
        "health_score": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        },
        "risk_threshold": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        },
        "risk_status": {
          "type": "string",
          "enum": [
            "healthy",
            "at_risk"
          ]
        },
        "renewal_at": {
          "anyOf": [
            {
              "type": "string",
              "description": "Source-defined string field."
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "organization_id",
        "workspace_id",
        "created_at",
        "updated_at",
        "name",
        "owner_user_id",
        "health_score",
        "risk_threshold",
        "risk_status",
        "renewal_at"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "account"
  ],
  "additionalProperties": false
}

Worked examples

Actual exported Worker responses captured with real local SQLite D1 and all committed migrations, synthetic Auth identity/grants, simulated Notify/Nexus and canonical archive transport. Fixture ids are examples only. No live notification delivery, metering acceptance, privacy erasure, workspace archive or deployment is established by these tests. Refused examples demonstrate boundaries and must not be executed as successful workflows.

Successful request

Actual exported Worker response with real local SQLite D1, synthetic Auth/grants and simulated Notify/Nexus/archive transport; no live delivery or deployment proof. Captured scenario: accounts.create.

Input · payload.json:

{
  "name": "Example Customer",
  "riskThreshold": 40,
  "renewalAt": "2027-03-31T00:00:00Z"
}

CLI:

topolo actions validate app_topolo_success.accounts.create --data @payload.json --json
topolo actions plan app_topolo_success.accounts.create --resource-type workspace --resource-id "$SUCCESS_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_success.accounts.create --resource-type workspace --resource-id "$SUCCESS_WORKSPACE_ID" --data @payload.json --confirm --json

MCP tool and arguments:

{
  "tool": "topolo_call_action",
  "arguments": {
    "actionId": "app_topolo_success.accounts.create",
    "input": {
      "name": "Example Customer",
      "riskThreshold": 40,
      "renewalAt": "2027-03-31T00:00:00Z"
    },
    "resourceType": "workspace",
    "resourceId": "<identifier returned by granted resource discovery>",
    "confirm": true
  }
}

Captured local response · HTTP 201:

{
  "account": {
    "id": "successacct_854a49b4-6ddd-4b79-8325-8299814747e6",
    "organization_id": "org_success_fixture",
    "workspace_id": "ws_success_fixture",
    "name": "Example Customer",
    "owner_user_id": "usr_success_fixture",
    "health_score": 100,
    "risk_threshold": 40,
    "risk_status": "healthy",
    "renewal_at": "2027-03-31T00:00:00Z",
    "created_at": "2026-10-04T05:10:03.146Z",
    "updated_at": "2026-10-04T05:10:03.146Z"
  }
}

HTTP 201. Save account.id and verify its workspace/organization, owner and chosen threshold. List accounts in the same resource context to verify persistence. Do not blindly replay a timed-out create.

Refused request · HTTP 400

Actual exported Worker response with real local SQLite D1, synthetic Auth/grants and simulated Notify/Nexus/archive transport; no live delivery or deployment proof. Captured scenario: invalid account name.

Input · payload.json:

{
  "name": ""
}

CLI:

topolo actions validate app_topolo_success.accounts.create --data @payload.json --json
topolo actions plan app_topolo_success.accounts.create --resource-type workspace --resource-id "$SUCCESS_WORKSPACE_ID" --data @payload.json --json

Captured local response · HTTP 400:

{
  "success": false,
  "error": {
    "code": "invalid_action_input",
    "message": "Invalid action input for \"accounts.create\".",
    "action": "accounts.create",
    "issues": [
      {
        "path": "name",
        "message": "Too small: expected string to have >=1 characters",
        "code": "too_small"
      }
    ]
  }
}

HTTP 400. The handler refused this request. Resolve its exact cause before retrying; input validation can reject an invalid fixture before it reaches the handler.

Verify the result

  • Save account.id and verify its workspace/organization, owner and chosen threshold.
  • List accounts in the same resource context to verify persistence. Do not blindly replay a timed-out create.

Errors and recovery

  • invalid_action_input (HTTP 400): Correct only the input paths reported by the runtime or CLI validator; retain action id and exact context.
  • action_permission_required (HTTP 403): The verified credential lacks the action permission. Stop this action and request the appropriate authorized grant; an identifier or organization ownership does not grant it.
  • organization_required (HTTP 403): Verify the authorized organization context; personal scope cannot operate on organization-owned Success data.
  • workspace_required (HTTP 400): Discover an authorized app-scoped workspace and pass its resource binding. API keys without a workspace resource are refused.
  • workspaces_unavailable (HTTP 503): Preserve the request id and report unavailable platform grants or database binding; do not invent a default workspace.

Auth, action-input validation and platform resource resolution can refuse a request before its handler. Retain the exact error, request id and context; requesting another context is not a legitimate way to bypass a refusal.

Recovery boundary

No published delete-account or edit-account action exists. Resolve ambiguous completion with accounts.list; organization erasure has much broader irreversible scope and is not a compensating action.

  • List Success customer accounts: List all customer accounts in the authorized workspace, ordered by latest update and then name. There is no pagination; the request can create the local workspace identity mirror.
  • Record Success account health: Save a score from 0 to 100, append history and enqueue a health-change event on every call, including identical repeats. Downward threshold crossing creates a risk; upward recovery resolves open risks.
  • Create Success account milestone: Create a new pending milestone for an account in the authorized workspace, using the account owner as recipient. Creation creates a new id on every call and emits no milestone-reached notification.
  • Create Success playbook task: Create a pending task for an authorized account with a required ISO due time. Immediate creation does not complete the task or send its due reminder; scheduled processing handles due events later.

Evidence

Actual exported Worker responses captured with real local SQLite D1 and all committed migrations, synthetic Auth identity/grants, simulated Notify/Nexus and canonical archive transport. Fixture ids are examples only. No live notification delivery, metering acceptance, privacy erasure, workspace archive or deployment is established by these tests. Capture digests and test scenarios are retained in the source fixture records.