Browse documentationBilling boundaries

Resource guide

Billing belongs to the payer

Workspace usage can be visible to members, while payment methods, automatic top-ups, and personal limits and the subscription belong to the designated billing user. A workspace owner may designate another owner as the payer; that does not let the first owner manage the second person's billing.

The payer must remain a live workspace owner. Reassignment, role demotion, and removal are checked inside the same durable mutation, so concurrent administration cannot leave a workspace with an ineligible payer. The audit log records each sensitive transition.

Request body
{
  "autoTopupEnabled": true,
  "autoTopupThresholdMicroUsd": 5000000,
  "autoTopupAmountMicroUsd": 20000000,
  "maxMonthlySpendMicroUsd": 100000000
}

Workspace storage is a billing setting

Read GET /v1/workspaces/{workspaceSlug}/billing as any workspace member. Its storage projection also appears in the payer's account overview. The grow result names the refusal the payer must resolve before buying more; a growing allowance reports the pending capacity while the VM catches up. Storage is reported in decimal gigabytes, as sold: usableGb is the allowance and usedBytes excludes the space reserved for the system image, never exceeding the allowance. Every workspace in GET /v1/whoami carries the same allowance as usableStorageGb, for a caller that needs no billing read.

The workspace billing PATCH applies payer, cap, then storage atomically. Storage targets are totals: repeating a purchase cannot buy the same allowance twice. Only an active Max subscriber can grow an allowance; a downgraded subscriber keeps paying for storage already bought. Transferring a workspace with extra storage requires a subscribed new payer, who pays subsequent daily charges.

Buy a target allowance
{
  "extraStorageGb": 100
}

Targets step by 100 GB up to 300 GB. A grow restarts the workspace's VM once, for less than a minute, so running work is interrupted; the new space is usable when growingToUsableGb no longer appears.

Extra storage is charged daily from credits. When todayCharged is true before a grow, the increased daily fee starts tomorrow. The purchased disk cannot shrink, and storage cannot be cancelled. A lapsed subscription or a balance at or below the storage floor pauses the workspace. The workspace's servicingPauseReason in GET /v1/whoami, and the pauseReason on a model request's subscription_inactive refusal, say which (subscription or storage). An eligible archived workspace provisions at its full plan plus extra allowance after the payer resubscribes or adds credits.

Keep units explicit

Contract amounts use integer micro-US dollars. Convert only at the display boundary and keep the integer value through calculations so rounding cannot create or erase spend.

Ledger metadata is an internal finite-JSON audit context capped at 16 KiB before storage. Public history deliberately projects only the billing facts it names; it never truncates metadata while paging or returns the private context.

Handle payment blocks as ownership flows

A payment-required response should send the responsible payer to billing settings. Retrying with a different key does not repair an inactive subscription, depleted balance, or monthly cap.

Keep card data on Stripe

Bento creates Stripe-hosted Checkout and Customer Portal sessions. Card entry and payment-method management therefore stay on Stripe's origin; Bento stores only the customer reference needed for webhooks and a readiness timestamp written only after Stripe verifies a successful setup or payment. Opening the Customer Portal creates the Stripe customer if needed; no saved payment method or subscription is required. Creating that customer or canceling Checkout does not verify a payment method or enable automatic top-ups. A card saved in the portal becomes ready when Stripe's customer-update webhook arrives. Successful top-ups still become credits through the idempotent webhook-to-ledger path.

Subscription Checkout accepts a catalog plan name, never a Stripe price reference. Bento resolves the environment-owned price at the server boundary. Upgrades invoice immediately, while downgrades and cancellation take effect at the paid-through boundary. In every case, a verified paid invoice is the only authority that grants a new monthly credit bucket; requesting a plan change never writes credits directly.

The Customer Portal is intentionally narrower than the first-party subscription controls. It owns payment-method updates and invoice history, while Bento owns plan changes so every tier follows the same payer authorization and catalog-price rules.

