cURL
curl -X POST https://api.metrifox.com/api/v1/subscriptions/bulk-assign-plan \
-H "x-api-key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"customer_keys": ["cust_001", "cust_002", "cust_003"],
"plan_key": "pro-plan",
"billing_interval": "monthly",
"currency_code": "EUR",
"skip_invoice": true,
"start_date": "2026-04-01"
}'
from metrifox_sdk import MetrifoxClient
client = MetrifoxClient(api_key="your_api_key")
result = client.subscriptions.bulk_assign_plan(
customer_keys=["cust_001", "cust_002", "cust_003"],
plan_key="pro-plan",
billing_interval="monthly",
currency_code="EUR",
skip_invoice=True,
start_date="2026-04-01"
)
import { init } from "metrifox-js";
const metrifoxClient = init({
apiKey: process.env.METRIFOX_API_KEY
});
const result = await metrifoxClient.subscriptions.bulkAssignPlan({
customer_keys: ["cust_001", "cust_002", "cust_003"],
plan_key: "pro-plan",
billing_interval: "monthly",
currency_code: "EUR",
skip_invoice: true,
start_date: "2026-04-01T00:00:00Z"
});
require 'metrifox-sdk'
METRIFOX_SDK = MetrifoxSDK.init({ api_key: "your-api-key" })
result = METRIFOX_SDK.subscriptions.bulk_assign_plan(
customer_keys: ["cust_001", "cust_002", "cust_003"],
plan_key: "pro-plan",
billing_interval: "monthly",
currency_code: "EUR",
skip_invoice: true,
start_date: "2026-04-01T00:00:00Z"
)
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{defaultHost}/api/v1/subscriptions/bulk-assign-plan",
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([
'customer_keys' => [
'cust_001',
'cust_002',
'cust_003'
],
'plan_key' => 'pro-plan',
'billing_interval' => 'monthly',
'currency_code' => 'EUR',
'items' => [
[
'quantity' => 100,
'feature_key' => 'api-calls',
'credit_key' => 'message-credits'
]
],
'skip_invoice' => false,
'start_date' => '2026-04-01'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://{defaultHost}/api/v1/subscriptions/bulk-assign-plan"
payload := strings.NewReader("{\n \"customer_keys\": [\n \"cust_001\",\n \"cust_002\",\n \"cust_003\"\n ],\n \"plan_key\": \"pro-plan\",\n \"billing_interval\": \"monthly\",\n \"currency_code\": \"EUR\",\n \"items\": [\n {\n \"quantity\": 100,\n \"feature_key\": \"api-calls\",\n \"credit_key\": \"message-credits\"\n }\n ],\n \"skip_invoice\": false,\n \"start_date\": \"2026-04-01\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://{defaultHost}/api/v1/subscriptions/bulk-assign-plan")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"customer_keys\": [\n \"cust_001\",\n \"cust_002\",\n \"cust_003\"\n ],\n \"plan_key\": \"pro-plan\",\n \"billing_interval\": \"monthly\",\n \"currency_code\": \"EUR\",\n \"items\": [\n {\n \"quantity\": 100,\n \"feature_key\": \"api-calls\",\n \"credit_key\": \"message-credits\"\n }\n ],\n \"skip_invoice\": false,\n \"start_date\": \"2026-04-01\"\n}")
.asString();{
"statusCode": 200,
"message": "Bulk plan assignment completed",
"meta": {},
"data": {
"succeeded": [
{
"customer_key": "cust_001"
},
{
"customer_key": "cust_002"
}
],
"failed": []
},
"errors": {}
}
Subscriptions
Bulk assign plan
Assign a plan to multiple customers in one request, with optional entitlement or credit items
POST
/
api
/
v1
/
subscriptions
/
bulk-assign-plan
cURL
curl -X POST https://api.metrifox.com/api/v1/subscriptions/bulk-assign-plan \
-H "x-api-key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"customer_keys": ["cust_001", "cust_002", "cust_003"],
"plan_key": "pro-plan",
"billing_interval": "monthly",
"currency_code": "EUR",
"skip_invoice": true,
"start_date": "2026-04-01"
}'
from metrifox_sdk import MetrifoxClient
client = MetrifoxClient(api_key="your_api_key")
result = client.subscriptions.bulk_assign_plan(
customer_keys=["cust_001", "cust_002", "cust_003"],
plan_key="pro-plan",
billing_interval="monthly",
currency_code="EUR",
skip_invoice=True,
start_date="2026-04-01"
)
import { init } from "metrifox-js";
const metrifoxClient = init({
apiKey: process.env.METRIFOX_API_KEY
});
const result = await metrifoxClient.subscriptions.bulkAssignPlan({
customer_keys: ["cust_001", "cust_002", "cust_003"],
plan_key: "pro-plan",
billing_interval: "monthly",
currency_code: "EUR",
skip_invoice: true,
start_date: "2026-04-01T00:00:00Z"
});
require 'metrifox-sdk'
METRIFOX_SDK = MetrifoxSDK.init({ api_key: "your-api-key" })
result = METRIFOX_SDK.subscriptions.bulk_assign_plan(
customer_keys: ["cust_001", "cust_002", "cust_003"],
plan_key: "pro-plan",
billing_interval: "monthly",
currency_code: "EUR",
skip_invoice: true,
start_date: "2026-04-01T00:00:00Z"
)
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{defaultHost}/api/v1/subscriptions/bulk-assign-plan",
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([
'customer_keys' => [
'cust_001',
'cust_002',
'cust_003'
],
'plan_key' => 'pro-plan',
'billing_interval' => 'monthly',
'currency_code' => 'EUR',
'items' => [
[
'quantity' => 100,
'feature_key' => 'api-calls',
'credit_key' => 'message-credits'
]
],
'skip_invoice' => false,
'start_date' => '2026-04-01'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://{defaultHost}/api/v1/subscriptions/bulk-assign-plan"
payload := strings.NewReader("{\n \"customer_keys\": [\n \"cust_001\",\n \"cust_002\",\n \"cust_003\"\n ],\n \"plan_key\": \"pro-plan\",\n \"billing_interval\": \"monthly\",\n \"currency_code\": \"EUR\",\n \"items\": [\n {\n \"quantity\": 100,\n \"feature_key\": \"api-calls\",\n \"credit_key\": \"message-credits\"\n }\n ],\n \"skip_invoice\": false,\n \"start_date\": \"2026-04-01\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://{defaultHost}/api/v1/subscriptions/bulk-assign-plan")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"customer_keys\": [\n \"cust_001\",\n \"cust_002\",\n \"cust_003\"\n ],\n \"plan_key\": \"pro-plan\",\n \"billing_interval\": \"monthly\",\n \"currency_code\": \"EUR\",\n \"items\": [\n {\n \"quantity\": 100,\n \"feature_key\": \"api-calls\",\n \"credit_key\": \"message-credits\"\n }\n ],\n \"skip_invoice\": false,\n \"start_date\": \"2026-04-01\"\n}")
.asString();{
"statusCode": 200,
"message": "Bulk plan assignment completed",
"meta": {},
"data": {
"succeeded": [
{
"customer_key": "cust_001"
},
{
"customer_key": "cust_002"
}
],
"failed": []
},
"errors": {}
}
Each customer is processed independently. If some customers fail (e.g., customer not found, already subscribed), the others will still be assigned. Check both
succeeded and failed arrays in the response.Use
skip_invoice: true when migrating customers who have already paid outside of Metrifox. The subscription and order will be created, but no invoice will be generated.billing_interval is optional for free plans. You can omit it and the subscription will be created without a billing cycle. For paid plans, billing_interval is required and must match one of the intervals configured on the plan.Use
currency_code when your plan has localized pricing in multiple currencies and you want to pin the subscription to a specific currency (e.g. "EUR" for a European customer). If omitted, the planβs default product currency is used.Use
start_date to backdate subscriptions when onboarding was delayed. Pass a date string in the past (e.g. "2026-04-01") and the subscription will be created with that start date. Combine with skip_invoice: true to avoid charging for the gap period. Future dates are not allowed.Body
application/json
A date string in the past to backdate the subscription start (e.g. "2026-04-01"). Use this when onboarding was delayed and you want the subscription to reflect the original agreed-upon start date.
Must be in the past β future dates are rejected. If omitted, the subscription starts immediately.
Example:
"2026-04-01"

