@1claw/openapi-spec 0.32.0 → 0.33.0

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/openapi.yaml CHANGED
@@ -70,6 +70,8 @@ tags:
70
70
  description: Event webhook registration and management
71
71
  - name: Platform
72
72
  description: Platform API for developers building on 1Claw (plt_ keys, user provisioning, bootstrap templates)
73
+ - name: OAuth
74
+ description: OAuth 2.0 authorization server (PKCE, consent, token exchange, OIDC UserInfo)
73
75
 
74
76
  # =============================================================================
75
77
  # PATHS
@@ -2423,8 +2425,14 @@ paths:
2423
2425
  summary: Lease a short-lived Bankr wallet API key
2424
2426
  description: |
2425
2427
  Provision a scoped, time-limited Bankr wallet API key for an agent.
2426
- Requires `BANKR_PARTNER_KEY` configured on the Vault service.
2427
- Default TTL 1 hour, max 24 hours. Max 5 concurrent leases per agent.
2428
+ **Privileged, deny-by-default:** agent callers need an explicit access policy
2429
+ on `agents/{agent_id}/bankr/*` in the `__agent-keys` vault (JWT scope
2430
+ `agents/{agent_id}/bankr/lease`). Agents may only lease for their own ID.
2431
+ The `bk_usr_` key is **omitted** from the JSON response for agent JWTs —
2432
+ stored server-side for Shroud resolution. Human callers receive `api_key` once.
2433
+ Requires `BANKR_PARTNER_KEY` on Vault. Agent default TTL 15 min when omitted;
2434
+ human/org default 1 hour (`BANKR_DEFAULT_LEASE_TTL_SECS`). Recommend 5–15 min
2435
+ for autonomous agents. Max TTL 24 hours. Max 5 concurrent leases per agent.
2428
2436
  operationId: leaseBankrKey
2429
2437
  parameters:
2430
2438
  - $ref: "#/components/parameters/AgentId"
@@ -3978,6 +3986,32 @@ paths:
3978
3986
  "404":
3979
3987
  $ref: "#/components/responses/NotFound"
3980
3988
 
3989
+ /v1/treasury/wallets/spend-policy:
3990
+ get:
3991
+ tags: [Treasury Wallets]
3992
+ summary: Get effective spend policy for current user
3993
+ description: |
3994
+ Returns the effective spend policy governing the authenticated user's
3995
+ wallet transactions. Resolves from per-user override (if set) or the
3996
+ app-wide default. Returns null if no policy is configured.
3997
+ operationId: getEffectiveSpendPolicy
3998
+ security:
3999
+ - BearerAuth: []
4000
+ responses:
4001
+ "200":
4002
+ description: Effective spend policy
4003
+ content:
4004
+ application/json:
4005
+ schema:
4006
+ type: object
4007
+ properties:
4008
+ policy:
4009
+ nullable: true
4010
+ allOf:
4011
+ - $ref: "#/components/schemas/SpendPolicyResponse"
4012
+ "401":
4013
+ $ref: "#/components/responses/Unauthorized"
4014
+
3981
4015
  # ---------------------------------------------------------------------------
3982
4016
  # Webhooks
3983
4017
  # ---------------------------------------------------------------------------
@@ -4923,6 +4957,132 @@ paths:
4923
4957
  "410":
4924
4958
  description: Claim token has expired
4925
4959
 
