Call this API method to add or edit coupons. If the coupon_id parameter is null, a new coupon is added. This API is limited to 100 coupons per request. Coupons shared between races cannot be edited using the API. The API returns a list of coupon ids added or edited.
| Field | Description |
|---|---|
coupon_id |
Coupon ID if editing. |
discount_type |
“O” for an Overall Discount, “R” for a Discount per Registrant or “E” for a Discount per Registrant per Event. |
start_date |
Date/time (Eastern Time) the coupon takes effect. |
end_date |
Optional Date/time (Eastern Time) the coupon takes effect. |
| Applicable Fees | |
applies_to_race_fee |
Does the discount apply to registration? |
exclude_event_cost |
Should the event cost be excluded from the discount amount? (Only applicable if applies_to_race_fee is “T”) |
applies_to_giveaway |
Does the discount apply to giveaway pricing? (Only applicable if applies_to_race_fee is “T”) |
applies_to_addons |
Does the discount apply to add-ons? (Only applicable if applies_to_race_fee is “T”) |
applies_to_club_membership_discounts |
Does the discount apply to events where the registrant is taking a club membership discount? (Only applicable if applies_to_race_fee is “T”) |
applies_to_race_memberships |
Does the discount apply to events where the registrant is taking a race membership discount? (Only applicable if applies_to_race_fee is “T”) |
applies_to_group_setup_fees |
Does the fee apply to group/team setup fees? (Only applicable if applies_to_race_fee is “T”) |
applies_to_group_special_event_costs |
Does the discount apply to events where the registrant is using special group/team event pricing? (Only applicable if applies_to_race_fee is “T”) |
applies_to_age_based_pricing |
Does the discount apply to events where the registrant is taking age-based pricing? (Only applicable if applies_to_race_fee is “T”) |
applies_to_multi_person_pricing |
Does the discount apply to events where the registrant is using multi-person pricing? (Only applicable if applies_to_race_fee is “T”) |
applies_to_extra_fee |
Does the discount apply to extra fees? (Only applicable if applies_to_race_fee is “T”) |
applies_with_multi_event_discount |
Does the discount apply to registrations that used multi-event discounts? |
applies_to_shipping_charges |
Does the discount apply to shipping charges? |
applies_to_store |
Does the discount apply to the store? |
| Usage Restrictions | |
new_customer_only |
Does the discount only apply to new participants in the race? |
minimum_amount_in_cents |
Minimum amount (determined by the fees that can be discounted according to the rules above) that the coupon can be used for. |
minimum_donation_amount_in_cents |
Minimum donation amount required to use the coupon. |
limit_per_customer |
Optional limit on the number of times a single customer can use the coupon. |
max_uses |
Optional limit on maximum number of use of the coupon. Note that one use might include multiple registrations. |
max_num_race_registrants |
Optional limit on maximum number of registrations to use the coupon. |
max_events_per_registration |
Optional limit on maximum number of events registrations per transaction that use the coupon. |
event_specific |
Does the coupon only apply to certain events? |
applicable_event_ids |
If the coupon only applies to certain events, list of event IDs that if applies to? |
| Coupon Management Fields | |
coupon_notes |
Optional notes about the coupon. |
tags |
Optional tags for the coupon. A tag may not contain spaces. |
For JSON requests, the request should look like the example below.
{
"coupons": [
{
"coupon_id": null,
"coupon_code": "abc",
"percentage": 25,
"fixed_discount_in_cents": 0,
"discount_type": "O",
"start_date": "2015-01-01 00:00:00",
"end_date": "2015-01-31 23:59:59",
"applies_to_race_fee": "T",
"exclude_event_cost": "F",
"applies_to_giveaway": "F",
"applies_to_addons": "F",
"applies_to_club_membership_discounts": "F",
"applies_to_race_memberships": "F",
"applies_to_group_setup_fees": "F",
"applies_to_group_special_event_costs": "F",
"applies_to_age_based_pricing": "F",
"applies_to_multi_person_pricing": "F",
"applies_to_extra_fee": "F",
"applies_with_multi_event_discount": "F",
"applies_to_shipping_charges": "F",
"applies_to_store": "F",
"new_customer_only": "F",
"minimum_amount_in_cents": 2000,
"minimum_donation_amount_in_cents": 500,
"limit_per_customer": 1,
"max_uses": 10,
"max_num_race_registrants": 10,
"max_events_per_registration": 2,
"event_specific": "F",
"applicable_event_ids": [],
"coupon_notes": null,
"tags": []
},
{
"coupon_id": 12345,
"coupon_code": "xyz",
"percentage": null,
"fixed_discount_in_cents": 500,
"discount_type": "O",
"start_date": "2015-01-01 00:00:00",
"end_date": null,
"applies_to_race_fee": "T",
"exclude_event_cost": "F",
"applies_to_giveaway": "F",
"applies_to_addons": "F",
"applies_to_club_membership_discounts": "F",
"applies_to_race_memberships": "F",
"applies_to_group_setup_fees": "F",
"applies_to_group_special_event_costs": "F",
"applies_to_age_based_pricing": "F",
"applies_to_multi_person_pricing": "F",
"applies_to_extra_fee": "F",
"applies_with_multi_event_discount": "F",
"applies_to_shipping_charges": "F",
"applies_to_store": "F",
"new_customer_only": "T",
"minimum_amount_in_cents": 0,
"minimum_donation_amount_in_cents": null,
"limit_per_customer": null,
"max_uses": null,
"max_num_race_registrants": null,
"max_events_per_registration": null,
"event_specific": "T",
"applicable_event_ids": [123,456],
"coupon_notes": "This coupons only applies to certain events.",
"tags": ["tag1", "tag2"]
}
]
}
For XML requests, the request should look like the example below.
<coupons> <coupon> <coupon_id></coupon_id> <coupon_code>abc</coupon_code> <percentage>25</percentage> <fixed_discount_in_cents>0</fixed_discount_in_cents> <discount_type>O</discount_type> <start_date>2015-01-01 00:00:00</start_date> <end_date>2015-01-31 23:59:59</end_date> <applies_to_race_fee>T</applies_to_race_fee> <exclude_event_cost>F</exclude_event_cost> <applies_to_giveaway>F</applies_to_giveaway> <applies_to_addons>F</applies_to_addons> <applies_to_club_membership_discounts>F</applies_to_club_membership_discounts> <applies_to_race_memberships>F</applies_to_race_memberships> <applies_to_group_setup_fees>F</applies_to_group_setup_fees> <applies_to_group_special_event_costs>F</applies_to_group_special_event_costs> <applies_to_age_based_pricing>F</applies_to_age_based_pricing> <applies_to_multi_person_pricing>F</applies_to_multi_person_pricing> <applies_to_extra_fee>F</applies_to_extra_fee> <applies_with_multi_event_discount>F</applies_with_multi_event_discount> <applies_to_shipping_charges>F</applies_to_shipping_charges> <applies_to_store>F</applies_to_store> <new_customer_only>F</new_customer_only> <minimum_amount_in_cents>2000</minimum_amount_in_cents> <minimum_donation_amount_in_cents>500</minimum_donation_amount_in_cents> <limit_per_customer>1</limit_per_customer> <max_uses>10</max_uses> <max_num_race_registrants>10</max_num_race_registrants> <max_events_per_registration>2</max_events_per_registration> <event_specific>F</event_specific> <applicable_event_ids></applicable_event_ids> <coupon_notes></coupon_notes> <tags></tags> </coupon> <coupon> <coupon_id>12345</coupon_id> <coupon_code>xyz</coupon_code> <percentage></percentage> <fixed_discount_in_cents>500</fixed_discount_in_cents> <discount_type>O</discount_type> <start_date>2015-01-01 00:00:00</start_date> <end_date></end_date> <applies_to_race_fee>T</applies_to_race_fee> <exclude_event_cost>F</exclude_event_cost> <applies_to_giveaway>F</applies_to_giveaway> <applies_to_addons>F</applies_to_addons> <applies_to_club_membership_discounts>F</applies_to_club_membership_discounts> <applies_to_race_memberships>F</applies_to_race_memberships> <applies_to_group_setup_fees>F</applies_to_group_setup_fees> <applies_to_group_special_event_costs>F</applies_to_group_special_event_costs> <applies_to_age_based_pricing>F</applies_to_age_based_pricing> <applies_to_multi_person_pricing>F</applies_to_multi_person_pricing> <applies_to_extra_fee>F</applies_to_extra_fee> <applies_with_multi_event_discount>F</applies_with_multi_event_discount> <applies_to_shipping_charges>F</applies_to_shipping_charges> <applies_to_store>F</applies_to_store> <new_customer_only>T</new_customer_only> <minimum_amount_in_cents>0</minimum_amount_in_cents> <minimum_donation_amount_in_cents></minimum_donation_amount_in_cents> <limit_per_customer></limit_per_customer> <max_uses></max_uses> <max_num_race_registrants></max_num_race_registrants> <max_events_per_registration></max_events_per_registration> <event_specific>T</event_specific> <applicable_event_ids> <event_id>123</event_id> <event_id>456</event_id> </applicable_event_ids> <coupon_notes>This coupons only applies to certain events.</coupon_notes> <tags> <tag>tag1</tag> <tag>tag2</tag> </tags> </coupon> </coupons>
| Parameter | HTTP Method | Default | Description | Datatype |
|---|---|---|---|---|
api_key |
GET | API Key | string |
|
api_secret |
GET | API Secret | string |
|
rsu_api_key |
GET | API v2 key. If used, you must send the API secret in an HTTP header named X-RSU-API-SECRET. | string |
|
sp_api_key |
GET | Super partner API key. If used, you must send the API secret in an HTTP header named X-RSU-API-SECRET. | string |
|
X-RSU-API-SECRET |
HTTP Header | API v2 or super partner secret. | string |
|
Authorization |
HTTP Header | Authorization Header. If using OAuth 2.0, fill this in with `Bearer <token>`. | string |
|
format |
GET | xml | Format of response. The default if not sent is `xml`, but `json` is preferred. | format |
| Parameter | HTTP Method | Default | Description | Datatype |
|---|---|---|---|---|
race_idRequired |
POST | ID of race. | uint |
|
request_format |
POST | xml | Format of request. The default if not sent is `xml`, but `json` is preferred. | format |
requestRequired |
POST | Request in proper format. | string |
{
"openapi": "3.0.3",
"info": {
"title": "Add or Edit Coupon",
"description": "Add or edit coupons for a race.",
"version": "1.0.0",
"contact": {
"name": "RunSignup API Support",
"url": "https://runsignup.com/API",
"email": "info@runsignup.com"
}
},
"servers": [
{
"url": "https://api.runsignup.com/rest",
"description": "Production API Server"
}
],
"tags": [
{
"name": "Coupons",
"description": "APIs related to Coupons"
}
],
"components": {
"schemas": {
"Error": {
"type": "object",
"properties": {
"error": {
"type": "string",
"description": "Error message"
},
"details": {
"type": "object",
"description": "Additional error details",
"additionalProperties": true
}
},
"required": [
"error"
]
},
"BadRequestError": {
"allOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"description": "Error indicating invalid request parameters or structure"
}
]
},
"UnauthorizedError": {
"allOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"description": "Error indicating authentication failure"
}
]
},
"ForbiddenError": {
"allOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"description": "Error indicating the authenticated user lacks required permissions"
}
]
},
"NotFoundError": {
"allOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"description": "Error indicating the requested resource does not exist"
}
]
},
"ServerError": {
"allOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"description": "Error indicating an unexpected server-side issue"
}
]
}
},
"securitySchemes": {
"apiKey": {
"type": "apiKey",
"in": "query",
"name": "api_key",
"description": "RunSignup API Key"
},
"apiSecret": {
"type": "apiKey",
"in": "query",
"name": "api_secret",
"description": "RunSignup API Secret"
}
}
},
"paths": {
"/race/{race_id}/coupons": {
"post": {
"tags": [
"Coupons"
],
"summary": "Add or Edit Coupon",
"description": "Add or edit coupons for a race.",
"operationId": "race_:race_id_coupons",
"parameters": [
{
"name": "race_id",
"in": "path",
"description": "Path parameter: race_id",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "api_key",
"in": "query",
"description": "API Key",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "api_secret",
"in": "query",
"description": "API Secret",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "rsu_api_key",
"in": "query",
"description": "API v2 key. If used, you must send the API secret in an HTTP header named X-RSU-API-SECRET.",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "sp_api_key",
"in": "query",
"description": "Super partner API key. If used, you must send the API secret in an HTTP header named X-RSU-API-SECRET.",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "X-RSU-API-SECRET",
"in": "header",
"description": "API v2 or super partner secret.",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "Authorization",
"in": "header",
"description": "Authorization Header. If using OAuth 2.0, fill this in with `Bearer <token>`.",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "format",
"in": "query",
"description": "Format of response. The default if not sent is `xml`, but `json` is preferred.",
"required": false,
"schema": {
"type": "string",
"enum": [
"xml",
"json",
"csv"
],
"default": "xml"
}
}
],
"security": [
{
"apiKey": [],
"apiSecret": []
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BadRequestError"
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UnauthorizedError"
}
}
}
},
"403": {
"description": "Forbidden",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ForbiddenError"
}
}
}
},
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NotFoundError"
}
}
}
},
"500": {
"description": "Internal Server Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ServerError"
}
}
}
}
},
"x-permissions": [
"affiliates",
"partners",
"race_directors",
"timers"
],
"requestBody": {
"required": true,
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"request_format": {
"type": "string",
"enum": [
"xml",
"json",
"csv"
],
"default": "xml"
},
"request": {
"type": "string"
}
},
"required": [
"request"
]
}
}
}
}
}
}
}
}