curl --request POST \
--url https://api.1club.ai/v1/platform/memberships \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contactId": 123,
"planId": 123,
"payment": {
"reference": "<string>",
"fee": 123
},
"startDate": "2023-11-07T05:31:56Z",
"autoRenew": true,
"overrides": {
"amount": 123,
"signupFee": 123,
"maxUses": 123,
"usesRemaining": 123,
"commitmentMonths": 60
}
}
'import requests
url = "https://api.1club.ai/v1/platform/memberships"
payload = {
"contactId": 123,
"planId": 123,
"payment": {
"reference": "<string>",
"fee": 123
},
"startDate": "2023-11-07T05:31:56Z",
"autoRenew": True,
"overrides": {
"amount": 123,
"signupFee": 123,
"maxUses": 123,
"usesRemaining": 123,
"commitmentMonths": 60
}
}
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({
contactId: 123,
planId: 123,
payment: {reference: '<string>', fee: 123},
startDate: '2023-11-07T05:31:56Z',
autoRenew: true,
overrides: {
amount: 123,
signupFee: 123,
maxUses: 123,
usesRemaining: 123,
commitmentMonths: 60
}
})
};
fetch('https://api.1club.ai/v1/platform/memberships', 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.1club.ai/v1/platform/memberships",
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([
'contactId' => 123,
'planId' => 123,
'payment' => [
'reference' => '<string>',
'fee' => 123
],
'startDate' => '2023-11-07T05:31:56Z',
'autoRenew' => true,
'overrides' => [
'amount' => 123,
'signupFee' => 123,
'maxUses' => 123,
'usesRemaining' => 123,
'commitmentMonths' => 60
]
]),
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.1club.ai/v1/platform/memberships"
payload := strings.NewReader("{\n \"contactId\": 123,\n \"planId\": 123,\n \"payment\": {\n \"reference\": \"<string>\",\n \"fee\": 123\n },\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"autoRenew\": true,\n \"overrides\": {\n \"amount\": 123,\n \"signupFee\": 123,\n \"maxUses\": 123,\n \"usesRemaining\": 123,\n \"commitmentMonths\": 60\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(string(body))
}HttpResponse<String> response = Unirest.post("https://api.1club.ai/v1/platform/memberships")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contactId\": 123,\n \"planId\": 123,\n \"payment\": {\n \"reference\": \"<string>\",\n \"fee\": 123\n },\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"autoRenew\": true,\n \"overrides\": {\n \"amount\": 123,\n \"signupFee\": 123,\n \"maxUses\": 123,\n \"usesRemaining\": 123,\n \"commitmentMonths\": 60\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.1club.ai/v1/platform/memberships")
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 \"contactId\": 123,\n \"planId\": 123,\n \"payment\": {\n \"reference\": \"<string>\",\n \"fee\": 123\n },\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"autoRenew\": true,\n \"overrides\": {\n \"amount\": 123,\n \"signupFee\": 123,\n \"maxUses\": 123,\n \"usesRemaining\": 123,\n \"commitmentMonths\": 60\n }\n}"
response = http.request(request)
puts response.read_body{
"membershipId": 123,
"membershipUuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contactId": 123,
"planId": 123,
"planName": "<string>",
"clubId": 123,
"status": "<string>",
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"renewalDate": "2023-11-07T05:31:56Z",
"autoRenew": true,
"price": 123,
"billingFrequency": "<string>",
"customPeriod": 123,
"customPeriodUnit": "<string>",
"maxUses": 123,
"usesRemaining": 123,
"usesAdjustment": 123,
"allowances": [
{
"allowanceId": 123,
"validFor": {},
"maxUses": 123,
"usesRemaining": 123,
"usesAdjustment": 123,
"sessionUnit": "<string>"
}
],
"sessionLengthMinutes": 123,
"shareWithAccount": true,
"commitmentEndsAt": "2023-11-07T05:31:56Z",
"commitmentMonths": 123,
"createdAt": "2023-11-07T05:31:56Z"
}{
"error": "<string>",
"code": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"details": {}
}Create a membership
Puts a customer on a plan. The plan is snapshotted onto the membership exactly as it is when sold in 1club - club, session allowance, coverage, billing frequency and renewal window - so the membership draws down booking allowance identically.
paid records a payment against the External / API method with no gateway call; unpaid leaves the membership’s transactions outstanding. The total charged is the period amount plus any joining fee, both taken from the plan unless overridden. Collection and refunds stay with you.
When nothing is owed at all - a free plan with no joining fee, or an amount of 0 on such a plan - the membership is created active straight away rather than awaiting a payment that will never come.
Supports the Idempotency-Key header.
curl --request POST \
--url https://api.1club.ai/v1/platform/memberships \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contactId": 123,
"planId": 123,
"payment": {
"reference": "<string>",
"fee": 123
},
"startDate": "2023-11-07T05:31:56Z",
"autoRenew": true,
"overrides": {
"amount": 123,
"signupFee": 123,
"maxUses": 123,
"usesRemaining": 123,
"commitmentMonths": 60
}
}
'import requests
url = "https://api.1club.ai/v1/platform/memberships"
payload = {
"contactId": 123,
"planId": 123,
"payment": {
"reference": "<string>",
"fee": 123
},
"startDate": "2023-11-07T05:31:56Z",
"autoRenew": True,
"overrides": {
"amount": 123,
"signupFee": 123,
"maxUses": 123,
"usesRemaining": 123,
"commitmentMonths": 60
}
}
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({
contactId: 123,
planId: 123,
payment: {reference: '<string>', fee: 123},
startDate: '2023-11-07T05:31:56Z',
autoRenew: true,
overrides: {
amount: 123,
signupFee: 123,
maxUses: 123,
usesRemaining: 123,
commitmentMonths: 60
}
})
};
fetch('https://api.1club.ai/v1/platform/memberships', 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.1club.ai/v1/platform/memberships",
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([
'contactId' => 123,
'planId' => 123,
'payment' => [
'reference' => '<string>',
'fee' => 123
],
'startDate' => '2023-11-07T05:31:56Z',
'autoRenew' => true,
'overrides' => [
'amount' => 123,
'signupFee' => 123,
'maxUses' => 123,
'usesRemaining' => 123,
'commitmentMonths' => 60
]
]),
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.1club.ai/v1/platform/memberships"
payload := strings.NewReader("{\n \"contactId\": 123,\n \"planId\": 123,\n \"payment\": {\n \"reference\": \"<string>\",\n \"fee\": 123\n },\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"autoRenew\": true,\n \"overrides\": {\n \"amount\": 123,\n \"signupFee\": 123,\n \"maxUses\": 123,\n \"usesRemaining\": 123,\n \"commitmentMonths\": 60\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(string(body))
}HttpResponse<String> response = Unirest.post("https://api.1club.ai/v1/platform/memberships")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contactId\": 123,\n \"planId\": 123,\n \"payment\": {\n \"reference\": \"<string>\",\n \"fee\": 123\n },\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"autoRenew\": true,\n \"overrides\": {\n \"amount\": 123,\n \"signupFee\": 123,\n \"maxUses\": 123,\n \"usesRemaining\": 123,\n \"commitmentMonths\": 60\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.1club.ai/v1/platform/memberships")
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 \"contactId\": 123,\n \"planId\": 123,\n \"payment\": {\n \"reference\": \"<string>\",\n \"fee\": 123\n },\n \"startDate\": \"2023-11-07T05:31:56Z\",\n \"autoRenew\": true,\n \"overrides\": {\n \"amount\": 123,\n \"signupFee\": 123,\n \"maxUses\": 123,\n \"usesRemaining\": 123,\n \"commitmentMonths\": 60\n }\n}"
response = http.request(request)
puts response.read_body{
"membershipId": 123,
"membershipUuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"contactId": 123,
"planId": 123,
"planName": "<string>",
"clubId": 123,
"status": "<string>",
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"renewalDate": "2023-11-07T05:31:56Z",
"autoRenew": true,
"price": 123,
"billingFrequency": "<string>",
"customPeriod": 123,
"customPeriodUnit": "<string>",
"maxUses": 123,
"usesRemaining": 123,
"usesAdjustment": 123,
"allowances": [
{
"allowanceId": 123,
"validFor": {},
"maxUses": 123,
"usesRemaining": 123,
"usesAdjustment": 123,
"sessionUnit": "<string>"
}
],
"sessionLengthMinutes": 123,
"shareWithAccount": true,
"commitmentEndsAt": "2023-11-07T05:31:56Z",
"commitmentMonths": 123,
"createdAt": "2023-11-07T05:31:56Z"
}{
"error": "<string>",
"code": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"details": {}
}Authorizations
Headers
Body
Response
Membership created
A customer's membership on a plan. The plan is snapshotted onto it at creation, so allowance and coverage behave exactly as they do for a membership sold in 1club.
Was this page helpful?