> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.paymentkit.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.paymentkit.com/_mcp/server.

# Bulk Update Subscription Items

POST https://app.paymentkit.com/api/{account_id}/subscriptions/bulk-update-items
Content-Type: application/json

Bulk update subscription items across multiple subscriptions.

Updates items on up to 100 subscriptions in a single API call.
Returns HTTP 200 even for partial failures - check the failed list.

Supports PAUSED subscriptions (in addition to ACTIVE, TRIALING, PAST\_DUE).
Proration is automatically skipped for PAUSED and TRIALING subscriptions.

Each subscription is processed independently - one failure doesn't affect others.

**Supported item operations** (same as single update):

* Add new item: `{"price_id": "price_xxx", "quantity": 2}`
* Update existing item: `{"id": "si_xxx", "quantity": 5}`
* Delete item: `{"id": "si_xxx", "deleted": true}`
* Schedule removal: `{"id": "si_xxx", "drop_at_end": true}`

**Error codes for failed subscriptions:**

* `subscription_not_found`: Subscription doesn't exist or belongs to another account
* `invalid_state`: Subscription in CANCELLED, INCOMPLETE, or SCHEDULED state
* `interval_mismatch`: Price interval doesn't match subscription interval
* `validation_error`: Invalid item change
* `payment_failed`: Payment failed (for always\_invoice behavior)

Reference: https://docs.paymentkit.com/api-reference/api-reference/subscriptions/bulk-update-subscription-items

## Authentication

- `Authorization` header (bearer token, required)

## Servers

- `https://app.paymentkit.com` (Production, default)
- `https://staging.paymentkit.com` (Staging)

## Request

### Path parameters

- `account_id` (string, required)

### Body (application/json)

- `subscriptions` (list of object, required)
  - `subscription_id` (string, required)
  - `items` (list of object, required)
    - `id` (string, optional, nullable)
    - `price_id` (string, optional, nullable)
    - `quantity` (integer, optional, nullable)
    - `deleted` (boolean, optional, nullable)
    - `drop_at_end` (boolean, optional, nullable)
    - `start_at_end` (boolean, optional, nullable)
- `proration_behavior` (enum, optional) — Proration behavior for mid-cycle subscription changes. - ALWAYS_INVOICE: Create invoice immediately and attempt payment now - CREATE_PRORATIONS: Create floating items (invoice_id=NULL) for next renewal - NONE: No proration, changes apply at next renewal only
  - Allowed values: `always_invoice`, `create_prorations`, `none`

## Response

### 200

Successful Response

- `total_processed` (integer, required)
- `total_succeeded` (integer, required)
- `total_failed` (integer, required)
- `total_proration_amount_atom` (integer, required)
- `invoices_created` (integer, required)
- `floating_items_created` (integer, required)
- `succeeded` (list of object, optional)
  - `subscription_id` (string, required)
  - `proration_amount_atom` (integer, optional, default: 0)
  - `invoice_id` (string, optional, nullable)
  - `floating_items_created` (integer, optional, default: 0)
- `failed` (list of object, optional)
  - `subscription_id` (string, required)
  - `error_code` (string, required)
  - `error_message` (string, required)

## Examples

**Request**

```json
{
  "subscriptions": [
    {
      "subscription_id": "sub_8f3a2b7c9d1e4f6a",
      "items": [
        {},
        {},
        {}
      ]
    },
    {
      "subscription_id": "sub_4d2c1e9b7a6f3c8d",
      "items": [
        {}
      ]
    }
  ]
}
```

**Response**

```json
{
  "total_processed": 2,
  "total_succeeded": 1,
  "total_failed": 1,
  "total_proration_amount_atom": 1500,
  "invoices_created": 1,
  "floating_items_created": 2,
  "succeeded": [
    {
      "subscription_id": "sub_8f3a2b7c9d1e4f6a",
      "proration_amount_atom": 1500,
      "invoice_id": "inv_20240615_001",
      "floating_items_created": 2
    }
  ],
  "failed": [
    {
      "subscription_id": "sub_4d2c1e9b7a6f3c8d",
      "error_code": "subscription_not_found",
      "error_message": "Subscription ID sub_4d2c1e9b7a6f3c8d does not exist or belongs to another account."
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://app.paymentkit.com/api/account_id/subscriptions/bulk-update-items"

payload = { "subscriptions": [
        {
            "subscription_id": "sub_8f3a2b7c9d1e4f6a",
            "items": [{}, {}, {}]
        },
        {
            "subscription_id": "sub_4d2c1e9b7a6f3c8d",
            "items": [{}]
        }
    ] }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://app.paymentkit.com/api/account_id/subscriptions/bulk-update-items';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"subscriptions":[{"subscription_id":"sub_8f3a2b7c9d1e4f6a","items":[{},{},{}]},{"subscription_id":"sub_4d2c1e9b7a6f3c8d","items":[{}]}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://app.paymentkit.com/api/account_id/subscriptions/bulk-update-items"

	payload := strings.NewReader("{\n  \"subscriptions\": [\n    {\n      \"subscription_id\": \"sub_8f3a2b7c9d1e4f6a\",\n      \"items\": [\n        {},\n        {},\n        {}\n      ]\n    },\n    {\n      \"subscription_id\": \"sub_4d2c1e9b7a6f3c8d\",\n      \"items\": [\n        {}\n      ]\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(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://app.paymentkit.com/api/account_id/subscriptions/bulk-update-items")

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  \"subscriptions\": [\n    {\n      \"subscription_id\": \"sub_8f3a2b7c9d1e4f6a\",\n      \"items\": [\n        {},\n        {},\n        {}\n      ]\n    },\n    {\n      \"subscription_id\": \"sub_4d2c1e9b7a6f3c8d\",\n      \"items\": [\n        {}\n      ]\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://app.paymentkit.com/api/account_id/subscriptions/bulk-update-items")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"subscriptions\": [\n    {\n      \"subscription_id\": \"sub_8f3a2b7c9d1e4f6a\",\n      \"items\": [\n        {},\n        {},\n        {}\n      ]\n    },\n    {\n      \"subscription_id\": \"sub_4d2c1e9b7a6f3c8d\",\n      \"items\": [\n        {}\n      ]\n    }\n  ]\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://app.paymentkit.com/api/account_id/subscriptions/bulk-update-items', [
  'body' => '{
  "subscriptions": [
    {
      "subscription_id": "sub_8f3a2b7c9d1e4f6a",
      "items": [
        {},
        {},
        {}
      ]
    },
    {
      "subscription_id": "sub_4d2c1e9b7a6f3c8d",
      "items": [
        {}
      ]
    }
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://app.paymentkit.com/api/account_id/subscriptions/bulk-update-items");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"subscriptions\": [\n    {\n      \"subscription_id\": \"sub_8f3a2b7c9d1e4f6a\",\n      \"items\": [\n        {},\n        {},\n        {}\n      ]\n    },\n    {\n      \"subscription_id\": \"sub_4d2c1e9b7a6f3c8d\",\n      \"items\": [\n        {}\n      ]\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["subscriptions": [
    [
      "subscription_id": "sub_8f3a2b7c9d1e4f6a",
      "items": [[], [], []]
    ],
    [
      "subscription_id": "sub_4d2c1e9b7a6f3c8d",
      "items": [[]]
    ]
  ]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://app.paymentkit.com/api/account_id/subscriptions/bulk-update-items")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```