Redeem promos

Records the caller org's claim on a promo.

POST /v1/marketing/promos/{code}/redeem

Addresshttps://api.hanzo.ai/v1/marketing/promos/{code}/redeem
MethodPOST
Operationpost_marketing_promos_by_code_redeem
AuthAuthorization: Bearer $HANZO_API_KEY

Records the caller org's claim on a promo. NOTHING IS CREDITED: the redemption is a row, and credit into an org is an admin decision made on the admin surface against an auditable ledger.

The plan is DERIVED from the org's live ACTIVE/TRIALING paid subscription and can never be named by the caller — an org with no qualifying subscription is refused, and so is one whose subscription cannot be read. The seat count is the single-seat floor (claimSeats), so the recorded figure has no input that can inflate it.

Guards run under one lock so the cap cannot be raced past: the fleet-wide redemption cap, one redemption per org, one per payment instrument (REQUIRED), and the per-redemption ceiling.

It is IDEMPOTENT: an org that already redeemed gets its original redemption back with alreadyRedeemed true.

Request

3 fields, body application/json (required).

FieldInTypeRequiredDescription
codepathstringyesCode is the promo code from the path.
codebodystring—Code is the promo code from the path.
instrumentbodystring—Instrument identifies the payment method.

Response

StatusBodyMeaning
200marketing.RedeemResultok
defaultproblem-detailsrefused

200 body — 9 fields.

FieldInTypeAlwaysDescription
alreadyRedeemedbodyboolean—AlreadyRedeemed is true when this org had already taken the promo and the call was an idempotent replay.
chargeCentsbodyinteger (int64)—ChargeCents is what month one costs after the discount, DiscountCents the discount that produced it.
discountCentsbodyinteger (int64)—DiscountCents is the discount claimed for month one, in USD cents, at the single-seat floor.
redemptionbodymarketing.Redemption—
redemption.codebodystring—Code is the promo redeemed.
redemption.discountCentsbodyinteger (int64)—DiscountCents is the month-one discount this redemption CLAIMS, in USD cents.
redemption.planbodystring—Plan is the tier redeemed against: pro, max or team.
redemption.redeemedAtbodyinteger (int64)—RedeemedAt is unix seconds.
redemption.seatsbodyinteger (int64)—Seats is the seat count the claim was priced at, and it is ALWAYS 1.

Failure carries the platform error shape — see Errors.

Examples

hanzo marketing promos redeem <code>
import { Configuration, MarketingApi } from 'hanzoai';

const api = new MarketingApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postMarketingPromosByCodeRedeem({ code: 'code', code: "<code>", instrument: "<instrument>" });
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import MarketingApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = MarketingApi(client).post_marketing_promos_by_code_redeem(code='code', code="<code>", instrument="<instrument>")
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.MarketingAPI.PostMarketingPromosByCodeRedeem(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, marketing_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = marketing_api::post_marketing_promos_by_code_redeem(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.MarketingApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new MarketingApi(client).postMarketingPromosByCodeRedeem();
curl -X POST https://api.hanzo.ai/v1/marketing/promos/<code>/redeem \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "code": "<code>",
       "instrument": "<instrument>"
     }'

MCP reaches marketing through the marketing tool, which names its 35 operations with its own verbs — this one among them, under a name only MCP declares. describe explains any of them:

curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "list_marketing_audiences"
         }
       }
     }'

Marketing API · All Hanzo APIs · Interactive reference

Was this page useful?