4960
+ # --- Spend Policies ---
4961
+
4962
+ /v1/platform/apps/{appId}/spend-policies:
4963
+ post:
4964
+ tags: [Platform]
4965
+ summary: Create wallet spend policy
4966
+ description: |
4967
+ Create an app-wide spend policy that governs what embedded wallet users
4968
+ can do with their wallets. Policies apply to all connected users by default
4969
+ and can be overridden per-user via connection-level policies.
4970
+ operationId: createSpendPolicy
4971
+ security:
4972
+ - BearerAuth: []
4973
+ parameters:
4974
+ - in: path
4975
+ name: appId
4976
+ required: true
4977
+ schema:
4978
+ type: string
4979
+ format: uuid
4980
+ requestBody:
4981
+ required: true
4982
+ content:
4983
+ application/json:
4984
+ schema:
4985
+ $ref: "#/components/schemas/CreateSpendPolicyRequest"
4986
+ responses:
4987
+ "201":
4988
+ description: Spend policy created
4989
+ content:
4990
+ application/json:
4991
+ schema:
4992
+ $ref: "#/components/schemas/SpendPolicyResponse"
4993
+ "400":
4994
+ $ref: "#/components/responses/BadRequest"
4995
+ "403":
4996
+ $ref: "#/components/responses/Forbidden"
4997
+ get:
4998
+ tags: [Platform]
4999
+ summary: List spend policies for app
5000
+ description: Returns all spend policies configured for the platform app.
5001
+ operationId: listSpendPolicies
5002
+ security:
5003
+ - BearerAuth: []
5004
+ parameters:
5005
+ - in: path
5006
+ name: appId
5007
+ required: true
5008
+ schema:
5009
+ type: string
5010
+ format: uuid
5011
+ responses:
5012
+ "200":
5013
+ description: Spend policies
5014
+ content:
5015
+ application/json:
5016
+ schema:
5017
+ type: object
5018
+ properties:
5019
+ policies:
5020
+ type: array
5021
+ items:
5022
+ $ref: "#/components/schemas/SpendPolicyResponse"
5023
+
5024
+ /v1/platform/apps/{appId}/spend-policies/{policyId}:
5025
+ delete:
5026
+ tags: [Platform]
5027
+ summary: Delete a spend policy
5028
+ operationId: deleteSpendPolicy
5029
+ security:
5030
+ - BearerAuth: []
5031
+ parameters:
5032
+ - in: path
5033
+ name: appId
5034
+ required: true
5035
+ schema:
5036
+ type: string
5037
+ format: uuid
5038
+ - in: path
5039
+ name: policyId
5040
+ required: true
5041
+ schema:
5042
+ type: string
5043
+ format: uuid
5044
+ responses:
5045
+ "204":
5046
+ description: Deleted
5047
+ "404":
5048
+ $ref: "#/components/responses/NotFound"
5049
+
5050
+ /v1/platform/connections/{connectionId}/spend-policy:
5051
+ put:
5052
+ tags: [Platform]
5053
+ summary: Set per-user spend policy override
5054
+ description: |
5055
+ Override the app-wide spend policy for a specific connected user. This
5056
+ policy takes precedence over the app default. Remove by deleting the
5057
+ connection-level policy.
5058
+ operationId: setUserSpendPolicy
5059
+ security:
5060
+ - BearerAuth: []
5061
+ parameters:
5062
+ - in: path
5063
+ name: connectionId
5064
+ required: true
5065
+ schema:
5066
+ type: string
5067
+ format: uuid
5068
+ requestBody:
5069
+ required: true
5070
+ content:
5071
+ application/json:
5072
+ schema:
5073
+ $ref: "#/components/schemas/CreateSpendPolicyRequest"
5074
+ responses:
5075
+ "200":
5076
+ description: Spend policy set
5077
+ content:
5078
+ application/json:
5079
+ schema:
5080
+ $ref: "#/components/schemas/SpendPolicyResponse"
5081
+ "400":
5082
+ $ref: "#/components/responses/BadRequest"
5083
+ "403":
5084
+ $ref: "#/components/responses/Forbidden"
5085
+
4926
5086
  # --- Approvals ---
4927
5087
 
4928
5088
  /v1/approvals:
@@ -5277,6 +5437,251 @@ paths:
5277
5437
  "200":
5278
5438
  description: Passkey token for X-Passkey-Token header
5279
5439
 
