soeru Billing API
The Billing API from soeru — 17 operation(s) for billing.
The Billing API from soeru — 17 operation(s) for billing.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/soeru-biz:soeru-biz-billing-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: soeru Billing API
description: AIパーソナライズ明細書メッセージ自動生成SaaS
version: 0.1.0
tags:
- name: Billing
paths:
/api/billing:
get:
tags:
- Billing
summary: Get Billing
description: 'Get current billing info for the user.
Phase NOTIF-4 fix (2026-05-11): brand_id クエリパラメータ対応.
multi-brand owner では brand_id を渡すことで該当 brand の subscription
を返す. 未指定時は legacy 互換 (data[0] = 最初の sub) で返す.
Frontend 側 (billing/page.tsx) は currentShop?.brand_id を渡す必要あり.'
operationId: get_billing_api_billing_get
parameters:
- name: brand_id
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Brand Id
- name: authorization
in: header
required: true
schema:
type: string
description: Bearer <token>
title: Authorization
description: Bearer <token>
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/billing/plans:
get:
tags:
- Billing
summary: Get Plans
description: 'Get available plans with pricing details.
New model (2026-04): Free (30 messages) + Standard (¥980 base + usage-based).'
operationId: get_plans_api_billing_plans_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
/api/billing/usage-by-shop:
get:
tags:
- Billing
summary: Get Usage By Shop
description: 'Get current billing period message count broken down by shop.
Returns a list of {shop_id, shop_name, platform, message_count} for each
shop owned by the user, plus the total.'
operationId: get_usage_by_shop_api_billing_usage_by_shop_get
parameters:
- name: authorization
in: header
required: true
schema:
type: string
description: Bearer <token>
title: Authorization
description: Bearer <token>
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/billing/usage-by-mode:
get:
tags:
- Billing
summary: Get Usage By Mode
description: 'Wave 4 (2026-05-06): 当月の instant vs reflective 内訳を返す.
課金ページの「料金内訳」セクションで使用. message_history.engine_metadata.mode
を集計する. mode 未セットの行 (Wave 4 以前 / 移行漏れ) は instant 扱い.
Returns:
{
"instant": {"count": int, "amount_jpy": int, "unit_price": int},
"reflective": {"count": int, "amount_jpy": int, "unit_price": int},
"total_count": int,
"total_amount_jpy": int,
"period_start": iso str | null,
}'
operationId: get_usage_by_mode_api_billing_usage_by_mode_get
parameters:
- name: authorization
in: header
required: true
schema:
type: string
description: Bearer <token>
title: Authorization
description: Bearer <token>
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/billing/pending-reflective-count:
get:
tags:
- Billing
summary: Get Pending Reflective Count
description: 'Wave 4 (2026-05-06): 該 shop の予約中件数を返す軽量 endpoint.
サイドバーの「予約一覧」エントリに件数 badge を出すために polling される.
SWR refresh interval は 30s 推奨 (重要度低).'
operationId: get_pending_reflective_count_api_billing_pending_reflective_count_get
parameters:
- name: x-shop-id
in: header
required: false
schema:
anyOf:
- type: string
- type: 'null'
description: Optional shop ID
title: X-Shop-Id
description: Optional shop ID
- name: authorization
in: header
required: true
schema:
type: string
description: Bearer <token>
title: Authorization
description: Bearer <token>
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/billing/create-checkout:
post:
tags:
- Billing
summary: Create Checkout
description: 'Create a Stripe Checkout session for free → standard upgrade.
New model (2026-04): Only one paid plan (standard).
Subscription has 2 Stripe items:
1. Base price: ¥980/month (recurring fixed)
2. Metered price: per-message usage (tiered: ¥18 × 1-300, ¥15 × 301+)'
operationId: create_checkout_api_billing_create_checkout_post
parameters:
- name: authorization
in: header
required: true
schema:
type: string
description: Bearer <token>
title: Authorization
description: Bearer <token>
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CheckoutRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/billing/create-portal:
post:
tags:
- Billing
summary: Create Portal
description: Create a Stripe Customer Portal session.
operationId: create_portal_api_billing_create_portal_post
parameters:
- name: authorization
in: header
required: true
schema:
type: string
description: Bearer <token>
title: Authorization
description: Bearer <token>
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/billing/invoices:
get:
tags:
- Billing
summary: Get Invoices
description: 'Get invoice history from Stripe.
Returns past invoices with amounts, dates, status, and PDF download URLs.
Also ensures Stripe is configured to email invoices to the customer.'
operationId: get_invoices_api_billing_invoices_get
parameters:
- name: limit
in: query
required: false
schema:
type: integer
default: 24
title: Limit
- name: authorization
in: header
required: true
schema:
type: string
description: Bearer <token>
title: Authorization
description: Bearer <token>
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/billing/cancel:
post:
tags:
- Billing
summary: Cancel Subscription
description: 'Cancel the user''s Stripe subscription.
Default behavior: cancel at end of current billing period (prorate=False).
The user retains access until `current_period_end`, then the webhook
`customer.subscription.deleted` automatically downgrades to free.
If immediate=True, cancel right away and prorate.
Phase 3 (2026-04-26 fix): brand_id を必須に近い形で受ける。multi-brand
owner で brand_id を渡さずに呼ぶと 400 で拒否 (どの sub をキャンセルする
か曖昧)。1-brand owner は legacy 互換で brand_id 省略可。Stripe 上は対象
の 1 sub のみ delete し、DB UPDATE も WHERE id = (target row id) で 1 行
限定 — owner_id 単条件で全 sub を巻き込む旧バグの再発を防ぐ。'
operationId: cancel_subscription_api_billing_cancel_post
parameters:
- name: authorization
in: header
required: true
schema:
type: string
description: Bearer <token>
title: Authorization
description: Bearer <token>
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CancelRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/billing/reactivate:
post:
tags:
- Billing
summary: Reactivate Subscription
description: 'Reactivate a subscription that was set to cancel at period end.
Only works if the subscription hasn''t actually been deleted yet
(status is cancel_pending, Stripe still has it as active with
cancel_at_period_end=True).
Phase 3 (2026-04-26 fix): brand_id 対応。multi-brand owner で brand_id を
渡さずに呼ぶと 400 で拒否。1-brand owner は brand_id 省略可 (legacy 互換)。
DB UPDATE は WHERE id = (target row id) で 1 行限定 — owner_id 単条件で
全 sub の status を上書きする旧バグの再発を防ぐ。'
operationId: reactivate_subscription_api_billing_reactivate_post
parameters:
- name: authorization
in: header
required: true
schema:
type: string
description: Bearer <token>
title: Authorization
description: Bearer <token>
requestBody:
content:
application/json:
schema:
anyOf:
- $ref: '#/components/schemas/ReactivateRequest'
- type: 'null'
title: Body
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/billing/invoice-email-status:
get:
tags:
- Billing
summary: Get Invoice Email Status
description: Check if invoice emails are enabled for this customer.
operationId: get_invoice_email_status_api_billing_invoice_email_status_get
parameters:
- name: authorization
in: header
required: true
schema:
type: string
description: Bearer <token>
title: Authorization
description: Bearer <token>
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/billing/enable-invoice-email:
post:
tags:
- Billing
summary: Enable Invoice Email
description: Toggle automatic invoice emails for this customer in Stripe.
operationId: enable_invoice_email_api_billing_enable_invoice_email_post
parameters:
- name: authorization
in: header
required: true
schema:
type: string
description: Bearer <token>
title: Authorization
description: Bearer <token>
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/InvoiceEmailRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/billing/brand-plans:
get:
tags:
- Billing
summary: Get Brand Plans
description: 'Return per-brand plan summaries for sidebar / header badge display.
Phase NOTIF-4 (2026-05-11, sho UX 提案): multi-brand owner が
どの brand が何プランか一目で分かるようにするため. UI コンポーネント
PlanBadge から呼ばれる軽量エンドポイント.
Returns: {brand_id: {plan, status, cancel_at_period_end}}
- brand_id: subscription の brand_id (None の場合は除外)
- plan: ''free'' | ''standard'' | ''dev''
- cancel_at_period_end: 解約予約中なら true'
operationId: get_brand_plans_api_billing_brand_plans_get
parameters:
- name: authorization
in: header
required: true
schema:
type: string
description: Bearer <token>
title: Authorization
description: Bearer <token>
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/billing/billing-profile:
get:
tags:
- Billing
summary: Get Billing Profile
description: 現在の請求情報を返す。未契約 (subscription 無し) も {all null} で返す。
operationId: get_billing_profile_api_billing_billing_profile_get
parameters:
- name: authorization
in: header
required: true
schema:
type: string
description: Bearer <token>
title: Authorization
description: Bearer <token>
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
put:
tags:
- Billing
summary: Update Billing Profile
description: 請求情報を保存し、Stripe Customer にも即時同期する。
operationId: update_billing_profile_api_billing_billing_profile_put
parameters:
- name: authorization
in: header
required: true
schema:
type: string
description: Bearer <token>
title: Authorization
description: Bearer <token>
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BillingProfile'
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/billing/setup-intent:
post:
tags:
- Billing
summary: Create Setup Intent
description: Return a SetupIntent client_secret for Stripe Elements card collection.
operationId: create_setup_intent_api_billing_setup_intent_post
parameters:
- name: authorization
in: header
required: true
schema:
type: string
description: Bearer <token>
title: Authorization
description: Bearer <token>
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/billing/add-brand:
post:
tags:
- Billing
summary: Add Brand
description: '新ブランドを追加し、その brand 用の Standard Subscription を Stripe で
作成する。Free user は既存 brand 用も同時に upgrade される (atomic)。
Returns: {brand_id, created_subscription_ids: [...], message}'
operationId: add_brand_api_billing_add_brand_post
parameters:
- name: authorization
in: header
required: true
schema:
type: string
description: Bearer <token>
title: Authorization
description: Bearer <token>
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AddBrandRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/billing/delete-account:
post:
tags:
- Billing
summary: Delete Account
description: 'Permanently delete a user''s account and all associated data.
Only available for free plan users. Paid users must cancel first.
Requires confirmation string "DELETE" to prevent accidental deletion.
Deletes in order:
1. Stripe customer (if exists) — removes payment methods & invoices
2. Messages, usage_logs, order_history (shop-linked data)
3. Shop settings, soeru_link data
4. Shops
5. Subscription record
6. User profile
7. Supabase Auth user'
operationId: delete_account_api_billing_delete_account_post
parameters:
- name: authorization
in: header
required: true
schema:
type: string
description: Bearer <token>
title: Authorization
description: Bearer <token>
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/DeleteAccountRequest'
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
components:
schemas:
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
AddBrandRequest:
properties:
brand_name:
type: string
maxLength: 100
minLength: 1
title: Brand Name
payment_method_id:
anyOf:
- type: string
maxLength: 255
- type: 'null'
title: Payment Method Id
billing_cycle:
type: string
pattern: ^(monthly|annual)$
title: Billing Cycle
default: monthly
type: object
required:
- brand_name
title: AddBrandRequest
CancelRequest:
properties:
immediate:
type: boolean
title: Immediate
default: false
reason:
anyOf:
- type: string
maxLength: 2000
- type: 'null'
title: Reason
brand_id:
anyOf:
- type: string
maxLength: 64
- type: 'null'
title: Brand Id
type: object
title: CancelRequest
description: Request body for subscription cancellation.
ReactivateRequest:
properties:
brand_id:
anyOf:
- type: string
maxLength: 64
- type: 'null'
title: Brand Id
type: object
title: ReactivateRequest
DeleteAccountRequest:
properties:
confirmation:
type: string
maxLength: 32
minLength: 1
title: Confirmation
type: object
required:
- confirmation
title: DeleteAccountRequest
description: Request body for account deletion.
CheckoutRequest:
properties:
plan:
type: string
maxLength: 64
minLength: 1
title: Plan
type: object
required:
- plan
title: CheckoutRequest
BillingProfile:
properties:
billing_company_name:
anyOf:
- type: string
maxLength: 200
- type: 'null'
title: Billing Company Name
billing_contact_name:
anyOf:
- type: string
maxLength: 100
- type: 'null'
title: Billing Contact Name
billing_postal_code:
anyOf:
- type: string
maxLength: 20
- type: 'null'
title: Billing Postal Code
billing_address:
anyOf:
- type: string
maxLength: 500
- type: 'null'
title: Billing Address
billing_phone:
anyOf:
- type: string
maxLength: 30
- type: 'null'
title: Billing Phone
type: object
title: BillingProfile
description: 請求情報のリクエスト/レスポンス共通モデル。全フィールド任意。
ValidationError:
properties:
loc:
items:
anyOf:
- type: string
- type: integer
type: array
title: Location
msg:
type: string
title: Message
type:
type: string
title: Error Type
input:
title: Input
ctx:
type: object
title: Context
type: object
required:
- loc
- msg
- type
title: ValidationError
InvoiceEmailRequest:
properties:
enabled:
type: boolean
title: Enabled
default: true
type: object
title: InvoiceEmailRequest