{"openapi":"3.1.0","info":{"title":"GET /api/v1/pending-changes","version":"1.0.0","description":"List proposed changes"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/pending-changes":{"get":{"tags":["pending-changes"],"summary":"List proposed changes","description":"Proposed changes for this business, newest first.","operationId":"list_pending_changes","parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"pending, approved, applied, rejected, failed, expired, or a comma-separated list","title":"Status"},"description":"pending, approved, applied, rejected, failed, expired, or a comma-separated list"},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"next_cursor from the last page","title":"Cursor"},"description":"next_cursor from the last page"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Page size (max 100)","default":20,"title":"Limit"},"description":"Page size (max 100)"},{"name":"round_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"One approval round, or 'none' for changes in no round","title":"Round Id"},"description":"One approval round, or 'none' for changes in no round"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_PendingChangeListResponse_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business","content":{"application/json":{"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"validation_error","message":"Validation failed: amount: Input should be a valid integer","errors":{"amount":"Input should be a valid integer"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"list_pending_changes_api_v1_pending_changes_get"}}},"components":{"schemas":{"PendingChangeDiffRow":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id","description":"Record the change touches."},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"},"field":{"type":"string","title":"Field"},"before":{"anyOf":[{},{"type":"null"}],"title":"Before"},"after":{"anyOf":[{},{"type":"null"}],"title":"After"},"amount_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Amount Cents"}},"type":"object","required":["field"],"title":"PendingChangeDiffRow","description":"One changed value, as the inbox shows it."},"PendingChangeListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/PendingChangeResponse"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"},"has_next":{"type":"boolean","title":"Has Next","default":false},"pending_count":{"type":"integer","title":"Pending Count","description":"Changes still waiting for a decision.","default":0}},"type":"object","title":"PendingChangeListResponse","description":"A page of proposed changes, newest first."},"PendingChangeResponse":{"properties":{"id":{"type":"string","title":"Id"},"business_id":{"type":"string","title":"Business Id"},"tool_name":{"type":"string","title":"Tool Name"},"summary":{"type":"string","title":"Summary"},"status":{"type":"string","enum":["pending","approved","applied","rejected","failed","expired"],"title":"Status"},"destructive":{"type":"boolean","title":"Destructive","description":"The tool deletes, voids or cancels something."},"plan_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Plan Hash"},"plan_hash_enforced":{"type":"boolean","title":"Plan Hash Enforced","description":"The apply re-checks plan_hash and refuses a changed plan."},"proposed_by_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Proposed By User Id"},"proposed_by_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Proposed By Name"},"proposed_via":{"type":"string","enum":["mcp","api","chat","workflow"],"title":"Proposed Via"},"decided_by_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Decided By User Id"},"decided_by_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Decided By Name"},"decided_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Decided At"},"decision_note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Decision Note"},"expires_at":{"type":"string","format":"date-time","title":"Expires At"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"diff":{"items":{"$ref":"#/components/schemas/PendingChangeDiffRow"},"type":"array","title":"Diff"},"diff_total":{"type":"integer","title":"Diff Total","description":"Changed values before truncation.","default":0},"arguments":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Arguments","description":"Apply arguments (detail only)."},"preview":{"anyOf":[{"additionalProperties":true,"type":"object"},{"items":{},"type":"array"},{"type":"null"}],"title":"Preview","description":"The client's preview payload (detail only)."},"result":{"anyOf":[{},{"type":"null"}],"title":"Result"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"stale_plan":{"type":"boolean","title":"Stale Plan","description":"The apply failed because the books moved since the preview.","default":false},"duplicate":{"type":"boolean","title":"Duplicate","description":"Create only: an identical pending proposal already existed.","default":false},"tier":{"type":"integer","title":"Tier","description":"Blast radius: 1 rule under materiality, 2 reviewed in a round, 3 approved one at a time (never batch-approved).","default":2},"tier_label":{"type":"string","title":"Tier Label","description":"Rule, Review or Approve individually.","default":"Review"},"tier_reasons":{"items":{"type":"string"},"type":"array","title":"Tier Reasons","description":"Why the change got its tier."},"impact_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Impact Cents","description":"Largest absolute amount the change touches."},"rows_affected":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rows Affected"},"reversible":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Reversible"},"round_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Round Id","description":"Approval round the change belongs to."},"external_ref":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Ref","description":"Reference the agent harness that proposed it sent along."}},"type":"object","required":["id","business_id","tool_name","summary","status","destructive","plan_hash_enforced","proposed_via","expires_at","created_at","updated_at"],"title":"PendingChangeResponse","description":"A proposed change and, once decided, its outcome."},"SuccessEnvelope_PendingChangeListResponse_":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"data":{"anyOf":[{"$ref":"#/components/schemas/PendingChangeListResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[PendingChangeListResponse]"},"ErrorResponse":{"title":"ErrorResponse","type":"object","description":"Envelope returned by every non-2xx response. Branch on `code` (stable) rather than `message` (human-readable, may change).","required":["error","message","code"],"properties":{"error":{"type":"string","description":"Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`."},"message":{"type":"string","description":"Human-readable explanation, safe to show to end users."},"code":{"type":"string","description":"Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`)."},"request_id":{"type":"string","description":"Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied."},"errors":{"type":"object","additionalProperties":{"type":"string"},"description":"Field-level validation messages keyed by field name. Present on 400/422 validation failures only."}}}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}