5440
+ # ---------------------------------------------------------------------------
5441
+ # Email OTP
5442
+ # ---------------------------------------------------------------------------
5443
+
5444
+ /v1/auth/email-otp/send:
5445
+ post:
5446
+ tags: [Authentication]
5447
+ summary: Send email OTP code
5448
+ description: |
5449
+ Sends a 6-digit one-time code to the specified email address.
5450
+ No authentication required. Rate-limited per IP and per email.
5451
+ operationId: sendEmailOtp
5452
+ security: []
5453
+ requestBody:
5454
+ required: true
5455
+ content:
5456
+ application/json:
5457
+ schema:
5458
+ type: object
5459
+ required: [email]
5460
+ properties:
5461
+ email:
5462
+ type: string
5463
+ format: email
5464
+ platform_app_id:
5465
+ type: string
5466
+ format: uuid
5467
+ description: Optional platform app context for embedded wallet flows
5468
+ responses:
5469
+ "200":
5470
+ description: OTP sent
5471
+ content:
5472
+ application/json:
5473
+ schema:
5474
+ type: object
5475
+ properties:
5476
+ status:
5477
+ type: string
5478
+ enum: [sent]
5479
+ "429":
5480
+ description: Rate limited
5481
+
5482
+ /v1/auth/email-otp/verify:
5483
+ post:
5484
+ tags: [Authentication]
5485
+ summary: Verify email OTP and get JWT
5486
+ description: |
5487
+ Verifies the 6-digit code sent to the user's email. If the user does not
5488
+ exist, a new account is created. Optionally auto-provisions treasury wallets
5489
+ for the specified chains. Returns a JWT for subsequent API calls.
5490
+ operationId: verifyEmailOtp
5491
+ security: []
5492
+ requestBody:
5493
+ required: true
5494
+ content:
5495
+ application/json:
5496
+ schema:
5497
+ type: object
5498
+ required: [email, code]
5499
+ properties:
5500
+ email:
5501
+ type: string
5502
+ format: email
5503
+ code:
5504
+ type: string
5505
+ description: 6-digit OTP code
5506
+ platform_app_id:
5507
+ type: string
5508
+ format: uuid
5509
+ auto_provision_chains:
5510
+ type: array
5511
+ items: { type: string }
5512
+ description: Chains to auto-generate wallets for (e.g. ["ethereum", "base"])
5513
+ responses:
5514
+ "200":
5515
+ description: Existing user authenticated
5516
+ content:
5517
+ application/json:
5518
+ schema:
5519
+ $ref: "#/components/schemas/EmailOtpVerifyResponse"
5520
+ "201":
5521
+ description: New user created and authenticated
5522
+ content:
5523
+ application/json:
5524
+ schema:
5525
+ $ref: "#/components/schemas/EmailOtpVerifyResponse"
5526
+ "400":
5527
+ description: Invalid or expired code
5528
+ "429":
5529
+ description: Rate limited
5530
+
5531
+ # ---------------------------------------------------------------------------
5532
+ # OAuth
5533
+ # ---------------------------------------------------------------------------
5534
+
5535
+ /v1/oauth/authorize:
5536
+ get:
5537
+ tags: [OAuth]
5538
+ summary: Get OAuth consent info
5539
+ description: |
5540
+ Returns information about the platform app requesting authorization so the
5541
+ UI can display a consent screen. Used by the 1Claw-hosted consent page.
5542
+ operationId: getOAuthConsent
5543
+ security:
5544
+ - BearerAuth: []
5545
+ parameters:
5546
+ - name: client_id
5547
+ in: query
5548
+ required: true
5549
+ schema: { type: string }
5550
+ description: Platform app slug
5551
+ - name: redirect_uri
5552
+ in: query
5553
+ required: true
5554
+ schema: { type: string, format: uri }
5555
+ - name: response_type
5556
+ in: query
5557
+ required: true
5558
+ schema: { type: string, enum: [code] }
5559
+ - name: scope
5560
+ in: query
5561
+ schema: { type: string }
5562
+ description: Space-delimited scopes (e.g. "openid email wallet")
5563
+ - name: state
5564
+ in: query
5565
+ schema: { type: string }
5566
+ - name: code_challenge
5567
+ in: query
5568
+ schema: { type: string }
5569
+ description: PKCE code challenge
5570
+ - name: code_challenge_method
5571
+ in: query
5572
+ schema: { type: string, enum: [S256, plain] }
5573
+ - name: nonce
5574
+ in: query
5575
+ schema: { type: string }
5576
+ description: OIDC nonce for ID token replay protection
5577
+ responses:
5578
+ "200":
5579
+ description: Consent screen data
5580
+ content:
5581
+ application/json:
5582
+ schema:
5583
+ $ref: "#/components/schemas/OAuthConsentResponse"
5584
+ "400":
5585
+ description: Invalid client_id, redirect_uri, or response_type
5586
+ post:
5587
+ tags: [OAuth]
5588
+ summary: Submit OAuth consent decision
5589
+ description: |
5590
+ The user approves or denies the authorization request. On approval, returns
5591
+ a redirect URL containing the authorization code. On denial, returns a
5592
+ redirect URL with an error parameter.
5593
+ operationId: submitOAuthConsent
5594
+ security:
5595
+ - BearerAuth: []
5596
+ requestBody:
5597
+ required: true
5598
+ content:
5599
+ application/json:
5600
+ schema:
5601
+ type: object
5602
+ required: [approve, client_id, redirect_uri]
5603
+ properties:
5604
+ approve: { type: boolean }
5605
+ client_id: { type: string }
5606
+ redirect_uri: { type: string, format: uri }
5607
+ scope: { type: string }
5608
+ state: { type: string }
5609
+ code_challenge: { type: string }
5610
+ code_challenge_method: { type: string, enum: [S256, plain] }
5611
+ nonce: { type: string }
5612
+ responses:
5613
+ "200":
5614
+ description: Redirect URL with authorization code or error
5615
+ content:
5616
+ application/json:
5617
+ schema:
5618
+ type: object
5619
+ required: [redirect_url]
5620
+ properties:
5621
+ redirect_url:
5622
+ type: string
5623
+ format: uri
5624
+ "400":
5625
+ description: Invalid request
5626
+
5627
+ /v1/oauth/token:
5628
+ post:
5629
+ tags: [OAuth]
5630
+ summary: Exchange authorization code for tokens
5631
+ description: |
5632
+ Standard OAuth 2.0 token endpoint. Exchanges an authorization code for an
5633
+ access token and optional OIDC ID token. Supports PKCE via `code_verifier`.
5634
+ operationId: exchangeOAuthToken
5635
+ security: []
5636
+ requestBody:
5637
+ required: true
5638
+ content:
5639
+ application/json:
5640
+ schema:
5641
+ type: object
5642
+ required: [grant_type, code, client_id, redirect_uri]
5643
+ properties:
5644
+ grant_type:
5645
+ type: string
5646
+ enum: [authorization_code]
5647
+ code: { type: string }
5648
+ client_id: { type: string }
5649
+ redirect_uri: { type: string, format: uri }
5650
+ code_verifier:
5651
+ type: string
5652
+ description: PKCE code verifier (required when code_challenge was used)
5653
+ responses:
5654
+ "200":
5655
+ description: Token response
5656
+ content:
5657
+ application/json:
5658
+ schema:
5659
+ $ref: "#/components/schemas/OAuthTokenResponse"
5660
+ "400":
5661
+ description: Invalid grant, code, or verifier
5662
+ "401":
5663
+ description: Invalid client credentials
5664
+
5665
+ /v1/oauth/userinfo:
5666
+ get:
5667
+ tags: [OAuth]
5668
+ summary: Get authenticated user info (OIDC UserInfo)
5669
+ description: |
5670
+ Standard OIDC UserInfo endpoint. Returns claims about the authenticated user
5671
+ based on the granted scopes.
5672
+ operationId: getOAuthUserInfo
5673
+ security:
5674
+ - BearerAuth: []
5675
+ responses:
5676
+ "200":
5677
+ description: User info
5678
+ content:
5679
+ application/json:
5680
+ schema:
5681
+ $ref: "#/components/schemas/OAuthUserInfoResponse"
5682
+ "401":
5683
+ $ref: "#/components/responses/Unauthorized"
5684
+
5280
5685
  # =============================================================================