The /v1/user/billing/* routes accept the same human identity used by the CLI and the dashboard. They act on that person's payer account; holding a workspace owner's role does not let you manage another person's billing. App credentials do not identify a personal payer. MCP sign-in uses the same human-key authority.

Billing

14 operations
GET/v1/workspaces/{workspaceSlug}/billing

Read the workspace payer, monthly spending cap, and storage allowance.

CLI
bento billing get
Scope
workspace_member
Request
No JSON request body
Response
Response JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "payerUserId": {
      "type": "string"
    },
    "monthlyCapMicroUsd": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        {
          "type": "null"
        }
      ]
    },
    "storage": {
      "type": "object",
      "properties": {
        "usableGb": {
          "type": "number"
        },
        "usedBytes": {
          "type": "number"
        },
        "sampledAt": {
          "type": "number"
        },
        "plan": {
          "type": "string",
          "enum": [
            "starter",
            "pro",
            "max"
          ]
        },
        "extraStorageGb": {
          "anyOf": [
            {
              "type": "number",
              "const": 0
            },
            {
              "type": "number",
              "const": 100
            },
            {
              "type": "number",
              "const": 200
            },
            {
              "type": "number",
              "const": 300
            }
          ]
        },
        "growingToUsableGb": {
          "type": "number"
        },
        "dailyFeeMicroUsd": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "monthlyFeeMicroUsd": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "todayCharged": {
          "type": "boolean"
        },
        "next": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "plan"
                },
                "plan": {
                  "type": "string",
                  "enum": [
                    "starter",
                    "pro",
                    "max"
                  ]
                },
                "usableGb": {
                  "type": "number"
                }
              },
              "required": [
                "kind",
                "plan",
                "usableGb"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "extra"
                },
                "usableGb": {
                  "type": "number"
                }
              },
              "required": [
                "kind",
                "usableGb"
              ],
              "additionalProperties": false
            }
          ]
        },
        "grow": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "allowed": {
                  "type": "boolean",
                  "const": true
                }
              },
              "required": [
                "allowed"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "allowed": {
                  "type": "boolean",
                  "const": false
                },
                "refusal": {
                  "type": "string",
                  "enum": [
                    "payer_required",
                    "max_plan_required",
                    "storage_cannot_shrink",
                    "storage_limit_reached",
                    "insufficient_credits",
                    "workspace_paused"
                  ]
                }
              },
              "required": [
                "allowed",
                "refusal"
              ],
              "additionalProperties": false
            }
          ]
        }
      },
      "required": [
        "usableGb",
        "plan",
        "extraStorageGb",
        "dailyFeeMicroUsd",
        "monthlyFeeMicroUsd",
        "todayCharged",
        "grow"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "payerUserId",
    "monthlyCapMicroUsd",
    "storage"
  ],
  "additionalProperties": false
}
Delivery
Standard response
Retry
Not declared idempotent
PATCH/v1/workspaces/{workspaceSlug}/billing

Update the workspace payer, monthly spending cap, and storage allowance.

CLI
bento billing update --body-file request.json
Scope
ws:{workspaceSlug}:admin
Request
Request JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "payerUserId": {
      "type": "string",
      "minLength": 1
    },
    "monthlyCapMicroUsd": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        {
          "type": "null"
        }
      ]
    },
    "extraStorageGb": {
      "anyOf": [
        {
          "type": "number",
          "const": 100
        },
        {
          "type": "number",
          "const": 200
        },
        {
          "type": "number",
          "const": 300
        }
      ]
    }
  },
  "additionalProperties": false
}
Response
Response JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "payerUserId": {
      "type": "string"
    },
    "monthlyCapMicroUsd": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        {
          "type": "null"
        }
      ]
    },
    "storage": {
      "type": "object",
      "properties": {
        "usableGb": {
          "type": "number"
        },
        "usedBytes": {
          "type": "number"
        },
        "sampledAt": {
          "type": "number"
        },
        "plan": {
          "type": "string",
          "enum": [
            "starter",
            "pro",
            "max"
          ]
        },
        "extraStorageGb": {
          "anyOf": [
            {
              "type": "number",
              "const": 0
            },
            {
              "type": "number",
              "const": 100
            },
            {
              "type": "number",
              "const": 200
            },
            {
              "type": "number",
              "const": 300
            }
          ]
        },
        "growingToUsableGb": {
          "type": "number"
        },
        "dailyFeeMicroUsd": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "monthlyFeeMicroUsd": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "todayCharged": {
          "type": "boolean"
        },
        "next": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "plan"
                },
                "plan": {
                  "type": "string",
                  "enum": [
                    "starter",
                    "pro",
                    "max"
                  ]
                },
                "usableGb": {
                  "type": "number"
                }
              },
              "required": [
                "kind",
                "plan",
                "usableGb"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "extra"
                },
                "usableGb": {
                  "type": "number"
                }
              },
              "required": [
                "kind",
                "usableGb"
              ],
              "additionalProperties": false
            }
          ]
        },
        "grow": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "allowed": {
                  "type": "boolean",
                  "const": true
                }
              },
              "required": [
                "allowed"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "allowed": {
                  "type": "boolean",
                  "const": false
                },
                "refusal": {
                  "type": "string",
                  "enum": [
                    "payer_required",
                    "max_plan_required",
                    "storage_cannot_shrink",
                    "storage_limit_reached",
                    "insufficient_credits",
                    "workspace_paused"
                  ]
                }
              },
              "required": [
                "allowed",
                "refusal"
              ],
              "additionalProperties": false
            }
          ]
        }
      },
      "required": [
        "usableGb",
        "plan",
        "extraStorageGb",
        "dailyFeeMicroUsd",
        "monthlyFeeMicroUsd",
        "todayCharged",
        "grow"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "payerUserId",
    "monthlyCapMicroUsd",
    "storage"
  ],
  "additionalProperties": false
}
Errors
Error body JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "anyOf": [
    {
      "type": "object",
      "properties": {
        "error": {
          "anyOf": [
            {
              "type": "string",
              "const": "owner_candidate_required"
            },
            {
              "type": "string",
              "const": "payer_subscription_required"
            }
          ]
        }
      },
      "required": [
        "error"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "error": {
          "type": "string",
          "enum": [
            "payer_required",
            "max_plan_required",
            "storage_cannot_shrink",
            "storage_limit_reached",
            "insufficient_credits",
            "workspace_paused"
          ]
        }
      },
      "required": [
        "error"
      ],
      "additionalProperties": false
    }
  ]
}
Delivery
Standard response
Retry
Not declared idempotent
GET/v1/workspaces/{workspaceSlug}/billing/usage

Read workspace usage grouped over a reporting period.

CLI
bento billing usage get
Scope
workspace_member
Request
No JSON request body
Query
Query parameters JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "period": {
      "default": "monthly",
      "type": "string",
      "enum": [
        "daily",
        "weekly",
        "monthly"
      ]
    },
    "group": {
      "default": "workspace",
      "type": "string",
      "enum": [
        "workspace",
        "user",
        "app"
      ]
    },
    "start": {
      "type": "string"
    },
    "end": {
      "type": "string"
    }
  }
}
Response
Response JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "period": {
      "type": "string",
      "enum": [
        "daily",
        "weekly",
        "monthly"
      ]
    },
    "group": {
      "type": "string",
      "enum": [
        "workspace",
        "user",
        "app"
      ]
    },
    "rows": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "workspaceId": {
            "type": "string"
          },
          "period": {
            "type": "string"
          },
          "spendMicroUsd": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "userId": {
            "type": "string"
          },
          "appId": {
            "type": "string"
          },
          "appSlug": {
            "type": "string"
          },
          "inputTokens": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "outputTokens": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "workspaceId",
          "period",
          "spendMicroUsd"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "period",
    "group",
    "rows"
  ],
  "additionalProperties": false
}
Delivery
Standard response
Retry
Not declared idempotent
GET/v1/workspaces/{workspaceSlug}/billing/ledger

List the workspace credit ledger newest-first with actor attribution.

CLI
bento billing ledger list
Scope
workspace_member
Request
No JSON request body
Query
Query parameters JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "cursor": {
      "type": "string",
      "minLength": 1
    },
    "limit": {
      "default": 50,
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    }
  },
  "additionalProperties": false
}
Response
Response JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "amountMicroUsd": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "type": {
            "type": "string",
            "enum": [
              "grant",
              "topup",
              "usage",
              "adjustment",
              "reservation",
              "subscription_grant",
              "subscription_expiry"
            ]
          },
          "actorUserId": {
            "type": "string"
          },
          "tier": {
            "type": "string",
            "enum": [
              "frontier",
              "balanced",
              "economy",
              "openai-frontier",
              "openai-max",
              "anthropic-frontier",
              "anthropic-max",
              "anthropic-balanced",
              "google-recommended",
              "google-balanced",
              "services"
            ]
          },
          "createdAt": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "id",
          "amountMicroUsd",
          "type",
          "createdAt"
        ],
        "additionalProperties": false
      }
    },
    "nextCursor": {
      "anyOf": [
        {
          "type": "string",
          "minLength": 1
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "items",
    "nextCursor"
  ],
  "additionalProperties": false
}
Errors
Opaque collection cursor is malformed or bound to another walk (400)
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "const": "invalid_cursor"
    }
  },
  "required": [
    "error"
  ],
  "additionalProperties": false,
  "description": "Opaque collection cursor is malformed or bound to another walk (400)"
}
Delivery
Standard response
Retry
Not declared idempotent
GET/v1/user/billing

Read the payer account and every workspace it funds. Answers a user API key as well as the dashboard.

CLI
bento user billing get
Scope
human
Request
No JSON request body
Response
Response JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "autoTopupEnabled": {
      "type": "boolean"
    },
    "autoTopupThresholdMicroUsd": {
      "type": "integer",
      "minimum": 5000000,
      "maximum": 9007199254740991
    },
    "autoTopupAmountMicroUsd": {
      "type": "integer",
      "minimum": 5000000,
      "maximum": 9007199254740991
    },
    "maxMonthlySpendMicroUsd": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "monthlySpendMicroUsd": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "monthlySpendPeriodKey": {
      "type": "string"
    },
    "balanceMicroUsd": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "lastTopupError": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "at": {
          "type": "number"
        }
      },
      "required": [
        "code",
        "message",
        "at"
      ],
      "additionalProperties": false
    },
    "consecutiveTopupFailures": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "firstPaidAt": {
      "type": "number"
    },
    "paidCreditBalanceMicroUsd": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "monthlyCreditBalanceMicroUsd": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "subscription": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "plan": {
              "type": "string",
              "enum": [
                "starter",
                "pro",
                "max"
              ]
            },
            "status": {
              "type": "string",
              "enum": [
                "incomplete",
                "incomplete_expired",
                "trialing",
                "active",
                "past_due",
                "canceled",
                "unpaid",
                "paused"
              ]
            },
            "isActive": {
              "type": "boolean"
            },
            "currentPeriodStart": {
              "type": "number"
            },
            "currentPeriodEnd": {
              "type": "number"
            },
            "creditsExpireAt": {
              "type": "number"
            },
            "cancelAtPeriodEnd": {
              "type": "boolean"
            },
            "pendingPlan": {
              "type": "string",
              "enum": [
                "starter",
                "pro",
                "max"
              ]
            }
          },
          "required": [
            "plan",
            "status",
            "isActive",
            "currentPeriodStart",
            "currentPeriodEnd",
            "creditsExpireAt",
            "cancelAtPeriodEnd"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "trial": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "available",
            "exhausted",
            "ended"
          ]
        }
      },
      "required": [
        "status"
      ],
      "additionalProperties": false
    },
    "hasPaymentMethod": {
      "type": "boolean"
    },
    "workspaces": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "storage": {
            "type": "object",
            "properties": {
              "usableGb": {
                "type": "number"
              },
              "usedBytes": {
                "type": "number"
              },
              "sampledAt": {
                "type": "number"
              },
              "plan": {
                "type": "string",
                "enum": [
                  "starter",
                  "pro",
                  "max"
                ]
              },
              "extraStorageGb": {
                "anyOf": [
                  {
                    "type": "number",
                    "const": 0
                  },
                  {
                    "type": "number",
                    "const": 100
                  },
                  {
                    "type": "number",
                    "const": 200
                  },
                  {
                    "type": "number",
                    "const": 300
                  }
                ]
              },
              "growingToUsableGb": {
                "type": "number"
              },
              "dailyFeeMicroUsd": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "monthlyFeeMicroUsd": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "todayCharged": {
                "type": "boolean"
              },
              "next": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "plan"
                      },
                      "plan": {
                        "type": "string",
                        "enum": [
                          "starter",
                          "pro",
                          "max"
                        ]
                      },
                      "usableGb": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "kind",
                      "plan",
                      "usableGb"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "extra"
                      },
                      "usableGb": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "kind",
                      "usableGb"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "grow": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "allowed": {
                        "type": "boolean",
                        "const": true
                      }
                    },
                    "required": [
                      "allowed"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "allowed": {
                        "type": "boolean",
                        "const": false
                      },
                      "refusal": {
                        "type": "string",
                        "enum": [
                          "payer_required",
                          "max_plan_required",
                          "storage_cannot_shrink",
                          "storage_limit_reached",
                          "insufficient_credits",
                          "workspace_paused"
                        ]
                      }
                    },
                    "required": [
                      "allowed",
                      "refusal"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            },
            "required": [
              "usableGb",
              "plan",
              "extraStorageGb",
              "dailyFeeMicroUsd",
              "monthlyFeeMicroUsd",
              "todayCharged",
              "grow"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "slug",
          "name",
          "storage"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "autoTopupThresholdMicroUsd",
    "monthlySpendMicroUsd",
    "balanceMicroUsd",
    "consecutiveTopupFailures",
    "paidCreditBalanceMicroUsd",
    "monthlyCreditBalanceMicroUsd",
    "subscription",
    "trial",
    "hasPaymentMethod",
    "workspaces"
  ],
  "additionalProperties": false
}
Delivery
Standard response
Retry
Not declared idempotent
PUT/v1/user/billing

Update the signed-in payer top-up and account-limit settings.

CLI
bento user billing update --workspace-slug example
Scope
human
Request
Request JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "autoTopupEnabled": {
      "type": "boolean"
    },
    "autoTopupThresholdMicroUsd": {
      "type": "integer",
      "minimum": 5000000,
      "maximum": 9007199254740991
    },
    "autoTopupAmountMicroUsd": {
      "type": "integer",
      "minimum": 5000000,
      "maximum": 9007199254740991
    },
    "workspaceSlug": {
      "type": "string"
    },
    "maxMonthlySpendMicroUsd": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "workspaceSlug"
  ],
  "additionalProperties": false
}
Response
Response JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "autoTopupEnabled": {
      "type": "boolean"
    },
    "autoTopupThresholdMicroUsd": {
      "type": "integer",
      "minimum": 5000000,
      "maximum": 9007199254740991
    },
    "autoTopupAmountMicroUsd": {
      "type": "integer",
      "minimum": 5000000,
      "maximum": 9007199254740991
    },
    "maxMonthlySpendMicroUsd": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "monthlySpendMicroUsd": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "monthlySpendPeriodKey": {
      "type": "string"
    },
    "balanceMicroUsd": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "lastTopupError": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "at": {
          "type": "number"
        }
      },
      "required": [
        "code",
        "message",
        "at"
      ],
      "additionalProperties": false
    },
    "consecutiveTopupFailures": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "firstPaidAt": {
      "type": "number"
    },
    "paidCreditBalanceMicroUsd": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "monthlyCreditBalanceMicroUsd": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "subscription": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "plan": {
              "type": "string",
              "enum": [
                "starter",
                "pro",
                "max"
              ]
            },
            "status": {
              "type": "string",
              "enum": [
                "incomplete",
                "incomplete_expired",
                "trialing",
                "active",
                "past_due",
                "canceled",
                "unpaid",
                "paused"
              ]
            },
            "isActive": {
              "type": "boolean"
            },
            "currentPeriodStart": {
              "type": "number"
            },
            "currentPeriodEnd": {
              "type": "number"
            },
            "creditsExpireAt": {
              "type": "number"
            },
            "cancelAtPeriodEnd": {
              "type": "boolean"
            },
            "pendingPlan": {
              "type": "string",
              "enum": [
                "starter",
                "pro",
                "max"
              ]
            }
          },
          "required": [
            "plan",
            "status",
            "isActive",
            "currentPeriodStart",
            "currentPeriodEnd",
            "creditsExpireAt",
            "cancelAtPeriodEnd"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "trial": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "available",
            "exhausted",
            "ended"
          ]
        }
      },
      "required": [
        "status"
      ],
      "additionalProperties": false
    },
    "hasPaymentMethod": {
      "type": "boolean"
    },
    "workspaces": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "storage": {
            "type": "object",
            "properties": {
              "usableGb": {
                "type": "number"
              },
              "usedBytes": {
                "type": "number"
              },
              "sampledAt": {
                "type": "number"
              },
              "plan": {
                "type": "string",
                "enum": [
                  "starter",
                  "pro",
                  "max"
                ]
              },
              "extraStorageGb": {
                "anyOf": [
                  {
                    "type": "number",
                    "const": 0
                  },
                  {
                    "type": "number",
                    "const": 100
                  },
                  {
                    "type": "number",
                    "const": 200
                  },
                  {
                    "type": "number",
                    "const": 300
                  }
                ]
              },
              "growingToUsableGb": {
                "type": "number"
              },
              "dailyFeeMicroUsd": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "monthlyFeeMicroUsd": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "todayCharged": {
                "type": "boolean"
              },
              "next": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "plan"
                      },
                      "plan": {
                        "type": "string",
                        "enum": [
                          "starter",
                          "pro",
                          "max"
                        ]
                      },
                      "usableGb": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "kind",
                      "plan",
                      "usableGb"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "extra"
                      },
                      "usableGb": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "kind",
                      "usableGb"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "grow": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "allowed": {
                        "type": "boolean",
                        "const": true
                      }
                    },
                    "required": [
                      "allowed"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "allowed": {
                        "type": "boolean",
                        "const": false
                      },
                      "refusal": {
                        "type": "string",
                        "enum": [
                          "payer_required",
                          "max_plan_required",
                          "storage_cannot_shrink",
                          "storage_limit_reached",
                          "insufficient_credits",
                          "workspace_paused"
                        ]
                      }
                    },
                    "required": [
                      "allowed",
                      "refusal"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            },
            "required": [
              "usableGb",
              "plan",
              "extraStorageGb",
              "dailyFeeMicroUsd",
              "monthlyFeeMicroUsd",
              "todayCharged",
              "grow"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "id",
          "slug",
          "name",
          "storage"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "autoTopupThresholdMicroUsd",
    "monthlySpendMicroUsd",
    "balanceMicroUsd",
    "consecutiveTopupFailures",
    "paidCreditBalanceMicroUsd",
    "monthlyCreditBalanceMicroUsd",
    "subscription",
    "trial",
    "hasPaymentMethod",
    "workspaces"
  ],
  "additionalProperties": false
}
Delivery
Standard response
Retry
Not declared idempotent
GET/v1/user/billing/history

Read recent billing ledger entries across funded workspaces.

CLI
bento user billing history list
Scope
human
Request
No JSON request body
Query
Query parameters JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "cursor": {
      "type": "string",
      "minLength": 1
    },
    "limit": {
      "default": 50,
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    }
  },
  "additionalProperties": false
}
Response
Response JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "amountMicroUsd": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "type": {
                "type": "string",
                "enum": [
                  "grant",
                  "topup",
                  "usage",
                  "adjustment",
                  "reservation",
                  "subscription_grant",
                  "subscription_expiry"
                ]
              },
              "usageKind": {
                "type": "string",
                "enum": [
                  "vm_compute",
                  "storage"
                ]
              },
              "createdAt": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "scope": {
                "type": "string",
                "const": "account"
              }
            },
            "required": [
              "id",
              "amountMicroUsd",
              "type",
              "createdAt",
              "scope"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "amountMicroUsd": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "type": {
                "type": "string",
                "enum": [
                  "grant",
                  "topup",
                  "usage",
                  "adjustment",
                  "reservation",
                  "subscription_grant",
                  "subscription_expiry"
                ]
              },
              "usageKind": {
                "type": "string",
                "enum": [
                  "vm_compute",
                  "storage"
                ]
              },
              "createdAt": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              },
              "scope": {
                "type": "string",
                "const": "workspace"
              },
              "workspaceId": {
                "type": "string"
              },
              "workspaceName": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "amountMicroUsd",
              "type",
              "createdAt",
              "scope",
              "workspaceId",
              "workspaceName"
            ],
            "additionalProperties": false
          }
        ]
      }
    },
    "nextCursor": {
      "anyOf": [
        {
          "type": "string",
          "minLength": 1
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "items",
    "nextCursor"
  ],
  "additionalProperties": false
}
Errors
Opaque collection cursor is malformed or bound to another walk (400)
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "const": "invalid_cursor"
    }
  },
  "required": [
    "error"
  ],
  "additionalProperties": false,
  "description": "Opaque collection cursor is malformed or bound to another walk (400)"
}
Delivery
Standard response
Retry
Not declared idempotent
POST/v1/user/billing/checkout

Create a Stripe-hosted setup or credit top-up Checkout session.

CLI
bento user billing checkout --workspace-slug example
Scope
human
Request
Request JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "workspaceSlug": {
      "type": "string"
    },
    "amountMicroUsd": {
      "type": "integer",
      "minimum": 5000000,
      "maximum": 9007199254740991
    }
  },
  "required": [
    "workspaceSlug"
  ]
}
Response
Response JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "format": "uri"
    },
    "sessionId": {
      "type": "string"
    }
  },
  "required": [
    "url"
  ],
  "additionalProperties": false
}
Delivery
Standard response
Retry
Not declared idempotent
POST/v1/user/billing/portal

Create a Stripe-hosted Customer Portal session.

CLI
bento user billing portal --workspace-slug example
Scope
human
Request
Request JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "workspaceSlug": {
      "type": "string"
    }
  },
  "required": [
    "workspaceSlug"
  ]
}
Response
Response JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "format": "uri"
    },
    "sessionId": {
      "type": "string"
    }
  },
  "required": [
    "url"
  ],
  "additionalProperties": false
}
Delivery
Standard response
Retry
Not declared idempotent
POST/v1/user/billing/subscription/checkout

Create a Stripe-hosted Checkout session for a server-resolved subscription plan. Answers a user API key.

CLI
bento user billing subscription checkout --workspace-slug example --plan starter
Scope
human
Request
Request JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "workspaceSlug": {
      "type": "string"
    },
    "plan": {
      "type": "string",
      "enum": [
        "starter",
        "pro",
        "max"
      ]
    }
  },
  "required": [
    "workspaceSlug",
    "plan"
  ]
}
Response
Response JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "format": "uri"
    },
    "sessionId": {
      "type": "string"
    }
  },
  "required": [
    "url"
  ],
  "additionalProperties": false
}
Delivery
Standard response
Retry
Not declared idempotent
PATCH/v1/user/billing/subscription/plan

Upgrade, schedule a downgrade, or cancel the payer subscription. Answers a user API key.

CLI
bento user billing subscription plan update --body-file request.json
Scope
human
Request
Request JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "anyOf": [
    {
      "type": "object",
      "properties": {
        "workspaceSlug": {
          "type": "string"
        },
        "plan": {
          "type": "string",
          "enum": [
            "starter",
            "pro",
            "max"
          ]
        }
      },
      "required": [
        "workspaceSlug",
        "plan"
      ]
    },
    {
      "type": "object",
      "properties": {
        "workspaceSlug": {
          "type": "string"
        },
        "cancel": {
          "type": "boolean",
          "const": true
        }
      },
      "required": [
        "workspaceSlug",
        "cancel"
      ]
    },
    {
      "type": "object",
      "properties": {
        "workspaceSlug": {
          "type": "string"
        },
        "resume": {
          "type": "boolean",
          "const": true
        }
      },
      "required": [
        "workspaceSlug",
        "resume"
      ]
    }
  ]
}
Response
Response JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean",
      "const": true
    }
  },
  "required": [
    "ok"
  ],
  "additionalProperties": false
}
Delivery
Standard response
Retry
Declared idempotent
POST/v1/workspaces/{workspaceSlug}/onboarding/payment-method/intents

Start or resume the onboarding card verification authorization.

CLI
bento onboarding payment-method intent create --attempt-id example-attempt
Scope
ws:{workspaceSlug}:agents
Request
Request JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "attemptId": {
      "type": "string",
      "minLength": 8,
      "maxLength": 200
    }
  },
  "required": [
    "attemptId"
  ]
}
Response
Response JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "const": "ready"
        },
        "paymentMethodReadyAt": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        }
      },
      "required": [
        "status",
        "paymentMethodReadyAt"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "const": "requires_confirmation"
        },
        "attemptId": {
          "type": "string",
          "minLength": 1
        },
        "paymentIntentId": {
          "type": "string",
          "minLength": 1
        },
        "clientSecret": {
          "type": "string",
          "minLength": 1
        },
        "publishableKey": {
          "type": "string",
          "minLength": 1
        },
        "amount": {
          "type": "number",
          "const": 1000
        },
        "currency": {
          "type": "string",
          "const": "usd"
        }
      },
      "required": [
        "status",
        "attemptId",
        "paymentIntentId",
        "clientSecret",
        "publishableKey",
        "amount",
        "currency"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "const": "pending"
        },
        "attemptId": {
          "type": "string",
          "minLength": 1
        },
        "paymentIntentId": {
          "type": "string",
          "minLength": 1
        },
        "clientSecret": {
          "type": "string",
          "minLength": 1
        },
        "publishableKey": {
          "type": "string",
          "minLength": 1
        },
        "amount": {
          "type": "number",
          "const": 1000
        },
        "currency": {
          "type": "string",
          "const": "usd"
        }
      },
      "required": [
        "status",
        "attemptId",
        "paymentIntentId",
        "clientSecret",
        "publishableKey",
        "amount",
        "currency"
      ],
      "additionalProperties": false
    }
  ]
}
Delivery
Standard response
Retry
Not declared idempotent
POST/v1/workspaces/{workspaceSlug}/onboarding/payment-method/complete

Verify, release, and save the onboarding payment method.

CLI
bento onboarding payment-method complete --body-file request.json
Scope
ws:{workspaceSlug}:agents
Request
Request JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "attemptId": {
      "type": "string",
      "minLength": 8,
      "maxLength": 200
    },
    "paymentIntentId": {
      "type": "string",
      "minLength": 1
    },
    "billingDetails": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "email": {
          "type": "string",
          "format": "email",
          "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
        },
        "address": {
          "type": "object",
          "properties": {
            "line1": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "line2": {
              "type": "string",
              "maxLength": 200
            },
            "city": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "state": {
              "type": "string",
              "maxLength": 100
            },
            "postalCode": {
              "type": "string",
              "minLength": 1,
              "maxLength": 30
            },
            "country": {
              "type": "string",
              "pattern": "^[A-Za-z]{2}$"
            }
          },
          "required": [
            "line1",
            "city",
            "postalCode",
            "country"
          ]
        }
      },
      "required": [
        "name",
        "email",
        "address"
      ]
    }
  },
  "required": [
    "attemptId",
    "paymentIntentId",
    "billingDetails"
  ]
}
Response
Response JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "ready": {
      "type": "boolean"
    },
    "paymentMethodReadyAt": {
      "type": "integer",
      "exclusiveMinimum": 0,
      "maximum": 9007199254740991
    },
    "attemptId": {
      "type": "string",
      "minLength": 1
    },
    "paymentIntentId": {
      "type": "string",
      "minLength": 1
    },
    "status": {
      "type": "string",
      "enum": [
        "idle",
        "requires_confirmation",
        "requires_action",
        "requires_capture",
        "canceling",
        "canceled",
        "ready",
        "failed"
      ]
    }
  },
  "required": [
    "ready"
  ],
  "additionalProperties": false
}
Delivery
Standard response
Retry
Not declared idempotent
GET/v1/workspaces/{workspaceSlug}/onboarding/payment-method

Read server-derived onboarding payment readiness and retry state.

CLI
bento onboarding payment-method get
Scope
ws:{workspaceSlug}:agents
Request
No JSON request body
Response
Response JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "ready": {
      "type": "boolean"
    },
    "paymentMethodReadyAt": {
      "type": "integer",
      "exclusiveMinimum": 0,
      "maximum": 9007199254740991
    },
    "attemptId": {
      "type": "string",
      "minLength": 1
    },
    "paymentIntentId": {
      "type": "string",
      "minLength": 1
    },
    "status": {
      "type": "string",
      "enum": [
        "idle",
        "requires_confirmation",
        "requires_action",
        "requires_capture",
        "canceling",
        "canceled",
        "ready",
        "failed"
      ]
    }
  },
  "required": [
    "ready"
  ],
  "additionalProperties": false
}
Delivery
Standard response
Retry
Not declared idempotent