@1claw/openapi-spec 0.33.0 → 0.34.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -40,7 +40,21 @@ openapi-generator generate \
40
40
  import spec from "@1claw/openapi-spec/openapi.json";
41
41
  ```
42
42
 
43
- ## What's in the spec (v0.32.1 — API `info.version` 2.18.0)
43
+ ## What's in the spec (v0.34.1 — API `info.version` 2.19.0)
44
+
45
+ ### Risk Engine & DPoP (2.19)
46
+ - **Risk events** — `GET /v1/risk/events` (list, filterable by severity/principal_type)
47
+ - **Risk verdicts** — `GET /v1/risk/verdicts` (active verdicts), `GET /v1/risk/verdicts/{type}/{id}` (single principal verdict)
48
+ - **Honeytokens** — `GET/POST/DELETE /v1/risk/honeytokens` (canary secret CRUD with trigger counts)
49
+ - **DPoP** — RFC 9449 Demonstration of Proof-of-Possession token binding (planned spec addition)
50
+
51
+ ### Webhooks (2.19)
52
+ - **Webhook CRUD** — `POST/GET /v1/webhooks`, `GET/PATCH/DELETE /v1/webhooks/{id}`. Events: `wallet.transfer.*`, `proposal.*`, `agent.transaction.*`, `signing_key.rotated`, `policy.*`
53
+
54
+ ### OAuth & Email OTP (2.19)
55
+ - **OAuth2 authorization server** — `GET/POST /v1/oauth/authorize`, `POST /v1/oauth/token`, `GET /v1/oauth/userinfo` ("Sign in with 1Claw")
56
+ - **Email OTP** — `POST /v1/auth/email-otp/send`, `POST /v1/auth/email-otp/verify` (passwordless login)
57
+ - **Spend policies** — `POST/GET/DELETE /v1/platform/apps/{id}/spend-policies`, `PUT /v1/platform/connections/{id}/spend-policy`, `GET /v1/treasury/wallets/spend-policy`
44
58
 
45
59
  ### Bankr dynamic key vending (2.18)
46
60
  - **Bankr keys** — `POST /v1/agents/{id}/bankr-keys/lease`, `GET /v1/agents/{id}/bankr-keys`, `DELETE /v1/agents/{id}/bankr-keys/{lease_id}`. Partner key vending for scoped, TTL-bound `bk_usr_` wallet API keys.
package/openapi.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
4
  "title": "1Claw API",
5
- "version": "2.18.0",
5
+ "version": "2.19.0",
6
6
  "description": "Secure secret management for AI agents. Provides vaults, secrets,\npolicy-based access control, agent identity, Intents API,\nsharing, billing, and audit logging.\n\nAll endpoints require JWT Bearer authentication unless marked with\n`security: []`.\n",
7
7
  "contact": {
8
8
  "email": "ops@1claw.xyz"
@@ -118,6 +118,10 @@
118
118
  {
119
119
  "name": "OAuth",
120
120
  "description": "OAuth 2.0 authorization server (PKCE, consent, token exchange, OIDC UserInfo)"
121
+ },
122
+ {
123
+ "name": "Risk Engine",
124
+ "description": "Risk events, verdicts, and honeytoken management"
121
125
  }
122
126
  ],
123
127
  "paths": {
@@ -4277,6 +4281,74 @@
4277
4281
  }
4278
4282
  }
4279
4283
  },
4284
+ "/v1/org/bankr-config": {
4285
+ "get": {
4286
+ "tags": [
4287
+ "Organization"
4288
+ ],
4289
+ "summary": "Get org Bankr partner configuration",
4290
+ "description": "Returns whether the org has configured Bankr BYOK (partner key prefix and default wallet only — never the secret). Users only.",
4291
+ "operationId": "getOrgBankrConfig",
4292
+ "responses": {
4293
+ "200": {
4294
+ "description": "Bankr configuration status",
4295
+ "content": {
4296
+ "application/json": {
4297
+ "schema": {
4298
+ "$ref": "#/components/schemas/OrgBankrConfigResponse"
4299
+ }
4300
+ }
4301
+ }
4302
+ }
4303
+ }
4304
+ },
4305
+ "put": {
4306
+ "tags": [
4307
+ "Organization"
4308
+ ],
4309
+ "summary": "Set org Bankr partner configuration",
4310
+ "description": "Store or replace the org's Bankr partner key (`bk_ptr_...`) and optional default wallet (`wlt_...`). Owner/admin only. Partner key encrypted at rest.",
4311
+ "operationId": "upsertOrgBankrConfig",
4312
+ "requestBody": {
4313
+ "required": true,
4314
+ "content": {
4315
+ "application/json": {
4316
+ "schema": {
4317
+ "$ref": "#/components/schemas/UpsertOrgBankrConfigRequest"
4318
+ }
4319
+ }
4320
+ }
4321
+ },
4322
+ "responses": {
4323
+ "200": {
4324
+ "description": "Configuration saved",
4325
+ "content": {
4326
+ "application/json": {
4327
+ "schema": {
4328
+ "$ref": "#/components/schemas/OrgBankrConfigResponse"
4329
+ }
4330
+ }
4331
+ }
4332
+ }
4333
+ }
4334
+ },
4335
+ "delete": {
4336
+ "tags": [
4337
+ "Organization"
4338
+ ],
4339
+ "summary": "Remove org Bankr partner configuration",
4340
+ "description": "Delete BYOK credentials for the org. Owner/admin only.",
4341
+ "operationId": "deleteOrgBankrConfig",
4342
+ "responses": {
4343
+ "204": {
4344
+ "description": "Configuration removed"
4345
+ },
4346
+ "404": {
4347
+ "description": "Configuration not found"
4348
+ }
4349
+ }
4350
+ }
4351
+ },
4280
4352
  "/v1/org/invite": {
4281
4353
  "post": {
4282
4354
  "tags": [
@@ -8904,6 +8976,267 @@
8904
8976
  }
8905
8977
  }
8906
8978
  }
8979
+ },
8980
+ "/v1/risk/events": {
8981
+ "get": {
8982
+ "tags": [
8983
+ "Risk Engine"
8984
+ ],
8985
+ "summary": "List risk events",
8986
+ "description": "Returns risk events detected by the risk engine, ordered by most recent first.\nFilter by severity or principal type.\n",
8987
+ "operationId": "listRiskEvents",
8988
+ "parameters": [
8989
+ {
8990
+ "name": "severity",
8991
+ "in": "query",
8992
+ "schema": {
8993
+ "type": "string",
8994
+ "enum": [
8995
+ "low",
8996
+ "medium",
8997
+ "high",
8998
+ "critical"
8999
+ ]
9000
+ },
9001
+ "description": "Filter events by severity level"
9002
+ },
9003
+ {
9004
+ "name": "principal_type",
9005
+ "in": "query",
9006
+ "schema": {
9007
+ "type": "string",
9008
+ "enum": [
9009
+ "user",
9010
+ "agent"
9011
+ ]
9012
+ },
9013
+ "description": "Filter events by principal type"
9014
+ },
9015
+ {
9016
+ "name": "limit",
9017
+ "in": "query",
9018
+ "schema": {
9019
+ "type": "integer",
9020
+ "default": 50
9021
+ }
9022
+ },
9023
+ {
9024
+ "name": "offset",
9025
+ "in": "query",
9026
+ "schema": {
9027
+ "type": "integer",
9028
+ "default": 0
9029
+ }
9030
+ }
9031
+ ],
9032
+ "responses": {
9033
+ "200": {
9034
+ "description": "Risk event list",
9035
+ "content": {
9036
+ "application/json": {
9037
+ "schema": {
9038
+ "$ref": "#/components/schemas/RiskEventListResponse"
9039
+ }
9040
+ }
9041
+ }
9042
+ },
9043
+ "401": {
9044
+ "$ref": "#/components/responses/Unauthorized"
9045
+ }
9046
+ }
9047
+ }
9048
+ },
9049
+ "/v1/risk/verdicts": {
9050
+ "get": {
9051
+ "tags": [
9052
+ "Risk Engine"
9053
+ ],
9054
+ "summary": "List risk verdicts",
9055
+ "description": "Returns all active risk verdicts for the caller's organization.",
9056
+ "operationId": "listRiskVerdicts",
9057
+ "responses": {
9058
+ "200": {
9059
+ "description": "Verdict list",
9060
+ "content": {
9061
+ "application/json": {
9062
+ "schema": {
9063
+ "$ref": "#/components/schemas/RiskVerdictListResponse"
9064
+ }
9065
+ }
9066
+ }
9067
+ },
9068
+ "401": {
9069
+ "$ref": "#/components/responses/Unauthorized"
9070
+ }
9071
+ }
9072
+ }
9073
+ },
9074
+ "/v1/risk/verdicts/{principal_type}/{principal_id}": {
9075
+ "get": {
9076
+ "tags": [
9077
+ "Risk Engine"
9078
+ ],
9079
+ "summary": "Get risk verdict for a principal",
9080
+ "description": "Returns the current risk verdict for a specific user or agent.",
9081
+ "operationId": "getRiskVerdict",
9082
+ "parameters": [
9083
+ {
9084
+ "name": "principal_type",
9085
+ "in": "path",
9086
+ "required": true,
9087
+ "schema": {
9088
+ "type": "string",
9089
+ "enum": [
9090
+ "user",
9091
+ "agent"
9092
+ ]
9093
+ }
9094
+ },
9095
+ {
9096
+ "name": "principal_id",
9097
+ "in": "path",
9098
+ "required": true,
9099
+ "schema": {
9100
+ "type": "string",
9101
+ "format": "uuid"
9102
+ }
9103
+ }
9104
+ ],
9105
+ "responses": {
9106
+ "200": {
9107
+ "description": "Risk verdict (null if no verdict exists)",
9108
+ "content": {
9109
+ "application/json": {
9110
+ "schema": {
9111
+ "type": "object",
9112
+ "properties": {
9113
+ "verdict": {
9114
+ "$ref": "#/components/schemas/RiskVerdict",
9115
+ "nullable": true
9116
+ }
9117
+ }
9118
+ }
9119
+ }
9120
+ }
9121
+ },
9122
+ "401": {
9123
+ "$ref": "#/components/responses/Unauthorized"
9124
+ },
9125
+ "404": {
9126
+ "$ref": "#/components/responses/NotFound"
9127
+ }
9128
+ }
9129
+ }
9130
+ },
9131
+ "/v1/risk/honeytokens": {
9132
+ "get": {
9133
+ "tags": [
9134
+ "Risk Engine"
9135
+ ],
9136
+ "summary": "List honeytokens",
9137
+ "description": "Returns all honeytokens (canary secrets) configured for the caller's organization.",
9138
+ "operationId": "listHoneytokens",
9139
+ "responses": {
9140
+ "200": {
9141
+ "description": "Honeytoken list",
9142
+ "content": {
9143
+ "application/json": {
9144
+ "schema": {
9145
+ "$ref": "#/components/schemas/HoneytokenListResponse"
9146
+ }
9147
+ }
9148
+ }
9149
+ },
9150
+ "401": {
9151
+ "$ref": "#/components/responses/Unauthorized"
9152
+ }
9153
+ }
9154
+ },
9155
+ "post": {
9156
+ "tags": [
9157
+ "Risk Engine"
9158
+ ],
9159
+ "summary": "Create a honeytoken",
9160
+ "description": "Register a secret path as a honeytoken (canary). Any access to this secret\ntriggers a risk event and increments the trigger counter.\n",
9161
+ "operationId": "createHoneytoken",
9162
+ "requestBody": {
9163
+ "required": true,
9164
+ "content": {
9165
+ "application/json": {
9166
+ "schema": {
9167
+ "$ref": "#/components/schemas/CreateHoneytokenRequest"
9168
+ }
9169
+ }
9170
+ }
9171
+ },
9172
+ "responses": {
9173
+ "201": {
9174
+ "description": "Honeytoken created",
9175
+ "content": {
9176
+ "application/json": {
9177
+ "schema": {
9178
+ "type": "object",
9179
+ "properties": {
9180
+ "honeytoken": {
9181
+ "$ref": "#/components/schemas/Honeytoken"
9182
+ }
9183
+ }
9184
+ }
9185
+ }
9186
+ }
9187
+ },
9188
+ "400": {
9189
+ "$ref": "#/components/responses/BadRequest"
9190
+ },
9191
+ "401": {
9192
+ "$ref": "#/components/responses/Unauthorized"
9193
+ }
9194
+ }
9195
+ }
9196
+ },
9197
+ "/v1/risk/honeytokens/{id}": {
9198
+ "delete": {
9199
+ "tags": [
9200
+ "Risk Engine"
9201
+ ],
9202
+ "summary": "Delete a honeytoken",
9203
+ "description": "Remove a honeytoken registration. The underlying secret is not affected.",
9204
+ "operationId": "deleteHoneytoken",
9205
+ "parameters": [
9206
+ {
9207
+ "name": "id",
9208
+ "in": "path",
9209
+ "required": true,
9210
+ "schema": {
9211
+ "type": "string",
9212
+ "format": "uuid"
9213
+ }
9214
+ }
9215
+ ],
9216
+ "responses": {
9217
+ "200": {
9218
+ "description": "Honeytoken deleted",
9219
+ "content": {
9220
+ "application/json": {
9221
+ "schema": {
9222
+ "type": "object",
9223
+ "properties": {
9224
+ "deleted": {
9225
+ "type": "boolean"
9226
+ }
9227
+ }
9228
+ }
9229
+ }
9230
+ }
9231
+ },
9232
+ "401": {
9233
+ "$ref": "#/components/responses/Unauthorized"
9234
+ },
9235
+ "404": {
9236
+ "$ref": "#/components/responses/NotFound"
9237
+ }
9238
+ }
9239
+ }
8907
9240
  }
8908
9241
  },
8909
9242
  "components": {
@@ -12274,6 +12607,43 @@
12274
12607
  }
12275
12608
  }
12276
12609
  },
12610
+ "OrgBankrConfigResponse": {
12611
+ "type": "object",
12612
+ "properties": {
12613
+ "configured": {
12614
+ "type": "boolean"
12615
+ },
12616
+ "partner_key_prefix": {
12617
+ "type": "string"
12618
+ },
12619
+ "default_wallet_id": {
12620
+ "type": "string"
12621
+ },
12622
+ "updated_at": {
12623
+ "type": "string",
12624
+ "format": "date-time"
12625
+ },
12626
+ "using_platform_fallback": {
12627
+ "type": "boolean"
12628
+ }
12629
+ }
12630
+ },
12631
+ "UpsertOrgBankrConfigRequest": {
12632
+ "type": "object",
12633
+ "required": [
12634
+ "partner_key"
12635
+ ],
12636
+ "properties": {
12637
+ "partner_key": {
12638
+ "type": "string",
12639
+ "description": "Bankr partner API key (bk_ptr_...)"
12640
+ },
12641
+ "default_wallet_id": {
12642
+ "type": "string",
12643
+ "description": "Default provisioned wallet (wlt_...)"
12644
+ }
12645
+ }
12646
+ },
12277
12647
  "UsageSummaryResponse": {
12278
12648
  "type": "object",
12279
12649
  "properties": {
@@ -15169,6 +15539,285 @@
15169
15539
  "format": "date-time"
15170
15540
  }
15171
15541
  }
15542
+ },
15543
+ "RiskEvent": {
15544
+ "type": "object",
15545
+ "required": [
15546
+ "id",
15547
+ "occurred_at",
15548
+ "principal_type",
15549
+ "principal_id",
15550
+ "org_id",
15551
+ "event_type",
15552
+ "payload",
15553
+ "created_at"
15554
+ ],
15555
+ "properties": {
15556
+ "id": {
15557
+ "type": "string",
15558
+ "format": "uuid"
15559
+ },
15560
+ "occurred_at": {
15561
+ "type": "string",
15562
+ "format": "date-time"
15563
+ },
15564
+ "principal_type": {
15565
+ "type": "string",
15566
+ "enum": [
15567
+ "user",
15568
+ "agent"
15569
+ ]
15570
+ },
15571
+ "principal_id": {
15572
+ "type": "string",
15573
+ "format": "uuid"
15574
+ },
15575
+ "org_id": {
15576
+ "type": "string",
15577
+ "format": "uuid"
15578
+ },
15579
+ "event_type": {
15580
+ "type": "string",
15581
+ "description": "Risk event type (e.g. first_seen, geo_velocity, honeytoken_access)"
15582
+ },
15583
+ "ip": {
15584
+ "type": "string",
15585
+ "nullable": true
15586
+ },
15587
+ "asn": {
15588
+ "type": "integer",
15589
+ "nullable": true
15590
+ },
15591
+ "asn_org": {
15592
+ "type": "string",
15593
+ "nullable": true
15594
+ },
15595
+ "country_code": {
15596
+ "type": "string",
15597
+ "nullable": true
15598
+ },
15599
+ "region": {
15600
+ "type": "string",
15601
+ "nullable": true
15602
+ },
15603
+ "city": {
15604
+ "type": "string",
15605
+ "nullable": true
15606
+ },
15607
+ "latitude": {
15608
+ "type": "number",
15609
+ "nullable": true
15610
+ },
15611
+ "longitude": {
15612
+ "type": "number",
15613
+ "nullable": true
15614
+ },
15615
+ "user_agent": {
15616
+ "type": "string",
15617
+ "nullable": true
15618
+ },
15619
+ "severity": {
15620
+ "type": "string",
15621
+ "nullable": true,
15622
+ "description": "Computed severity at event time (low, medium, high, critical)"
15623
+ },
15624
+ "payload": {
15625
+ "type": "object",
15626
+ "additionalProperties": true
15627
+ },
15628
+ "created_at": {
15629
+ "type": "string",
15630
+ "format": "date-time"
15631
+ }
15632
+ }
15633
+ },
15634
+ "RiskEventListResponse": {
15635
+ "type": "object",
15636
+ "required": [
15637
+ "events"
15638
+ ],
15639
+ "properties": {
15640
+ "events": {
15641
+ "type": "array",
15642
+ "items": {
15643
+ "$ref": "#/components/schemas/RiskEvent"
15644
+ }
15645
+ }
15646
+ }
15647
+ },
15648
+ "RiskVerdictReason": {
15649
+ "type": "object",
15650
+ "required": [
15651
+ "detector",
15652
+ "severity",
15653
+ "description"
15654
+ ],
15655
+ "properties": {
15656
+ "detector": {
15657
+ "type": "string"
15658
+ },
15659
+ "severity": {
15660
+ "type": "string"
15661
+ },
15662
+ "description": {
15663
+ "type": "string"
15664
+ },
15665
+ "metadata": {
15666
+ "type": "object",
15667
+ "additionalProperties": true
15668
+ }
15669
+ }
15670
+ },
15671
+ "RiskVerdict": {
15672
+ "type": "object",
15673
+ "required": [
15674
+ "principal_type",
15675
+ "principal_id",
15676
+ "org_id",
15677
+ "score",
15678
+ "severity",
15679
+ "reasons",
15680
+ "computed_at",
15681
+ "expires_at"
15682
+ ],
15683
+ "properties": {
15684
+ "principal_type": {
15685
+ "type": "string"
15686
+ },
15687
+ "principal_id": {
15688
+ "type": "string",
15689
+ "format": "uuid"
15690
+ },
15691
+ "org_id": {
15692
+ "type": "string",
15693
+ "format": "uuid"
15694
+ },
15695
+ "score": {
15696
+ "type": "number",
15697
+ "description": "Composite risk score (0.0 – 100.0)"
15698
+ },
15699
+ "severity": {
15700
+ "type": "string",
15701
+ "enum": [
15702
+ "low",
15703
+ "medium",
15704
+ "high",
15705
+ "critical"
15706
+ ]
15707
+ },
15708
+ "reasons": {
15709
+ "type": "array",
15710
+ "items": {
15711
+ "$ref": "#/components/schemas/RiskVerdictReason"
15712
+ }
15713
+ },
15714
+ "computed_at": {
15715
+ "type": "string",
15716
+ "format": "date-time"
15717
+ },
15718
+ "expires_at": {
15719
+ "type": "string",
15720
+ "format": "date-time"
15721
+ }
15722
+ }
15723
+ },
15724
+ "RiskVerdictListResponse": {
15725
+ "type": "object",
15726
+ "required": [
15727
+ "verdicts"
15728
+ ],
15729
+ "properties": {
15730
+ "verdicts": {
15731
+ "type": "array",
15732
+ "items": {
15733
+ "$ref": "#/components/schemas/RiskVerdict"
15734
+ }
15735
+ }
15736
+ }
15737
+ },
15738
+ "Honeytoken": {
15739
+ "type": "object",
15740
+ "required": [
15741
+ "id",
15742
+ "vault_id",
15743
+ "org_id",
15744
+ "secret_path",
15745
+ "created_by",
15746
+ "created_at",
15747
+ "triggered_count"
15748
+ ],
15749
+ "properties": {
15750
+ "id": {
15751
+ "type": "string",
15752
+ "format": "uuid"
15753
+ },
15754
+ "vault_id": {
15755
+ "type": "string",
15756
+ "format": "uuid"
15757
+ },
15758
+ "org_id": {
15759
+ "type": "string",
15760
+ "format": "uuid"
15761
+ },
15762
+ "secret_path": {
15763
+ "type": "string"
15764
+ },
15765
+ "created_by": {
15766
+ "type": "string",
15767
+ "format": "uuid"
15768
+ },
15769
+ "created_at": {
15770
+ "type": "string",
15771
+ "format": "date-time"
15772
+ },
15773
+ "notes": {
15774
+ "type": "string",
15775
+ "nullable": true
15776
+ },
15777
+ "triggered_count": {
15778
+ "type": "integer"
15779
+ },
15780
+ "last_triggered_at": {
15781
+ "type": "string",
15782
+ "format": "date-time",
15783
+ "nullable": true
15784
+ }
15785
+ }
15786
+ },
15787
+ "CreateHoneytokenRequest": {
15788
+ "type": "object",
15789
+ "required": [
15790
+ "vault_id",
15791
+ "secret_path"
15792
+ ],
15793
+ "properties": {
15794
+ "vault_id": {
15795
+ "type": "string",
15796
+ "format": "uuid"
15797
+ },
15798
+ "secret_path": {
15799
+ "type": "string",
15800
+ "description": "Vault secret path to monitor as a canary"
15801
+ },
15802
+ "notes": {
15803
+ "type": "string",
15804
+ "description": "Optional human-readable notes about this honeytoken"
15805
+ }
15806
+ }
15807
+ },
15808
+ "HoneytokenListResponse": {
15809
+ "type": "object",
15810
+ "required": [
15811
+ "honeytokens"
15812
+ ],
15813
+ "properties": {
15814
+ "honeytokens": {
15815
+ "type": "array",
15816
+ "items": {
15817
+ "$ref": "#/components/schemas/Honeytoken"
15818
+ }
15819
+ }
15820
+ }
15172
15821
  }
15173
15822
  }
15174
15823
  }
package/openapi.yaml CHANGED
@@ -2,7 +2,7 @@ openapi: 3.1.0
2
2
 
3
3
  info:
4
4
  title: 1Claw API
5
- version: 2.18.0
5
+ version: 2.19.0
6
6
  description: |
7
7
  Secure secret management for AI agents. Provides vaults, secrets,
8
8
  policy-based access control, agent identity, Intents API,
@@ -72,6 +72,8 @@ tags:
72
72
  description: Platform API for developers building on 1Claw (plt_ keys, user provisioning, bootstrap templates)
73
73
  - name: OAuth
74
74
  description: OAuth 2.0 authorization server (PKCE, consent, token exchange, OIDC UserInfo)
75
+ - name: Risk Engine
76
+ description: Risk events, verdicts, and honeytoken management
75
77
 
76
78
  # =============================================================================
77
79
  # PATHS
@@ -2806,6 +2808,48 @@ paths:
2806
2808
  "404":
2807
2809
  description: Agent-keys vault not found
2808
2810
 
2811
+ /v1/org/bankr-config:
2812
+ get:
2813
+ tags: [Organization]
2814
+ summary: Get org Bankr partner configuration
2815
+ description: Returns whether the org has configured Bankr BYOK (partner key prefix and default wallet only — never the secret). Users only.
2816
+ operationId: getOrgBankrConfig
2817
+ responses:
2818
+ "200":
2819
+ description: Bankr configuration status
2820
+ content:
2821
+ application/json:
2822
+ schema:
2823
+ $ref: "#/components/schemas/OrgBankrConfigResponse"
2824
+ put:
2825
+ tags: [Organization]
2826
+ summary: Set org Bankr partner configuration
2827
+ description: Store or replace the org's Bankr partner key (`bk_ptr_...`) and optional default wallet (`wlt_...`). Owner/admin only. Partner key encrypted at rest.
2828
+ operationId: upsertOrgBankrConfig
2829
+ requestBody:
2830
+ required: true
2831
+ content:
2832
+ application/json:
2833
+ schema:
2834
+ $ref: "#/components/schemas/UpsertOrgBankrConfigRequest"
2835
+ responses:
2836
+ "200":
2837
+ description: Configuration saved
2838
+ content:
2839
+ application/json:
2840
+ schema:
2841
+ $ref: "#/components/schemas/OrgBankrConfigResponse"
2842
+ delete:
2843
+ tags: [Organization]
2844
+ summary: Remove org Bankr partner configuration
2845
+ description: Delete BYOK credentials for the org. Owner/admin only.
2846
+ operationId: deleteOrgBankrConfig
2847
+ responses:
2848
+ "204":
2849
+ description: Configuration removed
2850
+ "404":
2851
+ description: Configuration not found
2852
+
2809
2853
  /v1/org/invite:
2810
2854
  post:
2811
2855
  tags: [Organization]
@@ -5682,6 +5726,173 @@ paths:
5682
5726
  "401":
5683
5727
  $ref: "#/components/responses/Unauthorized"
5684
5728
 
5729
+ # ---------------------------------------------------------------------------
5730
+ # Risk Engine
5731
+ # ---------------------------------------------------------------------------
5732
+
5733
+ /v1/risk/events:
5734
+ get:
5735
+ tags: [Risk Engine]
5736
+ summary: List risk events
5737
+ description: |
5738
+ Returns risk events detected by the risk engine, ordered by most recent first.
5739
+ Filter by severity or principal type.
5740
+ operationId: listRiskEvents
5741
+ parameters:
5742
+ - name: severity
5743
+ in: query
5744
+ schema:
5745
+ type: string
5746
+ enum: [low, medium, high, critical]
5747
+ description: Filter events by severity level
5748
+ - name: principal_type
5749
+ in: query
5750
+ schema:
5751
+ type: string
5752
+ enum: [user, agent]
5753
+ description: Filter events by principal type
5754
+ - name: limit
5755
+ in: query
5756
+ schema:
5757
+ type: integer
5758
+ default: 50
5759
+ - name: offset
5760
+ in: query
5761
+ schema:
5762
+ type: integer
5763
+ default: 0
5764
+ responses:
5765
+ "200":
5766
+ description: Risk event list
5767
+ content:
5768
+ application/json:
5769
+ schema:
5770
+ $ref: "#/components/schemas/RiskEventListResponse"
5771
+ "401":
5772
+ $ref: "#/components/responses/Unauthorized"
5773
+
5774
+ /v1/risk/verdicts:
5775
+ get:
5776
+ tags: [Risk Engine]
5777
+ summary: List risk verdicts
5778
+ description: Returns all active risk verdicts for the caller's organization.
5779
+ operationId: listRiskVerdicts
5780
+ responses:
5781
+ "200":
5782
+ description: Verdict list
5783
+ content:
5784
+ application/json:
5785
+ schema:
5786
+ $ref: "#/components/schemas/RiskVerdictListResponse"
5787
+ "401":
5788
+ $ref: "#/components/responses/Unauthorized"
5789
+
5790
+ /v1/risk/verdicts/{principal_type}/{principal_id}:
5791
+ get:
5792
+ tags: [Risk Engine]
5793
+ summary: Get risk verdict for a principal
5794
+ description: Returns the current risk verdict for a specific user or agent.
5795
+ operationId: getRiskVerdict
5796
+ parameters:
5797
+ - name: principal_type
5798
+ in: path
5799
+ required: true
5800
+ schema:
5801
+ type: string
5802
+ enum: [user, agent]
5803
+ - name: principal_id
5804
+ in: path
5805
+ required: true
5806
+ schema:
5807
+ type: string
5808
+ format: uuid
5809
+ responses:
5810
+ "200":
5811
+ description: Risk verdict (null if no verdict exists)
5812
+ content:
5813
+ application/json:
5814
+ schema:
5815
+ type: object
5816
+ properties:
5817
+ verdict:
5818
+ $ref: "#/components/schemas/RiskVerdict"
5819
+ nullable: true
5820
+ "401":
5821
+ $ref: "#/components/responses/Unauthorized"
5822
+ "404":
5823
+ $ref: "#/components/responses/NotFound"
5824
+
5825
+ /v1/risk/honeytokens:
5826
+ get:
5827
+ tags: [Risk Engine]
5828
+ summary: List honeytokens
5829
+ description: Returns all honeytokens (canary secrets) configured for the caller's organization.
5830
+ operationId: listHoneytokens
5831
+ responses:
5832
+ "200":
5833
+ description: Honeytoken list
5834
+ content:
5835
+ application/json:
5836
+ schema:
5837
+ $ref: "#/components/schemas/HoneytokenListResponse"
5838
+ "401":
5839
+ $ref: "#/components/responses/Unauthorized"
5840
+ post:
5841
+ tags: [Risk Engine]
5842
+ summary: Create a honeytoken
5843
+ description: |
5844
+ Register a secret path as a honeytoken (canary). Any access to this secret
5845
+ triggers a risk event and increments the trigger counter.
5846
+ operationId: createHoneytoken
5847
+ requestBody:
5848
+ required: true
5849
+ content:
5850
+ application/json:
5851
+ schema:
5852
+ $ref: "#/components/schemas/CreateHoneytokenRequest"
5853
+ responses:
5854
+ "201":
5855
+ description: Honeytoken created
5856
+ content:
5857
+ application/json:
5858
+ schema:
5859
+ type: object
5860
+ properties:
5861
+ honeytoken:
5862
+ $ref: "#/components/schemas/Honeytoken"
5863
+ "400":
5864
+ $ref: "#/components/responses/BadRequest"
5865
+ "401":
5866
+ $ref: "#/components/responses/Unauthorized"
5867
+
5868
+ /v1/risk/honeytokens/{id}:
5869
+ delete:
5870
+ tags: [Risk Engine]
5871
+ summary: Delete a honeytoken
5872
+ description: Remove a honeytoken registration. The underlying secret is not affected.
5873
+ operationId: deleteHoneytoken
5874
+ parameters:
5875
+ - name: id
5876
+ in: path
5877
+ required: true
5878
+ schema:
5879
+ type: string
5880
+ format: uuid
5881
+ responses:
5882
+ "200":
5883
+ description: Honeytoken deleted
5884
+ content:
5885
+ application/json:
5886
+ schema:
5887
+ type: object
5888
+ properties:
5889
+ deleted:
5890
+ type: boolean
5891
+ "401":
5892
+ $ref: "#/components/responses/Unauthorized"
5893
+ "404":
5894
+ $ref: "#/components/responses/NotFound"
5895
+
5685
5896
  # =============================================================================
5686
5897
  # COMPONENTS
5687
5898
  # =============================================================================
@@ -8043,6 +8254,32 @@ components:
8043
8254
  type: string
8044
8255
  format: uuid
8045
8256
 
8257
+ OrgBankrConfigResponse:
8258
+ type: object
8259
+ properties:
8260
+ configured:
8261
+ type: boolean
8262
+ partner_key_prefix:
8263
+ type: string
8264
+ default_wallet_id:
8265
+ type: string
8266
+ updated_at:
8267
+ type: string
8268
+ format: date-time
8269
+ using_platform_fallback:
8270
+ type: boolean
8271
+
8272
+ UpsertOrgBankrConfigRequest:
8273
+ type: object
8274
+ required: [partner_key]
8275
+ properties:
8276
+ partner_key:
8277
+ type: string
8278
+ description: Bankr partner API key (bk_ptr_...)
8279
+ default_wallet_id:
8280
+ type: string
8281
+ description: Default provisioned wallet (wlt_...)
8282
+
8046
8283
  # --- Billing ---
8047
8284
 
8048
8285
  UsageSummaryResponse:
@@ -10016,3 +10253,180 @@ components:
10016
10253
  created_at:
10017
10254
  type: string
10018
10255
  format: date-time
10256
+
10257
+ # --- Risk Engine ---
10258
+
10259
+ RiskEvent:
10260
+ type: object
10261
+ required: [id, occurred_at, principal_type, principal_id, org_id, event_type, payload, created_at]
10262
+ properties:
10263
+ id:
10264
+ type: string
10265
+ format: uuid
10266
+ occurred_at:
10267
+ type: string
10268
+ format: date-time
10269
+ principal_type:
10270
+ type: string
10271
+ enum: [user, agent]
10272
+ principal_id:
10273
+ type: string
10274
+ format: uuid
10275
+ org_id:
10276
+ type: string
10277
+ format: uuid
10278
+ event_type:
10279
+ type: string
10280
+ description: "Risk event type (e.g. first_seen, geo_velocity, honeytoken_access)"
10281
+ ip:
10282
+ type: string
10283
+ nullable: true
10284
+ asn:
10285
+ type: integer
10286
+ nullable: true
10287
+ asn_org:
10288
+ type: string
10289
+ nullable: true
10290
+ country_code:
10291
+ type: string
10292
+ nullable: true
10293
+ region:
10294
+ type: string
10295
+ nullable: true
10296
+ city:
10297
+ type: string
10298
+ nullable: true
10299
+ latitude:
10300
+ type: number
10301
+ nullable: true
10302
+ longitude:
10303
+ type: number
10304
+ nullable: true
10305
+ user_agent:
10306
+ type: string
10307
+ nullable: true
10308
+ severity:
10309
+ type: string
10310
+ nullable: true
10311
+ description: "Computed severity at event time (low, medium, high, critical)"
10312
+ payload:
10313
+ type: object
10314
+ additionalProperties: true
10315
+ created_at:
10316
+ type: string
10317
+ format: date-time
10318
+
10319
+ RiskEventListResponse:
10320
+ type: object
10321
+ required: [events]
10322
+ properties:
10323
+ events:
10324
+ type: array
10325
+ items:
10326
+ $ref: "#/components/schemas/RiskEvent"
10327
+
10328
+ RiskVerdictReason:
10329
+ type: object
10330
+ required: [detector, severity, description]
10331
+ properties:
10332
+ detector:
10333
+ type: string
10334
+ severity:
10335
+ type: string
10336
+ description:
10337
+ type: string
10338
+ metadata:
10339
+ type: object
10340
+ additionalProperties: true
10341
+
10342
+ RiskVerdict:
10343
+ type: object
10344
+ required: [principal_type, principal_id, org_id, score, severity, reasons, computed_at, expires_at]
10345
+ properties:
10346
+ principal_type:
10347
+ type: string
10348
+ principal_id:
10349
+ type: string
10350
+ format: uuid
10351
+ org_id:
10352
+ type: string
10353
+ format: uuid
10354
+ score:
10355
+ type: number
10356
+ description: Composite risk score (0.0 – 100.0)
10357
+ severity:
10358
+ type: string
10359
+ enum: [low, medium, high, critical]
10360
+ reasons:
10361
+ type: array
10362
+ items:
10363
+ $ref: "#/components/schemas/RiskVerdictReason"
10364
+ computed_at:
10365
+ type: string
10366
+ format: date-time
10367
+ expires_at:
10368
+ type: string
10369
+ format: date-time
10370
+
10371
+ RiskVerdictListResponse:
10372
+ type: object
10373
+ required: [verdicts]
10374
+ properties:
10375
+ verdicts:
10376
+ type: array
10377
+ items:
10378
+ $ref: "#/components/schemas/RiskVerdict"
10379
+
10380
+ Honeytoken:
10381
+ type: object
10382
+ required: [id, vault_id, org_id, secret_path, created_by, created_at, triggered_count]
10383
+ properties:
10384
+ id:
10385
+ type: string
10386
+ format: uuid
10387
+ vault_id:
10388
+ type: string
10389
+ format: uuid
10390
+ org_id:
10391
+ type: string
10392
+ format: uuid
10393
+ secret_path:
10394
+ type: string
10395
+ created_by:
10396
+ type: string
10397
+ format: uuid
10398
+ created_at:
10399
+ type: string
10400
+ format: date-time
10401
+ notes:
10402
+ type: string
10403
+ nullable: true
10404
+ triggered_count:
10405
+ type: integer
10406
+ last_triggered_at:
10407
+ type: string
10408
+ format: date-time
10409
+ nullable: true
10410
+
10411
+ CreateHoneytokenRequest:
10412
+ type: object
10413
+ required: [vault_id, secret_path]
10414
+ properties:
10415
+ vault_id:
10416
+ type: string
10417
+ format: uuid
10418
+ secret_path:
10419
+ type: string
10420
+ description: Vault secret path to monitor as a canary
10421
+ notes:
10422
+ type: string
10423
+ description: Optional human-readable notes about this honeytoken
10424
+
10425
+ HoneytokenListResponse:
10426
+ type: object
10427
+ required: [honeytokens]
10428
+ properties:
10429
+ honeytokens:
10430
+ type: array
10431
+ items:
10432
+ $ref: "#/components/schemas/Honeytoken"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1claw/openapi-spec",
3
- "version": "0.33.0",
3
+ "version": "0.34.1",
4
4
  "description": "OpenAPI 3.1.0 specification for the 1Claw Vault API — generate clients in any language",
5
5
  "license": "MIT",
6
6
  "repository": {