Import
Commit a Chargebee Import
Import a Chargebee export — customers, plans, and subscriptions — idempotently.
POST
/
v1
/
import
/
chargebee
/
commit
Import a Chargebee export (customers, plans, subscriptions)
curl --request POST \
--url https://billing.example.com/v1/import/chargebee/commit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customers": [
{}
],
"plans": [
{}
],
"subscriptions": [
{}
]
}
'import requests
url = "https://billing.example.com/v1/import/chargebee/commit"
payload = {
"customers": [{}],
"plans": [{}],
"subscriptions": [{}]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({customers: [{}], plans: [{}], subscriptions: [{}]})
};
fetch('https://billing.example.com/v1/import/chargebee/commit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://billing.example.com/v1/import/chargebee/commit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customers' => [
[
]
],
'plans' => [
[
]
],
'subscriptions' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://billing.example.com/v1/import/chargebee/commit"
payload := strings.NewReader("{\n \"customers\": [\n {}\n ],\n \"plans\": [\n {}\n ],\n \"subscriptions\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://billing.example.com/v1/import/chargebee/commit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customers\": [\n {}\n ],\n \"plans\": [\n {}\n ],\n \"subscriptions\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/import/chargebee/commit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customers\": [\n {}\n ],\n \"plans\": [\n {}\n ],\n \"subscriptions\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"plan": {},
"created": {},
"failures": [
{
"kind": "<string>",
"stripe_id": "<string>",
"error": "<string>"
}
]
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}Takes the same payload as preview
and performs the import, recording an idempotency mapping for every created
record — re-running is safe. Subscriptions are imported in their current
billing state via a direct insert: no invoice, charge, or ledger side
effect, so Recurso takes over at the next renewal.
The response contains the executed
Example request
curl -X POST https://api.recurso.dev/v1/import/chargebee/commit \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d @chargebee-export.json
plan, a created map of per-kind
counts, and a failures array — per-object failures are reported there
rather than aborting the whole import.
After committing, prove the migration with the
compare gate before cut-over.Authorizations
Tenant API key obtained from POST /auth/register or POST /v1/developer/keys.
Body
application/json
The Chargebee export JSON (same shape as the preview endpoint).
⌘I
Import a Chargebee export (customers, plans, subscriptions)
curl --request POST \
--url https://billing.example.com/v1/import/chargebee/commit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customers": [
{}
],
"plans": [
{}
],
"subscriptions": [
{}
]
}
'import requests
url = "https://billing.example.com/v1/import/chargebee/commit"
payload = {
"customers": [{}],
"plans": [{}],
"subscriptions": [{}]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({customers: [{}], plans: [{}], subscriptions: [{}]})
};
fetch('https://billing.example.com/v1/import/chargebee/commit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://billing.example.com/v1/import/chargebee/commit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customers' => [
[
]
],
'plans' => [
[
]
],
'subscriptions' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://billing.example.com/v1/import/chargebee/commit"
payload := strings.NewReader("{\n \"customers\": [\n {}\n ],\n \"plans\": [\n {}\n ],\n \"subscriptions\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://billing.example.com/v1/import/chargebee/commit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customers\": [\n {}\n ],\n \"plans\": [\n {}\n ],\n \"subscriptions\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/import/chargebee/commit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customers\": [\n {}\n ],\n \"plans\": [\n {}\n ],\n \"subscriptions\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"plan": {},
"created": {},
"failures": [
{
"kind": "<string>",
"stripe_id": "<string>",
"error": "<string>"
}
]
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}{
"error": {
"code": "validation_failed",
"message": "<string>"
}
}