Skip to main content
POST
/
memberships
/
{id}
/
add_free_days
Add free days membership
curl --request POST \
  --url https://api.whop.com/api/v1/memberships/{id}/add_free_days \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "free_days": 42
}
'
import requests

url = "https://api.whop.com/api/v1/memberships/{id}/add_free_days"

payload = { "free_days": 42 }
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({free_days: 42})
};

fetch('https://api.whop.com/api/v1/memberships/{id}/add_free_days', 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.whop.com/api/v1/memberships/{id}/add_free_days",
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([
'free_days' => 42
]),
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://api.whop.com/api/v1/memberships/{id}/add_free_days"

payload := strings.NewReader("{\n \"free_days\": 42\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://api.whop.com/api/v1/memberships/{id}/add_free_days")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"free_days\": 42\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.whop.com/api/v1/memberships/{id}/add_free_days")

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 \"free_days\": 42\n}"

response = http.request(request)
puts response.read_body
{
  "cancel_at_period_end": true,
  "canceled_at": "2023-12-01T05:00:00.401Z",
  "cancellation_reason": "I found a better alternative.",
  "checkout_configuration_id": "<string>",
  "company": {
    "id": "biz_xxxxxxxxxxxxxx",
    "title": "Pickaxe"
  },
  "created_at": "2023-12-01T05:00:00.401Z",
  "custom_field_responses": [
    {
      "answer": "<string>",
      "id": "cfrp_xxxxxxxxxxxxx",
      "question": "<string>"
    }
  ],
  "id": "mem_xxxxxxxxxxxxxx",
  "joined_at": "2023-12-01T05:00:00.401Z",
  "license_key": "A1B2C3-D4E5F6-G7H8I9",
  "manage_url": "https://whop.com/billing/manage/mem_abc123",
  "member": {
    "id": "mber_xxxxxxxxxxxxx"
  },
  "metadata": {},
  "payment_collection_paused": true,
  "plan": {
    "id": "plan_xxxxxxxxxxxxx",
    "metadata": {}
  },
  "product": {
    "id": "prod_xxxxxxxxxxxxx",
    "metadata": {},
    "title": "Pickaxe Analytics"
  },
  "promo_code": {
    "id": "promo_xxxxxxxxxxxx"
  },
  "renewal_period_end": "2023-12-01T05:00:00.401Z",
  "renewal_period_start": "2023-12-01T05:00:00.401Z",
  "updated_at": "2023-12-01T05:00:00.401Z",
  "user": {
    "email": "john.doe@example.com",
    "id": "user_xxxxxxxxxxxxx",
    "name": "John Doe",
    "username": "johndoe42"
  }
}
{
"error": {
"code": "parameter_missing",
"message": "Missing required parameter: amount.",
"param": "amount",
"type": "invalid_request_error"
}
}
{
"error": {
"message": "Invalid or missing API key",
"type": "unauthorized"
}
}
{
"error": {
"message": "You do not have permission to access this resource",
"type": "forbidden"
}
}
{
"error": {
"message": "Resource not found",
"type": "not_found"
}
}
{
"error": null
}
{
"error": null
}
{
"error": {
"message": "An unexpected error occurred",
"type": "internal_server_error"
}
}

Authorizations

Authorization
string
header
required

A company API key, company scoped JWT, app API key, or user OAuth token. You must prepend your key/token with the word 'Bearer', which will look like Bearer ***************************

Path Parameters

id
string
required

The unique identifier of the membership.

Example:

"mem_xxxxxxxxxxxxxx"

Body

application/json

Parameters for AddFreeDaysToMembership

free_days
integer
required

The number of free days to add (1-1095). Extends the billing period, expiration date, or Stripe trial depending on plan type.

Example:

42

Response

A successful response

A membership represents an active relationship between a user and a product. It tracks the user's access, billing status, and renewal schedule.

cancel_at_period_end
boolean
required

Whether this membership is set to cancel at the end of the current billing cycle. Only applies to memberships with a recurring plan.

cancel_option
enum<string> | null
required

The category selected for why the member canceled (e.g. too_expensive, switching, missing_features).

