Reimport a subscription's history
curl -X POST "https://api.summerbase.com/v1/subscriptions/:id/reimport" \ -H "Authorization: Bearer sb_..." \ -H "Content-Type: application/json" \ -d '{ "claim_ownership": true, "customer_id": "backend:acct_4821", "history": [ { "currency_code": "USD", "effective_at": "2025-11-17T10:04:00Z", "items": [ { "id": "backend:item_9001", "interval": "month", "price_id": "backend:growth-monthly", "quantity": "20", "unit_amount": "50.00" } ], "status": "trialing", "trial_ends_at": "2025-12-01T10:04:00Z" }, { "effective_at": "2025-12-01T10:04:00Z", "status": "active" }, { "effective_at": "2026-06-12T15:47:00Z", "items": [ { "id": "backend:item_9001", "interval": "month", "price_id": "backend:growth-monthly", "quantity": "25", "unit_amount": "50.00" } ] } ] }'const response = await fetch("https://api.summerbase.com/v1/subscriptions/:id/reimport", { method: "POST", headers: { Authorization: "Bearer sb_...", "Content-Type": "application/json", }, body: JSON.stringify({ "claim_ownership": true, "customer_id": "backend:acct_4821", "history": [ { "currency_code": "USD", "effective_at": "2025-11-17T10:04:00Z", "items": [ { "id": "backend:item_9001", "interval": "month", "price_id": "backend:growth-monthly", "quantity": "20", "unit_amount": "50.00" } ], "status": "trialing", "trial_ends_at": "2025-12-01T10:04:00Z" }, { "effective_at": "2025-12-01T10:04:00Z", "status": "active" }, { "effective_at": "2026-06-12T15:47:00Z", "items": [ { "id": "backend:item_9001", "interval": "month", "price_id": "backend:growth-monthly", "quantity": "25", "unit_amount": "50.00" } ] } ] }),})const data = await response.json()Replace everything your source has said about a subscription with its history, sent all at once and oldest first — the one way to write the past.
Each entry is a patch onto the one before it, applied through the same
rules as an update. The first is applied to a subscription holding
nothing of yours: if your source owns it, every field the first entry
leaves out takes what a new subscription would hold, so it has to carry
status and currency_code, and an item takes its defaults the first
time the history names it. Your properties on it are replaced. Other
sources’ properties and every identity stay; identities adds to them.
Lands whole or not at all.
What it replaces is deleted for good: gone from every answer within moments, and from every copy Summerbase keeps within a day.
A subscription that does not exist yet is created by its first entry,
which takes customer_id and claim_ownership like a create does.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The subscription — a Summerbase id, or a source identity like stripe:sub_123.
Example
backend:sub_7731Query Parameters
Section titled “Query Parameters”Relationships to include in the response instead of fetching separately. A dotted path expands what an expanded record can expand in turn — at most 4 deep, 10 paths a request, and never back to a record already on the path.
Request Bodyrequired
Section titled “Request Bodyrequired”object
For a subscription that does not exist yet: true to create it as the
source it lives in. Required to create one, as on a create.
Who is subscribed, for a subscription that does not exist yet. A
Summerbase id, or any source identity like stripe:cus_123, which
creates the customer if it is new.
The subscription’s history, oldest first. At most 10,000 entries.
object
As on the subscription.
As on the subscription.
As on the subscription.
When this became true. Later than the entry before it.
As on the subscription.
Every item of the subscription from this moment. Replaces the set.
object
What comes off this item’s invoice, as a decimal string, every coupon on it worked out. 0 is no discount, and clears one.
When the discount, or the earliest part of it, stops applying, if known. Read with discount_amount: sent without it, an amount has no known end.
This item’s id — a Summerbase id, or a source identity like stripe:si_123.
What other sources call this item, as source:id.
The unit the item bills in.
How many intervals between charges. Two months is month with a count of 2.
The price this item is on — a Summerbase id, or a source identity like stripe:price_123. It has to exist: create it first, with PATCH /v1/prices/{id}. The item’s plan is the price’s.
How the unit amount is arrived at. fixed unless said otherwise.
Properties to record for this item, in your source.
object
object
What to do with the value. Defaults to setting it.
What this value is. Given here, it is not inferred; omitted, the key’s existing definition decides, and a new key takes the type its first value looks like.
The value, as a string. Parsed into the key’s type — which type states
outright, or which the key’s existing definition decides. Null clears the
key.
How many units at this unit amount. A decimal string; 1.5 is allowed.
What one unit costs per interval, as a decimal string. Excludes tax and discounts.
Properties in your source that changed at this moment; null clears one.
object
object
What to do with the value. Defaults to setting it.
What this value is. Given here, it is not inferred; omitted, the key’s existing definition decides, and a new key takes the type its first value looks like.
The value, as a string. Parsed into the key’s type — which type states
outright, or which the key’s existing definition decides. Null clears the
key.
As on the subscription.
As on the subscription.
What other sources call this subscription, as source:id. Attached once, beside
the history — an identity is an address rather than a value and has no
moment. One that already identifies another record is refused.
What each source calls this record, as <source>:<id in that source>. Any entry addresses it — stripe:cus_123.
Example
{ "claim_ownership": true, "customer_id": "backend:acct_4821", "history": [ { "currency_code": "USD", "effective_at": "2025-11-17T10:04:00Z", "items": [ { "id": "backend:item_9001", "interval": "month", "price_id": "backend:growth-monthly", "quantity": "20", "unit_amount": "50.00" } ], "status": "trialing", "trial_ends_at": "2025-12-01T10:04:00Z" }, { "effective_at": "2025-12-01T10:04:00Z", "status": "active" }, { "effective_at": "2026-06-12T15:47:00Z", "items": [ { "id": "backend:item_9001", "interval": "month", "price_id": "backend:growth-monthly", "quantity": "25", "unit_amount": "50.00" } ] } ]}Response
Section titled “Response”Returns the subscription object.
Example
{ "annual_amount": "15000.00", "billing_amounts": [ { "interval": "month", "interval_count": 1, "net_amount": "1250.00" } ], "cancels_at": null, "currency_code": "USD", "current_period_ends_at": "2026-11-01T10:04:00Z", "customer_id": "0199a7c2-4e1b-7f38-b9d2-5a6c8e0f1d73", "ended_at": null, "id": "0199a7c2-5b3e-7a14-8c6d-2f9e4b7a1c05", "identities": [ "stripe:sub_1QhT5uV7wX9yZ2aB" ], "monthly_amount": "1250.00", "object": "subscription", "owner_source_id": "0198f1a3-0b7c-7e25-9f41-6a2d8c3e5b19", "properties": { "account_manager": "Priya Shah" }, "properties_by_source": { "backend": { "account_manager": "Priya Shah" }, "stripe": { "contract_id": "C-2025-118" } }, "recorded_at": "2025-11-17T10:04:03Z", "started_at": "2025-11-17T10:04:00Z", "status": "active", "trial_ends_at": "2025-12-01T10:04:00Z"}