Attach a subscription discount
Attach an eligible discount definition from the member’s company. Capture immutable pricing terms and attribute the change to the native member. Duplicate active attachments and existing subscription eligibility rules are enforced. Responses are no-store.
curl --request POST \
--url https://api.fluid.app/api/member/v2026-10/subscriptions/{id}/discounts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"discount_code": "WELCOME10",
"duration": "once"
}
'import requests
url = "https://api.fluid.app/api/member/v2026-10/subscriptions/{id}/discounts"
payload = {
"discount_code": "WELCOME10",
"duration": "once"
}
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({discount_code: 'WELCOME10', duration: 'once'})
};
fetch('https://api.fluid.app/api/member/v2026-10/subscriptions/{id}/discounts', 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.fluid.app/api/member/v2026-10/subscriptions/{id}/discounts",
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([
'discount_code' => 'WELCOME10',
'duration' => 'once'
]),
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.fluid.app/api/member/v2026-10/subscriptions/{id}/discounts"
payload := strings.NewReader("{\n \"discount_code\": \"WELCOME10\",\n \"duration\": \"once\"\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.fluid.app/api/member/v2026-10/subscriptions/{id}/discounts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"discount_code\": \"WELCOME10\",\n \"duration\": \"once\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/member/v2026-10/subscriptions/{id}/discounts")
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 \"discount_code\": \"WELCOME10\",\n \"duration\": \"once\"\n}"
response = http.request(request)
puts response.read_body{
"status": 201,
"data": {
"id": "019a23a4-9211-71bf-8fa5-a5f31a82a0de",
"subscription_id": "019a23a4-9211-71bf-8fa5-a5f31a82a0df",
"currency": "USD",
"discount": {
"id": "019a23a4-9211-71bf-8fa5-a5f31a82a0e0",
"code": "WELCOME10"
},
"discount_version": {
"version_number": 1,
"code": "WELCOME10",
"price_discount_type": "percentage",
"flat_value": null,
"percentage_value": "10.0",
"apply_to_volume": false
},
"duration": "once",
"duration_cycles": null,
"applied_cycles": 0,
"starts_at": "2026-10-01T12:00:00Z",
"created_at": "2026-10-01T12:00:00Z",
"updated_at": "2026-10-01T12:00:00Z",
"removed_at": null,
"removed_reason": null,
"removed_detail": null,
"notes": null,
"attached_via": "manual_member",
"attached_by": {
"kind": "member",
"id": "019a23a4-9211-71bf-8fa5-a5f31a82a0e1",
"label": "Riley Kim"
}
},
"meta": {
"request_uuid": "019a23a4-9211-71bf-8fa5-a5f31a82a0de",
"timestamp": "2026-10-01T12:00:00Z"
}
}{
"status": 123,
"error": {
"message": "<string>",
"details": {}
},
"meta": {
"request_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"status": 123,
"error": {
"message": "<string>",
"details": {}
},
"meta": {
"request_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"status": 123,
"error": {
"message": "<string>",
"details": {}
},
"meta": {
"request_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"status": 123,
"error": {
"message": "<string>",
"details": {}
},
"meta": {
"request_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"status": 123,
"error": {
"message": "<string>",
"details": {}
},
"meta": {
"request_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"status": 123,
"error": {
"message": "<string>",
"details": {}
},
"meta": {
"request_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"timestamp": "2023-11-07T05:31:56Z"
}
}Authorizations
A member credential in the Authorization: Bearer header: a member
session JWT, a portal JWT whose login is linked to a membership in
that company, or an opaque member token. The credential alone
identifies the member and company.
Path Parameters
Public UUID of an owned subscription.
Body
Top-level fields; undeclared fields and query parameters are rejected.
- Option 1
- Option 2
Exactly one discount definition selector and its duration; the bearer supplies all ownership and actor fields.
Public UUID of an eligible discount definition from this company.
Duration of this attachment.
forever, once, repeating Case-insensitive discount code; use instead of discount_id. Ambiguous codes return 422; select a definition by discount_id instead.
1Positive cycle count, required only for repeating duration.
1 <= x <= 2147483647Optional attachment explanation.
2048Response
Discount attached.
The newly attached discount.
curl --request POST \
--url https://api.fluid.app/api/member/v2026-10/subscriptions/{id}/discounts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"discount_code": "WELCOME10",
"duration": "once"
}
'import requests
url = "https://api.fluid.app/api/member/v2026-10/subscriptions/{id}/discounts"
payload = {
"discount_code": "WELCOME10",
"duration": "once"
}
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({discount_code: 'WELCOME10', duration: 'once'})
};
fetch('https://api.fluid.app/api/member/v2026-10/subscriptions/{id}/discounts', 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.fluid.app/api/member/v2026-10/subscriptions/{id}/discounts",
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([
'discount_code' => 'WELCOME10',
'duration' => 'once'
]),
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.fluid.app/api/member/v2026-10/subscriptions/{id}/discounts"
payload := strings.NewReader("{\n \"discount_code\": \"WELCOME10\",\n \"duration\": \"once\"\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.fluid.app/api/member/v2026-10/subscriptions/{id}/discounts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"discount_code\": \"WELCOME10\",\n \"duration\": \"once\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/member/v2026-10/subscriptions/{id}/discounts")
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 \"discount_code\": \"WELCOME10\",\n \"duration\": \"once\"\n}"
response = http.request(request)
puts response.read_body{
"status": 201,
"data": {
"id": "019a23a4-9211-71bf-8fa5-a5f31a82a0de",
"subscription_id": "019a23a4-9211-71bf-8fa5-a5f31a82a0df",
"currency": "USD",
"discount": {
"id": "019a23a4-9211-71bf-8fa5-a5f31a82a0e0",
"code": "WELCOME10"
},
"discount_version": {
"version_number": 1,
"code": "WELCOME10",
"price_discount_type": "percentage",
"flat_value": null,
"percentage_value": "10.0",
"apply_to_volume": false
},
"duration": "once",
"duration_cycles": null,
"applied_cycles": 0,
"starts_at": "2026-10-01T12:00:00Z",
"created_at": "2026-10-01T12:00:00Z",
"updated_at": "2026-10-01T12:00:00Z",
"removed_at": null,
"removed_reason": null,
"removed_detail": null,
"notes": null,
"attached_via": "manual_member",
"attached_by": {
"kind": "member",
"id": "019a23a4-9211-71bf-8fa5-a5f31a82a0e1",
"label": "Riley Kim"
}
},
"meta": {
"request_uuid": "019a23a4-9211-71bf-8fa5-a5f31a82a0de",
"timestamp": "2026-10-01T12:00:00Z"
}
}{
"status": 123,
"error": {
"message": "<string>",
"details": {}
},
"meta": {
"request_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"status": 123,
"error": {
"message": "<string>",
"details": {}
},
"meta": {
"request_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"status": 123,
"error": {
"message": "<string>",
"details": {}
},
"meta": {
"request_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"status": 123,
"error": {
"message": "<string>",
"details": {}
},
"meta": {
"request_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"status": 123,
"error": {
"message": "<string>",
"details": {}
},
"meta": {
"request_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"status": 123,
"error": {
"message": "<string>",
"details": {}
},
"meta": {
"request_uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"timestamp": "2023-11-07T05:31:56Z"
}
}