@codespar/sdk 0.16.19 → 0.16.20

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.
@@ -715,7 +715,10 @@ export interface paths {
715
715
  parameters: {
716
716
  query?: never;
717
717
  header?: never;
718
- path?: never;
718
+ path: {
719
+ /** @description The provider's catalog slug, as `GET /v1/providers` lists it. */
720
+ slug: string;
721
+ };
719
722
  cookie?: never;
720
723
  };
721
724
  requestBody?: never;
@@ -1405,7 +1408,10 @@ export interface paths {
1405
1408
  parameters: {
1406
1409
  query?: never;
1407
1410
  header?: never;
1408
- path?: never;
1411
+ path: {
1412
+ /** @description The tool call's wire id (`tc_<n>`), as `GET /v1/tool-calls` lists it. */
1413
+ id: string;
1414
+ };
1409
1415
  cookie?: never;
1410
1416
  };
1411
1417
  requestBody?: never;
@@ -1603,7 +1609,7 @@ export interface paths {
1603
1609
  content: {
1604
1610
  "application/json": {
1605
1611
  name: string;
1606
- /** @description The event type to subscribe to. Matching is EXACT string equality — there is no prefix and no wildcard, so `commerce.payment.succeeded` does not receive `commerce.payment.received`. A name outside the list below is accepted and recorded (`trigger.event_unknown`) rather than refused, so you can subscribe ahead of a release; until something emits it the subscription simply never fires. What this build emits: account_binding.closed, approval.decided, approval.pending, collect.attempt.cancelled, collect.attempt.expired, collect.attempt.failed, collect.attempt.issued, collect.attempt.ready, collect.attempt.superseded, collect.link.archived, collect.link.paused, collect.link.published, collect.payment.exception, collect.payment.paid, collect.refund.awaiting_decision, collect.refund.honored, collect.refund.required, commerce.account_launch_in.received, commerce.account_launch_out.received, commerce.account_status.changed, commerce.cashout.confirmed, commerce.charge.cancelled, commerce.charge.created, commerce.charge.expired, commerce.charge.expiry_notified, commerce.charge.paid, commerce.charge.payment_notified, commerce.dict_claim.cancelled, commerce.dict_claim.completed, commerce.dict_claim.confirmed, commerce.dict_claim.opened, commerce.dict_claim.waiting, commerce.internal_transfer_in.received, commerce.internal_transfer_out.received, commerce.mandate.expiring, commerce.mandate.granted, commerce.mandate.paused, commerce.mandate.resumed, commerce.mandate.revoked, commerce.onboarding.backgroundcheck_approved, commerce.onboarding.backgroundcheck_pending, commerce.onboarding.backgroundcheck_rejected, commerce.onboarding.documentscopy_approved, commerce.onboarding.documentscopy_pending, commerce.onboarding.documentscopy_processing, commerce.onboarding.documentscopy_rejected, commerce.onboarding.proposal_approved, commerce.onboarding.proposal_processing_documentscopy, commerce.onboarding.proposal_rejected, commerce.organization.paused, commerce.organization.resumed, commerce.payment.failed, commerce.payment.pending, commerce.payment.received, commerce.payment.refunded, commerce.payment.succeeded, commerce.payment.updated, commerce.pix_out.failed, commerce.pix_out.succeeded, commerce.pix_out.unconfirmed, commerce.pix_reversal_in.received, commerce.pix_reversal_out.received, commerce.recurrence.authorized, commerce.recurrence.cancelled, commerce.recurrence.cycle.accepted, commerce.recurrence.cycle.announced_late, commerce.recurrence.cycle.awaiting_instruction, commerce.recurrence.cycle.cancelled, commerce.recurrence.cycle.expired, commerce.recurrence.cycle.instruction_blocked, commerce.recurrence.cycle.instruction_missing, commerce.recurrence.cycle.instruction_refused, commerce.recurrence.cycle.paid, commerce.recurrence.cycle.queued_instruction_expired, commerce.recurrence.cycle.rejected, commerce.recurrence.cycle.scheduled, commerce.recurrence.cycle.settled_by_held_credit, commerce.recurrence.denied, commerce.recurrence.requested, commerce.recurrence.settlement_held, commerce.recurrence.settlement_hold_overdue, commerce.recurrence.settlement_hold_resolved, commerce.recurrence.settlement_possible_double_credit, commerce.rinne.observed, commerce.spend.failed, commerce.spend.settled, commerce.ted_in.succeeded, dda.boleto.registered, dda.subscription.activated, dda.subscription.failed, gate.paywall.charged, payable.rejected, project.archived, project.unarchived, proxy_call.failed, proxy_call.succeeded, sandbox.provisioning.account_bound, sandbox.provisioning.initial_credit, sandbox.provisioning.resumed, session.closed, spaces_customer_account.resumed, spaces_customer_account.suspended, system.health.degraded, system.health.recovered, tool_call.failed, tool_call.succeeded, trigger.delivery.failed, trigger.paused_automatically, trigger.test_fire, user.signed_up, wallet.balance.below. */
1612
+ /** @description The event type to subscribe to. Matching is EXACT string equality — there is no prefix and no wildcard, so `commerce.payment.succeeded` does not receive `commerce.payment.received`. A name outside the list below is accepted and recorded (`trigger.event_unknown`) rather than refused, so you can subscribe ahead of a release; until something emits it the subscription simply never fires. What this build emits: account_binding.closed, approval.decided, approval.pending, collect.attempt.cancelled, collect.attempt.expired, collect.attempt.failed, collect.attempt.issued, collect.attempt.ready, collect.attempt.superseded, collect.link.archived, collect.link.paused, collect.link.published, collect.payment.exception, collect.payment.paid, collect.refund.awaiting_decision, collect.refund.honored, collect.refund.required, commerce.account_launch_in.received, commerce.account_launch_out.received, commerce.account_status.changed, commerce.cashout.confirmed, commerce.charge.cancelled, commerce.charge.created, commerce.charge.expired, commerce.charge.expiry_notified, commerce.charge.paid, commerce.charge.payment_notified, commerce.dict_claim.cancelled, commerce.dict_claim.completed, commerce.dict_claim.confirmed, commerce.dict_claim.opened, commerce.dict_claim.waiting, commerce.internal_transfer_in.received, commerce.internal_transfer_out.received, commerce.mandate.expiring, commerce.mandate.granted, commerce.mandate.paused, commerce.mandate.resumed, commerce.mandate.revoked, commerce.onboarding.backgroundcheck_approved, commerce.onboarding.backgroundcheck_pending, commerce.onboarding.backgroundcheck_rejected, commerce.onboarding.documentscopy_approved, commerce.onboarding.documentscopy_pending, commerce.onboarding.documentscopy_processing, commerce.onboarding.documentscopy_rejected, commerce.onboarding.proposal_approved, commerce.onboarding.proposal_processing_documentscopy, commerce.onboarding.proposal_rejected, commerce.organization.paused, commerce.organization.resumed, commerce.payment.failed, commerce.payment.pending, commerce.payment.received, commerce.payment.refunded, commerce.payment.succeeded, commerce.payment.updated, commerce.pix_out.failed, commerce.pix_out.succeeded, commerce.pix_out.unconfirmed, commerce.pix_reversal_in.received, commerce.pix_reversal_out.received, commerce.recurrence.authorized, commerce.recurrence.cancelled, commerce.recurrence.cycle.accepted, commerce.recurrence.cycle.announced_late, commerce.recurrence.cycle.awaiting_instruction, commerce.recurrence.cycle.cancelled, commerce.recurrence.cycle.expired, commerce.recurrence.cycle.instruction_blocked, commerce.recurrence.cycle.instruction_missing, commerce.recurrence.cycle.instruction_refused, commerce.recurrence.cycle.paid, commerce.recurrence.cycle.queued_instruction_expired, commerce.recurrence.cycle.rejected, commerce.recurrence.cycle.scheduled, commerce.recurrence.cycle.settled_by_held_credit, commerce.recurrence.denied, commerce.recurrence.requested, commerce.recurrence.settlement_held, commerce.recurrence.settlement_hold_overdue, commerce.recurrence.settlement_hold_resolved, commerce.recurrence.settlement_possible_double_credit, commerce.rinne.observed, commerce.spend.failed, commerce.spend.settled, commerce.ted_in.succeeded, dda.boleto.registered, dda.subscription.activated, dda.subscription.failed, gate.paywall.charged, payable.batch.completed, payable.batch.item_executed, payable.batch.item_refused, payable.rejected, project.archived, project.unarchived, proxy_call.failed, proxy_call.succeeded, sandbox.provisioning.account_bound, sandbox.provisioning.initial_credit, sandbox.provisioning.resumed, session.closed, spaces_consent.accepted, spaces_customer_account.resumed, spaces_customer_account.suspended, system.health.degraded, system.health.recovered, tool_call.failed, tool_call.succeeded, trigger.delivery.failed, trigger.paused_automatically, trigger.test_fire, user.signed_up, wallet.balance.below. */
1607
1613
  event: string;
1608
1614
  server_id?: string;
1609
1615
  /**
@@ -1757,7 +1763,7 @@ export interface paths {
1757
1763
  content: {
1758
1764
  "application/json": {
1759
1765
  name: string;
1760
- /** @description The event type to subscribe to. Matching is EXACT string equality — there is no prefix and no wildcard, so `commerce.payment.succeeded` does not receive `commerce.payment.received`. A name outside the list below is accepted and recorded (`trigger.event_unknown`) rather than refused, so you can subscribe ahead of a release; until something emits it the subscription simply never fires. What this build emits: account_binding.closed, approval.decided, approval.pending, collect.attempt.cancelled, collect.attempt.expired, collect.attempt.failed, collect.attempt.issued, collect.attempt.ready, collect.attempt.superseded, collect.link.archived, collect.link.paused, collect.link.published, collect.payment.exception, collect.payment.paid, collect.refund.awaiting_decision, collect.refund.honored, collect.refund.required, commerce.account_launch_in.received, commerce.account_launch_out.received, commerce.account_status.changed, commerce.cashout.confirmed, commerce.charge.cancelled, commerce.charge.created, commerce.charge.expired, commerce.charge.expiry_notified, commerce.charge.paid, commerce.charge.payment_notified, commerce.dict_claim.cancelled, commerce.dict_claim.completed, commerce.dict_claim.confirmed, commerce.dict_claim.opened, commerce.dict_claim.waiting, commerce.internal_transfer_in.received, commerce.internal_transfer_out.received, commerce.mandate.expiring, commerce.mandate.granted, commerce.mandate.paused, commerce.mandate.resumed, commerce.mandate.revoked, commerce.onboarding.backgroundcheck_approved, commerce.onboarding.backgroundcheck_pending, commerce.onboarding.backgroundcheck_rejected, commerce.onboarding.documentscopy_approved, commerce.onboarding.documentscopy_pending, commerce.onboarding.documentscopy_processing, commerce.onboarding.documentscopy_rejected, commerce.onboarding.proposal_approved, commerce.onboarding.proposal_processing_documentscopy, commerce.onboarding.proposal_rejected, commerce.organization.paused, commerce.organization.resumed, commerce.payment.failed, commerce.payment.pending, commerce.payment.received, commerce.payment.refunded, commerce.payment.succeeded, commerce.payment.updated, commerce.pix_out.failed, commerce.pix_out.succeeded, commerce.pix_out.unconfirmed, commerce.pix_reversal_in.received, commerce.pix_reversal_out.received, commerce.recurrence.authorized, commerce.recurrence.cancelled, commerce.recurrence.cycle.accepted, commerce.recurrence.cycle.announced_late, commerce.recurrence.cycle.awaiting_instruction, commerce.recurrence.cycle.cancelled, commerce.recurrence.cycle.expired, commerce.recurrence.cycle.instruction_blocked, commerce.recurrence.cycle.instruction_missing, commerce.recurrence.cycle.instruction_refused, commerce.recurrence.cycle.paid, commerce.recurrence.cycle.queued_instruction_expired, commerce.recurrence.cycle.rejected, commerce.recurrence.cycle.scheduled, commerce.recurrence.cycle.settled_by_held_credit, commerce.recurrence.denied, commerce.recurrence.requested, commerce.recurrence.settlement_held, commerce.recurrence.settlement_hold_overdue, commerce.recurrence.settlement_hold_resolved, commerce.recurrence.settlement_possible_double_credit, commerce.rinne.observed, commerce.spend.failed, commerce.spend.settled, commerce.ted_in.succeeded, dda.boleto.registered, dda.subscription.activated, dda.subscription.failed, gate.paywall.charged, payable.rejected, project.archived, project.unarchived, proxy_call.failed, proxy_call.succeeded, sandbox.provisioning.account_bound, sandbox.provisioning.initial_credit, sandbox.provisioning.resumed, session.closed, spaces_customer_account.resumed, spaces_customer_account.suspended, system.health.degraded, system.health.recovered, tool_call.failed, tool_call.succeeded, trigger.delivery.failed, trigger.paused_automatically, trigger.test_fire, user.signed_up, wallet.balance.below. */
1766
+ /** @description The event type to subscribe to. Matching is EXACT string equality — there is no prefix and no wildcard, so `commerce.payment.succeeded` does not receive `commerce.payment.received`. A name outside the list below is accepted and recorded (`trigger.event_unknown`) rather than refused, so you can subscribe ahead of a release; until something emits it the subscription simply never fires. What this build emits: account_binding.closed, approval.decided, approval.pending, collect.attempt.cancelled, collect.attempt.expired, collect.attempt.failed, collect.attempt.issued, collect.attempt.ready, collect.attempt.superseded, collect.link.archived, collect.link.paused, collect.link.published, collect.payment.exception, collect.payment.paid, collect.refund.awaiting_decision, collect.refund.honored, collect.refund.required, commerce.account_launch_in.received, commerce.account_launch_out.received, commerce.account_status.changed, commerce.cashout.confirmed, commerce.charge.cancelled, commerce.charge.created, commerce.charge.expired, commerce.charge.expiry_notified, commerce.charge.paid, commerce.charge.payment_notified, commerce.dict_claim.cancelled, commerce.dict_claim.completed, commerce.dict_claim.confirmed, commerce.dict_claim.opened, commerce.dict_claim.waiting, commerce.internal_transfer_in.received, commerce.internal_transfer_out.received, commerce.mandate.expiring, commerce.mandate.granted, commerce.mandate.paused, commerce.mandate.resumed, commerce.mandate.revoked, commerce.onboarding.backgroundcheck_approved, commerce.onboarding.backgroundcheck_pending, commerce.onboarding.backgroundcheck_rejected, commerce.onboarding.documentscopy_approved, commerce.onboarding.documentscopy_pending, commerce.onboarding.documentscopy_processing, commerce.onboarding.documentscopy_rejected, commerce.onboarding.proposal_approved, commerce.onboarding.proposal_processing_documentscopy, commerce.onboarding.proposal_rejected, commerce.organization.paused, commerce.organization.resumed, commerce.payment.failed, commerce.payment.pending, commerce.payment.received, commerce.payment.refunded, commerce.payment.succeeded, commerce.payment.updated, commerce.pix_out.failed, commerce.pix_out.succeeded, commerce.pix_out.unconfirmed, commerce.pix_reversal_in.received, commerce.pix_reversal_out.received, commerce.recurrence.authorized, commerce.recurrence.cancelled, commerce.recurrence.cycle.accepted, commerce.recurrence.cycle.announced_late, commerce.recurrence.cycle.awaiting_instruction, commerce.recurrence.cycle.cancelled, commerce.recurrence.cycle.expired, commerce.recurrence.cycle.instruction_blocked, commerce.recurrence.cycle.instruction_missing, commerce.recurrence.cycle.instruction_refused, commerce.recurrence.cycle.paid, commerce.recurrence.cycle.queued_instruction_expired, commerce.recurrence.cycle.rejected, commerce.recurrence.cycle.scheduled, commerce.recurrence.cycle.settled_by_held_credit, commerce.recurrence.denied, commerce.recurrence.requested, commerce.recurrence.settlement_held, commerce.recurrence.settlement_hold_overdue, commerce.recurrence.settlement_hold_resolved, commerce.recurrence.settlement_possible_double_credit, commerce.rinne.observed, commerce.spend.failed, commerce.spend.settled, commerce.ted_in.succeeded, dda.boleto.registered, dda.subscription.activated, dda.subscription.failed, gate.paywall.charged, payable.batch.completed, payable.batch.item_executed, payable.batch.item_refused, payable.rejected, project.archived, project.unarchived, proxy_call.failed, proxy_call.succeeded, sandbox.provisioning.account_bound, sandbox.provisioning.initial_credit, sandbox.provisioning.resumed, session.closed, spaces_consent.accepted, spaces_customer_account.resumed, spaces_customer_account.suspended, system.health.degraded, system.health.recovered, tool_call.failed, tool_call.succeeded, trigger.delivery.failed, trigger.paused_automatically, trigger.test_fire, user.signed_up, wallet.balance.below. */
1761
1767
  event: string;
1762
1768
  server_id?: string;
1763
1769
  /**
@@ -1937,7 +1943,10 @@ export interface paths {
1937
1943
  parameters: {
1938
1944
  query?: never;
1939
1945
  header?: never;
1940
- path?: never;
1946
+ path: {
1947
+ /** @description The policy rule id, as `GET /v1/policies` lists it. */
1948
+ id: string;
1949
+ };
1941
1950
  cookie?: never;
1942
1951
  };
1943
1952
  requestBody?: never;
@@ -2323,7 +2332,10 @@ export interface paths {
2323
2332
  parameters: {
2324
2333
  query?: never;
2325
2334
  header?: never;
2326
- path?: never;
2335
+ path: {
2336
+ /** @description The consumer id (`csm_...`), as `GET /v1/consumers` lists it. */
2337
+ id: string;
2338
+ };
2327
2339
  cookie?: never;
2328
2340
  };
2329
2341
  requestBody?: never;
@@ -2380,7 +2392,10 @@ export interface paths {
2380
2392
  parameters: {
2381
2393
  query?: never;
2382
2394
  header?: never;
2383
- path?: never;
2395
+ path: {
2396
+ /** @description The consumer id (`csm_...`), as `GET /v1/consumers` lists it. */
2397
+ id: string;
2398
+ };
2384
2399
  cookie?: never;
2385
2400
  };
2386
2401
  requestBody?: {
@@ -12218,7 +12233,7 @@ export interface paths {
12218
12233
  *
12219
12234
  * EVERY CHECK SAYS WHAT IT MEASURED AND WHAT THAT MEANS HERE. Its own `status` keeps its vocabulary; beside it, `state` separates a real failure from pending configuration, from no activity, and from a feature not in use, with `required`, a `reason` code and, where something has to be set up, an `action`. A new account with no integration, no provider call and no FX quote reads `healthy`, with `connections` pending configuration.
12220
12235
  *
12221
- * GRADE ON `status`, AND READ THE RULE BEFORE WRITING THE ALERT. Only `state: failure` grades. `down` means `db` or `vault` fails. `degraded` means any other check fails, which today is one of: the tool catalog is not loaded (`tool_catalog`), a USD/BRL quote the router needs is missing, stale or unreadable (`fx_rates`; no deployment needs one until the router normalizes cost across currencies, and until then the quote is `not_in_use` whatever its age), a live Celcoin connection lacks a webhook subscription (`celcoin_webhook_subscriptions`), or a Pix Automático worker with work to do is stale, failing or never ran (`recurrence_holds`, `recurrence_scheduler`, including a hold past its time), or a BolePix paid twice has had its refund owed for longer than 3 days (`bolepix_refunds`). Everything else grades `healthy`. `attention` lists the failing checks and the ones pending configuration by name.
12236
+ * GRADE ON `status`, AND READ THE RULE BEFORE WRITING THE ALERT. Only `state: failure` grades. `down` means `db` or `vault` fails. `degraded` means any other check fails, which today is one of: the tool catalog is not loaded (`tool_catalog`), a USD/BRL quote the router needs is missing, stale or unreadable (`fx_rates`; no deployment needs one until the router normalizes cost across currencies, and until then the quote is `not_in_use` whatever its age), a live Celcoin connection lacks a webhook subscription (`celcoin_webhook_subscriptions`), or a Pix Automático worker with work to do is stale, failing or never ran (`recurrence_holds`, `recurrence_scheduler`, including a hold past its time), or a BolePix paid twice has had its refund owed for longer than 3 days (`bolepix_refunds`), or this production process has no working tool strategy and refuses every meta-tool call with 503 `tool_strategy_unavailable` (`tool_strategy`; reads, authentication and webhooks keep working). Everything else grades `healthy`. `attention` lists the failing checks and the ones pending configuration by name.
12222
12237
  *
12223
12238
  * `metrics` IS READ, NEVER GRADED. `metrics.recurrence_instruction_alarms` counts the Pix Automático instruction alarms still open on a cycle still ahead, per kind and reason, for the calling org: a cycle not announced, an instruction refused, held back by a ceiling, or queued and expired. Each alarm already reached its tenant as an event in the recurrence's project; this is the standing number, and it never moves `status`.
12224
12239
  *
@@ -12479,6 +12494,39 @@ export interface paths {
12479
12494
  owner: "account" | "operator";
12480
12495
  };
12481
12496
  };
12497
+ tool_strategy: {
12498
+ /**
12499
+ * @description `unavailable` when this production process could not build its tool strategy, or was asked for the simulator, and so refuses every meta-tool call with 503 `tool_strategy_unavailable`. A failure: it grades `degraded`, never `down`. Read from the process, not the database, and kept until the process is replaced.
12500
+ * @enum {string}
12501
+ */
12502
+ status: "available" | "unavailable";
12503
+ /** @description `real_strategy_unbuildable`, `mock_requested_in_production` or `decorator_unbuildable`, which `reason` repeats; null while available. */
12504
+ cause: string | null;
12505
+ /**
12506
+ * Format: date-time
12507
+ * @description When this process first refused; null while available.
12508
+ */
12509
+ since: string | null;
12510
+ /**
12511
+ * @description What the measurement means here. `failure`: something this deployment or tenant needs is broken, and the only state that moves `status`. `pending_configuration`: nothing is broken, something has not been set up yet, and `action` says what. `no_activity`: working, with nothing to measure yet. `not_in_use`: the feature behind the check is not used here. `unchecked`: the check could not be read and guards nothing required (a required check that cannot be read is a `failure`).
12512
+ * @enum {string}
12513
+ */
12514
+ state: "healthy" | "failure" | "pending_configuration" | "no_activity" | "not_in_use" | "unchecked";
12515
+ /** @description Whether a failure of this check breaks something this deployment or tenant needs right now. */
12516
+ required: boolean;
12517
+ /** @description A stable code for the state (for example `no_integration_connected`, `quote_stale`, `tool_catalog_not_loaded`). Word it in the reader; do not parse `message`. */
12518
+ reason: string;
12519
+ /** @description Present on `pending_configuration`, and on the provisioning failure `tool_catalog_not_loaded`. */
12520
+ action?: {
12521
+ /** @enum {string} */
12522
+ code: "connect_integration" | "load_tool_catalog" | "generate_embeddings";
12523
+ /**
12524
+ * @description `account`: the tenant resolves it in the dashboard. `operator`: the platform operator does.
12525
+ * @enum {string}
12526
+ */
12527
+ owner: "account" | "operator";
12528
+ };
12529
+ };
12482
12530
  };
12483
12531
  metrics: {
12484
12532
  recurrence_instruction_alarms: {
@@ -42802,7 +42850,7 @@ export interface paths {
42802
42850
  patch?: never;
42803
42851
  trace?: never;
42804
42852
  };
42805
- "/v1/shop/agent/purchases": {
42853
+ "/v1/payables/files": {
42806
42854
  parameters: {
42807
42855
  query?: never;
42808
42856
  header?: never;
@@ -42812,10 +42860,10 @@ export interface paths {
42812
42860
  get?: never;
42813
42861
  put?: never;
42814
42862
  /**
42815
- * Propose a purchase at a supported store (never an order)
42816
- * @description Scope `shop:purchases:write`. The store, its origin and its prices come from the server's registry and the store's own catalog, never from the request. The same `agent_id` and `idempotency_key` with the same intent answers the same purchase (`idempotent_replay: true`).
42863
+ * Upload a document or a spreadsheet of payables
42864
+ * @description One file per request, in the multipart field `file`: a PDF, a PNG, JPEG or WEBP image, a CSV or an XLSX, accepted by its bytes (the declared type is not consulted). At most 10 MB, 10 pages and 500 rows. A local reader runs in the request — PDF text layer (boleto lines and barcodes, BR Codes, labelled Pix keys), QR codes and boleto barcodes in images, rows of a sheet (`pix_key` | `boleto_line` | `br_code`, `amount`, `description`, `reference`; Portuguese or English headers) — and what it cannot resolve still becomes an item that asks for the missing field. The original file is not kept: only its SHA-256, kind, size and the items found. The `file_id` is project-scoped and expires in 24 hours if no batch uses it.
42817
42865
  *
42818
- * **What an assistant can and cannot do.** It proposes a purchase and reads where it stands; it never pays, approves, saves a card or logs in at a store. A verified person presses Pagar on the dashboard and completes what the purchase waits for (the protected card or CVV form, the store login); the purchase then runs through the same executor as the Shop's own chat, at most once at the store. No answer carries a card number, a security code, a cookie or a collect secret. Test projects only in this first delivery; behind `SHOP_PURCHASES_ENABLED`.
42866
+ * Scope: `payables:write`.
42819
42867
  */
42820
42868
  post: {
42821
42869
  parameters: {
@@ -42826,143 +42874,121 @@ export interface paths {
42826
42874
  };
42827
42875
  requestBody?: {
42828
42876
  content: {
42829
- "application/json": {
42830
- agent_id: string;
42831
- merchant: string;
42832
- items: {
42833
- sku_id: string;
42834
- quantity: number;
42835
- }[];
42877
+ "multipart/form-data": {
42836
42878
  /**
42837
- * @default card
42838
- * @enum {string}
42879
+ * Format: binary
42880
+ * @description The file. At most 10 MB.
42839
42881
  */
42840
- payment_method?: "card" | "store_on_file";
42841
- idempotency_key: string;
42882
+ file: string;
42842
42883
  };
42843
42884
  };
42844
42885
  };
42845
42886
  responses: {
42846
42887
  /** @description OK */
42847
- 200: {
42888
+ 201: {
42848
42889
  headers: {
42849
42890
  [name: string]: unknown;
42850
42891
  };
42851
42892
  content: {
42852
42893
  "application/json": {
42853
- purchase: {
42854
- /** @description The purchase proposal id (`prp_...`). */
42855
- id: string;
42856
- /** @enum {string} */
42857
- kind: "purchase";
42858
- /** @enum {string} */
42859
- state: "drafted" | "awaiting_approval" | "executing" | "succeeded" | "failed" | "denied";
42894
+ /** @description `pfile_` followed by 20 characters. Project-scoped; used by a batch, by the chat and by the remote MCP. */
42895
+ file_id: string;
42896
+ /** @enum {string} */
42897
+ kind: "pdf" | "image" | "csv" | "xlsx";
42898
+ /** @description SHA-256 of the bytes as sent. The file itself is not kept. */
42899
+ sha256: string;
42900
+ size_bytes: number;
42901
+ /** @description Charges found by the local reader (boleto lines, BR Codes, Pix keys, QR codes, rows). */
42902
+ items_found: number;
42903
+ /** @description Of those, how many still miss something the person has to complete (an amount, a destination). */
42904
+ unresolved: number;
42905
+ /** @description ISO 8601. A file no batch used by then is forgotten. */
42906
+ expires_at: string;
42907
+ };
42908
+ };
42909
+ };
42910
+ /** @description No multipart part named `file`, or an empty one; or the body could not be read. */
42911
+ 400: {
42912
+ headers: {
42913
+ [name: string]: unknown;
42914
+ };
42915
+ content: {
42916
+ "application/json": {
42917
+ error: {
42860
42918
  /** @enum {string} */
42861
- run_state: "ready" | "awaiting_user" | "running" | "interrupted" | "completed" | "cancelled";
42862
- awaiting: {
42863
- /** @enum {string} */
42864
- reason: "instrument" | "store_login" | "cvv" | "approval" | "challenge";
42865
- } | null;
42866
- merchant: {
42867
- id: string;
42868
- name: string;
42919
+ code: "payable_file_required" | "invalid_body";
42920
+ message: string;
42921
+ details?: {
42922
+ [key: string]: unknown;
42869
42923
  };
42870
- items: {
42871
- sku_id: string;
42872
- name: string;
42873
- quantity: number;
42874
- unit_price_minor: number;
42875
- }[];
42876
- total_minor: number;
42877
- /** @enum {string} */
42878
- currency: "BRL";
42879
- /** @enum {string} */
42880
- payment_method: "card" | "store_on_file";
42881
- order: {
42882
- id: string | null;
42883
- status: string | null;
42884
- amount_minor: number | null;
42885
- } | null;
42886
- receipt: {
42887
- /** @enum {string} */
42888
- funding_origin: "external_card" | "store_on_file";
42889
- /** @enum {boolean} */
42890
- wallet_debit: false;
42891
- } | null;
42892
- failure: {
42893
- code: string;
42894
- } | null;
42895
- next_action: string | null;
42896
42924
  };
42897
- /** @description The proposal card as the dashboard shows it. */
42898
- proposal: {
42899
- [key: string]: unknown;
42900
- } | null;
42901
- idempotent_replay: boolean;
42925
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
42926
+ request_id: string | null;
42902
42927
  };
42903
42928
  };
42904
42929
  };
42905
- /** @description OK */
42906
- 201: {
42930
+ /** @description Over 10 MB. Nothing was read or kept. */
42931
+ 413: {
42907
42932
  headers: {
42908
42933
  [name: string]: unknown;
42909
42934
  };
42910
42935
  content: {
42911
42936
  "application/json": {
42912
- purchase: {
42913
- /** @description The purchase proposal id (`prp_...`). */
42914
- id: string;
42915
- /** @enum {string} */
42916
- kind: "purchase";
42917
- /** @enum {string} */
42918
- state: "drafted" | "awaiting_approval" | "executing" | "succeeded" | "failed" | "denied";
42937
+ error: {
42919
42938
  /** @enum {string} */
42920
- run_state: "ready" | "awaiting_user" | "running" | "interrupted" | "completed" | "cancelled";
42921
- awaiting: {
42922
- /** @enum {string} */
42923
- reason: "instrument" | "store_login" | "cvv" | "approval" | "challenge";
42924
- } | null;
42925
- merchant: {
42926
- id: string;
42927
- name: string;
42939
+ code: "payable_file_too_large";
42940
+ message: string;
42941
+ details?: {
42942
+ [key: string]: unknown;
42928
42943
  };
42929
- items: {
42930
- sku_id: string;
42931
- name: string;
42932
- quantity: number;
42933
- unit_price_minor: number;
42934
- }[];
42935
- total_minor: number;
42944
+ };
42945
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
42946
+ request_id: string | null;
42947
+ };
42948
+ };
42949
+ };
42950
+ /** @description Not a PDF, PNG, JPEG, WEBP, CSV or XLSX by its bytes. */
42951
+ 415: {
42952
+ headers: {
42953
+ [name: string]: unknown;
42954
+ };
42955
+ content: {
42956
+ "application/json": {
42957
+ error: {
42936
42958
  /** @enum {string} */
42937
- currency: "BRL";
42959
+ code: "payable_file_type_unsupported";
42960
+ message: string;
42961
+ details?: {
42962
+ [key: string]: unknown;
42963
+ };
42964
+ };
42965
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
42966
+ request_id: string | null;
42967
+ };
42968
+ };
42969
+ };
42970
+ /** @description `payable_file_unreadable`: `details.reason` is `too_many_pages`, `active_content`, `encrypted`, `malformed`, `resource_limit`, `webp_unsupported` or `sheet_unreadable`. `payable_file_rows_exceeded`: more than 500 data rows. */
42971
+ 422: {
42972
+ headers: {
42973
+ [name: string]: unknown;
42974
+ };
42975
+ content: {
42976
+ "application/json": {
42977
+ error: {
42938
42978
  /** @enum {string} */
42939
- payment_method: "card" | "store_on_file";
42940
- order: {
42941
- id: string | null;
42942
- status: string | null;
42943
- amount_minor: number | null;
42944
- } | null;
42945
- receipt: {
42946
- /** @enum {string} */
42947
- funding_origin: "external_card" | "store_on_file";
42948
- /** @enum {boolean} */
42949
- wallet_debit: false;
42950
- } | null;
42951
- failure: {
42952
- code: string;
42953
- } | null;
42954
- next_action: string | null;
42979
+ code: "payable_file_unreadable" | "payable_file_rows_exceeded";
42980
+ message: string;
42981
+ details?: {
42982
+ [key: string]: unknown;
42983
+ };
42955
42984
  };
42956
- /** @description The proposal card as the dashboard shows it. */
42957
- proposal: {
42958
- [key: string]: unknown;
42959
- } | null;
42960
- idempotent_replay: boolean;
42985
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
42986
+ request_id: string | null;
42961
42987
  };
42962
42988
  };
42963
42989
  };
42964
- /** @description The body did not match the schema. */
42965
- 400: {
42990
+ /** @description Every document inspector is busy; retry in a few seconds. */
42991
+ 503: {
42966
42992
  headers: {
42967
42993
  [name: string]: unknown;
42968
42994
  };
@@ -42970,7 +42996,7 @@ export interface paths {
42970
42996
  "application/json": {
42971
42997
  error: {
42972
42998
  /** @enum {string} */
42973
- code: "invalid_body";
42999
+ code: "payable_file_inspection_busy";
42974
43000
  message: string;
42975
43001
  details?: {
42976
43002
  [key: string]: unknown;
@@ -42981,15 +43007,72 @@ export interface paths {
42981
43007
  };
42982
43008
  };
42983
43009
  };
42984
- /** @description The key does not hold `shop:purchases:write`. */
42985
- 403: {
43010
+ };
43011
+ };
43012
+ delete?: never;
43013
+ options?: never;
43014
+ head?: never;
43015
+ patch?: never;
43016
+ trace?: never;
43017
+ };
43018
+ "/v1/payables/files/authorizations": {
43019
+ parameters: {
43020
+ query?: never;
43021
+ header?: never;
43022
+ path?: never;
43023
+ cookie?: never;
43024
+ };
43025
+ get?: never;
43026
+ put?: never;
43027
+ /**
43028
+ * Authorize a browser to upload files straight to the API
43029
+ * @description For a browser that cannot send the file through its own server (a proxy that refuses large bodies). Returns a short-lived token and the URL that accepts it: `POST upload_url` with `Authorization: Bearer <token>` and the multipart field `file`, exactly as `POST /v1/payables/files`. The token uploads at most `max_files` files of at most `max_bytes` each into this caller's org, project and environment until `expires_at` (10 minutes), attributed to this caller; it reads nothing and is accepted by no other route. Only its SHA-256 is kept. Use `upload_url` as given: it is authenticated by the token alone (send it in the header, never in the URL), answers the dashboard's browser origins only and never with credentials, spends one use per request whatever the outcome, and refuses an absent, unknown, expired or used-up token with 401 `payable_upload_token_invalid`. Its other answers are those of `POST /v1/payables/files`.
43030
+ *
43031
+ * Scope: `payables:write`.
43032
+ */
43033
+ post: {
43034
+ parameters: {
43035
+ query?: never;
43036
+ header?: never;
43037
+ path?: never;
43038
+ cookie?: never;
43039
+ };
43040
+ requestBody?: {
43041
+ content: {
43042
+ "application/json": Record<string, never>;
43043
+ };
43044
+ };
43045
+ responses: {
43046
+ /** @description OK */
43047
+ 201: {
43048
+ headers: {
43049
+ [name: string]: unknown;
43050
+ };
43051
+ content: {
43052
+ "application/json": {
43053
+ /** @description Where the browser posts each file (multipart field `file`) with `Authorization: Bearer <token>`. Use it as given. */
43054
+ upload_url: string;
43055
+ /** @description `pfup_` followed by 32 characters. Shown once; it uploads files into this project and authorizes nothing else. */
43056
+ token: string;
43057
+ /** @description ISO 8601, ten minutes from now. */
43058
+ expires_at: string;
43059
+ /** @description The size limit of each file: 10485760. */
43060
+ max_bytes: number;
43061
+ /** @description How many uploads the token allows: 20. */
43062
+ max_files: number;
43063
+ };
43064
+ };
43065
+ };
43066
+ /** @description The body is not an empty JSON object. */
43067
+ 400: {
42986
43068
  headers: {
42987
43069
  [name: string]: unknown;
42988
43070
  };
42989
43071
  content: {
42990
43072
  "application/json": {
42991
43073
  error: {
42992
- code: string;
43074
+ /** @enum {string} */
43075
+ code: "invalid_body";
42993
43076
  message: string;
42994
43077
  details?: {
42995
43078
  [key: string]: unknown;
@@ -43000,8 +43083,263 @@ export interface paths {
43000
43083
  };
43001
43084
  };
43002
43085
  };
43003
- /** @description No mandate permits the store, or the project is not Test. */
43004
- 409: {
43086
+ };
43087
+ };
43088
+ delete?: never;
43089
+ options?: never;
43090
+ head?: never;
43091
+ patch?: never;
43092
+ trace?: never;
43093
+ };
43094
+ "/v1/payables/batches": {
43095
+ parameters: {
43096
+ query?: never;
43097
+ header?: never;
43098
+ path?: never;
43099
+ cookie?: never;
43100
+ };
43101
+ get?: never;
43102
+ put?: never;
43103
+ /**
43104
+ * Create a batch of payables from files and items
43105
+ * @description At least one of `file_ids` (uploaded with `POST /v1/payables/files`) and `items` (stated in text). At most 20 files and 500 items. Every item is resolved on the rail before it can be confirmed.
43106
+ *
43107
+ * **What an item shows comes from the rail, never from the file.** A boleto is quoted (amount, beneficiary, masked document, due date); a Pix key is resolved in the DICT (owner name, masked document); a BR Code is decoded with its CRC, and a dynamic one through the payment provider's own decode call (its location URL is never fetched by us). A bare Pix key never sets the amount: the person, the integration or the CSV column states it, and `amount_source` says which. Nothing a document says about a beneficiary or an amount changes those values. No model reads any file.
43108
+ *
43109
+ * **Identity.** An item's `item_id` is the payable's id, derived from the batch and the item's content (the file hash and the carrier, or a row's content and `reference`), never from its position: re-uploading the same file into the same batch, reordering, or resuming never yields another item. A carrier repeated in the batch is flagged `duplicate_in_batch`; one already open or paid in the project fails `duplicate_document`.
43110
+ *
43111
+ * `Idempotency-Key` is required; a replay with the same key answers the same batch.
43112
+ *
43113
+ * Scope: `payables:write`.
43114
+ */
43115
+ post: {
43116
+ parameters: {
43117
+ query?: never;
43118
+ header: {
43119
+ "Idempotency-Key": string;
43120
+ };
43121
+ path?: never;
43122
+ cookie?: never;
43123
+ };
43124
+ requestBody?: {
43125
+ content: {
43126
+ "application/json": {
43127
+ file_ids?: string[];
43128
+ items?: {
43129
+ /** @description A Pix key: CPF, CNPJ, e-mail, +55 phone or random (EVP). */
43130
+ pix_key?: string;
43131
+ /** @description A boleto's digitable line (47 or 48 digits) or barcode (44). */
43132
+ boleto_line?: string;
43133
+ /** @description A Pix copia-e-cola (BR Code, `000201…`). */
43134
+ br_code?: string;
43135
+ /** @description The amount the person states, in centavos. Required for a bare Pix key; ignored where the rail names the amount. */
43136
+ amount_minor?: number;
43137
+ description?: string;
43138
+ /** @description The caller's own reference; part of the item's identity. */
43139
+ reference?: string;
43140
+ }[];
43141
+ /**
43142
+ * @default api
43143
+ * @enum {string}
43144
+ */
43145
+ source?: "api" | "chat" | "dashboard" | "cli" | "mcp";
43146
+ conversation_id?: string;
43147
+ };
43148
+ };
43149
+ };
43150
+ responses: {
43151
+ /** @description OK */
43152
+ 200: {
43153
+ headers: {
43154
+ [name: string]: unknown;
43155
+ };
43156
+ content: {
43157
+ "application/json": {
43158
+ /** @description `pbat_` followed by 20 characters. */
43159
+ batch_id: string;
43160
+ /** @enum {string} */
43161
+ status: "reviewing" | "ready" | "confirmed" | "executing" | "completed" | "partially_completed" | "failed" | "canceled";
43162
+ /** @description Bumps on every change to the list. A confirmation binds to one version. */
43163
+ version: number;
43164
+ /** @description SHA-256 over the canonical list: for each non-excluded item in `item_id` order `item_id|rail|destination id|amount_minor|currency`, then the total. Send it back on pay. */
43165
+ list_hash: string;
43166
+ /** @enum {string} */
43167
+ currency: "BRL";
43168
+ totals: {
43169
+ items: number;
43170
+ payable_items: number;
43171
+ excluded: number;
43172
+ amount_minor: number;
43173
+ };
43174
+ confirmation: {
43175
+ version: number;
43176
+ list_hash: string;
43177
+ /** @description `user_…` (a verified person) or `api_key:<key id>`. */
43178
+ confirmed_by: string;
43179
+ confirmed_at: string;
43180
+ mandate_id: string;
43181
+ } | null;
43182
+ items: {
43183
+ /** @description `pbl_` + 16 characters: the payable's id, derived from the batch and the item's content. */
43184
+ item_id: string;
43185
+ /** @description Display order. Not part of the identity: reordering never makes another item. */
43186
+ position: number;
43187
+ origin: {
43188
+ file_id: string | null;
43189
+ page: number | null;
43190
+ row: number | null;
43191
+ /** @enum {string} */
43192
+ kind: "boleto_line" | "br_code" | "pix_key" | "qr_image" | "barcode_image" | "csv_row" | "manual";
43193
+ };
43194
+ /** @enum {string|null} */
43195
+ rail: "boleto" | "pix" | null;
43196
+ /** @enum {string} */
43197
+ state: "needs_complement" | "resolving" | "ready" | "excluded" | "rejected" | "dispatching" | "executed" | "refused" | "uncertain";
43198
+ missing: ("amount" | "destination" | "pix_key_owner_confirmation")[];
43199
+ destination: {
43200
+ /** @enum {string} */
43201
+ kind: "boleto" | "pix_key" | "br_code_static" | "br_code_dynamic";
43202
+ /** @description The boleto line or the Pix key, masked. */
43203
+ display: string;
43204
+ /** @description From the rail (the boleto registration, the DICT owner); never from the document. */
43205
+ beneficiary_name: string | null;
43206
+ /** @description From the rail, masked. */
43207
+ beneficiary_document_masked: string | null;
43208
+ /** @description YYYY-MM-DD from the rail, or null. */
43209
+ due_date: string | null;
43210
+ } | null;
43211
+ amount_minor: number | null;
43212
+ /** @enum {string|null} */
43213
+ amount_source: "rail_quote" | "br_code" | "stated_by_person" | "csv" | null;
43214
+ description: string | null;
43215
+ reference: string | null;
43216
+ checks: {
43217
+ /** @enum {string} */
43218
+ code: "carrier_check_digits" | "duplicate_in_batch" | "duplicate_document" | "amount_matches_rail" | "due_date_state" | "pix_key_resolved";
43219
+ /** @enum {string} */
43220
+ status: "pass" | "fail" | "warn";
43221
+ message: string;
43222
+ /** @description True when a test project's own responder answered the consult behind this check, not the rail. */
43223
+ simulated?: boolean;
43224
+ }[];
43225
+ payment: {
43226
+ /** @enum {string} */
43227
+ state: "executed" | "refused" | "uncertain";
43228
+ attempt_id: string | null;
43229
+ receipt_id: string | null;
43230
+ end_to_end_id: string | null;
43231
+ refusal: {
43232
+ code: string;
43233
+ message: string;
43234
+ } | null;
43235
+ } | null;
43236
+ }[];
43237
+ created_at: string;
43238
+ /** @enum {string} */
43239
+ source: "api" | "chat" | "dashboard" | "cli" | "mcp";
43240
+ conversation_id: string | null;
43241
+ /** @description True when this answers an earlier call with the same Idempotency-Key. */
43242
+ idempotent_replay: boolean;
43243
+ };
43244
+ };
43245
+ };
43246
+ /** @description OK */
43247
+ 201: {
43248
+ headers: {
43249
+ [name: string]: unknown;
43250
+ };
43251
+ content: {
43252
+ "application/json": {
43253
+ /** @description `pbat_` followed by 20 characters. */
43254
+ batch_id: string;
43255
+ /** @enum {string} */
43256
+ status: "reviewing" | "ready" | "confirmed" | "executing" | "completed" | "partially_completed" | "failed" | "canceled";
43257
+ /** @description Bumps on every change to the list. A confirmation binds to one version. */
43258
+ version: number;
43259
+ /** @description SHA-256 over the canonical list: for each non-excluded item in `item_id` order `item_id|rail|destination id|amount_minor|currency`, then the total. Send it back on pay. */
43260
+ list_hash: string;
43261
+ /** @enum {string} */
43262
+ currency: "BRL";
43263
+ totals: {
43264
+ items: number;
43265
+ payable_items: number;
43266
+ excluded: number;
43267
+ amount_minor: number;
43268
+ };
43269
+ confirmation: {
43270
+ version: number;
43271
+ list_hash: string;
43272
+ /** @description `user_…` (a verified person) or `api_key:<key id>`. */
43273
+ confirmed_by: string;
43274
+ confirmed_at: string;
43275
+ mandate_id: string;
43276
+ } | null;
43277
+ items: {
43278
+ /** @description `pbl_` + 16 characters: the payable's id, derived from the batch and the item's content. */
43279
+ item_id: string;
43280
+ /** @description Display order. Not part of the identity: reordering never makes another item. */
43281
+ position: number;
43282
+ origin: {
43283
+ file_id: string | null;
43284
+ page: number | null;
43285
+ row: number | null;
43286
+ /** @enum {string} */
43287
+ kind: "boleto_line" | "br_code" | "pix_key" | "qr_image" | "barcode_image" | "csv_row" | "manual";
43288
+ };
43289
+ /** @enum {string|null} */
43290
+ rail: "boleto" | "pix" | null;
43291
+ /** @enum {string} */
43292
+ state: "needs_complement" | "resolving" | "ready" | "excluded" | "rejected" | "dispatching" | "executed" | "refused" | "uncertain";
43293
+ missing: ("amount" | "destination" | "pix_key_owner_confirmation")[];
43294
+ destination: {
43295
+ /** @enum {string} */
43296
+ kind: "boleto" | "pix_key" | "br_code_static" | "br_code_dynamic";
43297
+ /** @description The boleto line or the Pix key, masked. */
43298
+ display: string;
43299
+ /** @description From the rail (the boleto registration, the DICT owner); never from the document. */
43300
+ beneficiary_name: string | null;
43301
+ /** @description From the rail, masked. */
43302
+ beneficiary_document_masked: string | null;
43303
+ /** @description YYYY-MM-DD from the rail, or null. */
43304
+ due_date: string | null;
43305
+ } | null;
43306
+ amount_minor: number | null;
43307
+ /** @enum {string|null} */
43308
+ amount_source: "rail_quote" | "br_code" | "stated_by_person" | "csv" | null;
43309
+ description: string | null;
43310
+ reference: string | null;
43311
+ checks: {
43312
+ /** @enum {string} */
43313
+ code: "carrier_check_digits" | "duplicate_in_batch" | "duplicate_document" | "amount_matches_rail" | "due_date_state" | "pix_key_resolved";
43314
+ /** @enum {string} */
43315
+ status: "pass" | "fail" | "warn";
43316
+ message: string;
43317
+ /** @description True when a test project's own responder answered the consult behind this check, not the rail. */
43318
+ simulated?: boolean;
43319
+ }[];
43320
+ payment: {
43321
+ /** @enum {string} */
43322
+ state: "executed" | "refused" | "uncertain";
43323
+ attempt_id: string | null;
43324
+ receipt_id: string | null;
43325
+ end_to_end_id: string | null;
43326
+ refusal: {
43327
+ code: string;
43328
+ message: string;
43329
+ } | null;
43330
+ } | null;
43331
+ }[];
43332
+ created_at: string;
43333
+ /** @enum {string} */
43334
+ source: "api" | "chat" | "dashboard" | "cli" | "mcp";
43335
+ conversation_id: string | null;
43336
+ /** @description True when this answers an earlier call with the same Idempotency-Key. */
43337
+ idempotent_replay: boolean;
43338
+ };
43339
+ };
43340
+ };
43341
+ /** @description The body did not match, the batch would be empty, or the Idempotency-Key is missing. */
43342
+ 400: {
43005
43343
  headers: {
43006
43344
  [name: string]: unknown;
43007
43345
  };
@@ -43009,7 +43347,7 @@ export interface paths {
43009
43347
  "application/json": {
43010
43348
  error: {
43011
43349
  /** @enum {string} */
43012
- code: "proposal_no_mandate" | "purchase_merchant_unsupported";
43350
+ code: "invalid_body" | "payable_batch_empty" | "payable_batch_idempotency_key_required" | "invalid_idempotency_key";
43013
43351
  message: string;
43014
43352
  details?: {
43015
43353
  [key: string]: unknown;
@@ -43020,15 +43358,16 @@ export interface paths {
43020
43358
  };
43021
43359
  };
43022
43360
  };
43023
- /** @description The agent, the store, the rail or an item is not one that can be bought. */
43024
- 422: {
43361
+ /** @description The Idempotency-Key was used with a different body. */
43362
+ 409: {
43025
43363
  headers: {
43026
43364
  [name: string]: unknown;
43027
43365
  };
43028
43366
  content: {
43029
43367
  "application/json": {
43030
43368
  error: {
43031
- code: string;
43369
+ /** @enum {string} */
43370
+ code: "idempotency_key_conflict";
43032
43371
  message: string;
43033
43372
  details?: {
43034
43373
  [key: string]: unknown;
@@ -43039,8 +43378,8 @@ export interface paths {
43039
43378
  };
43040
43379
  };
43041
43380
  };
43042
- /** @description Shop purchases are off on this deployment. */
43043
- 503: {
43381
+ /** @description A `file_id` that is not an unexpired file of this project, or more than 20 files / 500 items. */
43382
+ 422: {
43044
43383
  headers: {
43045
43384
  [name: string]: unknown;
43046
43385
  };
@@ -43048,7 +43387,7 @@ export interface paths {
43048
43387
  "application/json": {
43049
43388
  error: {
43050
43389
  /** @enum {string} */
43051
- code: "shop_purchases_disabled";
43390
+ code: "payable_file_not_found" | "payable_batch_too_large";
43052
43391
  message: string;
43053
43392
  details?: {
43054
43393
  [key: string]: unknown;
@@ -43067,7 +43406,7 @@ export interface paths {
43067
43406
  patch?: never;
43068
43407
  trace?: never;
43069
43408
  };
43070
- "/v1/shop/agent/purchases/{id}": {
43409
+ "/v1/payables/batches/{batchId}": {
43071
43410
  parameters: {
43072
43411
  query?: never;
43073
43412
  header?: never;
@@ -43075,16 +43414,1130 @@ export interface paths {
43075
43414
  cookie?: never;
43076
43415
  };
43077
43416
  /**
43078
- * Where a purchase stands
43079
- * @description Scope `shop:purchases:read`. References and states only: the order the store answered, a receipt marked as external (no Wallet debit), what it waits for.
43417
+ * Read a batch, its items and their results
43418
+ * @description The batch as it is now: every item with its resolved destination, amount and source, the missing fields, the checks and, after paying, its own `payment` result. While a large batch executes, `status` is `executing` and this shows progress.
43080
43419
  *
43081
- * **What an assistant can and cannot do.** It proposes a purchase and reads where it stands; it never pays, approves, saves a card or logs in at a store. A verified person presses Pagar on the dashboard and completes what the purchase waits for (the protected card or CVV form, the store login); the purchase then runs through the same executor as the Shop's own chat, at most once at the store. No answer carries a card number, a security code, a cookie or a collect secret. Test projects only in this first delivery; behind `SHOP_PURCHASES_ENABLED`.
43420
+ * **The confirmation binds to the list.** `version` bumps on every change and `list_hash` is the SHA-256 of the canonical list (each non-excluded item in `item_id` order as `item_id|rail|destination id|amount_minor|currency`, then the total). Any change after a confirmation needs a new one.
43421
+ *
43422
+ * Scope: `payables:read`.
43082
43423
  */
43083
43424
  get: {
43084
43425
  parameters: {
43085
43426
  query?: never;
43086
43427
  header?: never;
43087
- path?: never;
43428
+ path: {
43429
+ /** @description `pbat_` followed by 20 characters. */
43430
+ batchId: string;
43431
+ };
43432
+ cookie?: never;
43433
+ };
43434
+ requestBody?: never;
43435
+ responses: {
43436
+ /** @description OK */
43437
+ 200: {
43438
+ headers: {
43439
+ [name: string]: unknown;
43440
+ };
43441
+ content: {
43442
+ "application/json": {
43443
+ /** @description `pbat_` followed by 20 characters. */
43444
+ batch_id: string;
43445
+ /** @enum {string} */
43446
+ status: "reviewing" | "ready" | "confirmed" | "executing" | "completed" | "partially_completed" | "failed" | "canceled";
43447
+ /** @description Bumps on every change to the list. A confirmation binds to one version. */
43448
+ version: number;
43449
+ /** @description SHA-256 over the canonical list: for each non-excluded item in `item_id` order `item_id|rail|destination id|amount_minor|currency`, then the total. Send it back on pay. */
43450
+ list_hash: string;
43451
+ /** @enum {string} */
43452
+ currency: "BRL";
43453
+ totals: {
43454
+ items: number;
43455
+ payable_items: number;
43456
+ excluded: number;
43457
+ amount_minor: number;
43458
+ };
43459
+ confirmation: {
43460
+ version: number;
43461
+ list_hash: string;
43462
+ /** @description `user_…` (a verified person) or `api_key:<key id>`. */
43463
+ confirmed_by: string;
43464
+ confirmed_at: string;
43465
+ mandate_id: string;
43466
+ } | null;
43467
+ items: {
43468
+ /** @description `pbl_` + 16 characters: the payable's id, derived from the batch and the item's content. */
43469
+ item_id: string;
43470
+ /** @description Display order. Not part of the identity: reordering never makes another item. */
43471
+ position: number;
43472
+ origin: {
43473
+ file_id: string | null;
43474
+ page: number | null;
43475
+ row: number | null;
43476
+ /** @enum {string} */
43477
+ kind: "boleto_line" | "br_code" | "pix_key" | "qr_image" | "barcode_image" | "csv_row" | "manual";
43478
+ };
43479
+ /** @enum {string|null} */
43480
+ rail: "boleto" | "pix" | null;
43481
+ /** @enum {string} */
43482
+ state: "needs_complement" | "resolving" | "ready" | "excluded" | "rejected" | "dispatching" | "executed" | "refused" | "uncertain";
43483
+ missing: ("amount" | "destination" | "pix_key_owner_confirmation")[];
43484
+ destination: {
43485
+ /** @enum {string} */
43486
+ kind: "boleto" | "pix_key" | "br_code_static" | "br_code_dynamic";
43487
+ /** @description The boleto line or the Pix key, masked. */
43488
+ display: string;
43489
+ /** @description From the rail (the boleto registration, the DICT owner); never from the document. */
43490
+ beneficiary_name: string | null;
43491
+ /** @description From the rail, masked. */
43492
+ beneficiary_document_masked: string | null;
43493
+ /** @description YYYY-MM-DD from the rail, or null. */
43494
+ due_date: string | null;
43495
+ } | null;
43496
+ amount_minor: number | null;
43497
+ /** @enum {string|null} */
43498
+ amount_source: "rail_quote" | "br_code" | "stated_by_person" | "csv" | null;
43499
+ description: string | null;
43500
+ reference: string | null;
43501
+ checks: {
43502
+ /** @enum {string} */
43503
+ code: "carrier_check_digits" | "duplicate_in_batch" | "duplicate_document" | "amount_matches_rail" | "due_date_state" | "pix_key_resolved";
43504
+ /** @enum {string} */
43505
+ status: "pass" | "fail" | "warn";
43506
+ message: string;
43507
+ /** @description True when a test project's own responder answered the consult behind this check, not the rail. */
43508
+ simulated?: boolean;
43509
+ }[];
43510
+ payment: {
43511
+ /** @enum {string} */
43512
+ state: "executed" | "refused" | "uncertain";
43513
+ attempt_id: string | null;
43514
+ receipt_id: string | null;
43515
+ end_to_end_id: string | null;
43516
+ refusal: {
43517
+ code: string;
43518
+ message: string;
43519
+ } | null;
43520
+ } | null;
43521
+ }[];
43522
+ created_at: string;
43523
+ /** @enum {string} */
43524
+ source: "api" | "chat" | "dashboard" | "cli" | "mcp";
43525
+ conversation_id: string | null;
43526
+ };
43527
+ };
43528
+ };
43529
+ /** @description No batch with this id in this project. */
43530
+ 404: {
43531
+ headers: {
43532
+ [name: string]: unknown;
43533
+ };
43534
+ content: {
43535
+ "application/json": {
43536
+ error: {
43537
+ /** @enum {string} */
43538
+ code: "payable_batch_not_found";
43539
+ message: string;
43540
+ details?: {
43541
+ [key: string]: unknown;
43542
+ };
43543
+ };
43544
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
43545
+ request_id: string | null;
43546
+ };
43547
+ };
43548
+ };
43549
+ };
43550
+ };
43551
+ put?: never;
43552
+ post?: never;
43553
+ delete?: never;
43554
+ options?: never;
43555
+ head?: never;
43556
+ patch?: never;
43557
+ trace?: never;
43558
+ };
43559
+ "/v1/payables/batches/{batchId}/items/{itemId}": {
43560
+ parameters: {
43561
+ query?: never;
43562
+ header?: never;
43563
+ path?: never;
43564
+ cookie?: never;
43565
+ };
43566
+ get?: never;
43567
+ put?: never;
43568
+ post?: never;
43569
+ delete?: never;
43570
+ options?: never;
43571
+ head?: never;
43572
+ /**
43573
+ * Complement, correct or exclude one item
43574
+ * @description Re-resolves the item's destination on the rail, re-runs its checks, keeps every other item as it is and bumps `version`. A correction of the carrier is a new carrier for the same item.
43575
+ *
43576
+ * **The confirmation binds to the list.** `version` bumps on every change and `list_hash` is the SHA-256 of the canonical list (each non-excluded item in `item_id` order as `item_id|rail|destination id|amount_minor|currency`, then the total). Any change after a confirmation needs a new one.
43577
+ *
43578
+ * Scope: `payables:write`.
43579
+ */
43580
+ patch: {
43581
+ parameters: {
43582
+ query?: never;
43583
+ header?: never;
43584
+ path: {
43585
+ batchId: string;
43586
+ /** @description `pbl_` followed by 16 characters. */
43587
+ itemId: string;
43588
+ };
43589
+ cookie?: never;
43590
+ };
43591
+ requestBody?: {
43592
+ content: {
43593
+ "application/json": {
43594
+ expected_version: number;
43595
+ amount_minor?: number;
43596
+ pix_key?: string;
43597
+ boleto_line?: string;
43598
+ br_code?: string;
43599
+ description?: string;
43600
+ excluded?: boolean;
43601
+ };
43602
+ };
43603
+ };
43604
+ responses: {
43605
+ /** @description OK */
43606
+ 200: {
43607
+ headers: {
43608
+ [name: string]: unknown;
43609
+ };
43610
+ content: {
43611
+ "application/json": {
43612
+ /** @description `pbat_` followed by 20 characters. */
43613
+ batch_id: string;
43614
+ /** @enum {string} */
43615
+ status: "reviewing" | "ready" | "confirmed" | "executing" | "completed" | "partially_completed" | "failed" | "canceled";
43616
+ /** @description Bumps on every change to the list. A confirmation binds to one version. */
43617
+ version: number;
43618
+ /** @description SHA-256 over the canonical list: for each non-excluded item in `item_id` order `item_id|rail|destination id|amount_minor|currency`, then the total. Send it back on pay. */
43619
+ list_hash: string;
43620
+ /** @enum {string} */
43621
+ currency: "BRL";
43622
+ totals: {
43623
+ items: number;
43624
+ payable_items: number;
43625
+ excluded: number;
43626
+ amount_minor: number;
43627
+ };
43628
+ confirmation: {
43629
+ version: number;
43630
+ list_hash: string;
43631
+ /** @description `user_…` (a verified person) or `api_key:<key id>`. */
43632
+ confirmed_by: string;
43633
+ confirmed_at: string;
43634
+ mandate_id: string;
43635
+ } | null;
43636
+ items: {
43637
+ /** @description `pbl_` + 16 characters: the payable's id, derived from the batch and the item's content. */
43638
+ item_id: string;
43639
+ /** @description Display order. Not part of the identity: reordering never makes another item. */
43640
+ position: number;
43641
+ origin: {
43642
+ file_id: string | null;
43643
+ page: number | null;
43644
+ row: number | null;
43645
+ /** @enum {string} */
43646
+ kind: "boleto_line" | "br_code" | "pix_key" | "qr_image" | "barcode_image" | "csv_row" | "manual";
43647
+ };
43648
+ /** @enum {string|null} */
43649
+ rail: "boleto" | "pix" | null;
43650
+ /** @enum {string} */
43651
+ state: "needs_complement" | "resolving" | "ready" | "excluded" | "rejected" | "dispatching" | "executed" | "refused" | "uncertain";
43652
+ missing: ("amount" | "destination" | "pix_key_owner_confirmation")[];
43653
+ destination: {
43654
+ /** @enum {string} */
43655
+ kind: "boleto" | "pix_key" | "br_code_static" | "br_code_dynamic";
43656
+ /** @description The boleto line or the Pix key, masked. */
43657
+ display: string;
43658
+ /** @description From the rail (the boleto registration, the DICT owner); never from the document. */
43659
+ beneficiary_name: string | null;
43660
+ /** @description From the rail, masked. */
43661
+ beneficiary_document_masked: string | null;
43662
+ /** @description YYYY-MM-DD from the rail, or null. */
43663
+ due_date: string | null;
43664
+ } | null;
43665
+ amount_minor: number | null;
43666
+ /** @enum {string|null} */
43667
+ amount_source: "rail_quote" | "br_code" | "stated_by_person" | "csv" | null;
43668
+ description: string | null;
43669
+ reference: string | null;
43670
+ checks: {
43671
+ /** @enum {string} */
43672
+ code: "carrier_check_digits" | "duplicate_in_batch" | "duplicate_document" | "amount_matches_rail" | "due_date_state" | "pix_key_resolved";
43673
+ /** @enum {string} */
43674
+ status: "pass" | "fail" | "warn";
43675
+ message: string;
43676
+ /** @description True when a test project's own responder answered the consult behind this check, not the rail. */
43677
+ simulated?: boolean;
43678
+ }[];
43679
+ payment: {
43680
+ /** @enum {string} */
43681
+ state: "executed" | "refused" | "uncertain";
43682
+ attempt_id: string | null;
43683
+ receipt_id: string | null;
43684
+ end_to_end_id: string | null;
43685
+ refusal: {
43686
+ code: string;
43687
+ message: string;
43688
+ } | null;
43689
+ } | null;
43690
+ }[];
43691
+ created_at: string;
43692
+ /** @enum {string} */
43693
+ source: "api" | "chat" | "dashboard" | "cli" | "mcp";
43694
+ conversation_id: string | null;
43695
+ };
43696
+ };
43697
+ };
43698
+ /** @description The body did not match the schema. */
43699
+ 400: {
43700
+ headers: {
43701
+ [name: string]: unknown;
43702
+ };
43703
+ content: {
43704
+ "application/json": {
43705
+ error: {
43706
+ /** @enum {string} */
43707
+ code: "invalid_body";
43708
+ message: string;
43709
+ details?: {
43710
+ [key: string]: unknown;
43711
+ };
43712
+ };
43713
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
43714
+ request_id: string | null;
43715
+ };
43716
+ };
43717
+ };
43718
+ /** @description No such batch or item in this project. */
43719
+ 404: {
43720
+ headers: {
43721
+ [name: string]: unknown;
43722
+ };
43723
+ content: {
43724
+ "application/json": {
43725
+ error: {
43726
+ /** @enum {string} */
43727
+ code: "payable_batch_not_found" | "payable_batch_item_not_found";
43728
+ message: string;
43729
+ details?: {
43730
+ [key: string]: unknown;
43731
+ };
43732
+ };
43733
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
43734
+ request_id: string | null;
43735
+ };
43736
+ };
43737
+ };
43738
+ /** @description `payable_batch_version_conflict`: `expected_version` is stale; `details.batch` is the current batch. `payable_batch_locked`: the batch was confirmed. */
43739
+ 409: {
43740
+ headers: {
43741
+ [name: string]: unknown;
43742
+ };
43743
+ content: {
43744
+ "application/json": {
43745
+ error: {
43746
+ /** @enum {string} */
43747
+ code: "payable_batch_version_conflict" | "payable_batch_locked";
43748
+ message: string;
43749
+ details?: {
43750
+ [key: string]: unknown;
43751
+ };
43752
+ };
43753
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
43754
+ request_id: string | null;
43755
+ };
43756
+ };
43757
+ };
43758
+ /** @description The correction does not fit this item. */
43759
+ 422: {
43760
+ headers: {
43761
+ [name: string]: unknown;
43762
+ };
43763
+ content: {
43764
+ "application/json": {
43765
+ error: {
43766
+ /** @enum {string} */
43767
+ code: "payable_batch_item_invalid";
43768
+ message: string;
43769
+ details?: {
43770
+ [key: string]: unknown;
43771
+ };
43772
+ };
43773
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
43774
+ request_id: string | null;
43775
+ };
43776
+ };
43777
+ };
43778
+ };
43779
+ };
43780
+ trace?: never;
43781
+ };
43782
+ "/v1/payables/batches/{batchId}/items": {
43783
+ parameters: {
43784
+ query?: never;
43785
+ header?: never;
43786
+ path?: never;
43787
+ cookie?: never;
43788
+ };
43789
+ get?: never;
43790
+ put?: never;
43791
+ /**
43792
+ * Add files or items to an open batch
43793
+ * @description Same rules as creating: every new item is resolved on the rail; `version` bumps.
43794
+ *
43795
+ * Scope: `payables:write`.
43796
+ */
43797
+ post: {
43798
+ parameters: {
43799
+ query?: never;
43800
+ header?: never;
43801
+ path: {
43802
+ batchId: string;
43803
+ };
43804
+ cookie?: never;
43805
+ };
43806
+ requestBody?: {
43807
+ content: {
43808
+ "application/json": {
43809
+ expected_version: number;
43810
+ file_ids?: string[];
43811
+ items?: {
43812
+ /** @description A Pix key: CPF, CNPJ, e-mail, +55 phone or random (EVP). */
43813
+ pix_key?: string;
43814
+ /** @description A boleto's digitable line (47 or 48 digits) or barcode (44). */
43815
+ boleto_line?: string;
43816
+ /** @description A Pix copia-e-cola (BR Code, `000201…`). */
43817
+ br_code?: string;
43818
+ /** @description The amount the person states, in centavos. Required for a bare Pix key; ignored where the rail names the amount. */
43819
+ amount_minor?: number;
43820
+ description?: string;
43821
+ /** @description The caller's own reference; part of the item's identity. */
43822
+ reference?: string;
43823
+ }[];
43824
+ };
43825
+ };
43826
+ };
43827
+ responses: {
43828
+ /** @description OK */
43829
+ 200: {
43830
+ headers: {
43831
+ [name: string]: unknown;
43832
+ };
43833
+ content: {
43834
+ "application/json": {
43835
+ /** @description `pbat_` followed by 20 characters. */
43836
+ batch_id: string;
43837
+ /** @enum {string} */
43838
+ status: "reviewing" | "ready" | "confirmed" | "executing" | "completed" | "partially_completed" | "failed" | "canceled";
43839
+ /** @description Bumps on every change to the list. A confirmation binds to one version. */
43840
+ version: number;
43841
+ /** @description SHA-256 over the canonical list: for each non-excluded item in `item_id` order `item_id|rail|destination id|amount_minor|currency`, then the total. Send it back on pay. */
43842
+ list_hash: string;
43843
+ /** @enum {string} */
43844
+ currency: "BRL";
43845
+ totals: {
43846
+ items: number;
43847
+ payable_items: number;
43848
+ excluded: number;
43849
+ amount_minor: number;
43850
+ };
43851
+ confirmation: {
43852
+ version: number;
43853
+ list_hash: string;
43854
+ /** @description `user_…` (a verified person) or `api_key:<key id>`. */
43855
+ confirmed_by: string;
43856
+ confirmed_at: string;
43857
+ mandate_id: string;
43858
+ } | null;
43859
+ items: {
43860
+ /** @description `pbl_` + 16 characters: the payable's id, derived from the batch and the item's content. */
43861
+ item_id: string;
43862
+ /** @description Display order. Not part of the identity: reordering never makes another item. */
43863
+ position: number;
43864
+ origin: {
43865
+ file_id: string | null;
43866
+ page: number | null;
43867
+ row: number | null;
43868
+ /** @enum {string} */
43869
+ kind: "boleto_line" | "br_code" | "pix_key" | "qr_image" | "barcode_image" | "csv_row" | "manual";
43870
+ };
43871
+ /** @enum {string|null} */
43872
+ rail: "boleto" | "pix" | null;
43873
+ /** @enum {string} */
43874
+ state: "needs_complement" | "resolving" | "ready" | "excluded" | "rejected" | "dispatching" | "executed" | "refused" | "uncertain";
43875
+ missing: ("amount" | "destination" | "pix_key_owner_confirmation")[];
43876
+ destination: {
43877
+ /** @enum {string} */
43878
+ kind: "boleto" | "pix_key" | "br_code_static" | "br_code_dynamic";
43879
+ /** @description The boleto line or the Pix key, masked. */
43880
+ display: string;
43881
+ /** @description From the rail (the boleto registration, the DICT owner); never from the document. */
43882
+ beneficiary_name: string | null;
43883
+ /** @description From the rail, masked. */
43884
+ beneficiary_document_masked: string | null;
43885
+ /** @description YYYY-MM-DD from the rail, or null. */
43886
+ due_date: string | null;
43887
+ } | null;
43888
+ amount_minor: number | null;
43889
+ /** @enum {string|null} */
43890
+ amount_source: "rail_quote" | "br_code" | "stated_by_person" | "csv" | null;
43891
+ description: string | null;
43892
+ reference: string | null;
43893
+ checks: {
43894
+ /** @enum {string} */
43895
+ code: "carrier_check_digits" | "duplicate_in_batch" | "duplicate_document" | "amount_matches_rail" | "due_date_state" | "pix_key_resolved";
43896
+ /** @enum {string} */
43897
+ status: "pass" | "fail" | "warn";
43898
+ message: string;
43899
+ /** @description True when a test project's own responder answered the consult behind this check, not the rail. */
43900
+ simulated?: boolean;
43901
+ }[];
43902
+ payment: {
43903
+ /** @enum {string} */
43904
+ state: "executed" | "refused" | "uncertain";
43905
+ attempt_id: string | null;
43906
+ receipt_id: string | null;
43907
+ end_to_end_id: string | null;
43908
+ refusal: {
43909
+ code: string;
43910
+ message: string;
43911
+ } | null;
43912
+ } | null;
43913
+ }[];
43914
+ created_at: string;
43915
+ /** @enum {string} */
43916
+ source: "api" | "chat" | "dashboard" | "cli" | "mcp";
43917
+ conversation_id: string | null;
43918
+ };
43919
+ };
43920
+ };
43921
+ /** @description The body did not match, or nothing to add. */
43922
+ 400: {
43923
+ headers: {
43924
+ [name: string]: unknown;
43925
+ };
43926
+ content: {
43927
+ "application/json": {
43928
+ error: {
43929
+ /** @enum {string} */
43930
+ code: "invalid_body" | "payable_batch_empty";
43931
+ message: string;
43932
+ details?: {
43933
+ [key: string]: unknown;
43934
+ };
43935
+ };
43936
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
43937
+ request_id: string | null;
43938
+ };
43939
+ };
43940
+ };
43941
+ /** @description No batch with this id in this project. */
43942
+ 404: {
43943
+ headers: {
43944
+ [name: string]: unknown;
43945
+ };
43946
+ content: {
43947
+ "application/json": {
43948
+ error: {
43949
+ /** @enum {string} */
43950
+ code: "payable_batch_not_found";
43951
+ message: string;
43952
+ details?: {
43953
+ [key: string]: unknown;
43954
+ };
43955
+ };
43956
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
43957
+ request_id: string | null;
43958
+ };
43959
+ };
43960
+ };
43961
+ /** @description Stale `expected_version` (current batch in `details.batch`), or the batch was confirmed. */
43962
+ 409: {
43963
+ headers: {
43964
+ [name: string]: unknown;
43965
+ };
43966
+ content: {
43967
+ "application/json": {
43968
+ error: {
43969
+ /** @enum {string} */
43970
+ code: "payable_batch_version_conflict" | "payable_batch_locked";
43971
+ message: string;
43972
+ details?: {
43973
+ [key: string]: unknown;
43974
+ };
43975
+ };
43976
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
43977
+ request_id: string | null;
43978
+ };
43979
+ };
43980
+ };
43981
+ /** @description A `file_id` that is not an unexpired file of this project, or the batch would pass 20 files / 500 items. */
43982
+ 422: {
43983
+ headers: {
43984
+ [name: string]: unknown;
43985
+ };
43986
+ content: {
43987
+ "application/json": {
43988
+ error: {
43989
+ /** @enum {string} */
43990
+ code: "payable_file_not_found" | "payable_batch_too_large";
43991
+ message: string;
43992
+ details?: {
43993
+ [key: string]: unknown;
43994
+ };
43995
+ };
43996
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
43997
+ request_id: string | null;
43998
+ };
43999
+ };
44000
+ };
44001
+ };
44002
+ };
44003
+ delete?: never;
44004
+ options?: never;
44005
+ head?: never;
44006
+ patch?: never;
44007
+ trace?: never;
44008
+ };
44009
+ "/v1/payables/batches/{batchId}/pay": {
44010
+ parameters: {
44011
+ query?: never;
44012
+ header?: never;
44013
+ path?: never;
44014
+ cookie?: never;
44015
+ };
44016
+ get?: never;
44017
+ put?: never;
44018
+ /**
44019
+ * Confirm the exact list and pay it
44020
+ * @description Records the confirmation (version, hash, who, mandate) and pays every payable item through the governed consumer-payment cycle: mandate verification, policy, caps under lock, hold, dispatch with uncertainty classification and a sealed receipt. Each item gets its own `payment`: an item refused by the mandate, a policy or funds is `refused` with the code and does not stop the others.
44021
+ *
44022
+ * **Who confirms.** A verified person through the dashboard (the decide gate, enforcement on), or an API key with `payables:pay` and a `mandate_id` of this organization.
44023
+ *
44024
+ * **Resume, never pay twice.** A later call with the same `version` and `list_hash` resumes: executed items are returned as they are, an `uncertain` item is looked up on the payment's own record first and never resent, and only items never dispatched are dispatched. Two concurrent calls claim items with a conditional update, so an item is dispatched at most once. The attempt id is derived from the item and its quote, so the same item at the same quote is the same attempt, hold and receipt.
44025
+ *
44026
+ * **The rail is consulted again** before each dispatch; an answer that is not the confirmed one is `refused` with `payable_quote_diverged` and nothing is sent. A large batch may answer with `status: executing` after about 20 seconds: repeat the same call (same `version` and `list_hash`) to continue with the items never dispatched; `GET` shows progress.
44027
+ *
44028
+ * `Idempotency-Key` is required.
44029
+ *
44030
+ * Scope: `payables:pay`.
44031
+ */
44032
+ post: {
44033
+ parameters: {
44034
+ query?: never;
44035
+ header: {
44036
+ "Idempotency-Key": string;
44037
+ };
44038
+ path: {
44039
+ batchId: string;
44040
+ };
44041
+ cookie?: never;
44042
+ };
44043
+ requestBody?: {
44044
+ content: {
44045
+ "application/json": {
44046
+ version: number;
44047
+ list_hash: string;
44048
+ /** @description Required for an API key. A chat batch paid by its person uses the conversation's Shop mandate when absent. */
44049
+ mandate_id?: string;
44050
+ };
44051
+ };
44052
+ };
44053
+ responses: {
44054
+ /** @description OK */
44055
+ 200: {
44056
+ headers: {
44057
+ [name: string]: unknown;
44058
+ };
44059
+ content: {
44060
+ "application/json": {
44061
+ /** @description `pbat_` followed by 20 characters. */
44062
+ batch_id: string;
44063
+ /** @enum {string} */
44064
+ status: "reviewing" | "ready" | "confirmed" | "executing" | "completed" | "partially_completed" | "failed" | "canceled";
44065
+ /** @description Bumps on every change to the list. A confirmation binds to one version. */
44066
+ version: number;
44067
+ /** @description SHA-256 over the canonical list: for each non-excluded item in `item_id` order `item_id|rail|destination id|amount_minor|currency`, then the total. Send it back on pay. */
44068
+ list_hash: string;
44069
+ /** @enum {string} */
44070
+ currency: "BRL";
44071
+ totals: {
44072
+ items: number;
44073
+ payable_items: number;
44074
+ excluded: number;
44075
+ amount_minor: number;
44076
+ };
44077
+ confirmation: {
44078
+ version: number;
44079
+ list_hash: string;
44080
+ /** @description `user_…` (a verified person) or `api_key:<key id>`. */
44081
+ confirmed_by: string;
44082
+ confirmed_at: string;
44083
+ mandate_id: string;
44084
+ } | null;
44085
+ items: {
44086
+ /** @description `pbl_` + 16 characters: the payable's id, derived from the batch and the item's content. */
44087
+ item_id: string;
44088
+ /** @description Display order. Not part of the identity: reordering never makes another item. */
44089
+ position: number;
44090
+ origin: {
44091
+ file_id: string | null;
44092
+ page: number | null;
44093
+ row: number | null;
44094
+ /** @enum {string} */
44095
+ kind: "boleto_line" | "br_code" | "pix_key" | "qr_image" | "barcode_image" | "csv_row" | "manual";
44096
+ };
44097
+ /** @enum {string|null} */
44098
+ rail: "boleto" | "pix" | null;
44099
+ /** @enum {string} */
44100
+ state: "needs_complement" | "resolving" | "ready" | "excluded" | "rejected" | "dispatching" | "executed" | "refused" | "uncertain";
44101
+ missing: ("amount" | "destination" | "pix_key_owner_confirmation")[];
44102
+ destination: {
44103
+ /** @enum {string} */
44104
+ kind: "boleto" | "pix_key" | "br_code_static" | "br_code_dynamic";
44105
+ /** @description The boleto line or the Pix key, masked. */
44106
+ display: string;
44107
+ /** @description From the rail (the boleto registration, the DICT owner); never from the document. */
44108
+ beneficiary_name: string | null;
44109
+ /** @description From the rail, masked. */
44110
+ beneficiary_document_masked: string | null;
44111
+ /** @description YYYY-MM-DD from the rail, or null. */
44112
+ due_date: string | null;
44113
+ } | null;
44114
+ amount_minor: number | null;
44115
+ /** @enum {string|null} */
44116
+ amount_source: "rail_quote" | "br_code" | "stated_by_person" | "csv" | null;
44117
+ description: string | null;
44118
+ reference: string | null;
44119
+ checks: {
44120
+ /** @enum {string} */
44121
+ code: "carrier_check_digits" | "duplicate_in_batch" | "duplicate_document" | "amount_matches_rail" | "due_date_state" | "pix_key_resolved";
44122
+ /** @enum {string} */
44123
+ status: "pass" | "fail" | "warn";
44124
+ message: string;
44125
+ /** @description True when a test project's own responder answered the consult behind this check, not the rail. */
44126
+ simulated?: boolean;
44127
+ }[];
44128
+ payment: {
44129
+ /** @enum {string} */
44130
+ state: "executed" | "refused" | "uncertain";
44131
+ attempt_id: string | null;
44132
+ receipt_id: string | null;
44133
+ end_to_end_id: string | null;
44134
+ refusal: {
44135
+ code: string;
44136
+ message: string;
44137
+ } | null;
44138
+ } | null;
44139
+ }[];
44140
+ created_at: string;
44141
+ /** @enum {string} */
44142
+ source: "api" | "chat" | "dashboard" | "cli" | "mcp";
44143
+ conversation_id: string | null;
44144
+ };
44145
+ };
44146
+ };
44147
+ /** @description The body did not match, or the Idempotency-Key is missing. */
44148
+ 400: {
44149
+ headers: {
44150
+ [name: string]: unknown;
44151
+ };
44152
+ content: {
44153
+ "application/json": {
44154
+ error: {
44155
+ /** @enum {string} */
44156
+ code: "invalid_body" | "payable_batch_idempotency_key_required" | "invalid_idempotency_key";
44157
+ message: string;
44158
+ details?: {
44159
+ [key: string]: unknown;
44160
+ };
44161
+ };
44162
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
44163
+ request_id: string | null;
44164
+ };
44165
+ };
44166
+ };
44167
+ /** @description The dashboard path confirms only as a verified person: the person's session token is missing, invalid or names someone else. An API key never takes this path; it pays with `payables:pay` and a `mandate_id`. */
44168
+ 403: {
44169
+ headers: {
44170
+ [name: string]: unknown;
44171
+ };
44172
+ content: {
44173
+ "application/json": {
44174
+ error: {
44175
+ /** @enum {string} */
44176
+ code: "user_token_required" | "user_token_invalid" | "user_token_identity_mismatch";
44177
+ message: string;
44178
+ details?: {
44179
+ [key: string]: unknown;
44180
+ };
44181
+ };
44182
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
44183
+ request_id: string | null;
44184
+ };
44185
+ };
44186
+ };
44187
+ /** @description No batch with this id in this project, or no such mandate in this organization. */
44188
+ 404: {
44189
+ headers: {
44190
+ [name: string]: unknown;
44191
+ };
44192
+ content: {
44193
+ "application/json": {
44194
+ error: {
44195
+ /** @enum {string} */
44196
+ code: "payable_batch_not_found" | "mandate_not_found";
44197
+ message: string;
44198
+ details?: {
44199
+ [key: string]: unknown;
44200
+ };
44201
+ };
44202
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
44203
+ request_id: string | null;
44204
+ };
44205
+ };
44206
+ };
44207
+ /** @description `version`/`list_hash` are not the current list's; `details.batch` is the current batch. */
44208
+ 409: {
44209
+ headers: {
44210
+ [name: string]: unknown;
44211
+ };
44212
+ content: {
44213
+ "application/json": {
44214
+ error: {
44215
+ /** @enum {string} */
44216
+ code: "payable_batch_version_mismatch";
44217
+ message: string;
44218
+ details?: {
44219
+ [key: string]: unknown;
44220
+ };
44221
+ };
44222
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
44223
+ request_id: string | null;
44224
+ };
44225
+ };
44226
+ };
44227
+ /** @description `payable_batch_not_ready`: a non-excluded item is not `ready` (`details.items`). `payable_batch_mandate_required`: an API key named no `mandate_id`. `payable_batch_mandate_unavailable`: the conversation has no Shop mandate to pay under. */
44228
+ 422: {
44229
+ headers: {
44230
+ [name: string]: unknown;
44231
+ };
44232
+ content: {
44233
+ "application/json": {
44234
+ error: {
44235
+ /** @enum {string} */
44236
+ code: "payable_batch_not_ready" | "payable_batch_mandate_required" | "payable_batch_mandate_unavailable";
44237
+ message: string;
44238
+ details?: {
44239
+ [key: string]: unknown;
44240
+ };
44241
+ };
44242
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
44243
+ request_id: string | null;
44244
+ };
44245
+ };
44246
+ };
44247
+ };
44248
+ };
44249
+ delete?: never;
44250
+ options?: never;
44251
+ head?: never;
44252
+ patch?: never;
44253
+ trace?: never;
44254
+ };
44255
+ "/v1/shop/agent/purchases": {
44256
+ parameters: {
44257
+ query?: never;
44258
+ header?: never;
44259
+ path?: never;
44260
+ cookie?: never;
44261
+ };
44262
+ get?: never;
44263
+ put?: never;
44264
+ /**
44265
+ * Propose a purchase at a supported store (never an order)
44266
+ * @description Scope `shop:purchases:write`. The store, its origin and its prices come from the server's registry and the store's own catalog, never from the request. The same `agent_id` and `idempotency_key` with the same intent answers the same purchase (`idempotent_replay: true`).
44267
+ *
44268
+ * **What an assistant can and cannot do.** It proposes a purchase and reads where it stands; it never pays, approves, saves a card or logs in at a store. A verified person presses Pagar on the dashboard and completes what the purchase waits for (the protected card or CVV form, the store login); the purchase then runs through the same executor as the Shop's own chat, at most once at the store. No answer carries a card number, a security code, a cookie or a collect secret. Test projects only in this first delivery; behind `SHOP_PURCHASES_ENABLED`.
44269
+ */
44270
+ post: {
44271
+ parameters: {
44272
+ query?: never;
44273
+ header?: never;
44274
+ path?: never;
44275
+ cookie?: never;
44276
+ };
44277
+ requestBody?: {
44278
+ content: {
44279
+ "application/json": {
44280
+ agent_id: string;
44281
+ merchant: string;
44282
+ items: {
44283
+ sku_id: string;
44284
+ quantity: number;
44285
+ }[];
44286
+ /**
44287
+ * @default card
44288
+ * @enum {string}
44289
+ */
44290
+ payment_method?: "card" | "store_on_file";
44291
+ idempotency_key: string;
44292
+ };
44293
+ };
44294
+ };
44295
+ responses: {
44296
+ /** @description OK */
44297
+ 200: {
44298
+ headers: {
44299
+ [name: string]: unknown;
44300
+ };
44301
+ content: {
44302
+ "application/json": {
44303
+ purchase: {
44304
+ /** @description The purchase proposal id (`prp_...`). */
44305
+ id: string;
44306
+ /** @enum {string} */
44307
+ kind: "purchase";
44308
+ /** @enum {string} */
44309
+ state: "drafted" | "awaiting_approval" | "executing" | "succeeded" | "failed" | "denied";
44310
+ /** @enum {string} */
44311
+ run_state: "ready" | "awaiting_user" | "running" | "interrupted" | "completed" | "cancelled";
44312
+ awaiting: {
44313
+ /** @enum {string} */
44314
+ reason: "instrument" | "store_login" | "cvv" | "approval" | "challenge";
44315
+ } | null;
44316
+ merchant: {
44317
+ id: string;
44318
+ name: string;
44319
+ };
44320
+ items: {
44321
+ sku_id: string;
44322
+ name: string;
44323
+ quantity: number;
44324
+ unit_price_minor: number;
44325
+ }[];
44326
+ total_minor: number;
44327
+ /** @enum {string} */
44328
+ currency: "BRL";
44329
+ /** @enum {string} */
44330
+ payment_method: "card" | "store_on_file";
44331
+ order: {
44332
+ id: string | null;
44333
+ status: string | null;
44334
+ amount_minor: number | null;
44335
+ } | null;
44336
+ receipt: {
44337
+ /** @enum {string} */
44338
+ funding_origin: "external_card" | "store_on_file";
44339
+ /** @enum {boolean} */
44340
+ wallet_debit: false;
44341
+ } | null;
44342
+ failure: {
44343
+ code: string;
44344
+ } | null;
44345
+ next_action: string | null;
44346
+ };
44347
+ /** @description The proposal card as the dashboard shows it. */
44348
+ proposal: {
44349
+ [key: string]: unknown;
44350
+ } | null;
44351
+ idempotent_replay: boolean;
44352
+ };
44353
+ };
44354
+ };
44355
+ /** @description OK */
44356
+ 201: {
44357
+ headers: {
44358
+ [name: string]: unknown;
44359
+ };
44360
+ content: {
44361
+ "application/json": {
44362
+ purchase: {
44363
+ /** @description The purchase proposal id (`prp_...`). */
44364
+ id: string;
44365
+ /** @enum {string} */
44366
+ kind: "purchase";
44367
+ /** @enum {string} */
44368
+ state: "drafted" | "awaiting_approval" | "executing" | "succeeded" | "failed" | "denied";
44369
+ /** @enum {string} */
44370
+ run_state: "ready" | "awaiting_user" | "running" | "interrupted" | "completed" | "cancelled";
44371
+ awaiting: {
44372
+ /** @enum {string} */
44373
+ reason: "instrument" | "store_login" | "cvv" | "approval" | "challenge";
44374
+ } | null;
44375
+ merchant: {
44376
+ id: string;
44377
+ name: string;
44378
+ };
44379
+ items: {
44380
+ sku_id: string;
44381
+ name: string;
44382
+ quantity: number;
44383
+ unit_price_minor: number;
44384
+ }[];
44385
+ total_minor: number;
44386
+ /** @enum {string} */
44387
+ currency: "BRL";
44388
+ /** @enum {string} */
44389
+ payment_method: "card" | "store_on_file";
44390
+ order: {
44391
+ id: string | null;
44392
+ status: string | null;
44393
+ amount_minor: number | null;
44394
+ } | null;
44395
+ receipt: {
44396
+ /** @enum {string} */
44397
+ funding_origin: "external_card" | "store_on_file";
44398
+ /** @enum {boolean} */
44399
+ wallet_debit: false;
44400
+ } | null;
44401
+ failure: {
44402
+ code: string;
44403
+ } | null;
44404
+ next_action: string | null;
44405
+ };
44406
+ /** @description The proposal card as the dashboard shows it. */
44407
+ proposal: {
44408
+ [key: string]: unknown;
44409
+ } | null;
44410
+ idempotent_replay: boolean;
44411
+ };
44412
+ };
44413
+ };
44414
+ /** @description The body did not match the schema. */
44415
+ 400: {
44416
+ headers: {
44417
+ [name: string]: unknown;
44418
+ };
44419
+ content: {
44420
+ "application/json": {
44421
+ error: {
44422
+ /** @enum {string} */
44423
+ code: "invalid_body";
44424
+ message: string;
44425
+ details?: {
44426
+ [key: string]: unknown;
44427
+ };
44428
+ };
44429
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
44430
+ request_id: string | null;
44431
+ };
44432
+ };
44433
+ };
44434
+ /** @description The key does not hold `shop:purchases:write`. */
44435
+ 403: {
44436
+ headers: {
44437
+ [name: string]: unknown;
44438
+ };
44439
+ content: {
44440
+ "application/json": {
44441
+ error: {
44442
+ code: string;
44443
+ message: string;
44444
+ details?: {
44445
+ [key: string]: unknown;
44446
+ };
44447
+ };
44448
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
44449
+ request_id: string | null;
44450
+ };
44451
+ };
44452
+ };
44453
+ /** @description No mandate permits the store, or the project is not Test. */
44454
+ 409: {
44455
+ headers: {
44456
+ [name: string]: unknown;
44457
+ };
44458
+ content: {
44459
+ "application/json": {
44460
+ error: {
44461
+ /** @enum {string} */
44462
+ code: "proposal_no_mandate" | "purchase_merchant_unsupported";
44463
+ message: string;
44464
+ details?: {
44465
+ [key: string]: unknown;
44466
+ };
44467
+ };
44468
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
44469
+ request_id: string | null;
44470
+ };
44471
+ };
44472
+ };
44473
+ /** @description The agent, the store, the rail or an item is not one that can be bought. */
44474
+ 422: {
44475
+ headers: {
44476
+ [name: string]: unknown;
44477
+ };
44478
+ content: {
44479
+ "application/json": {
44480
+ error: {
44481
+ code: string;
44482
+ message: string;
44483
+ details?: {
44484
+ [key: string]: unknown;
44485
+ };
44486
+ };
44487
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
44488
+ request_id: string | null;
44489
+ };
44490
+ };
44491
+ };
44492
+ /** @description Shop purchases are off on this deployment. */
44493
+ 503: {
44494
+ headers: {
44495
+ [name: string]: unknown;
44496
+ };
44497
+ content: {
44498
+ "application/json": {
44499
+ error: {
44500
+ /** @enum {string} */
44501
+ code: "shop_purchases_disabled";
44502
+ message: string;
44503
+ details?: {
44504
+ [key: string]: unknown;
44505
+ };
44506
+ };
44507
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
44508
+ request_id: string | null;
44509
+ };
44510
+ };
44511
+ };
44512
+ };
44513
+ };
44514
+ delete?: never;
44515
+ options?: never;
44516
+ head?: never;
44517
+ patch?: never;
44518
+ trace?: never;
44519
+ };
44520
+ "/v1/shop/agent/purchases/{id}": {
44521
+ parameters: {
44522
+ query?: never;
44523
+ header?: never;
44524
+ path?: never;
44525
+ cookie?: never;
44526
+ };
44527
+ /**
44528
+ * Where a purchase stands
44529
+ * @description Scope `shop:purchases:read`. References and states only: the order the store answered, a receipt marked as external (no Wallet debit), what it waits for.
44530
+ *
44531
+ * **What an assistant can and cannot do.** It proposes a purchase and reads where it stands; it never pays, approves, saves a card or logs in at a store. A verified person presses Pagar on the dashboard and completes what the purchase waits for (the protected card or CVV form, the store login); the purchase then runs through the same executor as the Shop's own chat, at most once at the store. No answer carries a card number, a security code, a cookie or a collect secret. Test projects only in this first delivery; behind `SHOP_PURCHASES_ENABLED`.
44532
+ */
44533
+ get: {
44534
+ parameters: {
44535
+ query?: never;
44536
+ header?: never;
44537
+ path: {
44538
+ /** @description The purchase proposal id (`prp_...`), from `POST /v1/shop/agent/purchases`. */
44539
+ id: string;
44540
+ };
43088
44541
  cookie?: never;
43089
44542
  };
43090
44543
  requestBody?: never;