Download OpenAPI specification:Download
This documentation covers BayRewards APIs. Use the Authentication endpoints to obtain an access token and include the bearer token in the Authorization header for protected endpoints.
Use this endpoint for authentication. Securely include an access token in all API calls.
Obtain an access token using client credentials.
| client_id required | string INSERT_YOUR_CLIENT_ID_HERE |
| client_secret required | string INSERT_YOUR_CLIENT_SECRET_HERE. |
| grant_type required | string client_credentials |
| scope required | string Provide necessary scope Eg. read_customer write_customer |
{- "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
- "token_type": "bearer",
- "expires_in": 3600,
- "scope": "read_customer write_customer"
}You can include contact details along with the email when creating a new contact. If the email already exists, the contact details will be updated accordingly.
Authorization: This endpoint requires a bearer token with the write_customer scope.
required | string or integer The customer ID that you maintain in your platform. This value can be passed either as a string or an integer. |
| email required | string This is the email address of the customer. |
| referred_id | string This is the unique referral ID of the referrer (existing customer) who shared the referral link. The value is extracted from the resolved referral parameter after short-URL expansion. |
| subscription_status | boolean The subscription status of the customer. Possible values are: |
| phone | string The phone number of the customer in E.164 format. e.g +14155552671 |
| created_at required | string The date when the customer account was created format (YYYY-MM-DD). |
| updated_at required | string The date when the customer account was updated format (YYYY-MM-DD). |
| date_of_birth | string The customer's birthdate in format (YYYY-MM-DD) |
| reward_eligibility | boolean Indicates whether the customer is eligible to earn points for creating an account. When true, the customer receives points for this action (if the rule is enabled). When false or not passed, no points are awarded. By default, it is set to false. Help Article : https://help.targetbay.com/s/article/Understanding-rewards-eligibility-in-the-Customer-Create-Update-API |
| first_name | string This is the customer's first name. |
| last_name | string This is the customer's last name. |
| full_name | string This is the customer's full name. |
| address1 | string |
| address2 | string |
| city | string |
| state | string |
| country | string |
| country_code | string |
| zip | integer |
{- "platform_customer_id": "8223704023221",
- "email": "johndoe@targetbay.com",
- "referred_id": "69785a978d6796ee090dd4d0",
- "subscription_status": true,
- "phone": "+14155552671",
- "created_at": "2021-08-04",
- "updated_at": "2021-08-05",
- "date_of_birth": "1990-05-20",
- "reward_eligibility": true,
- "first_name": "John",
- "last_name": "Doe",
- "full_name": "John Doe",
- "address1": "Melrose Avenu",
- "address2": "No 102",
- "city": "Los Angeles",
- "state": "Michigan",
- "country": "United States",
- "country_code": "US",
- "zip": 30303
}{- "success": true,
- "locale": "en",
- "data": {
- "message": "Customer created / updated successfully"
}
}Retrieves the information for a specific customer identified by their unique platform customer ID / Email.
Authorization: This endpoint requires a bearer token with the read_customer scope.
required | string or integer The path identifier to fetch customer information. This value can be either - a string / integer platform_customer_id (e.g. 8223704023221), or - an email address (e.g. aabbcc@gmail.com) only when the query parameter |
| lookup | string Value: "email" Example: lookup=email Optional modifier to indicate the path |
{- "success": true,
- "locale": "en",
- "data": {
- "wallet_balance": 1500,
- "total_points": 1700,
- "message": "Customer information retrieved successfully"
}
}Deletes a specified email contact from the BayRewards system using the provided platform customer ID. This action will delete all associated data for the contact, including points balance and any other related information.
Authorization: This endpoint requires a bearer token with the write_customer scope.
required | string or integer The unique ID of the customer whose email contact is to be deleted from BayRewards. This value can be passed either as a string or an integer. |
{- "success": true,
- "locale": "en",
- "data": {
- "message": "Customer deleted successfully"
}
}Use these API endpoints to create, update, or delete collections, products, and orders in your BayRewards account.
This endpoint allows for the creation and updating of collections within the BayRewards system.
Authorization: This endpoint requires a bearer token with the write_collection scope.
required | integer or string This is the unique ID for the collection within your platform. It can be passed as either an integer or a string. |
string or integer This is the ID of the parent collection, if the current collection is a sub-collection. If there is no parent collection, this field can be omitted. It can be passed as either an integer or a string. | |
| title required | string This is the name or title of the collection. It serves as the identifier or label for the collection within the platform. |
{- "platform_collection_id": "8223704023221",
- "title": "Vehicles"
}{- "success": true,
- "locale": "en",
- "data": {
- "message": "Collection created / updated successfully"
}
}This endpoint allows for the deletion of collections within the BayRewards system.
Authorization: This endpoint requires a bearer token with the write_collection scope.
required | string or integer The unique ID of the collection you wish to delete. This value can be passed as either an integer or a string. |
{- "success": true,
- "locale": "en",
- "data": {
- "message": "collection deleted successfully"
}
}This endpoint allows for the creation or updating of a product within the BayRewards system.
Authorization: This endpoint requires a bearer token with the write_product scope.
required | string or integer The unique identifier for the product in your platform. This value can be passed as either an integer or a string. |
string or integer The unique identifiers for the product's collection(s) in your platform. This value can be passed as either an integer or a string. | |
| product_title required | string The name of the product. |
| product_type | string The type of the product. Must be either |
| product_url | string The URL where the product can be found on your website. |
| created_at | string The timestamp when the product was created format (YYYY-MM-DD). |
| updated_at | string The timestamp when the product was last updated format (YYYY-MM-DD). |
| price required | number The price of the product. |
Array of objects A list of images associated with the product. | |
required | Array of objects Detailed variant information for the product. |
{- "platform_product_id": "822370402970",
- "platform_collection_id": [
- 8223704023999,
- 8223704023992
], - "product_title": "Shirt",
- "product_type": "variant",
- "created_at": "2021-08-04",
- "updated_at": "2021-08-05",
- "price": 79.99,
- "images": [
], - "variants": [
- {
- "variant_id": 8,
- "variant_title": "Pink-shirt",
- "price": 99.99,
- "sku": "BRW-002",
- "created_at": "2021-08-05",
- "updated_at": "2021-08-06"
}
]
}{- "success": true,
- "locale": "string",
- "data": {
- "message": "Product created / updated successfully"
}
}Deletes a specific product from the BayRewards platform using the provided product ID.
Authorization: This endpoint requires a bearer token with the write_product scope.
required | string or integer The Product ID that you wish to delete. This value can be passed as either a string or an integer. |
{- "success": true,
- "locale": "en",
- "data": {
- "message": "Product deleted successfully"
}
}Creates a new order within the BayRewards system. This endpoint allows users to submit or update an order by providing necessary details.
Authorization: This endpoint requires a bearer token with the write_order scope.
required | string or integer The unique identifier for the order in your platform. This value can be passed as either a string or an integer. |
integer or string The unique identifier for the customer placing the order. If not provided, the order will be marked as a guest order (customer without an account). This value can be passed as either a string or an integer. | |
| email required | string The email address of the customer associated with the order. |
| phone | string The phone number of the customer in E.164 format. |
| created_at required | string The timestamp when the order was created format (YYYY-MM-DD). |
| updated_at required | string The timestamp when the order was last updated format (YYYY-MM-DD). |
| completed_at | string The timestamp when the order was completed format (YYYY-MM-DD). To learn more about this field, please refer to the Help article attached under reward_eligibility. |
| reward_eligibility | boolean Indicates whether the customer is eligible to earn points for placing an order. When true, the customer receives points for eligible order actions (if the rule is enabled). When false or not passed, no points are awarded. By default, it is set to false. Help Article : https://help.targetbay.com/s/article/BayRewards-API-Understanding-reward-eligibility-in-Order-Create-Update |
| currency | string Currency used for the order. |
| subtotal_price required | number The subtotal amount of the order before any discounts or taxes. |
| total_discounts | string The total amount of discounts applied to the order. |
| total_price required | number The total amount of the order, including taxes and discounts. |
| total_tax | number The total tax amount applied to the order. |
Array of objects List of discount codes applied to the order. If left blank, no discount will be applied. | |
Array of objects Refund details associated with the order. | |
| order_status required | string The current status of the order (open, completed, cancelled). |
| financial_status | string The financial status of the order (paid, pending, failed). |
| order_number | number Unique identifier for the order, typically assigned by the system. |
required | Array of objects The list of products within the order. |
{- "platform_order_id": "4112002",
- "platform_customer_id": "643456",
- "email": "jaygatsbytest@gmail.com",
- "phone": "+14155552671",
- "created_at": "2021-08-05",
- "updated_at": "2021-08-06",
- "completed_at": "2021-08-06",
- "reward_eligibility": false,
- "currency": "USD",
- "subtotal_price": 500,
- "total_discounts": "10",
- "total_price": 500,
- "total_tax": 0,
- "discount_codes": [
- {
- "discount_code": "CHECKOUTNOW",
- "amount": 10.55,
- "type": "percentage"
}
], - "refunds": [
- {
- "id": 979,
- "total": "90",
- "reason": null
}
], - "order_status": "open",
- "financial_status": "paid",
- "order_number": 5674898,
- "line_items": [
- {
- "variant_id": 1,
- "platform_product_id": "4112002",
- "product_title": "Shirt",
- "price": 1000,
- "quantity": 1,
- "sku": "411202gd"
}
]
}{- "success": true,
- "locale": "en",
- "data": {
- "message": "Order created / updated successfully"
}
}This endpoint allows you to delete an existing order from the BayRewards system.
Authorization: This endpoint requires a bearer token with the write_order scope.
required | string or integer The unique ID of the order that you wish to delete. This value can be passed as either a string or an integer. |
{- "success": true,
- "locale": "en",
- "data": {
- "message": "Order deleted successfully"
}
}Adjust customer points balance based on the email/platform_customer_id provided.
Authorization: This endpoint requires a bearer token with the write_customer scope.
| email required | string The email address of the customer whose points you want to adjust. Either this field or platform_customer_id is required to access this API. |
| points required | integer The number of points you want to adjust. If you simply pass a number, it will add points to the customer’s balance. To deduct points, use a negative value (e.g., -100). |
string or integer The unique ID of the customer. Can be integer or string. |
{- "email": "48xxxxxx@gmail.com",
- "platform_customer_id": "82237040299",
- "points": 10
}{- "success": true,
- "locale": "en",
- "data": {
- "email": "48xxxxxxx@gmail.com",
- "platform_customer_id": 82237040299,
- "wallet_balance": 90,
- "total_points": 90,
- "adjusted_points": -10,
- "message": "accepted"
}
}Use these API endpoints to create, update, or delete discount codes in your BayRewards account.
You can perform create and update operations on a discount code in BayRewards. If the discount code exists, it will be updated; if not, a new one will be created.
Authorization: This endpoint requires a bearer token with the write_discount scope.
| rule_id required | integer You can find the Rule ID in the BayRewards application under the Points section. Go to the Redeem option, and on the right side, you’ll see the list of rules created for redemption. Click Edit on the required rule, and on the right-hand side, within the Discount Payload, you’ll find the Rule ID. |
| rule_type required | string You can find the Rule Type in the BayRewards application under the Points section. Go to the Redeem option, and on the right side, you’ll see the list of rules created for redemption. Click Edit on the required rule, and on the right-hand side, within the Discount Payload, you’ll find the Rule Type. The available rule types are: redeem, referral, and vip. |
required | Array of objects The unique discount code and its status in your platform. It can either be |
{- "rule_id": 2009,
- "rule_type": "redeem",
- "discount_codes": [
- {
- "discount_code": "DISCOUNT2001",
- "discount_code_status": "active"
}, - {
- "discount_code": "DISCOUNT2002",
- "discount_code_status": "expired"
}, - {
- "discount_code": "DISCOUNT2003",
- "discount_code_status": "used"
}
]
}{- "success": true,
- "locale": "en",
- "data": {
- "message": "Discount created / updated successfully"
}
}Retrieves discount code information for a specific rule.
Authorization: This endpoint requires a bearer token with the read_discount scope.
| rule_id required | integer The rule ID maintained in BayRewards platform. You can check this under description for the created redemption rule. |
{- "success": true,
- "locale": "en",
- "data": {
- "message": "Discount information retrieved successfully",
- "discount_codes": [
- {
- "rule_id": 50,
- "discount_code": "5",
- "discount_code_status": "active"
}, - {
- "rule_id": 50,
- "discount_code": "7",
- "discount_code_status": "expired"
}
]
}
}Permanently deletes all discount codes associated with the provided rule ID.
Authorization: This endpoint requires a bearer token with the write_discount scope.
| rule_id required | integer The unique rule ID whose discount codes need to be deleted. |
{- "success": true,
- "locale": "en",
- "data": {
- "message": "Discount code deleted successfully"
}
}Permanently deletes a specific discount code from the BayRewards platform using the provided discount code value.
Authorization: This endpoint requires a bearer token with the write_discount scope.
| discount_code required | string The discount code you want to delete from BayRewards. |
{- "success": true,
- "locale": "en",
- "data": {
- "message": "Discount code deleted successfully"
}
}