Skip to main content
PUT
/
inventory
/
memberships
/
bulk
Bulk Update Memberships
curl --request PUT \
  --url https://api.decodahealth.com/inventory/memberships/bulk \
  --header 'API-KEY: <api-key>' \
  --header 'Content-Type: application/json' \
  --header 'TENANT: <tenant>' \
  --data '
[
  {
    "id": "<string>",
    "name": "<string>",
    "description": "<string>",
    "price": 123
  }
]
'
import requests

url = "https://api.decodahealth.com/inventory/memberships/bulk"

payload = [
{
"id": "<string>",
"name": "<string>",
"description": "<string>",
"price": 123
}
]
headers = {
"TENANT": "<tenant>",
"API-KEY": "<api-key>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'PUT',
headers: {TENANT: '<tenant>', 'API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify([{id: '<string>', name: '<string>', description: '<string>', price: 123}])
};

fetch('https://api.decodahealth.com/inventory/memberships/bulk', 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://api.decodahealth.com/inventory/memberships/bulk",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
[
'id' => '<string>',
'name' => '<string>',
'description' => '<string>',
'price' => 123
]
]),
CURLOPT_HTTPHEADER => [
"API-KEY: <api-key>",
"Content-Type: application/json",
"TENANT: <tenant>"
],
]);

$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://api.decodahealth.com/inventory/memberships/bulk"

payload := strings.NewReader("[\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"price\": 123\n }\n]")

req, _ := http.NewRequest("PUT", url, payload)

req.Header.Add("TENANT", "<tenant>")
req.Header.Add("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.put("https://api.decodahealth.com/inventory/memberships/bulk")
.header("TENANT", "<tenant>")
.header("API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("[\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"price\": 123\n }\n]")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.decodahealth.com/inventory/memberships/bulk")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["TENANT"] = '<tenant>'
request["API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"price\": 123\n }\n]"

response = http.request(request)
puts response.read_body
[
  {
    "name": "<string>",
    "price": 123,
    "id": "<string>",
    "externalId": "<string>",
    "description": "<string>",
    "globalDiscountPercentage": 0,
    "patientCreditAmount": 0,
    "patientCreditFrequency": "MONTHLY",
    "patientCreditExpiryDays": 123,
    "maxRenewals": 0,
    "autoRenew": true,
    "setupFee": 0,
    "freezeFee": 0,
    "minimumBillingCycles": 0,
    "billingFrequency": "MONTHLY",
    "textColor": "<string>",
    "isArchived": false,
    "ruleSetId": "<string>",
    "merchantAccountId": "<string>",
    "feeSchedule": [
      {
        "cycleNumber": 2,
        "price": 1,
        "id": "<string>",
        "membershipId": ""
      }
    ],
    "discounts": [
      {
        "membershipId": "<string>",
        "id": "<string>",
        "externalId": "<string>",
        "itemId": "<string>",
        "itemCategory": "<string>",
        "isPhysical": true,
        "discountPercentage": 123,
        "discountAmount": 123,
        "creditAmount": 123,
        "quantity": 123,
        "rollover": false,
        "rolloverExpiryDays": 123,
        "neverExpire": false,
        "group": "<string>",
        "isArchived": false
      }
    ],
    "memberCount": 0,
    "totalRevenue": 0
  }
]
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Headers

TENANT
string
required

The tenant you are making this request on behalf of

API-KEY
string
required

Your api key

Body

application/json
id
string
required
name
string | null
description
string | null
price
integer | null

Response

Successful Response

name
string
required

Name of the membership

price
integer
required

Price of the membership in cents

id
string

Unique identifier for the membership

externalId
string | null

External system identifier for the membership

description
string | null

Optional description of the membership

globalDiscountPercentage
number | null
default:0

Global discount percentage for all items

patientCreditAmount
integer
default:0

Amount of patient credit in cents

patientCreditFrequency
enum<string>
default:MONTHLY

Frequency of patient credit

Available options:
DAILY,
WEEKLY,
BIWEEKLY,
MONTHLY,
QUARTERLY,
SEMI_ANNUALLY,
YEARLY
patientCreditExpiryDays
integer | null

Days until patient credit expires

maxRenewals
integer | null
default:0

Maximum number of renewals (null means unlimited)

autoRenew
boolean
default:true

Whether the membership auto-renews

setupFee
integer
default:0

Setup fee for the membership in cents

freezeFee
integer
default:0

Fee to freeze the membership in cents

minimumBillingCycles
integer
default:0

Minimum number of billing cycles required

billingFrequency
enum<string>
default:MONTHLY

Billing frequency for the membership

Available options:
DAILY,
WEEKLY,
BIWEEKLY,
MONTHLY,
QUARTERLY,
SEMI_ANNUALLY,
YEARLY
textColor
string | null

Text color for the membership

isArchived
boolean
default:false

Whether the membership is archived

ruleSetId
string | null

ID of the rule set for the membership

merchantAccountId
string | null

Bank account (merchant account) that membership deposits go to

feeSchedule
MembershipFeeScheduleEntry · object[] | null

Cycle-specific price overrides

discounts
MembershipDiscount · object[] | null

Optional discounts for the membership

memberCount
integer | null
default:0

Number of active members

totalRevenue
integer | null
default:0

Total revenue from this membership