Skip to content

Reimport a subscription's history

POST
/v1/subscriptions/:id/reimport
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"
}
]
}
]
}'

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.

id
required
string
>= 1 characters <= 320 characters

The subscription — a Summerbase id, or a source identity like stripe:sub_123.

Example

backend:sub_7731
expand[]
Array<string>
<= 10 items
Allowed values: currency customer items owner_source

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.

Media typeapplication/json
object
claim_ownership

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.

boolean
customer_id

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.

string
history
required

The subscription’s history, oldest first. At most 10,000 entries.

Array<object>
object
cancels_at

As on the subscription.

string format: date-time
currency_code

As on the subscription.

string
>= 3 characters <= 3 characters
current_period_ends_at

As on the subscription.

string format: date-time
effective_at
required

When this became true. Later than the entry before it.

string format: date-time
ended_at

As on the subscription.

string format: date-time
items

Every item of the subscription from this moment. Replaces the set.

Array<object>
object
discount_amount

What comes off this item’s invoice, as a decimal string, every coupon on it worked out. 0 is no discount, and clears one.

string format: decimal
discount_ends_at

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.

string format: date-time
id
required

This item’s id — a Summerbase id, or a source identity like stripe:si_123.

string
>= 1 characters <= 320 characters
identities

What other sources call this item, as source:id.

Array<string>
interval

The unit the item bills in.

string
Allowed values: day week month year
interval_count

How many intervals between charges. Two months is month with a count of 2.

integer
>= 1
price_id

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.

string
<= 320 characters
pricing_model

How the unit amount is arrived at. fixed unless said otherwise.

string
Allowed values: fixed tiered metered
properties

Properties to record for this item, in your source.

object
key
additional properties
Any of:
string
quantity

How many units at this unit amount. A decimal string; 1.5 is allowed.

string format: decimal
unit_amount

What one unit costs per interval, as a decimal string. Excludes tax and discounts.

string format: decimal
properties

Properties in your source that changed at this moment; null clears one.

object
key
additional properties
Any of:
string
status

As on the subscription.

string
Allowed values: pending trialing active paused canceled
trial_ends_at

As on the subscription.

string format: date-time
identities

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.

Array<string>

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"
}
]
}
]
}

Returns the subscription object.

Media typeapplication/json

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"
}