@ledewire/browser 0.8.1 → 0.9.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/README.md +31 -0
- package/dist/index.d.ts +1038 -33
- package/dist/index.js +125 -16
- package/dist/index.js.map +1 -1
- package/dist/ledewire.min.js +1 -1
- package/dist/ledewire.min.js.map +1 -1
- package/llms.txt +41 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -114,6 +114,11 @@ declare class BrowserAuthNamespace {
|
|
|
114
114
|
* Register a new buyer account with email and password.
|
|
115
115
|
* Tokens are stored automatically after successful signup.
|
|
116
116
|
*
|
|
117
|
+
* Pass `company_invitation_token` (from a Company invitation email) to sign
|
|
118
|
+
* up and join the Company in one step. If the token does not name a pending
|
|
119
|
+
* invitation addressed to this email, the account is still created, without
|
|
120
|
+
* a membership.
|
|
121
|
+
*
|
|
117
122
|
* @param body - Signup credentials and display name.
|
|
118
123
|
* @returns The authentication token response.
|
|
119
124
|
*/
|
|
@@ -216,8 +221,10 @@ declare class BrowserClient {
|
|
|
216
221
|
readonly content: BrowserContentNamespace;
|
|
217
222
|
/** Seller operations: API key login, content list/search/get */
|
|
218
223
|
readonly seller: BrowserSellerNamespace;
|
|
219
|
-
/** Authenticated buyer account: API
|
|
224
|
+
/** Authenticated buyer account: API keys, MCP keys, and the daily spend cap */
|
|
220
225
|
readonly user: UserNamespace;
|
|
226
|
+
/** Company membership, and Company administration: members, Machine users, wallet, reports */
|
|
227
|
+
readonly company: CompanyNamespace;
|
|
221
228
|
/* Excluded from this release type: __constructor */
|
|
222
229
|
}
|
|
223
230
|
|
|
@@ -541,7 +548,24 @@ declare class BrowserWalletNamespace {
|
|
|
541
548
|
* mid-acquisition can see why their balance is lower than their purchase
|
|
542
549
|
* history explains.
|
|
543
550
|
*
|
|
551
|
+
* **Company members:** a buyer with an open Company membership spends from the
|
|
552
|
+
* Company wallet and never sees its balance, so `balance_cents` and
|
|
553
|
+
* `spendable_cents` are `null`. `company_name` names the Company whose wallet
|
|
554
|
+
* pays, and `remaining_cents` is what the member may still spend today under
|
|
555
|
+
* their membership Spend cap. For anyone else, `company_name` is `null` and
|
|
556
|
+
* `remaining_cents` is their own cap's headroom (`null` when uncapped).
|
|
557
|
+
*
|
|
544
558
|
* @returns The current wallet balance in cents, including held funds detail.
|
|
559
|
+
*
|
|
560
|
+
* @example
|
|
561
|
+
* ```ts
|
|
562
|
+
* const wallet = await lw.wallet.balance()
|
|
563
|
+
* if (wallet.company_name !== null) {
|
|
564
|
+
* console.log(`${wallet.company_name} pays; ${wallet.remaining_cents}c left today`)
|
|
565
|
+
* } else {
|
|
566
|
+
* console.log(`Balance: ${wallet.balance_cents}c`)
|
|
567
|
+
* }
|
|
568
|
+
* ```
|
|
545
569
|
*/
|
|
546
570
|
balance(): Promise<WalletBalanceResponse>;
|
|
547
571
|
/**
|
|
@@ -563,14 +587,21 @@ declare class BrowserWalletNamespace {
|
|
|
563
587
|
*/
|
|
564
588
|
transactions(): Promise<WalletTransactionItem[]>;
|
|
565
589
|
/**
|
|
566
|
-
* Creates a payment session for funding the buyer's wallet.
|
|
590
|
+
* Creates a payment session for funding the buyer's personal wallet. A
|
|
591
|
+
* Company admin funds the Company wallet with
|
|
592
|
+
* `company.wallet.createPaymentSession()` instead.
|
|
567
593
|
*
|
|
568
594
|
* @param body - The amount and currency to fund.
|
|
569
595
|
* @returns Payment session details for use with the payment provider widget.
|
|
570
596
|
*/
|
|
571
597
|
createPaymentSession(body: WalletPaymentSessionRequest): Promise<WalletPaymentSessionResponse>;
|
|
572
598
|
/**
|
|
573
|
-
* Polls the status of a wallet funding payment session.
|
|
599
|
+
* Polls the status of a personal wallet funding payment session.
|
|
600
|
+
*
|
|
601
|
+
* `completed`, `failed` and `cancelled` are terminal. An ACH top-up can sit
|
|
602
|
+
* in `awaiting_verification` (bank microdeposits not yet confirmed) and then
|
|
603
|
+
* `processing` (the debit under way) for days before it completes.
|
|
604
|
+
* `balance_cents` is `null` for a Company member.
|
|
574
605
|
*
|
|
575
606
|
* @param sessionId - The session ID returned by `createPaymentSession`.
|
|
576
607
|
* @returns The current payment status.
|
|
@@ -643,6 +674,620 @@ export declare type CheckoutState = CheckoutStateResponse;
|
|
|
643
674
|
/** Full checkout state for a buyer/content pair, including auth and fund status. */
|
|
644
675
|
export declare type CheckoutStateResponse = components['schemas']['CheckoutStateResponse'];
|
|
645
676
|
|
|
677
|
+
/**
|
|
678
|
+
* A pending invitation to join a Company. Joining always waits for the invitee
|
|
679
|
+
* to accept, because it moves their spending onto the Company wallet. Never
|
|
680
|
+
* carries the acceptance token, which reaches only the invited address.
|
|
681
|
+
*/
|
|
682
|
+
export declare type CompanyInvitation = components['schemas']['CompanyInvitation'];
|
|
683
|
+
|
|
684
|
+
/** Request body for accepting a Company invitation. */
|
|
685
|
+
export declare type CompanyInvitationAcceptRequest = components['schemas']['CompanyInvitationAcceptRequest'];
|
|
686
|
+
|
|
687
|
+
/** The Company's pending invitations. */
|
|
688
|
+
export declare type CompanyInvitationList = components['schemas']['CompanyInvitationList'];
|
|
689
|
+
|
|
690
|
+
/** Request body for inviting someone to the Company. */
|
|
691
|
+
export declare type CompanyInvitationRequest = Omit<components['schemas']['CompanyInvitationRequest'], 'role'> & {
|
|
692
|
+
role?: CompanyRole;
|
|
693
|
+
};
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* Invite people to a Company, and accept an invitation.
|
|
697
|
+
*
|
|
698
|
+
* Nobody joins until they accept, because joining moves their spending onto
|
|
699
|
+
* the Company wallet. Every invitation emails a token that accepting requires,
|
|
700
|
+
* even for a buyer already signed in as the invited address. An existing buyer
|
|
701
|
+
* passes it to {@link accept}; a new address passes it to `auth.signup()` as
|
|
702
|
+
* `company_invitation_token`, which signs up and joins in one step.
|
|
703
|
+
*
|
|
704
|
+
* `list()` and `create()` are Company-admin only; `accept()` is for the invitee.
|
|
705
|
+
*
|
|
706
|
+
* Obtain via `client.company.invitations` — do not construct directly.
|
|
707
|
+
*
|
|
708
|
+
* @example
|
|
709
|
+
* ```ts
|
|
710
|
+
* // Admin: invite an analyst
|
|
711
|
+
* await client.company.invitations.create({ email: 'analyst@example.com' })
|
|
712
|
+
*
|
|
713
|
+
* // Invitee (already has an account): accept with the emailed token
|
|
714
|
+
* const membership = await client.company.invitations.accept({ token })
|
|
715
|
+
* ```
|
|
716
|
+
*/
|
|
717
|
+
declare class CompanyInvitationsNamespace {
|
|
718
|
+
private readonly http;
|
|
719
|
+
/* Excluded from this release type: __constructor */
|
|
720
|
+
/**
|
|
721
|
+
* Lists the Company's pending invitations. Company admins only.
|
|
722
|
+
*
|
|
723
|
+
* @returns The pending invitations.
|
|
724
|
+
* @throws {ForbiddenError} When the caller is not a Company admin.
|
|
725
|
+
* @throws {NotFoundError} When the caller belongs to no Company.
|
|
726
|
+
*/
|
|
727
|
+
list(): Promise<CompanyInvitationList>;
|
|
728
|
+
/**
|
|
729
|
+
* Invites someone to the Company and emails them the acceptance token.
|
|
730
|
+
* Company admins only. Inviting someone who belongs to another Company
|
|
731
|
+
* succeeds; their accept is refused until they leave it.
|
|
732
|
+
*
|
|
733
|
+
* @param body - The invitee's email, and their role (default `'member'`).
|
|
734
|
+
* @returns The invitation. It expires seven days after it is sent.
|
|
735
|
+
* @throws {ForbiddenError} When the caller is not a Company admin.
|
|
736
|
+
* @throws {LedewireError} With `statusCode === 409` when the address is
|
|
737
|
+
* already a member or already has a pending invitation.
|
|
738
|
+
*/
|
|
739
|
+
create(body: CompanyInvitationRequest): Promise<CompanyInvitation>;
|
|
740
|
+
/**
|
|
741
|
+
* Accepts an invitation, opening a membership with the invited role. The
|
|
742
|
+
* token must belong to an invitation addressed to one of the buyer's
|
|
743
|
+
* addresses.
|
|
744
|
+
*
|
|
745
|
+
* @param body - The token from the invitation email.
|
|
746
|
+
* @returns The new membership.
|
|
747
|
+
* @throws {NotFoundError} When no invitation with this token is addressed to
|
|
748
|
+
* this buyer.
|
|
749
|
+
* @throws {LedewireError} With `statusCode === 409` when already accepted, or
|
|
750
|
+
* when the buyer already belongs to a Company (leave it first); with
|
|
751
|
+
* `statusCode === 410` when the invitation has expired or was withdrawn.
|
|
752
|
+
*/
|
|
753
|
+
accept(body: CompanyInvitationAcceptRequest): Promise<CompanyMembership>;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* A Machine user: a Buyer with a name and no email, password or login, owned by
|
|
758
|
+
* a Company and joined as a non-admin member. It authenticates only with the
|
|
759
|
+
* Buyer keys and MCP API keys a Company admin issues it. Deactivation is
|
|
760
|
+
* permanent.
|
|
761
|
+
*/
|
|
762
|
+
export declare type CompanyMachineUser = components['schemas']['CompanyMachineUser'];
|
|
763
|
+
|
|
764
|
+
/**
|
|
765
|
+
* A Machine user's Buyer key (secret never included after creation). It logs in
|
|
766
|
+
* through `auth.loginWithBuyerApiKey()`; its limit is the Machine user's
|
|
767
|
+
* membership Spend cap.
|
|
768
|
+
*/
|
|
769
|
+
export declare type CompanyMachineUserBuyerKey = components['schemas']['CompanyMachineUserBuyerKey'];
|
|
770
|
+
|
|
771
|
+
/** Request body for creating a Machine user's Buyer key. */
|
|
772
|
+
export declare type CompanyMachineUserBuyerKeyCreateRequest = components['schemas']['CompanyMachineUserBuyerKeyRequest'];
|
|
773
|
+
|
|
774
|
+
/**
|
|
775
|
+
* Returned once when a Machine user's Buyer key is created. The `secret` is
|
|
776
|
+
* shown exactly once and cannot be retrieved again.
|
|
777
|
+
*/
|
|
778
|
+
export declare type CompanyMachineUserBuyerKeyCreateResponse = components['schemas']['CompanyMachineUserBuyerKeyCreateResponse'];
|
|
779
|
+
|
|
780
|
+
/** A Machine user's Buyer keys, oldest first. */
|
|
781
|
+
export declare type CompanyMachineUserBuyerKeyList = components['schemas']['CompanyMachineUserBuyerKeyList'];
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* Issue and revoke a Machine user's Buyer keys. Company admins only.
|
|
785
|
+
*
|
|
786
|
+
* A Machine user's Buyer key logs in through `auth.loginWithBuyerApiKey()` (or
|
|
787
|
+
* `createAgentClient()`), exactly like a buyer's own key. Its spending limit is
|
|
788
|
+
* the Machine user's membership Spend cap, so a key carries no
|
|
789
|
+
* `spending_limit_cents` of its own.
|
|
790
|
+
*
|
|
791
|
+
* **Secret handling:** `create()` returns the `secret` exactly once.
|
|
792
|
+
*
|
|
793
|
+
* Obtain via `client.company.machineUsers.buyerKeys` — do not construct directly.
|
|
794
|
+
*/
|
|
795
|
+
declare class CompanyMachineUserBuyerKeysNamespace {
|
|
796
|
+
private readonly http;
|
|
797
|
+
/* Excluded from this release type: __constructor */
|
|
798
|
+
/**
|
|
799
|
+
* Lists a Machine user's Buyer keys, oldest first. Secrets are never included.
|
|
800
|
+
*
|
|
801
|
+
* @param machineUserId - The Machine user id (`CompanyMachineUser.id`).
|
|
802
|
+
* @returns The keys.
|
|
803
|
+
* @throws {NotFoundError} When the Machine user is not in the caller's Company.
|
|
804
|
+
*/
|
|
805
|
+
list(machineUserId: string): Promise<CompanyMachineUserBuyerKeyList>;
|
|
806
|
+
/**
|
|
807
|
+
* Creates a Buyer key for a Machine user.
|
|
808
|
+
*
|
|
809
|
+
* @param machineUserId - The Machine user id (`CompanyMachineUser.id`).
|
|
810
|
+
* @param body - The key's name, unique among this Machine user's Buyer keys.
|
|
811
|
+
* @returns The key with its one-time `secret` — store it immediately.
|
|
812
|
+
* @throws {LedewireError} With `statusCode === 409` when the Machine user is
|
|
813
|
+
* deactivated; with `statusCode === 422` for a duplicate name.
|
|
814
|
+
*/
|
|
815
|
+
create(machineUserId: string, body: CompanyMachineUserBuyerKeyCreateRequest): Promise<CompanyMachineUserBuyerKeyCreateResponse>;
|
|
816
|
+
/**
|
|
817
|
+
* Revokes a Machine user's Buyer key.
|
|
818
|
+
*
|
|
819
|
+
* @param machineUserId - The Machine user id (`CompanyMachineUser.id`).
|
|
820
|
+
* @param id - The key id.
|
|
821
|
+
* @throws {NotFoundError} When there is no such Machine user in the caller's
|
|
822
|
+
* Company, or no such active key.
|
|
823
|
+
*/
|
|
824
|
+
revoke(machineUserId: string, id: string): Promise<void>;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
/** Request body for creating a Machine user. */
|
|
828
|
+
export declare type CompanyMachineUserCreateRequest = components['schemas']['CompanyMachineUserRequest'];
|
|
829
|
+
|
|
830
|
+
/** The Company's Machine users. */
|
|
831
|
+
export declare type CompanyMachineUserList = components['schemas']['CompanyMachineUserList'];
|
|
832
|
+
|
|
833
|
+
/**
|
|
834
|
+
* A Machine user's active MCP API key. Carries buyer scopes only
|
|
835
|
+
* (`mcp:search`, `mcp:purchase`), never a store, and does not expire.
|
|
836
|
+
*/
|
|
837
|
+
export declare type CompanyMachineUserMcpKey = components['schemas']['CompanyMachineUserMcpKey'];
|
|
838
|
+
|
|
839
|
+
/** Request body for creating a Machine user's MCP API key. */
|
|
840
|
+
export declare type CompanyMachineUserMcpKeyCreateRequest = components['schemas']['CompanyMachineUserMcpKeyRequest'];
|
|
841
|
+
|
|
842
|
+
/**
|
|
843
|
+
* Returned once when a Machine user's MCP API key is created. The `secret` is
|
|
844
|
+
* shown exactly once and cannot be retrieved again.
|
|
845
|
+
*/
|
|
846
|
+
export declare type CompanyMachineUserMcpKeyCreateResponse = components['schemas']['CompanyMachineUserMcpKeyCreateResponse'];
|
|
847
|
+
|
|
848
|
+
/** A Machine user's MCP API keys, oldest first. */
|
|
849
|
+
export declare type CompanyMachineUserMcpKeyList = components['schemas']['CompanyMachineUserMcpKeyList'];
|
|
850
|
+
|
|
851
|
+
/**
|
|
852
|
+
* Issue and revoke a Machine user's MCP API keys. Company admins only.
|
|
853
|
+
*
|
|
854
|
+
* A Machine user's MCP key carries buyer scopes only — `mcp:search` and
|
|
855
|
+
* `mcp:purchase` — never a store, and does not expire; revoke it instead. It is
|
|
856
|
+
* presented to the Ledewire MCP server as `Authorization: Bearer <key>:<secret>`.
|
|
857
|
+
*
|
|
858
|
+
* **Secret handling:** `create()` returns the `secret` exactly once.
|
|
859
|
+
*
|
|
860
|
+
* Obtain via `client.company.machineUsers.mcpKeys` — do not construct directly.
|
|
861
|
+
*/
|
|
862
|
+
declare class CompanyMachineUserMcpKeysNamespace {
|
|
863
|
+
private readonly http;
|
|
864
|
+
/* Excluded from this release type: __constructor */
|
|
865
|
+
/**
|
|
866
|
+
* Lists a Machine user's active MCP API keys, oldest first. Secrets are never
|
|
867
|
+
* included.
|
|
868
|
+
*
|
|
869
|
+
* @param machineUserId - The Machine user id (`CompanyMachineUser.id`).
|
|
870
|
+
* @returns The keys.
|
|
871
|
+
* @throws {NotFoundError} When the Machine user is not in the caller's Company.
|
|
872
|
+
*/
|
|
873
|
+
list(machineUserId: string): Promise<CompanyMachineUserMcpKeyList>;
|
|
874
|
+
/**
|
|
875
|
+
* Creates an MCP API key for a Machine user.
|
|
876
|
+
*
|
|
877
|
+
* @param machineUserId - The Machine user id (`CompanyMachineUser.id`).
|
|
878
|
+
* @param body - A label and at least one of `'mcp:search'`, `'mcp:purchase'`.
|
|
879
|
+
* Any other scope, or a `store_id`, is refused with `400`.
|
|
880
|
+
* @returns The key with its one-time `secret` — store it immediately.
|
|
881
|
+
* @throws {LedewireError} With `statusCode === 409` when the Machine user is
|
|
882
|
+
* deactivated; with `statusCode === 422` for a duplicate label.
|
|
883
|
+
*/
|
|
884
|
+
create(machineUserId: string, body: CompanyMachineUserMcpKeyCreateRequest): Promise<CompanyMachineUserMcpKeyCreateResponse>;
|
|
885
|
+
/**
|
|
886
|
+
* Revokes a Machine user's MCP API key.
|
|
887
|
+
*
|
|
888
|
+
* @param machineUserId - The Machine user id (`CompanyMachineUser.id`).
|
|
889
|
+
* @param id - The key id.
|
|
890
|
+
* @throws {NotFoundError} When there is no such Machine user in the caller's
|
|
891
|
+
* Company, or no such active key.
|
|
892
|
+
*/
|
|
893
|
+
revoke(machineUserId: string, id: string): Promise<void>;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
/**
|
|
897
|
+
* Manage the Company's Machine users. Company admins only.
|
|
898
|
+
*
|
|
899
|
+
* A Machine user is a Buyer with a name and no email, password or login — an
|
|
900
|
+
* identity for an autonomous agent that spends the Company's money. It joins at
|
|
901
|
+
* once as a non-admin member with the default daily Spend cap (change it with
|
|
902
|
+
* `company.members.update()`), and authenticates only with the keys an admin
|
|
903
|
+
* issues it through {@link buyerKeys} and {@link mcpKeys}. Every human-only flow
|
|
904
|
+
* (login, Google sign-in, password reset, accepting or leaving a membership)
|
|
905
|
+
* refuses it.
|
|
906
|
+
*
|
|
907
|
+
* Obtain via `client.company.machineUsers` — do not construct directly.
|
|
908
|
+
*
|
|
909
|
+
* @example
|
|
910
|
+
* ```ts
|
|
911
|
+
* const agentUser = await client.company.machineUsers.create({ name: 'research-agent' })
|
|
912
|
+
* const { key, secret } = await client.company.machineUsers.buyerKeys.create(agentUser.id, {
|
|
913
|
+
* name: 'production',
|
|
914
|
+
* })
|
|
915
|
+
* // Store immediately — the secret cannot be retrieved again
|
|
916
|
+
* await secretsManager.put('LEDEWIRE_AGENT_KEY', `${key}:${secret}`)
|
|
917
|
+
*
|
|
918
|
+
* // The agent then authenticates as the Machine user (server-side, @ledewire/node)
|
|
919
|
+
* const agent = createAgentClient({ key, secret })
|
|
920
|
+
* ```
|
|
921
|
+
*/
|
|
922
|
+
declare class CompanyMachineUsersNamespace {
|
|
923
|
+
private readonly http;
|
|
924
|
+
/** A Machine user's Buyer keys: list, create, revoke. */
|
|
925
|
+
readonly buyerKeys: CompanyMachineUserBuyerKeysNamespace;
|
|
926
|
+
/** A Machine user's MCP API keys: list, create, revoke. */
|
|
927
|
+
readonly mcpKeys: CompanyMachineUserMcpKeysNamespace;
|
|
928
|
+
/* Excluded from this release type: __constructor */
|
|
929
|
+
/**
|
|
930
|
+
* Lists the Company's Machine users, deactivated ones included
|
|
931
|
+
* (`deactivated_at` set).
|
|
932
|
+
*
|
|
933
|
+
* @returns The Machine users.
|
|
934
|
+
* @throws {ForbiddenError} When the caller is not a Company admin.
|
|
935
|
+
* @throws {NotFoundError} When the caller belongs to no Company.
|
|
936
|
+
*/
|
|
937
|
+
list(): Promise<CompanyMachineUserList>;
|
|
938
|
+
/**
|
|
939
|
+
* Creates a Machine user, joined at once as an active non-admin member.
|
|
940
|
+
*
|
|
941
|
+
* @param body - A name (at most 100 characters, unique among the Company's
|
|
942
|
+
* active Machine users) and an optional description.
|
|
943
|
+
* @returns The Machine user.
|
|
944
|
+
* @throws {LedewireError} With `statusCode === 409` when an active Machine
|
|
945
|
+
* user already has this name; with `statusCode === 422` when the name is
|
|
946
|
+
* blank or too long.
|
|
947
|
+
*/
|
|
948
|
+
create(body: CompanyMachineUserCreateRequest): Promise<CompanyMachineUser>;
|
|
949
|
+
/**
|
|
950
|
+
* Deactivates a Machine user, **permanently**. In one step this closes its
|
|
951
|
+
* membership, revokes every key it holds, and ends its sessions. It cannot be
|
|
952
|
+
* reactivated; create a new one, which may reuse the name.
|
|
953
|
+
*
|
|
954
|
+
* @param id - The Machine user id (`CompanyMachineUser.id`).
|
|
955
|
+
* @returns The deactivated Machine user.
|
|
956
|
+
* @throws {NotFoundError} When the Machine user is not in the caller's Company.
|
|
957
|
+
* @throws {LedewireError} With `statusCode === 409` when already deactivated.
|
|
958
|
+
*/
|
|
959
|
+
deactivate(id: string): Promise<CompanyMachineUser>;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
/**
|
|
963
|
+
* An open Company membership as a Company admin sees it. `id` is the membership
|
|
964
|
+
* id the `company.members` methods take — not the member's `user_id`.
|
|
965
|
+
*/
|
|
966
|
+
export declare type CompanyMember = components['schemas']['CompanyMember'];
|
|
967
|
+
|
|
968
|
+
/** The Company's open memberships. */
|
|
969
|
+
export declare type CompanyMemberList = components['schemas']['CompanyMemberList'];
|
|
970
|
+
|
|
971
|
+
/**
|
|
972
|
+
* The authenticated buyer's own open Company membership. Names the Company but
|
|
973
|
+
* never its balance: a member sees only what they may still spend.
|
|
974
|
+
*/
|
|
975
|
+
export declare type CompanyMembership = components['schemas']['CompanyMembership'];
|
|
976
|
+
|
|
977
|
+
/**
|
|
978
|
+
* Read or close the authenticated buyer's own Company membership.
|
|
979
|
+
*
|
|
980
|
+
* While a buyer holds an open membership, the Company wallet pays for their
|
|
981
|
+
* purchases and their own membership Spend cap limits them. They never see the
|
|
982
|
+
* Company balance: `wallet.balance()` reports `balance_cents: null` and a
|
|
983
|
+
* `remaining_cents` allowance instead, with `company_name` naming whose wallet
|
|
984
|
+
* pays.
|
|
985
|
+
*
|
|
986
|
+
* Obtain via `client.company.membership` — do not construct directly.
|
|
987
|
+
*
|
|
988
|
+
* @example
|
|
989
|
+
* ```ts
|
|
990
|
+
* try {
|
|
991
|
+
* const { company_name, role } = await client.company.membership.get()
|
|
992
|
+
* console.log(`Purchases are paid by ${company_name} (${role})`)
|
|
993
|
+
* } catch (err) {
|
|
994
|
+
* if (err instanceof NotFoundError) console.log('Not in a Company')
|
|
995
|
+
* else throw err
|
|
996
|
+
* }
|
|
997
|
+
* ```
|
|
998
|
+
*/
|
|
999
|
+
declare class CompanyMembershipNamespace {
|
|
1000
|
+
private readonly http;
|
|
1001
|
+
/* Excluded from this release type: __constructor */
|
|
1002
|
+
/**
|
|
1003
|
+
* Returns the authenticated buyer's open Company membership. Names the
|
|
1004
|
+
* Company, never its balance.
|
|
1005
|
+
*
|
|
1006
|
+
* @returns The membership.
|
|
1007
|
+
* @throws {NotFoundError} When the buyer belongs to no Company.
|
|
1008
|
+
*/
|
|
1009
|
+
get(): Promise<CompanyMembership>;
|
|
1010
|
+
/**
|
|
1011
|
+
* Leaves the Company. The buyer's purchases are paid from their personal
|
|
1012
|
+
* wallet again afterwards.
|
|
1013
|
+
*
|
|
1014
|
+
* @throws {NotFoundError} When the buyer belongs to no Company.
|
|
1015
|
+
* @throws {ForbiddenError} For a Machine user, which cannot leave — an admin
|
|
1016
|
+
* deactivates it instead.
|
|
1017
|
+
* @throws {LedewireError} With `statusCode === 422` when the buyer is the
|
|
1018
|
+
* Company's last admin.
|
|
1019
|
+
*/
|
|
1020
|
+
leave(): Promise<void>;
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
/**
|
|
1024
|
+
* Manage the Company's open memberships: list them, change a member's role or
|
|
1025
|
+
* daily Spend cap, and remove a member. Company admins only.
|
|
1026
|
+
*
|
|
1027
|
+
* Every method takes the **membership id** (`CompanyMember.id`), not the
|
|
1028
|
+
* member's `user_id`.
|
|
1029
|
+
*
|
|
1030
|
+
* A member's daily Spend cap is never `null` — Company members are never
|
|
1031
|
+
* uncapped. It defaults to 1000 cents ($10) on joining, is read in the
|
|
1032
|
+
* Company's timezone, and also binds bulk acquisitions.
|
|
1033
|
+
*
|
|
1034
|
+
* Obtain via `client.company.members` — do not construct directly.
|
|
1035
|
+
*
|
|
1036
|
+
* @example
|
|
1037
|
+
* ```ts
|
|
1038
|
+
* const { data: members } = await client.company.members.list()
|
|
1039
|
+
* const analyst = members.find((m) => m.email === 'analyst@example.com')
|
|
1040
|
+
* if (analyst) {
|
|
1041
|
+
* await client.company.members.update(analyst.id, { daily_spend_limit_cents: 5000 })
|
|
1042
|
+
* }
|
|
1043
|
+
* ```
|
|
1044
|
+
*/
|
|
1045
|
+
declare class CompanyMembersNamespace {
|
|
1046
|
+
private readonly http;
|
|
1047
|
+
/* Excluded from this release type: __constructor */
|
|
1048
|
+
/**
|
|
1049
|
+
* Lists the Company's open memberships, Machine users included
|
|
1050
|
+
* (`kind: 'machine'`, `email: null`).
|
|
1051
|
+
*
|
|
1052
|
+
* @returns The members.
|
|
1053
|
+
* @throws {ForbiddenError} When the caller is not a Company admin.
|
|
1054
|
+
* @throws {NotFoundError} When the caller belongs to no Company.
|
|
1055
|
+
*/
|
|
1056
|
+
list(): Promise<CompanyMemberList>;
|
|
1057
|
+
/**
|
|
1058
|
+
* Changes a member's role, daily Spend cap, or both. Any admin may set any
|
|
1059
|
+
* member's cap, their own included.
|
|
1060
|
+
*
|
|
1061
|
+
* @param id - The membership id (`CompanyMember.id`).
|
|
1062
|
+
* @param body - At least one of `role` and `daily_spend_limit_cents`.
|
|
1063
|
+
* @returns The updated member.
|
|
1064
|
+
* @throws {LedewireError} With `statusCode === 400` when neither field is
|
|
1065
|
+
* given or the cap is `null`/negative; with `statusCode === 422` for an
|
|
1066
|
+
* unknown role, or a change that would leave the Company with no admin.
|
|
1067
|
+
*/
|
|
1068
|
+
update(id: string, body: CompanyMemberUpdateRequest): Promise<CompanyMember>;
|
|
1069
|
+
/**
|
|
1070
|
+
* Removes a member, closing their membership. Their ledger accounts stay
|
|
1071
|
+
* with the Company. Removing a Machine user deactivates it permanently.
|
|
1072
|
+
*
|
|
1073
|
+
* @param id - The membership id (`CompanyMember.id`).
|
|
1074
|
+
* @throws {LedewireError} With `statusCode === 422` when it would leave the
|
|
1075
|
+
* Company with no admin.
|
|
1076
|
+
*/
|
|
1077
|
+
remove(id: string): Promise<void>;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
/**
|
|
1081
|
+
* Request body for changing a member's role or daily Spend cap — at least one
|
|
1082
|
+
* of the two. `daily_spend_limit_cents` cannot be `null`: a Company member is
|
|
1083
|
+
* never uncapped.
|
|
1084
|
+
*/
|
|
1085
|
+
export declare type CompanyMemberUpdateRequest = components['schemas']['CompanyMemberRoleRequest'];
|
|
1086
|
+
|
|
1087
|
+
/**
|
|
1088
|
+
* Company operations for the authenticated buyer.
|
|
1089
|
+
*
|
|
1090
|
+
* A Company is a shared wallet that pays for its members' purchases. Each
|
|
1091
|
+
* member spends under their own daily Spend cap, set by a Company admin, and
|
|
1092
|
+
* never sees the Company balance. Admins fund the wallet, manage members and
|
|
1093
|
+
* Machine users (agent identities with no login), and report on spend.
|
|
1094
|
+
*
|
|
1095
|
+
* `membership` and `invitations.accept()` are for any buyer; everything else is
|
|
1096
|
+
* Company-admin only and throws {@link ForbiddenError} for a plain member.
|
|
1097
|
+
*
|
|
1098
|
+
* Obtain via `client.company` — do not construct directly.
|
|
1099
|
+
*/
|
|
1100
|
+
declare class CompanyNamespace {
|
|
1101
|
+
/** The authenticated buyer's own membership: read it, or leave the Company. */
|
|
1102
|
+
readonly membership: CompanyMembershipNamespace;
|
|
1103
|
+
/** Invite people to the Company (admin), and accept an invitation (invitee). */
|
|
1104
|
+
readonly invitations: CompanyInvitationsNamespace;
|
|
1105
|
+
/** List members, change a member's role or daily Spend cap, remove a member (admin). */
|
|
1106
|
+
readonly members: CompanyMembersNamespace;
|
|
1107
|
+
/** Machine users and their Buyer keys and MCP API keys (admin). */
|
|
1108
|
+
readonly machineUsers: CompanyMachineUsersNamespace;
|
|
1109
|
+
/** Fund the Company wallet and list unsettled top-ups (admin). */
|
|
1110
|
+
readonly wallet: CompanyWalletNamespace;
|
|
1111
|
+
/** Everything the Company paid for, attributed to its members (admin). */
|
|
1112
|
+
readonly purchases: CompanyPurchasesNamespace;
|
|
1113
|
+
/** What each member has spent of the Company's money (admin). */
|
|
1114
|
+
readonly spend: CompanySpendNamespace;
|
|
1115
|
+
/* Excluded from this release type: __constructor */
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
/** A Company wallet top-up that has not settled yet. */
|
|
1119
|
+
export declare type CompanyPendingTopUp = components['schemas']['CompanyPendingTopUp'];
|
|
1120
|
+
|
|
1121
|
+
/** The Company's unsettled top-ups, newest first. */
|
|
1122
|
+
export declare type CompanyPendingTopUpList = components['schemas']['CompanyPendingTopUpList'];
|
|
1123
|
+
|
|
1124
|
+
/**
|
|
1125
|
+
* One thing the Company paid for — a purchase or a Bulk acquisition drawn on
|
|
1126
|
+
* the Company wallet — attributed to the membership that bought it.
|
|
1127
|
+
*/
|
|
1128
|
+
export declare type CompanyPurchase = components['schemas']['CompanyPurchase'];
|
|
1129
|
+
|
|
1130
|
+
/** Everything the Company paid for, newest first, paginated. */
|
|
1131
|
+
export declare type CompanyPurchaseList = components['schemas']['CompanyPurchaseList'];
|
|
1132
|
+
|
|
1133
|
+
/**
|
|
1134
|
+
* The membership a {@link CompanyPurchase} or spend row is attributed to.
|
|
1135
|
+
* Recorded at payment time, so it still names a member who has since left.
|
|
1136
|
+
*/
|
|
1137
|
+
export declare type CompanyPurchaseMember = components['schemas']['CompanyPurchaseMember'];
|
|
1138
|
+
|
|
1139
|
+
/**
|
|
1140
|
+
* Everything the Company paid for. Company admins only.
|
|
1141
|
+
*
|
|
1142
|
+
* Obtain via `client.company.purchases` — do not construct directly.
|
|
1143
|
+
*
|
|
1144
|
+
* @example
|
|
1145
|
+
* ```ts
|
|
1146
|
+
* const { data, pagination } = await client.company.purchases.list({
|
|
1147
|
+
* kind: 'bulk_acquisition',
|
|
1148
|
+
* from: '2026-09-01',
|
|
1149
|
+
* to: '2026-09-30',
|
|
1150
|
+
* })
|
|
1151
|
+
* ```
|
|
1152
|
+
*/
|
|
1153
|
+
declare class CompanyPurchasesNamespace {
|
|
1154
|
+
private readonly http;
|
|
1155
|
+
/* Excluded from this release type: __constructor */
|
|
1156
|
+
/**
|
|
1157
|
+
* Lists every purchase and Bulk acquisition drawn on the Company wallet,
|
|
1158
|
+
* newest first, each attributed to the membership that bought it — including
|
|
1159
|
+
* members who have since left. A Bulk acquisition's per-work purchases are
|
|
1160
|
+
* not listed separately, and a failed purchase is not listed.
|
|
1161
|
+
*
|
|
1162
|
+
* A Bulk acquisition's corpus and manifest are reachable by a Company admin
|
|
1163
|
+
* through `acquisitions.getCorpus()` / `downloadCorpus()` / `getManifest()`
|
|
1164
|
+
* with its `id`.
|
|
1165
|
+
*
|
|
1166
|
+
* @param params - Optional filters (`member`, `from`, `to`, `kind`) and pagination.
|
|
1167
|
+
* @returns A paginated list of Company purchases.
|
|
1168
|
+
* @throws {ForbiddenError} When the caller is not a Company admin.
|
|
1169
|
+
* @throws {LedewireError} With `statusCode === 400` for an invalid filter.
|
|
1170
|
+
*/
|
|
1171
|
+
list(params?: CompanyPurchasesParams): Promise<CompanyPurchaseList>;
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
/** Query parameters accepted by `GET /v1/company/purchases`. */
|
|
1175
|
+
export declare interface CompanyPurchasesParams extends CompanyReportFilters {
|
|
1176
|
+
/** Only purchases, or only Bulk acquisitions. Both by default. */
|
|
1177
|
+
kind?: CompanyPurchase['kind'];
|
|
1178
|
+
/** Page number (1-based). Defaults to 1. */
|
|
1179
|
+
page?: number;
|
|
1180
|
+
/** Items per page. Maximum 100. Defaults to 25. */
|
|
1181
|
+
per_page?: number;
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
/**
|
|
1185
|
+
* Filters shared by the Company purchase and spend reports. `from`/`to` are
|
|
1186
|
+
* inclusive `YYYY-MM-DD` days read in the Company's timezone.
|
|
1187
|
+
*/
|
|
1188
|
+
export declare interface CompanyReportFilters {
|
|
1189
|
+
/** A membership id (`member.id`), open or closed. */
|
|
1190
|
+
member?: string;
|
|
1191
|
+
/** The first day to include, `YYYY-MM-DD`, in the Company's timezone. */
|
|
1192
|
+
from?: string;
|
|
1193
|
+
/** The last day to include, `YYYY-MM-DD`, in the Company's timezone. */
|
|
1194
|
+
to?: string;
|
|
1195
|
+
[key: string]: string | number | undefined;
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
/** A Company membership role. Only an `admin` can manage the Company. */
|
|
1199
|
+
export declare type CompanyRole = CompanyMembership['role'];
|
|
1200
|
+
|
|
1201
|
+
/** What each membership, open or closed, has spent of the Company's money. */
|
|
1202
|
+
export declare type CompanySpendList = components['schemas']['CompanySpendList'];
|
|
1203
|
+
|
|
1204
|
+
/**
|
|
1205
|
+
* What each member has spent of the Company's money. Company admins only.
|
|
1206
|
+
*
|
|
1207
|
+
* Obtain via `client.company.spend` — do not construct directly.
|
|
1208
|
+
*
|
|
1209
|
+
* @example
|
|
1210
|
+
* ```ts
|
|
1211
|
+
* const { data } = await client.company.spend.list({ from: '2026-09-01' })
|
|
1212
|
+
* for (const { member, spend_cents } of data) console.log(member.name, spend_cents)
|
|
1213
|
+
* ```
|
|
1214
|
+
*/
|
|
1215
|
+
declare class CompanySpendNamespace {
|
|
1216
|
+
private readonly http;
|
|
1217
|
+
/* Excluded from this release type: __constructor */
|
|
1218
|
+
/**
|
|
1219
|
+
* Returns one row per membership the Company has had, open or closed, oldest
|
|
1220
|
+
* first, with what each spent in the range — lifetime when neither `from`
|
|
1221
|
+
* nor `to` is given.
|
|
1222
|
+
*
|
|
1223
|
+
* `spend_cents` is net of refunds and counts what a Bulk acquisition
|
|
1224
|
+
* captured; a live hold does not count until it captures, so it can be lower
|
|
1225
|
+
* than the same member's `amount_cents` in `company.purchases.list()`.
|
|
1226
|
+
*
|
|
1227
|
+
* @param params - Optional `member`, `from`, and `to` filters.
|
|
1228
|
+
* @returns Spend per membership.
|
|
1229
|
+
* @throws {ForbiddenError} When the caller is not a Company admin.
|
|
1230
|
+
* @throws {LedewireError} With `statusCode === 400` for an invalid filter.
|
|
1231
|
+
*/
|
|
1232
|
+
list(params?: CompanySpendParams): Promise<CompanySpendList>;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
/**
|
|
1236
|
+
* Query parameters accepted by `GET /v1/company/spend`. Lifetime spend when
|
|
1237
|
+
* neither `from` nor `to` is given.
|
|
1238
|
+
*/
|
|
1239
|
+
export declare type CompanySpendParams = CompanyReportFilters;
|
|
1240
|
+
|
|
1241
|
+
/**
|
|
1242
|
+
* Fund the Company wallet and track top-ups that have not settled. Company
|
|
1243
|
+
* admins only.
|
|
1244
|
+
*
|
|
1245
|
+
* Members never see the Company balance and cannot fund the Company wallet; a
|
|
1246
|
+
* member who runs short is refused at purchase and must ask an admin.
|
|
1247
|
+
*
|
|
1248
|
+
* Obtain via `client.company.wallet` — do not construct directly.
|
|
1249
|
+
*
|
|
1250
|
+
* @example
|
|
1251
|
+
* ```ts
|
|
1252
|
+
* const session = await client.company.wallet.createPaymentSession({ amount_cents: 50000 })
|
|
1253
|
+
* // Confirm with session.client_secret in the payment widget, as for a personal top-up.
|
|
1254
|
+
*
|
|
1255
|
+
* const { data: pending } = await client.company.wallet.listPendingTopUps()
|
|
1256
|
+
* ```
|
|
1257
|
+
*/
|
|
1258
|
+
declare class CompanyWalletNamespace {
|
|
1259
|
+
private readonly http;
|
|
1260
|
+
/* Excluded from this release type: __constructor */
|
|
1261
|
+
/**
|
|
1262
|
+
* Starts a Company wallet top-up, by card or ACH (`us_bank_account`). Confirm
|
|
1263
|
+
* it client-side with the returned `client_secret`, as for a personal top-up.
|
|
1264
|
+
*
|
|
1265
|
+
* The top-up is spendable only once it settles: a card usually settles at
|
|
1266
|
+
* once, an ACH debit after about four business days. Starting another top-up
|
|
1267
|
+
* never cancels an ACH debit already processing. Track it with
|
|
1268
|
+
* {@link listPendingTopUps}: a top-up drops off that list once it settles.
|
|
1269
|
+
* (`wallet.getPaymentStatus()` covers personal top-ups only and does not
|
|
1270
|
+
* find a Company session.)
|
|
1271
|
+
*
|
|
1272
|
+
* @param body - The amount to fund.
|
|
1273
|
+
* @returns Payment session details for the payment provider widget.
|
|
1274
|
+
* @throws {ForbiddenError} When the caller is not a Company admin.
|
|
1275
|
+
* @throws {LedewireError} With `statusCode === 402` when the payment provider
|
|
1276
|
+
* refused to create the session.
|
|
1277
|
+
*/
|
|
1278
|
+
createPaymentSession(body: WalletPaymentSessionRequest): Promise<WalletPaymentSessionResponse>;
|
|
1279
|
+
/**
|
|
1280
|
+
* Lists the Company's top-ups that are not yet spendable, newest first:
|
|
1281
|
+
* `pending` (a session not yet paid), `awaiting_verification` (a bank account
|
|
1282
|
+
* whose microdeposits are not yet confirmed, up to ten days), and
|
|
1283
|
+
* `processing` (an ACH debit under way).
|
|
1284
|
+
*
|
|
1285
|
+
* @returns The pending top-ups.
|
|
1286
|
+
* @throws {ForbiddenError} When the caller is not a Company admin.
|
|
1287
|
+
*/
|
|
1288
|
+
listPendingTopUps(): Promise<CompanyPendingTopUpList>;
|
|
1289
|
+
}
|
|
1290
|
+
|
|
646
1291
|
declare interface components {
|
|
647
1292
|
schemas: {
|
|
648
1293
|
/** @description Platform-level public configuration. No authentication required. */
|
|
@@ -653,10 +1298,19 @@ declare interface components {
|
|
|
653
1298
|
ContentAccessInfo: {
|
|
654
1299
|
user_id: string | null;
|
|
655
1300
|
has_purchased: boolean;
|
|
1301
|
+
/** @description Whether the buyer can afford the price. For a Company member, whether their Remaining covers it — the Company balance is never consulted, and a shortfall there surfaces only as the refusal at purchase. */
|
|
656
1302
|
has_sufficient_funds: boolean;
|
|
657
|
-
|
|
658
|
-
|
|
1303
|
+
/** @description The buyer's wallet balance. null for a Company member, who never sees the Company balance. */
|
|
1304
|
+
wallet_balance_cents: number | null;
|
|
1305
|
+
/**
|
|
1306
|
+
* @description Never fund_wallet for a Company member, who cannot fund the Company wallet.
|
|
1307
|
+
* @enum {string}
|
|
1308
|
+
*/
|
|
659
1309
|
next_required_action: 'authenticate' | 'fund_wallet' | 'purchase';
|
|
1310
|
+
/** @description Spend cap minus spend so far today — for a Company member, their membership's cap. null when the buyer is uncapped or unauthenticated. */
|
|
1311
|
+
remaining_cents: number | null;
|
|
1312
|
+
/** @description The buyer's Company, if they hold an open membership. */
|
|
1313
|
+
company_name: string | null;
|
|
660
1314
|
};
|
|
661
1315
|
AuthenticationResponse: {
|
|
662
1316
|
/** @enum {string} */
|
|
@@ -666,7 +1320,7 @@ declare interface components {
|
|
|
666
1320
|
refresh_token: string;
|
|
667
1321
|
/**
|
|
668
1322
|
* Format: date-time
|
|
669
|
-
* @description When the
|
|
1323
|
+
* @description When the access token expires, about 30 minutes after it was issued. Equal to the token's `exp` claim. Refresh before then.
|
|
670
1324
|
*/
|
|
671
1325
|
expires_at: string;
|
|
672
1326
|
};
|
|
@@ -676,7 +1330,10 @@ declare interface components {
|
|
|
676
1330
|
token_type: 'Bearer';
|
|
677
1331
|
access_token: string;
|
|
678
1332
|
refresh_token: string;
|
|
679
|
-
/**
|
|
1333
|
+
/**
|
|
1334
|
+
* Format: date-time
|
|
1335
|
+
* @description When the access token expires, about 30 minutes after it was issued. Equal to the token's `exp` claim. Refresh before then.
|
|
1336
|
+
*/
|
|
680
1337
|
expires_at: string;
|
|
681
1338
|
/** @description Stores the authenticated user can manage, for store-selection on the client. */
|
|
682
1339
|
stores: components['schemas']['MerchantLoginStore'][];
|
|
@@ -731,15 +1388,19 @@ declare interface components {
|
|
|
731
1388
|
message: string;
|
|
732
1389
|
/**
|
|
733
1390
|
* @description Machine-readable reason, present on refusals that carry one. Branch on this rather than on `message`, which is prose and may be reworded. `retrieval_failed` is transient and worth retrying; `not_licensable` means report it undelivered; `price_drifted` means re-quote; `client_error` is ours to fix and must never be retried unchanged; `insufficient_funds` is cleared by funding the wallet and `daily_spend_cap_reached` deliberately is not.
|
|
1391
|
+
*
|
|
1392
|
+
* On the Bulk acquisition steps: `exclusions_unacknowledged` means post the acknowledgement first; `quote_not_ready` means keep polling a `pending` quote or re-quote a `failed` one (`quote_state` says which); `quote_expired` and `quote_in_progress` mean re-quote, and wait for the re-quote already running; `invalid_acquisition_state` means re-read the acquisition (`status` and `expected_status` are alongside); `nothing_to_hold` means every work was excluded and a different selection is needed; `run_not_started` means the run could not be queued, so nothing was held and the same authorization is safe to retry.
|
|
734
1393
|
* @enum {string}
|
|
735
1394
|
*/
|
|
736
|
-
type?: 'retrieval_failed' | 'not_licensable' | 'price_drifted' | 'client_error' | 'insufficient_funds' | 'daily_spend_cap_reached';
|
|
1395
|
+
type?: 'retrieval_failed' | 'not_licensable' | 'price_drifted' | 'client_error' | 'insufficient_funds' | 'daily_spend_cap_reached' | 'exclusions_unacknowledged' | 'invalid_acquisition_state' | 'quote_not_ready' | 'nothing_to_hold' | 'quote_expired' | 'quote_in_progress' | 'run_not_started';
|
|
737
1396
|
};
|
|
738
1397
|
};
|
|
739
1398
|
AuthSignupRequest: {
|
|
740
1399
|
email: string;
|
|
741
1400
|
password: string;
|
|
742
1401
|
name: string;
|
|
1402
|
+
/** @description The token from a Company invitation email. When it names a pending invitation addressed to this email, signup also accepts it and the new buyer joins the Company. Otherwise the account is created without a membership. */
|
|
1403
|
+
company_invitation_token?: string;
|
|
743
1404
|
};
|
|
744
1405
|
AuthLoginEmailRequest: {
|
|
745
1406
|
email?: string;
|
|
@@ -793,7 +1454,7 @@ declare interface components {
|
|
|
793
1454
|
/** @description 64-char hex authentication secret. Store immediately — shown once only. */
|
|
794
1455
|
secret: string;
|
|
795
1456
|
};
|
|
796
|
-
/** @description The authenticated buyer's daily spend cap, read against the current spend window. The cap governs every wallet debit the buyer makes — MCP, REST, or the web payment gate — and spend is derived from completed purchases, so a refund returns allowance. cap_cents, spent_cents, remaining_cents and resets_at are spelled exactly as they are in DailySpendCapReachedError, so a refusal and this resource describe the same numbers. */
|
|
1457
|
+
/** @description The authenticated buyer's daily spend cap, read against the current spend window. The cap governs every wallet debit the buyer makes — MCP, REST, or the web payment gate — and spend is derived from completed purchases, so a refund returns allowance. cap_cents, spent_cents, remaining_cents and resets_at are spelled exactly as they are in DailySpendCapReachedError, so a refusal and this resource describe the same numbers. For a Company member it is the membership's cap, read-only, in the Company's timezone, counting only spend paid through the membership; company_name names the Company. The Company balance never appears here. */
|
|
797
1458
|
UserSpendCap: {
|
|
798
1459
|
/** @description The daily spend cap in cents. null means uncapped. */
|
|
799
1460
|
cap_cents: number | null;
|
|
@@ -808,8 +1469,259 @@ declare interface components {
|
|
|
808
1469
|
* @description The instant the current spend window rolls, in UTC.
|
|
809
1470
|
*/
|
|
810
1471
|
resets_at: string;
|
|
811
|
-
/** @description Whether this buyer's bulk acquisitions are exempt from the cap. When true, spent_cents and remaining_cents describe ordinary spend only — an authorized bulk acquisition does not consume them — so a client presenting remaining_cents must say which number it is. */
|
|
1472
|
+
/** @description Whether this buyer's bulk acquisitions are exempt from the cap. When true, spent_cents and remaining_cents describe ordinary spend only — an authorized bulk acquisition does not consume them — so a client presenting remaining_cents must say which number it is. Always false for a Company member, whose cap binds bulk acquisitions too. */
|
|
812
1473
|
bulk_exempt: boolean;
|
|
1474
|
+
/** @description The Company whose cap this is, for a buyer with an open Company membership; null otherwise. A member sees the Company's name, never its balance. */
|
|
1475
|
+
company_name: string | null;
|
|
1476
|
+
};
|
|
1477
|
+
/** @description A pending invitation to join a Company. Joining always waits for the invitee to accept, because it moves their Agents' spending onto the Company wallet. Never carries the signup token, which reaches only the invited address. */
|
|
1478
|
+
CompanyInvitation: {
|
|
1479
|
+
/** Format: uuid */
|
|
1480
|
+
id: string;
|
|
1481
|
+
/** Format: uuid */
|
|
1482
|
+
company_id: string;
|
|
1483
|
+
company_name: string;
|
|
1484
|
+
/** @description The invited address, lowercased. */
|
|
1485
|
+
email: string;
|
|
1486
|
+
/** @enum {string} */
|
|
1487
|
+
role: 'admin' | 'member';
|
|
1488
|
+
/** Format: date-time */
|
|
1489
|
+
invited_at: string;
|
|
1490
|
+
/**
|
|
1491
|
+
* Format: date-time
|
|
1492
|
+
* @description Seven days after it was sent. An expired invitation cannot be accepted.
|
|
1493
|
+
*/
|
|
1494
|
+
expires_at: string;
|
|
1495
|
+
};
|
|
1496
|
+
CompanyInvitationList: {
|
|
1497
|
+
data: components['schemas']['CompanyInvitation'][];
|
|
1498
|
+
};
|
|
1499
|
+
CompanyInvitationRequest: {
|
|
1500
|
+
email: string;
|
|
1501
|
+
/**
|
|
1502
|
+
* @default member
|
|
1503
|
+
* @enum {string}
|
|
1504
|
+
*/
|
|
1505
|
+
role: 'admin' | 'member';
|
|
1506
|
+
};
|
|
1507
|
+
/** @description An open membership as a Company admin sees it. */
|
|
1508
|
+
CompanyMember: {
|
|
1509
|
+
/**
|
|
1510
|
+
* Format: uuid
|
|
1511
|
+
* @description The membership id, used by the members/{id} routes.
|
|
1512
|
+
*/
|
|
1513
|
+
id: string;
|
|
1514
|
+
/** Format: uuid */
|
|
1515
|
+
user_id: string;
|
|
1516
|
+
name: string;
|
|
1517
|
+
/** @description Null for a Machine user, which has no email address. */
|
|
1518
|
+
email: string | null;
|
|
1519
|
+
/**
|
|
1520
|
+
* @description A machine member is a Machine user: it cannot be made an admin, and removing it deactivates it permanently.
|
|
1521
|
+
* @enum {string}
|
|
1522
|
+
*/
|
|
1523
|
+
kind: 'human' | 'machine';
|
|
1524
|
+
/** @enum {string} */
|
|
1525
|
+
role: 'admin' | 'member';
|
|
1526
|
+
/** Format: date-time */
|
|
1527
|
+
joined_at: string;
|
|
1528
|
+
/** @description The member's daily Spend cap, read in the Company's timezone. Never null: a member is never uncapped. Defaults to 1000 ($10) on joining, and again on rejoining. */
|
|
1529
|
+
daily_spend_limit_cents: number;
|
|
1530
|
+
};
|
|
1531
|
+
/** @description One thing the Company paid for, as a Company admin sees it: a purchase or a Bulk acquisition drawn on the Company wallet, attributed to the member who bought it. */
|
|
1532
|
+
CompanyPurchase: {
|
|
1533
|
+
/** @enum {string} */
|
|
1534
|
+
kind: 'purchase' | 'bulk_acquisition';
|
|
1535
|
+
/**
|
|
1536
|
+
* Format: uuid
|
|
1537
|
+
* @description The purchase id, or the acquisition id for a Bulk acquisition.
|
|
1538
|
+
*/
|
|
1539
|
+
id: string;
|
|
1540
|
+
member: components['schemas']['CompanyPurchaseMember'];
|
|
1541
|
+
/** @description The purchase's or the acquisition's own status. */
|
|
1542
|
+
status: string;
|
|
1543
|
+
/** @description A purchase's price. A Bulk acquisition's captured amount once it has settled, failed or been cancelled, and the amount still held while it is authorized or acquiring — so while a Hold is live this is more than the member's `spend_cents`, which counts only what was captured. */
|
|
1544
|
+
amount_cents: number;
|
|
1545
|
+
/**
|
|
1546
|
+
* Format: date-time
|
|
1547
|
+
* @description When the purchase was made, or when the Bulk acquisition was authorized — the moment it counts against the member's Spend window.
|
|
1548
|
+
*/
|
|
1549
|
+
occurred_at: string;
|
|
1550
|
+
};
|
|
1551
|
+
/** @description The membership that paid. Recorded when it was paid, so it still names the member after they leave; a person who left and rejoined appears under each membership. */
|
|
1552
|
+
CompanyPurchaseMember: {
|
|
1553
|
+
/**
|
|
1554
|
+
* Format: uuid
|
|
1555
|
+
* @description The membership id, which the `member` filter takes.
|
|
1556
|
+
*/
|
|
1557
|
+
id: string;
|
|
1558
|
+
/** Format: uuid */
|
|
1559
|
+
user_id: string;
|
|
1560
|
+
name: string;
|
|
1561
|
+
/** @enum {string} */
|
|
1562
|
+
kind: 'human' | 'machine';
|
|
1563
|
+
/**
|
|
1564
|
+
* Format: date-time
|
|
1565
|
+
* @description When the membership closed, or null while it is open.
|
|
1566
|
+
*/
|
|
1567
|
+
left_at: string | null;
|
|
1568
|
+
};
|
|
1569
|
+
CompanyPurchaseList: {
|
|
1570
|
+
data: components['schemas']['CompanyPurchase'][];
|
|
1571
|
+
pagination: components['schemas']['PaginationMeta'];
|
|
1572
|
+
};
|
|
1573
|
+
CompanySpendList: {
|
|
1574
|
+
/** @description Every membership the Company has had, open or closed, oldest first. */
|
|
1575
|
+
data: {
|
|
1576
|
+
member: components['schemas']['CompanyPurchaseMember'];
|
|
1577
|
+
/** @description What the member has spent of the Company's money in the range, net of refunds, read from the member's own ledger account. A Bulk acquisition counts what it captured; a live Hold does not count until it captures. */
|
|
1578
|
+
spend_cents: number;
|
|
1579
|
+
}[];
|
|
1580
|
+
};
|
|
1581
|
+
/** @description A Machine user as a Company admin sees it: a Buyer with a name and no email, password or login, created as an active non-admin member. Deactivation is permanent. */
|
|
1582
|
+
CompanyMachineUser: {
|
|
1583
|
+
/**
|
|
1584
|
+
* Format: uuid
|
|
1585
|
+
* @description The Machine user id, used by the machine-users/{id} routes.
|
|
1586
|
+
*/
|
|
1587
|
+
id: string;
|
|
1588
|
+
/**
|
|
1589
|
+
* Format: uuid
|
|
1590
|
+
* @description Its Buyer id, which attribution and history name it by.
|
|
1591
|
+
*/
|
|
1592
|
+
user_id: string;
|
|
1593
|
+
/** @description Unique among the Company's active Machine users; a deactivated one's may be reused. */
|
|
1594
|
+
name: string;
|
|
1595
|
+
description: string | null;
|
|
1596
|
+
/** Format: uuid */
|
|
1597
|
+
created_by_user_id: string | null;
|
|
1598
|
+
/** Format: date-time */
|
|
1599
|
+
created_at: string;
|
|
1600
|
+
/** Format: date-time */
|
|
1601
|
+
deactivated_at: string | null;
|
|
1602
|
+
};
|
|
1603
|
+
CompanyMachineUserList: {
|
|
1604
|
+
data: components['schemas']['CompanyMachineUser'][];
|
|
1605
|
+
};
|
|
1606
|
+
CompanyMachineUserRequest: {
|
|
1607
|
+
name: string;
|
|
1608
|
+
description?: string | null;
|
|
1609
|
+
};
|
|
1610
|
+
/** @description A Machine user's Buyer key as a Company admin sees it. It logs in through POST /v1/auth/login/buyer-api-key. Its limit is the Machine user's membership Spend cap. */
|
|
1611
|
+
CompanyMachineUserBuyerKey: {
|
|
1612
|
+
/** Format: uuid */
|
|
1613
|
+
id: string;
|
|
1614
|
+
name: string;
|
|
1615
|
+
/** @description Structured public identifier (e.g. bktst_abc123) */
|
|
1616
|
+
key: string;
|
|
1617
|
+
/**
|
|
1618
|
+
* Format: uuid
|
|
1619
|
+
* @description The Company admin who created it.
|
|
1620
|
+
*/
|
|
1621
|
+
created_by_user_id: string | null;
|
|
1622
|
+
/** Format: date-time */
|
|
1623
|
+
last_used_at: string | null;
|
|
1624
|
+
/** Format: date-time */
|
|
1625
|
+
created_at: string;
|
|
1626
|
+
};
|
|
1627
|
+
/** @description Returned once only at creation. The secret is not stored and cannot be retrieved again. */
|
|
1628
|
+
CompanyMachineUserBuyerKeyCreateResponse: components['schemas']['CompanyMachineUserBuyerKey'] & {
|
|
1629
|
+
/** @description 64-char hex authentication secret. Store immediately — shown once only. */
|
|
1630
|
+
secret: string;
|
|
1631
|
+
};
|
|
1632
|
+
CompanyMachineUserBuyerKeyList: {
|
|
1633
|
+
data: components['schemas']['CompanyMachineUserBuyerKey'][];
|
|
1634
|
+
};
|
|
1635
|
+
/** @description spending_limit_cents is refused with 400: the Machine user's membership Spend cap is its limit. */
|
|
1636
|
+
CompanyMachineUserBuyerKeyRequest: {
|
|
1637
|
+
/** @description Unique among this Machine user's Buyer keys. */
|
|
1638
|
+
name: string;
|
|
1639
|
+
};
|
|
1640
|
+
/** @description A Machine user's active MCP API Key as a Company admin sees it. Presented as a `key:secret` Bearer token. It carries buyer Scopes only, never a Store, and does not expire; revoke it instead. */
|
|
1641
|
+
CompanyMachineUserMcpKey: {
|
|
1642
|
+
/** Format: uuid */
|
|
1643
|
+
id: string;
|
|
1644
|
+
label: string;
|
|
1645
|
+
key: string;
|
|
1646
|
+
scopes: ('mcp:search' | 'mcp:purchase')[];
|
|
1647
|
+
/**
|
|
1648
|
+
* Format: uuid
|
|
1649
|
+
* @description The Company admin who created it.
|
|
1650
|
+
*/
|
|
1651
|
+
created_by_user_id: string | null;
|
|
1652
|
+
/**
|
|
1653
|
+
* Format: date-time
|
|
1654
|
+
* @description Always null for a key an admin created.
|
|
1655
|
+
*/
|
|
1656
|
+
expires_at: string | null;
|
|
1657
|
+
/** Format: date-time */
|
|
1658
|
+
last_used_at: string | null;
|
|
1659
|
+
/** Format: date-time */
|
|
1660
|
+
created_at: string;
|
|
1661
|
+
};
|
|
1662
|
+
/** @description Returned once only at creation. The secret cannot be retrieved again. */
|
|
1663
|
+
CompanyMachineUserMcpKeyCreateResponse: components['schemas']['CompanyMachineUserMcpKey'] & {
|
|
1664
|
+
/** @description Authentication secret. Store immediately — shown once only. */
|
|
1665
|
+
secret: string;
|
|
1666
|
+
};
|
|
1667
|
+
CompanyMachineUserMcpKeyList: {
|
|
1668
|
+
data: components['schemas']['CompanyMachineUserMcpKey'][];
|
|
1669
|
+
};
|
|
1670
|
+
/** @description Any Scope other than mcp:search and mcp:purchase, or a store_id, is refused with 400. */
|
|
1671
|
+
CompanyMachineUserMcpKeyRequest: {
|
|
1672
|
+
label: string;
|
|
1673
|
+
scopes: ('mcp:search' | 'mcp:purchase')[];
|
|
1674
|
+
};
|
|
1675
|
+
CompanyMemberList: {
|
|
1676
|
+
data: components['schemas']['CompanyMember'][];
|
|
1677
|
+
};
|
|
1678
|
+
/** @description A Company wallet top-up that has not yet settled, as a Company admin sees it. */
|
|
1679
|
+
CompanyPendingTopUp: {
|
|
1680
|
+
/** Format: uuid */
|
|
1681
|
+
id: string;
|
|
1682
|
+
/** @description The payment session id returned when the top-up was started. */
|
|
1683
|
+
session_id: string | null;
|
|
1684
|
+
amount_cents: number;
|
|
1685
|
+
/** @enum {string} */
|
|
1686
|
+
status: 'pending' | 'awaiting_verification' | 'processing';
|
|
1687
|
+
/**
|
|
1688
|
+
* Format: uuid
|
|
1689
|
+
* @description The admin who started the top-up.
|
|
1690
|
+
*/
|
|
1691
|
+
initiated_by_user_id: string;
|
|
1692
|
+
/** Format: date-time */
|
|
1693
|
+
created_at: string;
|
|
1694
|
+
/**
|
|
1695
|
+
* Format: date
|
|
1696
|
+
* @description The payment provider's estimate of when an ACH debit lands. Not guaranteed, and null until the provider can determine it, and always for a card.
|
|
1697
|
+
*/
|
|
1698
|
+
expected_debit_date: string | null;
|
|
1699
|
+
};
|
|
1700
|
+
CompanyPendingTopUpList: {
|
|
1701
|
+
data: components['schemas']['CompanyPendingTopUp'][];
|
|
1702
|
+
};
|
|
1703
|
+
CompanyInvitationAcceptRequest: {
|
|
1704
|
+
/** @description The token from the invitation email. */
|
|
1705
|
+
token: string;
|
|
1706
|
+
};
|
|
1707
|
+
/** @description At least one of role and daily_spend_limit_cents. */
|
|
1708
|
+
CompanyMemberRoleRequest: {
|
|
1709
|
+
/** @enum {string} */
|
|
1710
|
+
role?: 'admin' | 'member';
|
|
1711
|
+
/** @description The member's daily Spend cap in cents. Any admin may set any member's, their own included. null is refused — a member is never uncapped. Writes an AuditEvent. */
|
|
1712
|
+
daily_spend_limit_cents?: number;
|
|
1713
|
+
};
|
|
1714
|
+
/** @description The authenticated buyer's own open Company membership. Names the Company but never its balance. */
|
|
1715
|
+
CompanyMembership: {
|
|
1716
|
+
/** Format: uuid */
|
|
1717
|
+
id: string;
|
|
1718
|
+
/** Format: uuid */
|
|
1719
|
+
company_id: string;
|
|
1720
|
+
company_name: string;
|
|
1721
|
+
/** @enum {string} */
|
|
1722
|
+
role: 'admin' | 'member';
|
|
1723
|
+
/** Format: date-time */
|
|
1724
|
+
joined_at: string;
|
|
813
1725
|
};
|
|
814
1726
|
/** @description Sets the buyer's cap. The field is required and nullable: null is how a buyer becomes uncapped, and an omitted field is treated as a client error rather than as a request to be uncapped. A cap below spend already made in the current window is accepted — it simply leaves remaining_cents at zero until the window rolls. Zero is a valid cap and refuses every priced purchase. */
|
|
815
1727
|
UserSpendCapUpdateRequest: {
|
|
@@ -828,9 +1740,9 @@ declare interface components {
|
|
|
828
1740
|
* @description Scopes the key to a specific store. User must be an owner or author of that store.
|
|
829
1741
|
*/
|
|
830
1742
|
store_id?: string | null;
|
|
831
|
-
/** @description Grants access to seller content management tools. Defaults to false. */
|
|
1743
|
+
/** @description Grants access to seller content management tools. Defaults to false. Requires a `store_id` for which the user is an owner or author; otherwise the request is refused with 403. Re-checked on every use, so a key stops working if the holder loses the role. */
|
|
832
1744
|
can_manage_content?: boolean;
|
|
833
|
-
/** @description Grants access to seller analytics tools. Defaults to false. */
|
|
1745
|
+
/** @description Grants access to seller analytics tools. Defaults to false. Requires a `store_id` for which the user is an owner or author; an author's analytics cover only their own content. Otherwise refused with 403, and re-checked on every use. */
|
|
834
1746
|
can_read_analytics?: boolean;
|
|
835
1747
|
};
|
|
836
1748
|
/** @description Returned once only at creation. The secret cannot be retrieved again. */
|
|
@@ -891,7 +1803,7 @@ declare interface components {
|
|
|
891
1803
|
/** @description Academic citation count from source metadata. Null for non-academic content or unknown values. */
|
|
892
1804
|
citation_count: number | null;
|
|
893
1805
|
};
|
|
894
|
-
/** @description Content returned to a store team member
|
|
1806
|
+
/** @description Content returned without a purchase to a store team member reading their own store's content — any of it for an owner, only what they wrote for an author. */
|
|
895
1807
|
McpSellerContent: components['schemas']['McpContentSearchResult'] & {
|
|
896
1808
|
/** @description Article body. Present when content_type is `markdown` or inline `html`. */
|
|
897
1809
|
content_body?: string | null;
|
|
@@ -960,8 +1872,12 @@ declare interface components {
|
|
|
960
1872
|
} | null;
|
|
961
1873
|
};
|
|
962
1874
|
McpGetWalletBalanceResult: {
|
|
963
|
-
/** @description Current wallet balance in cents for the authenticated MCP key owner. */
|
|
964
|
-
wallet_balance_cents: number;
|
|
1875
|
+
/** @description Current wallet balance in cents for the authenticated MCP key owner. null for a Company member, who never sees the Company balance; read remaining_cents instead. */
|
|
1876
|
+
wallet_balance_cents: number | null;
|
|
1877
|
+
/** @description Spend cap minus spend so far today — for a Company member, their membership's cap, never reduced by the Company balance. null when uncapped. */
|
|
1878
|
+
remaining_cents: number | null;
|
|
1879
|
+
/** @description The Company whose wallet pays, for a member; null otherwise. */
|
|
1880
|
+
company_name: string | null;
|
|
965
1881
|
};
|
|
966
1882
|
McpRegisterResult: {
|
|
967
1883
|
/** @description The API key identifier (not secret). */
|
|
@@ -976,8 +1892,12 @@ declare interface components {
|
|
|
976
1892
|
content: components['schemas']['McpContentSearchResult'];
|
|
977
1893
|
/** @description Whether the authenticated user has a completed purchase for this content. */
|
|
978
1894
|
has_purchased: boolean;
|
|
979
|
-
/** @description Current wallet balance in cents for the authenticated MCP key owner. */
|
|
980
|
-
wallet_balance_cents: number;
|
|
1895
|
+
/** @description Current wallet balance in cents for the authenticated MCP key owner. null for a Company member, who never sees the Company balance. */
|
|
1896
|
+
wallet_balance_cents: number | null;
|
|
1897
|
+
/** @description Spend cap minus spend so far today; a member's membership cap. null when uncapped. */
|
|
1898
|
+
remaining_cents: number | null;
|
|
1899
|
+
/** @description The Company whose wallet pays, for a member; null otherwise. */
|
|
1900
|
+
company_name: string | null;
|
|
981
1901
|
};
|
|
982
1902
|
McpListPurchasesResult: {
|
|
983
1903
|
/** @description Receipts, newest first, one per purchase and never collapsed — a Buyer may hold several purchases of one work, each at the price in force when it was made. These were `McpFullContent` until #939, which meant this endpoint returned the body of every article the Buyer had ever bought. */
|
|
@@ -987,7 +1907,7 @@ declare interface components {
|
|
|
987
1907
|
offset: number;
|
|
988
1908
|
limit: number;
|
|
989
1909
|
};
|
|
990
|
-
/** @description Returned as structuredContent when a get_content payment attempt fails due to insufficient wallet balance. Always accompanied by isError: true. */
|
|
1910
|
+
/** @description Returned as structuredContent when a get_content payment attempt fails due to insufficient wallet balance. Always accompanied by isError: true. A Company member instead receives McpCompanyInsufficientFundsError, with the same error code. */
|
|
991
1911
|
McpInsufficientFundsError: {
|
|
992
1912
|
/** @enum {string} */
|
|
993
1913
|
error: 'insufficient_funds';
|
|
@@ -1003,6 +1923,14 @@ declare interface components {
|
|
|
1003
1923
|
*/
|
|
1004
1924
|
funding_url: string;
|
|
1005
1925
|
};
|
|
1926
|
+
/** @description A Company member's get_content payment the Company wallet cannot cover. Always accompanied by isError: true. Same error code as McpInsufficientFundsError, but no balance, shortfall or funding_url: a member never sees the Company balance and cannot fund the Company wallet. The remedy is to ask a Company admin. */
|
|
1927
|
+
McpCompanyInsufficientFundsError: {
|
|
1928
|
+
/** @enum {string} */
|
|
1929
|
+
error: 'insufficient_funds';
|
|
1930
|
+
/** @description Price of the content in cents. */
|
|
1931
|
+
required_cents: number;
|
|
1932
|
+
message: string;
|
|
1933
|
+
};
|
|
1006
1934
|
/** @description Returned as structuredContent when a get_content call is refused because the buyer's daily spend cap would be exceeded. Always accompanied by isError: true. Deliberately carries no funding_url — adding money to the wallet cannot raise a cap, and a payload resembling McpInsufficientFundsError would send agents to the wrong remedy. The cap resets at resets_at; until then the only remedies are raising the cap or waiting. */
|
|
1007
1935
|
McpDailySpendCapReachedError: {
|
|
1008
1936
|
/** @enum {string} */
|
|
@@ -1018,8 +1946,10 @@ declare interface components {
|
|
|
1018
1946
|
* @description The instant the current spend window rolls, in UTC. One calendar day boundary in the buyer's own timezone.
|
|
1019
1947
|
*/
|
|
1020
1948
|
resets_at: string;
|
|
1021
|
-
/** @description Whether this buyer's bulk acquisitions are exempt from the cap. When true, spent_cents and remaining_cents describe ordinary spend only — an authorized bulk acquisition does not consume them — so a client presenting remaining_cents must say which number it is. */
|
|
1949
|
+
/** @description Whether this buyer's bulk acquisitions are exempt from the cap. When true, spent_cents and remaining_cents describe ordinary spend only — an authorized bulk acquisition does not consume them — so a client presenting remaining_cents must say which number it is. Always false for a Company member, whose cap binds bulk acquisitions too. */
|
|
1022
1950
|
bulk_exempt: boolean;
|
|
1951
|
+
/** @description The remedy in words. A Company member is told to ask a Company admin, who sets their cap; anyone else, that the daily cap is reached. */
|
|
1952
|
+
message?: string;
|
|
1023
1953
|
};
|
|
1024
1954
|
/** @description The REST and x402 web-gate form of the same refusal, returned with HTTP 402 Payment Required by POST /v1/purchases and GET /v1/x402/contents/{id}. Carries the same fields as McpDailySpendCapReachedError alongside the standard error envelope, and the same absence of a funding URL. `error.type` is the machine-readable discriminator. */
|
|
1025
1955
|
DailySpendCapReachedError: {
|
|
@@ -1043,6 +1973,8 @@ declare interface components {
|
|
|
1043
1973
|
resets_at: string;
|
|
1044
1974
|
/** @description Whether this buyer's bulk acquisitions are exempt from the cap. When true, spent_cents and remaining_cents describe ordinary spend only. */
|
|
1045
1975
|
bulk_exempt: boolean;
|
|
1976
|
+
/** @description The remedy in words. A Company member is told to ask a Company admin, who sets their cap; anyone else, that the daily cap is reached. */
|
|
1977
|
+
message?: string;
|
|
1046
1978
|
};
|
|
1047
1979
|
/** @description Returned by the fund_wallet tool. Contains the buyer portal wallet URL. Open this link in a browser to add funds using the Ledewire wallet funding page. */
|
|
1048
1980
|
McpFundWalletResult: {
|
|
@@ -1272,13 +2204,13 @@ declare interface components {
|
|
|
1272
2204
|
[key: string]: unknown;
|
|
1273
2205
|
};
|
|
1274
2206
|
};
|
|
1275
|
-
/** @description The buyer's wallet. balance_cents and spendable_cents are the same number and always will be — balance_cents has always meant "what you can spend", and money committed to a bulk acquisition is a hold, which moves it out of the wallet rather than annotating it. held_cents and holds exist so a buyer mid-acquisition can see why their balance is lower than their purchase history explains. */
|
|
2207
|
+
/** @description The buyer's wallet. balance_cents and spendable_cents are the same number and always will be — balance_cents has always meant "what you can spend", and money committed to a bulk acquisition is a hold, which moves it out of the wallet rather than annotating it. held_cents and holds exist so a buyer mid-acquisition can see why their balance is lower than their purchase history explains. For a Company member the balances are null — a member never sees the Company balance — and remaining_cents and company_name say what they may still spend and whose wallet pays. */
|
|
1276
2208
|
WalletBalanceResponse: {
|
|
1277
|
-
/** @description Spendable balance in cents. Excludes funds held against a bulk acquisition. */
|
|
1278
|
-
balance_cents: number;
|
|
1279
|
-
/** @description The same figure as balance_cents, named in the vocabulary holds require. */
|
|
1280
|
-
spendable_cents: number;
|
|
1281
|
-
/** @description Total
|
|
2209
|
+
/** @description Spendable balance in cents. Excludes held funds — those held against a bulk acquisition, and a brokered purchase's price while its content is being retrieved. */
|
|
2210
|
+
balance_cents: number | null;
|
|
2211
|
+
/** @description The same figure as balance_cents, named in the vocabulary holds require. null for a Company member. */
|
|
2212
|
+
spendable_cents: number | null;
|
|
2213
|
+
/** @description Total held and not yet spent or released. Includes, for the few seconds its content is being retrieved, the price of a brokered purchase in progress, which has no entry in holds. */
|
|
1282
2214
|
held_cents: number;
|
|
1283
2215
|
/** @description One entry per bulk acquisition currently holding funds. Empty when none is. */
|
|
1284
2216
|
holds: {
|
|
@@ -1292,6 +2224,10 @@ declare interface components {
|
|
|
1292
2224
|
*/
|
|
1293
2225
|
authorized_at: string;
|
|
1294
2226
|
}[];
|
|
2227
|
+
/** @description Spend cap minus spend so far today — for a Company member, their membership's cap, never reduced by the Company balance. null when uncapped. */
|
|
2228
|
+
remaining_cents: number | null;
|
|
2229
|
+
/** @description The Company whose wallet pays, for a member; null otherwise. */
|
|
2230
|
+
company_name: string | null;
|
|
1295
2231
|
};
|
|
1296
2232
|
WalletTransactionItem: {
|
|
1297
2233
|
/** @description ID of the transaction entry (matches the source record) */
|
|
@@ -1879,10 +2815,11 @@ declare interface components {
|
|
|
1879
2815
|
};
|
|
1880
2816
|
WalletPaymentStatusResponse: {
|
|
1881
2817
|
/** @enum {string} */
|
|
1882
|
-
status: 'pending' | 'completed' | 'failed';
|
|
2818
|
+
status: 'pending' | 'awaiting_verification' | 'processing' | 'completed' | 'failed' | 'cancelled';
|
|
1883
2819
|
/** Format: date-time */
|
|
1884
2820
|
updated_at: string;
|
|
1885
|
-
|
|
2821
|
+
/** @description The wallet balance. null for a Company member, as on GET /v1/wallet/balance. */
|
|
2822
|
+
balance_cents: number | null;
|
|
1886
2823
|
};
|
|
1887
2824
|
SalesSummaryResponse: {
|
|
1888
2825
|
/** @description Amount in cents */
|
|
@@ -2010,7 +2947,7 @@ declare interface components {
|
|
|
2010
2947
|
*/
|
|
2011
2948
|
line_state: 'pending' | 'firm' | 'estimated' | 'excluded';
|
|
2012
2949
|
/**
|
|
2013
|
-
* @description Present only on an excluded line. `excluded_rate_unavailable` is the one transient reason.
|
|
2950
|
+
* @description Present only on an excluded line. `excluded_rate_unavailable` is the one transient reason. `excluded_free_not_supported` is retired — a work published at zero is now included at no cost — and appears only on lines quoted before that; a re-quote prices them back in.
|
|
2014
2951
|
* @enum {string|null}
|
|
2015
2952
|
*/
|
|
2016
2953
|
exclusion_reason?: 'excluded_malformed' | 'excluded_duplicate' | 'excluded_no_rate' | 'excluded_free_not_supported' | 'excluded_not_deliverable' | 'excluded_insufficient_rights' | 'excluded_above_price_ceiling' | 'excluded_rate_unavailable' | null;
|
|
@@ -2049,6 +2986,28 @@ declare interface components {
|
|
|
2049
2986
|
domains: string[];
|
|
2050
2987
|
/** @description Whether works from this publication can come back in a Bulk acquisition's corpus — true when it publishes a `FULL_USE` rate. */
|
|
2051
2988
|
bulk_licensable: boolean;
|
|
2989
|
+
/** @description The oldest date we have swept this publication back to, when that was true as of, and where we looked. Coverage is stated this way and never as a percentage. Null means "no horizon established yet" — it is not a horizon of zero, and is never sent as an object of nulls. */
|
|
2990
|
+
coverage_horizon: {
|
|
2991
|
+
/**
|
|
2992
|
+
* Format: date-time
|
|
2993
|
+
* @description The oldest date swept back to.
|
|
2994
|
+
* @example 2019-03-01T00:00:00Z
|
|
2995
|
+
*/
|
|
2996
|
+
horizon_at: string;
|
|
2997
|
+
/**
|
|
2998
|
+
* Format: date-time
|
|
2999
|
+
* @description When the sweep behind the horizon began. The Broker adds works behind a horizon after the fact, so the horizon holds only of the catalog as it stood at this time.
|
|
3000
|
+
* @example 2026-09-27T04:30:00Z
|
|
3001
|
+
*/
|
|
3002
|
+
as_of: string;
|
|
3003
|
+
/**
|
|
3004
|
+
* @description Where the sweep looked — today always the Broker's catalog.
|
|
3005
|
+
* @example [
|
|
3006
|
+
* "catalog"
|
|
3007
|
+
* ]
|
|
3008
|
+
*/
|
|
3009
|
+
sources: string[];
|
|
3010
|
+
} | null;
|
|
2052
3011
|
};
|
|
2053
3012
|
/** @description Every Publication the Broker reports as ready to license, paginated. */
|
|
2054
3013
|
PublicationListResponse: {
|
|
@@ -2108,7 +3067,7 @@ declare interface components {
|
|
|
2108
3067
|
*/
|
|
2109
3068
|
status: 'quoted' | 'authorized' | 'acquiring' | 'settled' | 'cancelled' | 'failed';
|
|
2110
3069
|
/**
|
|
2111
|
-
* @description Whether the Selection has been priced. Pricing is asynchronous — resolving rates for 10,000 works is ~200 upstream batch calls under undocumented limits — so a submitted Selection comes back `pending` and the client polls this.
|
|
3070
|
+
* @description Whether the Selection has been priced. Pricing is asynchronous — resolving rates for 10,000 works is ~200 upstream batch calls under undocumented limits — so a submitted Selection comes back `pending` and the client polls this. Stop polling once `status` leaves `quoted`: a quote cancelled while still being priced stays `pending`.
|
|
2112
3071
|
* @enum {string}
|
|
2113
3072
|
*/
|
|
2114
3073
|
quote_state: 'pending' | 'ready' | 'failed';
|
|
@@ -2138,6 +3097,8 @@ declare interface components {
|
|
|
2138
3097
|
/** @description Quoted and not yet reached. What a resumed run will attempt. */
|
|
2139
3098
|
outstanding: number;
|
|
2140
3099
|
};
|
|
3100
|
+
/** @description Seconds to wait before polling again, also sent as `Retry-After`. Present only while there is something to wait for — `quote_state` is `pending` on a `quoted` acquisition, or `status` is `authorized` or `acquiring` — and absent otherwise, so a client can poll for as long as the field is there. Grows with the size of the Selection, from 2 seconds to at most 60. */
|
|
3101
|
+
poll_after_seconds?: number;
|
|
2141
3102
|
/** Format: date-time */
|
|
2142
3103
|
created_at: string;
|
|
2143
3104
|
};
|
|
@@ -2174,10 +3135,12 @@ declare interface components {
|
|
|
2174
3135
|
* A corpus is a rendering of Purchases the Buyer already holds, not an entitlement of its own, which is what makes everything about it cheap: it can be discarded and rebuilt, and rebuilding grants nothing that was not already granted. So a blob past its 30-day retention answers `rebuild_required` at 200 rather than 404 or 410 — those would tell the Buyer something was lost, and nothing was.
|
|
2175
3136
|
*
|
|
2176
3137
|
* `rebuild_required` covers "never assembled" as well as "expired", on purpose: from the Buyer's side they are one situation — there is no file, ask for one — and splitting them would put our bookkeeping into their contract.
|
|
3138
|
+
*
|
|
3139
|
+
* **Assembly starts by itself when the acquisition settles** with at least one work delivered, so a client polls the acquisition until `settled` and then polls this until `ready` — there is nothing to ask for in between. `POST` is for a corpus that has expired or failed. An acquisition that delivered nothing has nothing to render and reads `rebuild_required`.
|
|
2177
3140
|
*/
|
|
2178
3141
|
CorpusResponse: {
|
|
2179
3142
|
/**
|
|
2180
|
-
* @description `ready` is downloadable now. `assembling` means a run is in flight and `pending` that one is queued — poll either. `rebuild_required` means ask for it again, with `POST /v1/acquisitions/{id}/corpus
|
|
3143
|
+
* @description `ready` is downloadable now. `assembling` means a run is in flight and `pending` that one is queued — poll either. `rebuild_required` means ask for it again, with `POST /v1/acquisitions/{id}/corpus`, and is also what a run abandoned mid-assembly (a worker that died) reads as once it has gone two hours without progress. `failed` carries a reason; a POST retries one that failed transiently, and leaves one that failed because our records disagree with the signed manifest as it is.
|
|
2181
3144
|
* @enum {string}
|
|
2182
3145
|
*/
|
|
2183
3146
|
state: 'pending' | 'assembling' | 'ready' | 'rebuild_required' | 'failed';
|
|
@@ -2195,6 +3158,8 @@ declare interface components {
|
|
|
2195
3158
|
expires_at?: string | null;
|
|
2196
3159
|
/** @description Why assembly broke. Present only when `state` is `failed`. */
|
|
2197
3160
|
failure_reason?: string | null;
|
|
3161
|
+
/** @description Seconds to wait before polling again, also sent as `Retry-After`. Present only while `state` is `pending` or `assembling`; `ready`, `failed` and `rebuild_required` carry neither, since nothing changes until the Buyer acts. Grows with the number of works the corpus renders, from 2 seconds to at most 60. */
|
|
3162
|
+
poll_after_seconds?: number;
|
|
2198
3163
|
/**
|
|
2199
3164
|
* @description Where to fetch the archive, relative to this API, and null in every state but `ready`.
|
|
2200
3165
|
*
|
|
@@ -2391,7 +3356,10 @@ declare interface components {
|
|
|
2391
3356
|
responses: never;
|
|
2392
3357
|
parameters: never;
|
|
2393
3358
|
requestBodies: never;
|
|
2394
|
-
headers:
|
|
3359
|
+
headers: {
|
|
3360
|
+
/** @description Seconds to wait before polling again, sent only while a bulk step is still in progress — a quote being priced, a run in flight, a corpus queued or assembling — and equal to the body's `poll_after_seconds`. Absent once there is nothing left to wait for. Sized from the selection: at least 2 and at most 60. */
|
|
3361
|
+
PollRetryAfter: number;
|
|
3362
|
+
};
|
|
2395
3363
|
pathItems: never;
|
|
2396
3364
|
}
|
|
2397
3365
|
|
|
@@ -2423,6 +3391,19 @@ export declare type DailySpendCapReachedErrorBody = components['schemas']['Daily
|
|
|
2423
3391
|
* - `insufficient_funds` — cleared by funding the wallet.
|
|
2424
3392
|
* - `daily_spend_cap_reached` — deliberately **not** cleared by funding the wallet; see
|
|
2425
3393
|
* {@link SpendCapReachedError}.
|
|
3394
|
+
*
|
|
3395
|
+
* On the bulk acquisition steps:
|
|
3396
|
+
*
|
|
3397
|
+
* - `exclusions_unacknowledged` — call `acquisitions.acknowledgeExclusions()` first.
|
|
3398
|
+
* - `quote_not_ready` — keep polling a `pending` quote, or re-quote a `failed` one
|
|
3399
|
+
* (`quote_state` says which).
|
|
3400
|
+
* - `quote_expired` — re-quote.
|
|
3401
|
+
* - `quote_in_progress` — wait for the re-quote already running.
|
|
3402
|
+
* - `invalid_acquisition_state` — re-read the acquisition; `status` and
|
|
3403
|
+
* `expected_status` arrive in `LedewireError.details`.
|
|
3404
|
+
* - `nothing_to_hold` — every work was excluded; a different Selection is needed.
|
|
3405
|
+
* - `run_not_started` — the run could not be queued, so nothing was held and the same
|
|
3406
|
+
* authorization is safe to retry.
|
|
2426
3407
|
*/
|
|
2427
3408
|
export declare type ErrorType = NonNullable<components['schemas']['ErrorResponse']['error']['type']>;
|
|
2428
3409
|
|
|
@@ -3063,6 +4044,8 @@ declare class UserApiKeysNamespace {
|
|
|
3063
4044
|
*
|
|
3064
4045
|
* @param body - Name and optional spend ceiling for the new key.
|
|
3065
4046
|
* @returns The new key's public identifier and one-time secret.
|
|
4047
|
+
* @throws {ForbiddenError} When the caller is a Machine user, whose keys its
|
|
4048
|
+
* Company's admins manage through `company.machineUsers.buyerKeys`.
|
|
3066
4049
|
*
|
|
3067
4050
|
* @example
|
|
3068
4051
|
* ```ts
|
|
@@ -3082,6 +4065,7 @@ declare class UserApiKeysNamespace {
|
|
|
3082
4065
|
* token refresh. Revocation takes effect immediately.
|
|
3083
4066
|
*
|
|
3084
4067
|
* @param id - UUID of the API key to revoke.
|
|
4068
|
+
* @throws {ForbiddenError} When the caller is a Machine user.
|
|
3085
4069
|
*/
|
|
3086
4070
|
revoke(id: string): Promise<void>;
|
|
3087
4071
|
}
|
|
@@ -3141,6 +4125,12 @@ declare class UserMcpKeysNamespace {
|
|
|
3141
4125
|
*
|
|
3142
4126
|
* @param body - Label and scopes for the new key.
|
|
3143
4127
|
* @returns The new key's public identifier, scopes, and one-time secret.
|
|
4128
|
+
* @throws {ForbiddenError} When a seller-tier scope or `store_id` names a store
|
|
4129
|
+
* the user is not an owner or author of (plain store members cannot hold a
|
|
4130
|
+
* store-scoped key), or when the caller is a Machine user, whose keys its
|
|
4131
|
+
* Company's admins manage through `company.machineUsers.mcpKeys`. Seller-tier
|
|
4132
|
+
* scopes are re-checked on every use, so a key stops working if its holder
|
|
4133
|
+
* loses the role.
|
|
3144
4134
|
*
|
|
3145
4135
|
* @example
|
|
3146
4136
|
* ```ts
|
|
@@ -3159,6 +4149,7 @@ declare class UserMcpKeysNamespace {
|
|
|
3159
4149
|
* desired scopes — scopes cannot be edited in place.
|
|
3160
4150
|
*
|
|
3161
4151
|
* @param id - UUID of the MCP API key to revoke.
|
|
4152
|
+
* @throws {ForbiddenError} When the caller is a Machine user.
|
|
3162
4153
|
*/
|
|
3163
4154
|
revoke(id: string): Promise<void>;
|
|
3164
4155
|
}
|
|
@@ -3241,6 +4232,12 @@ declare class UserSpendCapNamespace {
|
|
|
3241
4232
|
* Returns the authenticated buyer's spend cap, read against the current spend
|
|
3242
4233
|
* window.
|
|
3243
4234
|
*
|
|
4235
|
+
* For a buyer with an open Company membership this is the membership's cap —
|
|
4236
|
+
* read in the Company's timezone, counting only spend paid through the
|
|
4237
|
+
* membership, never uncapped, and always binding bulk acquisitions
|
|
4238
|
+
* (`bulk_exempt: false`). `company_name` names the Company; it is `null` for
|
|
4239
|
+
* anyone else.
|
|
4240
|
+
*
|
|
3244
4241
|
* @returns The current spend cap, spend-to-date, and reset time.
|
|
3245
4242
|
*/
|
|
3246
4243
|
get(): Promise<UserSpendCap>;
|
|
@@ -3254,6 +4251,9 @@ declare class UserSpendCapNamespace {
|
|
|
3254
4251
|
*
|
|
3255
4252
|
* @param body - The new cap in whole cents, or `null` to remove it.
|
|
3256
4253
|
* @returns The updated spend cap.
|
|
4254
|
+
* @throws {ForbiddenError} When the buyer holds an open Company membership. A
|
|
4255
|
+
* member's cap — an admin's own included — is set by a Company admin through
|
|
4256
|
+
* `company.members.update()`.
|
|
3257
4257
|
*/
|
|
3258
4258
|
update(body: UserSpendCapUpdateRequest): Promise<UserSpendCap>;
|
|
3259
4259
|
}
|
|
@@ -3268,8 +4268,13 @@ export declare type UserSpendCapUpdateRequest = components['schemas']['UserSpend
|
|
|
3268
4268
|
/** Current wallet balance for the authenticated buyer. */
|
|
3269
4269
|
export declare type WalletBalanceResponse = components['schemas']['WalletBalanceResponse'];
|
|
3270
4270
|
|
|
3271
|
-
/**
|
|
3272
|
-
|
|
4271
|
+
/**
|
|
4272
|
+
* Request body for creating a wallet payment session (personal or Company).
|
|
4273
|
+
* `currency` is optional; the server defaults it to `'usd'`.
|
|
4274
|
+
*/
|
|
4275
|
+
export declare type WalletPaymentSessionRequest = Omit<components['schemas']['WalletPaymentSessionRequest'], 'currency'> & {
|
|
4276
|
+
currency?: string;
|
|
4277
|
+
};
|
|
3273
4278
|
|
|
3274
4279
|
/** Response from creating a wallet payment session. */
|
|
3275
4280
|
export declare type WalletPaymentSessionResponse = components['schemas']['WalletPaymentSessionResponse'];
|