Available options:
too_expensive,
switching,
missing_features,
technical_issues,
bad_experience,
other,
testing
canceled_at
string<date-time> | null
required

The time the customer initiated cancellation of this membership. As a Unix timestamp. Null if the membership has not been canceled.

Example:

"2023-12-01T05:00:00.401Z"

cancellation_reason
string | null
required

Free-text explanation provided by the customer when canceling. Null if the customer did not provide a reason.

Example:

"I found a better alternative."

checkout_configuration_id
string | null
required

The ID of the checkout session/configuration that produced this membership, if any. Use this to map memberships back to the checkout configuration that created them.

company
object
required

The company this membership belongs to.

created_at
string<date-time>
required

The datetime the membership was created.

Example:

"2023-12-01T05:00:00.401Z"

currency
enum<string> | null
required

The three-letter ISO currency code for this membership's billing. Null if the membership is free.

Available options:
usd,
sgd,
inr,
aud,
brl,
cad,
dkk,
eur,
nok,
gbp,
sek,
chf,
hkd,
huf,
jpy,
mxn,
myr,
pln,
czk,
nzd,
aed,
eth,
ape,
cop,
ron,
thb,
bgn,
idr,
dop,
php,
try,
krw,
twd,
vnd,
pkr,
clp,
uyu,
ars,
zar,
dzd,
tnd,
mad,
kes,
kwd,
jod,
all,
xcd,
amd,
bsd,
bhd,
bob,
bam,
khr,
crc,
xof,
egp,
etb,
gmd,
ghs,
gtq,
gyd,
ils,
jmd,
mop,
mga,
mur,
mdl,
mnt,
nad,
ngn,
mkd,
omr,
pyg,
pen,
qar,
rwf,
sar,
rsd,
lkr,
tzs,
ttd,
uzs,
rub,
btc,
cny,
usdt,
kzt,
awg,
whop_usd,
xau
custom_field_responses
object[]
required

The customer's responses to custom checkout questions configured on the product at the time of purchase.

id
string
required

The unique identifier for the membership.

Example:

"mem_xxxxxxxxxxxxxx"

joined_at
string<date-time> | null
required

The time the user first joined the company associated with this membership. As a Unix timestamp. Null if the member record does not exist.

Example:

"2023-12-01T05:00:00.401Z"

license_key
string | null
required

The software license key associated with this membership. Only present if the product includes a Whop Software Licensing experience. Null otherwise.

Example:

"A1B2C3-D4E5F6-G7H8I9"

manage_url
string | null
required

The URL where the customer can view and manage this membership, including cancellation and plan changes. Null if no member record exists.

Example:

"https://whop.com/billing/manage/mem_abc123"

member
object | null
required

The member record linking the user to the company for this membership. Null if the member record has not been created yet.

metadata
object | null
required

Custom key-value pairs for the membership (commonly used for software licensing, e.g., HWID). Max 50 keys, 100 chars per key, 500 chars per string value.

payment_collection_paused
boolean
required

Whether recurring payment collection for this membership is temporarily paused by the company.

plan
object
required

The plan the customer purchased to create this membership.

product
object
required

The product this membership grants access to.

promo_code
object | null
required

The promotional code currently applied to this membership's billing. Null if no promo code is active.

renewal_period_end
string<date-time> | null
required

The end of the current billing period for this recurring membership. As a Unix timestamp. Null if the membership is not recurring.

Example:

"2023-12-01T05:00:00.401Z"

renewal_period_start
string<date-time> | null
required

The start of the current billing period for this recurring membership. As a Unix timestamp. Null if the membership is not recurring.

Example:

"2023-12-01T05:00:00.401Z"

status
enum<string>
required

The current lifecycle status of the membership (e.g., active, trialing, past_due, canceled, expired, completed).

Available options:
trialing,
active,
past_due,
completed,
canceled,
expired,
unresolved,
drafted,
canceling
updated_at
string<date-time>
required

The datetime the membership was last updated.

Example:

"2023-12-01T05:00:00.401Z"

user
object | null
required

The user who owns this membership. Null if the user account has been deleted.