cURL
curl --request POST 'https://api.integrateledger.com/v1/plans/starter/migrations/4/run' \
-H "Authorization: Bearer $LEDGER_API_KEY" \
-H 'Idempotency-Key: migrate_123'import ledger from "integrateledger";
const client = new ledger({ apiKey: process.env.LEDGER_API_KEY ?? "" });
await client.runPlanMigration({ id: "starter", migrationId: 4, idempotencyKey: "migrate_123" });import os
from integrateledger import ledger
client = ledger(api_key=os.environ["LEDGER_API_KEY"])
client.run_plan_migration("starter", 4, idempotency_key="migrate_123"){
"migrationId": 123,
"planId": "<string>",
"fromVersion": 123,
"toVersion": 123,
"timing": "now",
"status": "draft",
"customers": 1,
"byChange": {
"priceUp": 1,
"priceDown": 1,
"same": 1
},
"progress": {
"queued": 1,
"scheduled": 1,
"applied": 1
},
"skipped": [
{
"customerId": "<string>",
"reason": "pending_change"
}
]
}{
"error": "<string>",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment.",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment.",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "insufficient_permissions",
"requiredScope": "customers:read",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment."
}{
"error": "<string>",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment.",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment.",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "rate_limited",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment."
}Plans
Run a plan migration
Move a previewed migration’s subscribers to the new version.
POST
/
v1
/
plans
/
{id}
/
migrations
/
{migrationId}
/
run
cURL
curl --request POST 'https://api.integrateledger.com/v1/plans/starter/migrations/4/run' \
-H "Authorization: Bearer $LEDGER_API_KEY" \
-H 'Idempotency-Key: migrate_123'import ledger from "integrateledger";
const client = new ledger({ apiKey: process.env.LEDGER_API_KEY ?? "" });
await client.runPlanMigration({ id: "starter", migrationId: 4, idempotencyKey: "migrate_123" });import os
from integrateledger import ledger
client = ledger(api_key=os.environ["LEDGER_API_KEY"])
client.run_plan_migration("starter", 4, idempotency_key="migrate_123"){
"migrationId": 123,
"planId": "<string>",
"fromVersion": 123,
"toVersion": 123,
"timing": "now",
"status": "draft",
"customers": 1,
"byChange": {
"priceUp": 1,
"priceDown": 1,
"same": 1
},
"progress": {
"queued": 1,
"scheduled": 1,
"applied": 1
},
"skipped": [
{
"customerId": "<string>",
"reason": "pending_change"
}
]
}{
"error": "<string>",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment.",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment.",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "insufficient_permissions",
"requiredScope": "customers:read",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment."
}{
"error": "<string>",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment.",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "<string>",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment.",
"issues": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"error": "rate_limited",
"message": "No customer \"user_123\" exists in this environment. Create it with POST /v1/customers, or check that the API key is for the right environment."
}Queues a move for each subscriber the migration can move, and records the rest as skipped. Ledger then moves them one at a time: read the migration to follow its progress. Each subscriber is checked again when their move is made, so one whose state changed since the preview is skipped then.
Send an
Idempotency-Key. The same key again returns the migration unchanged; once a migration runs, another key is refused with 409 idempotency_key_mismatch.
Needs the Billing permission at Write.Authorizations
Headers
Path Parameters
Response
The migration, running