5281
5686
  # COMPONENTS
5282
5687
  # =============================================================================
@@ -7163,7 +7568,7 @@ components:
7163
7568
  format: uuid
7164
7569
  api_key:
7165
7570
  type: string
7166
- description: Ephemeral bk_usr_ key (one-time display).
7571
+ description: Ephemeral bk_usr_ key. Present for human callers only; omitted for agent JWTs.
7167
7572
  wallet_id:
7168
7573
  type: string
7169
7574
  expires_at:
@@ -9453,3 +9858,161 @@ components:
9453
9858
  created_at:
9454
9859
  type: string
9455
9860
  format: date-time
9861
+
9862
+ # --- Email OTP ---
9863
+
9864
+ EmailOtpVerifyResponse:
9865
+ type: object
9866
+ required: [token, user_id, org_id, is_new_user, email]
9867
+ properties:
9868
+ token:
9869
+ type: string
9870
+ description: JWT access token
9871
+ user_id:
9872
+ type: string
9873
+ format: uuid
9874
+ org_id:
9875
+ type: string
9876
+ format: uuid
9877
+ is_new_user:
9878
+ type: boolean
9879
+ email:
9880
+ type: string
9881
+ format: email
9882
+ wallet_address:
9883
+ type: string
9884
+ nullable: true
9885
+ description: Ethereum address if auto_provision_chains included an EVM chain
9886
+
9887
+ # --- OAuth ---
9888
+
9889
+ OAuthConsentResponse:
9890
+ type: object
9891
+ required: [app_name, app_slug, scopes, redirect_uri, already_consented]
9892
+ properties:
9893
+ app_name:
9894
+ type: string
9895
+ app_slug:
9896
+ type: string
9897
+ app_logo_url:
9898
+ type: string
9899
+ format: uri
9900
+ nullable: true
9901
+ scopes:
9902
+ type: array
9903
+ items: { type: string }
9904
+ redirect_uri:
9905
+ type: string
9906
+ format: uri
9907
+ already_consented:
9908
+ type: boolean
9909
+
9910
+ OAuthTokenResponse:
9911
+ type: object
9912
+ required: [access_token, token_type, expires_in, scope]
9913
+ properties:
9914
+ access_token:
9915
+ type: string
9916
+ token_type:
9917
+ type: string
9918
+ enum: [Bearer]
9919
+ expires_in:
9920
+ type: integer
9921
+ description: Token lifetime in seconds
9922
+ id_token:
9923
+ type: string
9924
+ nullable: true
9925
+ description: OIDC ID token (when openid scope was granted)
9926
+ scope:
9927
+ type: string
9928
+
9929
+ OAuthUserInfoResponse:
9930
+ type: object
9931
+ required: [sub, email]
9932
+ properties:
9933
+ sub:
9934
+ type: string
9935
+ format: uuid
9936
+ email:
9937
+ type: string
9938
+ format: email
9939
+ name:
9940
+ type: string
9941
+ nullable: true
9942
+ wallet_address:
9943
+ type: string
9944
+ nullable: true
9945
+
9946
+ # --- Spend Policies ---
9947
+
9948
+ CreateSpendPolicyRequest:
9949
+ type: object
9950
+ properties:
9951
+ user_id:
9952
+ type: string
9953
+ format: uuid
9954
+ description: Scope to a specific user (app-level policies only)
9955
+ to_allowlist:
9956
+ type: array
9957
+ items: { type: string }
9958
+ description: Permitted destination addresses (empty = unrestricted)
9959
+ to_denylist:
9960
+ type: array
9961
+ items: { type: string }
9962
+ description: Blocked destination addresses
9963
+ max_value_per_tx_eth:
9964
+ type: string
9965
+ description: Maximum value per transaction in ETH (decimal string)
9966
+ daily_limit_eth:
9967
+ type: string
9968
+ description: Rolling 24h spend cap in ETH (decimal string)
9969
+ allowed_chains:
9970
+ type: array
9971
+ items: { type: string }
9972
+ description: Chains the user may transact on (empty = all enabled)
9973
+ allowed_tokens:
9974
+ type: array
9975
+ items: { type: string }
9976
+ description: Permitted ERC-20 token contract addresses
9977
+ max_transactions_per_day:
9978
+ type: integer
9979
+ description: Maximum number of transactions per 24h window
9980
+
9981
+ SpendPolicyResponse:
9982
+ type: object
9983
+ required: [id, platform_app_id, created_at]
9984
+ properties:
9985
+ id:
9986
+ type: string
9987
+ format: uuid
9988
+ platform_app_id:
9989
+ type: string
9990
+ format: uuid
9991
+ user_id:
9992
+ type: string
9993
+ format: uuid
9994
+ nullable: true
9995
+ to_allowlist:
9996
+ type: array
9997
+ items: { type: string }
9998
+ to_denylist:
9999
+ type: array
10000
+ items: { type: string }
10001
+ max_value_per_tx_eth:
10002
+ type: string
10003
+ nullable: true
10004
+ daily_limit_eth:
10005
+ type: string
10006
+ nullable: true
10007
+ allowed_chains:
10008
+ type: array
10009
+ items: { type: string }
10010
+ allowed_tokens:
10011
+ type: array
10012
+ items: { type: string }
10013
+ max_transactions_per_day:
10014
+ type: integer
10015
+ nullable: true
10016
+ created_at:
10017
+ type: string
10018
+ format: date-time
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1claw/openapi-spec",
3
- "version": "0.32.0",
3
+ "version": "0.33.0",
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": {