---
title: Create Earning Rule
slug: create-earning-rule
docTags: 
createdAt: 2026-10-19T15:09:30.814Z
---

{
  "id": "q_NlZU3LCrM1kbKk4YgbI",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.b.preview.loyaltyservices.io/api/v3/earning-rules",
    "servers": [
      {
        "url": "https://api.b.preview.loyaltyservices.io/api/v3/earning-rules"
      }
    ],
    "name": "Create Earning Rule",
    "description": "Create a new earning rule",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "Earning rule to create",
          "customType": "EarningRule",
          "schema": [
            {
              "name": "name",
              "kind": "required",
              "type": "string",
              "description": "<p>Natural key for this rule. Must be unique. Also shown as the human-readable label in the admin UI.</p>",
              "example": "Base Earn Rule 2026",
              "maxLength": 50
            },
            {
              "name": "statusCode",
              "kind": "required",
              "type": "string",
              "description": "<p>Lifecycle status of the rule. Active (A) rules fire during processing; Inactive (I) rules are skipped.</p>",
              "example": "A"
            },
            {
              "name": "startDate",
              "kind": "required",
              "type": "string<date>",
              "description": "First accrual date on which this rule is eligible to fire. Transactions with an accrual date before this date do not qualify.",
              "example": "2026-01-01",
              "format": "date"
            },
            {
              "name": "endDate",
              "kind": "optional",
              "type": "string<date>",
              "description": "Last accrual date on which this rule is eligible to fire. Transactions with an accrual date after this date do not qualify. Omit or set to null for no expiry.",
              "example": "2026-12-31",
              "format": "date"
            },
            {
              "name": "rank",
              "kind": "optional",
              "type": "integer<int32>",
              "description": "Sort order when multiple earning rules apply. Lower values are evaluated first.",
              "example": 10,
              "format": "int32"
            },
            {
              "name": "information",
              "kind": "optional",
              "type": "string",
              "description": "Additional notes or descriptive information about this rule.",
              "example": "Standard base earn rate for all transactions",
              "maxLength": 500
            },
            {
              "name": "rawExpression",
              "kind": "optional",
              "type": "string",
              "description": "Boolean eligibility expression evaluated against member and accrual context."
            },
            {
              "name": "workflowStatus",
              "kind": "optional",
              "type": "string",
              "description": "<p>Editorial state of the rule. Values for this field need to match datacodes setup with a CodeType of: RuleWorkflowStatus.</p>",
              "example": "WORKING"
            },
            {
              "name": "dataReleaseName",
              "kind": "optional",
              "type": "string",
              "description": "<p>Name of the data release bundle this rule is assigned to. Pass a name to assign the rule to an existing release; omit or set to null to leave unassigned.</p>",
              "example": "Rules Release 2025",
              "maxLength": 250
            },
            {
              "name": "results",
              "kind": "required",
              "type": "object",
              "description": "Reward outcome configuration for an earning rule.",
              "modelRef": "#/components/schemas/EarningRuleResults",
              "customType": "EarningRuleResults",
              "schema": [
                {
                  "name": "pointCategoryCode",
                  "kind": "optional",
                  "type": "string",
                  "description": "<p>The point category bucket into which earned points are deposited. Values for this field need to match datacodes setup with a CodeType of: PointCategory.</p>",
                  "example": "Base"
                },
                {
                  "name": "typeCode",
                  "kind": "optional",
                  "type": "string",
                  "description": "<p>How the point award is calculated. Values for this field need to match the code value (not description) of a datacode with a CodeType of: ResultType. Example values: F (Fixed), P (Percent).</p>",
                  "example": "F",
                  "default": "F"
                },
                {
                  "name": "amount",
                  "kind": "optional",
                  "type": "number",
                  "description": "Award magnitude interpreted according to typeCode.",
                  "example": 500
                },
                {
                  "name": "tierQualifier",
                  "kind": "optional",
                  "type": "boolean",
                  "description": "<p>When true, the earned points also count toward tier qualification.</p>",
                  "default": false
                },
                {
                  "name": "rounding",
                  "kind": "optional",
                  "type": "string",
                  "description": "Rounding rule applied to the calculated point award.",
                  "example": "Round"
                },
                {
                  "name": "transactionRounding",
                  "kind": "optional",
                  "type": "string",
                  "description": "<p>Rounding rule applied to the transaction amount before point calculation. When set, the transaction amount is rounded to whole units using this mode prior to applying the earning rule formula.</p>",
                  "example": "Round"
                },
                {
                  "name": "numberOfDecimals",
                  "kind": "optional",
                  "type": "integer<int32>",
                  "description": "Number of decimal places in the final calculated point award. The rounding field controls the rounding mode applied when scaling to this precision.",
                  "example": 0,
                  "format": "int32"
                }
              ]
            },
            {
              "name": "limits",
              "kind": "optional",
              "type": "object",
              "description": "Cap configuration for point earn amounts.",
              "modelRef": "#/components/schemas/EarningRuleLimits",
              "customType": "EarningRuleLimits",
              "schema": [
                {
                  "name": "minimumEarn",
                  "kind": "optional",
                  "type": "integer<int32>",
                  "description": "Minimum number of points a member can earn from a single trigger of this rule.",
                  "example": 1,
                  "format": "int32"
                },
                {
                  "name": "maximumEarn",
                  "kind": "optional",
                  "type": "integer<int32>",
                  "description": "Maximum number of points a member can earn from a single trigger of this rule.",
                  "example": 10000,
                  "format": "int32"
                },
                {
                  "name": "pendingDays",
                  "kind": "optional",
                  "type": "integer<int32>",
                  "description": "Number of days a Pending Earning remains pending before it is submitted as an earning.",
                  "example": 3,
                  "format": "int32"
                }
              ]
            },
            {
              "name": "invoicing",
              "kind": "optional",
              "type": "object",
              "description": "Billing configuration applied when the cost of this rule is charged back to an invoiced party.",
              "modelRef": "#/components/schemas/ProBonusInvoicing",
              "customType": "ProBonusInvoicing",
              "schema": [
                {
                  "name": "billable",
                  "kind": "optional",
                  "type": "boolean",
                  "description": "<p>When true, the cost of this rule is charged back to the invoiced party identified by billableToTypeCode.</p>"
                },
                {
                  "name": "billableToTypeCode",
                  "kind": "optional",
                  "type": "string",
                  "description": "<p>The party billed when billable is true. Values for this field need to match datacodes setup with a CodeType of: InvoiceTo. e.g. Hotel or Corporate.</p>",
                  "example": "Hotel"
                },
                {
                  "name": "invoiceTypeCode",
                  "kind": "optional",
                  "type": "string",
                  "description": "<p>Invoice classification applied when billableToTypeCode is Hotel. Values for this field need to match datacodes setup with a CodeType of: InvoiceType.</p>",
                  "example": "Standard"
                },
                {
                  "name": "invoiceAmount",
                  "kind": "optional",
                  "type": "number",
                  "description": "Fixed fee charged per occurrence when billable is true.",
                  "example": 25
                },
                {
                  "name": "invoiceRate",
                  "kind": "optional",
                  "type": "number",
                  "description": "<p>Rate-based fee charged per occurrence when billable is true. Client-specific — may not be available on all deployments.</p>",
                  "example": 0.15
                },
                {
                  "name": "ownerName",
                  "kind": "optional",
                  "type": "string",
                  "description": "Name of the owner responsible for this rule.",
                  "example": "Marketing Team"
                },
                {
                  "name": "taxable",
                  "kind": "optional",
                  "type": "boolean",
                  "description": "<p>When true, points awarded by this rule are treated as taxable income.</p>",
                  "example": false
                }
              ]
            }
          ],
          "modelRef": "#/components/schemas/EarningRule",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "OAuth2",
          "name": "OAuth2",
          "kind": "optional",
          "type": "oauth2",
          "description": "<p>See <a href=\"https://docs.wearephaedon.com/docs/platform-api-authentication\" target=\"_blank\">https://docs.wearephaedon.com/docs/platform-api-authentication</a></p>",
          "oauth2Flows": {
            "clientCredentials": {
              "tokenUrl": "https://phaedon.oktapreview.com/oauth2/auscfbbmieFBGGOzR1d7/v1/token",
              "scopes": {
                "api:custom-data:read": "Grants read access to custom data information",
                "api:custom-data:modify": "Grants modify access to custom data information",
                "api:data-codes:read": "Grants read access to data codes",
                "api:data-codes:modify": "Grants modify access to data codes",
                "api:coupon-compensation:read": "Grants read access to compensations for coupon code",
                "api:coupon-compensation:create": "Grants access to create compensations for coupon code",
                "api:coupon-compensation:modify": "Grants access to edit compensation nights for coupon code",
                "api:coupon-request:modify": "Grants modify access to create coupons",
                "api:member:search": "Grants search access to member information",
                "api:member:verify": "Grants verify access to member information",
                "api:member:merge": "Grants access to merge members",
                "api:member:enroll": "Grants access to enroll members",
                "api:member:modify": "Grants modify access to member information",
                "api:member:read": "Grants read access to member information",
                "api:member:close": "Grants access to close member account",
                "api:member:migrate": "Grants access to migrate member accounts",
                "api:member-address:read": "Grants read access to member address information",
                "api:member-address:modify": "Grants modify access to member address information",
                "api:member-alias:read": "Grants read access to member alias information",
                "api:member-alias:modify": "Grants modify access to member alias information",
                "api:member-badge:read": "Grants read access to member badge information",
                "api:member-badge:modify": "Grants modify access to member badge information",
                "api:member-bonus:add": "Grants access to add a bonus to a member",
                "api:member-bonus:read": "Grants read access to member bonus information",
                "api:member-comments:read": "Grants read access to member comments information",
                "api:member-comments:modify": "Grants modify access to member comments information",
                "api:member-communication:read": "Grants read access to member communication information",
                "api:member-communication:modify": "Grants modify access to member communication information",
                "api:member-coupon:read": "Grants read access to member coupon information",
                "api:member-coupon-use:cancel": "Grants access to cancel member coupon uses",
                "api:member-coupon:transfer": "Grants access to transfer a member coupon",
                "api:member-coupon-use:update": "Grants access to update member coupon uses",
                "api:member-currency:read": "Grants read access to member currency information",
                "api:member-currency:adjust": "Grants access to adjust member currency",
                "api:member-currency:migrate": "Grants access to migrate member currency",
                "api:member-currency-conversion:convert": "Grants access to convert member currency",
                "api:member-email:read": "Grants read access to member email information",
                "api:member-email:modify": "Grants modify access to member email information",
                "api:member-event:read": "Grants read access to member events",
                "api:member-event:modify": "Grants modify access to member events",
                "api:event-rule:read": "Grants read access to event rules",
                "api:event-rule:modify": "Grants access to modify event rule",
                "api:event-rule:admin": "Grants full admin access to event rules",
                "api:member-list:read": "Grants read access to member list information",
                "api:member-list:modify": "Grants modify access to member list information",
                "api:member-partner-link:read": "Grants read access to member partner link information",
                "api:member-partner-link:modify": "Grants modify access to member partner link information",
                "api:member-payment-card:read": "Grants read access to member payment card information",
                "api:member-payment-card:modify": "Grants modify access to member payment card information",
                "api:member-phone:read": "Grants read access to member phone information",
                "api:member-phone:modify": "Grants modify access to member phone information",
                "api:member-preference:read": "Grants read access to member preference information",
                "api:member-preference:modify": "Grants modify access to member preference information",
                "api:member-promotion:read": "Grants read access to member promotion information",
                "api:member-promotion:register": "Grants access to register a member into a promotion",
                "api:member-redemption:create": "Grants redeem access to member redemption information",
                "api:member-redemption:over-redeem": "Grants access to over redeem",
                "api:member-redemption:read": "Grants read access to member redemption information",
                "api:member-redemption:cancel": "Grants access to cancel member redemptions",
                "api:member-redemption:migrate": "Allows migration of member redemption information",
                "api:member-redemption:patch": "Grants patching access to member redemption",
                "api:member-tier:read": "Grants read access to member tier information",
                "api:member-tier:adjust": "Grants access to adjust member tiers",
                "api:member-tier:migrate": "Grants access to migrate member tiers",
                "api:member-transaction:read": "Grants read access to transaction information",
                "api:member-transaction:cancel": "Grants access to cancel transactions",
                "api:member-transaction:clone": "Grants access to clone transactions",
                "api:member-transfer:transfer": "Grants access to do member to member transfers",
                "api:preference:read": "Grants read access to preference information",
                "api:promotion:read": "Grants read access to promotion information",
                "api:tier:read": "Grant read access to tier information",
                "api:promotion:register": "Grants access to register a member into a promotion using token",
                "api:promotion-token:manage": "Grants access to generate promotion token",
                "api:redemption:read": "Grants read access to redemption information",
                "api:redemption:modify": "Grants access to modify redemption information",
                "api:bonus-rule:read": "Grants read access to bonus rule configuration",
                "api:bonus-rule:modify": "Grants access to modify bonus rule configuration",
                "api:bonus-rule:manage": "Grants limited admin access to bonus rule configuration",
                "api:bonus-rule:admin": "Grants full admin access to bonus rules",
                "api:promotion-rule:read": "Grants read access to promotion rule configuration",
                "api:promotion-rule:modify": "Grants access to modify promotion rule configuration",
                "api:promotion-rule:manage": "Grants limited admin access to promotion rule configuration",
                "api:promotion-rule:admin": "Grants full admin access to promotion rules",
                "api:reports:under-investigation": "Grants access to under investigation report",
                "api:transaction:submit": "Grants access to submit transactions",
                "api:transaction:migrate": "Grants access to migrate transactions",
                "api:user:read": "Grants access to read user information",
                "api:user:modify": "Grants access to create user",
                "api:user-task:read": "Grants read access to user tasks",
                "api:user-task:modify": "Grants modify access to user tasks",
                "api:user-role:read": "Grants read access to user roles",
                "api:user-role:modify": "Grants modify access to user roles",
                "api:compensation:read": "Grants read access to hotel summary information",
                "api:compensation:modify": "Grants modify access to hotel summary information",
                "api:member-referral:read": "Grants read access to member referral information",
                "api:member-referral:modify": "Grants modify access to member referral information",
                "api:member-referral-codes:read": "Grants read access to member referral codes",
                "api:member-referral-codes:create": "Grants access to create member referral codes",
                "api:outbound-notification:modify": "Grants access to send outbound notification",
                "api:outbound-notification:read": "Grants access to read outbound notification types",
                "api:background-task:read": "Grants read access to background task information",
                "api:async-task:create": "Grants access to submit operations for background processing",
                "api:async-task:read": "Grants read access to background processing results",
                "api:audit-configuration:read": "Grants read access to audit configuration information",
                "api:audit-configuration:modify": "Grants modify access to audit configuration information",
                "api:badge:read": "Grant read access to badge information",
                "api:broadcast-messages:read": "Grant Read access to broadcast messages",
                "api:expression-config:read": "Grant read access to expression builder configuration",
                "api:managed-entity:read": "Grant read access to managed entity data",
                "api:customer-satisfaction:modify": "Grants modify access to customer satisfaction metrics",
                "api:member-linked-account:modify": "Grant modify access to member linked account",
                "api:member-linked-account:read": "Grants access to read linked member accounts",
                "api:enroll-codes:read": "Grants access to read enroll codes",
                "api:contact-us:modify": "Grants access to submit Contact Us inquiry",
                "api:data-release:read": "Grants read access to data releases",
                "api:points-pool:read": "Grants read access to points pools",
                "api:points-pool:modify": "Grants modify access to points pools",
                "api:segment:read": "Grants read access to segments",
                "api:segment:modify": "Grants modify access to segments",
                "api:communication-type:read": "Grants read access to communication types",
                "api:communication-type:modify": "Grants modify access to communication types",
                "api:member-status-match:read": "Grants read access to status match eligibility and submitted images/applications",
                "api:member-status-match:create": "Grants access to upload status match images and submit applications",
                "api:earning-rule:modify": "Grant modify access to earning rules"
              }
            }
          },
          "requiredScopes": [
            "api:earning-rule:modify"
          ]
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Success",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "EarningRule",
            "schema": [
              {
                "name": "name",
                "kind": "required",
                "type": "string",
                "description": "<p>Natural key for this rule. Must be unique. Also shown as the human-readable label in the admin UI.</p>",
                "example": "Base Earn Rule 2026",
                "maxLength": 50
              },
              {
                "name": "statusCode",
                "kind": "required",
                "type": "string",
                "description": "<p>Lifecycle status of the rule. Active (A) rules fire during processing; Inactive (I) rules are skipped.</p>",
                "example": "A"
              },
              {
                "name": "startDate",
                "kind": "required",
                "type": "string<date>",
                "description": "First accrual date on which this rule is eligible to fire. Transactions with an accrual date before this date do not qualify.",
                "example": "2026-01-01",
                "format": "date"
              },
              {
                "name": "endDate",
                "kind": "optional",
                "type": "string<date>",
                "description": "Last accrual date on which this rule is eligible to fire. Transactions with an accrual date after this date do not qualify. Omit or set to null for no expiry.",
                "example": "2026-12-31",
                "format": "date"
              },
              {
                "name": "rank",
                "kind": "optional",
                "type": "integer<int32>",
                "description": "Sort order when multiple earning rules apply. Lower values are evaluated first.",
                "example": 10,
                "format": "int32"
              },
              {
                "name": "information",
                "kind": "optional",
                "type": "string",
                "description": "Additional notes or descriptive information about this rule.",
                "example": "Standard base earn rate for all transactions",
                "maxLength": 500
              },
              {
                "name": "rawExpression",
                "kind": "optional",
                "type": "string",
                "description": "Boolean eligibility expression evaluated against member and accrual context."
              },
              {
                "name": "workflowStatus",
                "kind": "optional",
                "type": "string",
                "description": "<p>Editorial state of the rule. Values for this field need to match datacodes setup with a CodeType of: RuleWorkflowStatus.</p>",
                "example": "WORKING"
              },
              {
                "name": "dataReleaseName",
                "kind": "optional",
                "type": "string",
                "description": "<p>Name of the data release bundle this rule is assigned to. Pass a name to assign the rule to an existing release; omit or set to null to leave unassigned.</p>",
                "example": "Rules Release 2025",
                "maxLength": 250
              },
              {
                "name": "dataReleaseItemStatus",
                "kind": "optional",
                "type": "string",
                "readOnly": true,
                "description": "<p>Deployment status of this rule within its data release. Values for this field need to match datacodes setup with a CodeType of: DataReleaseItemStatus.</p>",
                "example": "LIVE",
                "maxLength": 50
              },
              {
                "name": "results",
                "kind": "required",
                "type": "object",
                "description": "Reward outcome configuration for an earning rule.",
                "modelRef": "#/components/schemas/EarningRuleResults",
                "customType": "EarningRuleResults",
                "schema": [
                  {
                    "name": "pointCategoryCode",
                    "kind": "optional",
                    "type": "string",
                    "description": "<p>The point category bucket into which earned points are deposited. Values for this field need to match datacodes setup with a CodeType of: PointCategory.</p>",
                    "example": "Base"
                  },
                  {
                    "name": "typeCode",
                    "kind": "optional",
                    "type": "string",
                    "description": "<p>How the point award is calculated. Values for this field need to match the code value (not description) of a datacode with a CodeType of: ResultType. Example values: F (Fixed), P (Percent).</p>",
                    "example": "F",
                    "default": "F"
                  },
                  {
                    "name": "amount",
                    "kind": "optional",
                    "type": "number",
                    "description": "Award magnitude interpreted according to typeCode.",
                    "example": 500
                  },
                  {
                    "name": "tierQualifier",
                    "kind": "optional",
                    "type": "boolean",
                    "description": "<p>When true, the earned points also count toward tier qualification.</p>",
                    "default": false
                  },
                  {
                    "name": "rounding",
                    "kind": "optional",
                    "type": "string",
                    "description": "Rounding rule applied to the calculated point award.",
                    "example": "Round"
                  },
                  {
                    "name": "transactionRounding",
                    "kind": "optional",
                    "type": "string",
                    "description": "<p>Rounding rule applied to the transaction amount before point calculation. When set, the transaction amount is rounded to whole units using this mode prior to applying the earning rule formula.</p>",
                    "example": "Round"
                  },
                  {
                    "name": "numberOfDecimals",
                    "kind": "optional",
                    "type": "integer<int32>",
                    "description": "Number of decimal places in the final calculated point award. The rounding field controls the rounding mode applied when scaling to this precision.",
                    "example": 0,
                    "format": "int32"
                  }
                ]
              },
              {
                "name": "limits",
                "kind": "optional",
                "type": "object",
                "description": "Cap configuration for point earn amounts.",
                "modelRef": "#/components/schemas/EarningRuleLimits",
                "customType": "EarningRuleLimits",
                "schema": [
                  {
                    "name": "minimumEarn",
                    "kind": "optional",
                    "type": "integer<int32>",
                    "description": "Minimum number of points a member can earn from a single trigger of this rule.",
                    "example": 1,
                    "format": "int32"
                  },
                  {
                    "name": "maximumEarn",
                    "kind": "optional",
                    "type": "integer<int32>",
                    "description": "Maximum number of points a member can earn from a single trigger of this rule.",
                    "example": 10000,
                    "format": "int32"
                  },
                  {
                    "name": "pendingDays",
                    "kind": "optional",
                    "type": "integer<int32>",
                    "description": "Number of days a Pending Earning remains pending before it is submitted as an earning.",
                    "example": 3,
                    "format": "int32"
                  }
                ]
              },
              {
                "name": "invoicing",
                "kind": "optional",
                "type": "object",
                "description": "Billing configuration applied when the cost of this rule is charged back to an invoiced party.",
                "modelRef": "#/components/schemas/ProBonusInvoicing",
                "customType": "ProBonusInvoicing",
                "schema": [
                  {
                    "name": "billable",
                    "kind": "optional",
                    "type": "boolean",
                    "description": "<p>When true, the cost of this rule is charged back to the invoiced party identified by billableToTypeCode.</p>"
                  },
                  {
                    "name": "billableToTypeCode",
                    "kind": "optional",
                    "type": "string",
                    "description": "<p>The party billed when billable is true. Values for this field need to match datacodes setup with a CodeType of: InvoiceTo. e.g. Hotel or Corporate.</p>",
                    "example": "Hotel"
                  },
                  {
                    "name": "invoiceTypeCode",
                    "kind": "optional",
                    "type": "string",
                    "description": "<p>Invoice classification applied when billableToTypeCode is Hotel. Values for this field need to match datacodes setup with a CodeType of: InvoiceType.</p>",
                    "example": "Standard"
                  },
                  {
                    "name": "invoiceAmount",
                    "kind": "optional",
                    "type": "number",
                    "description": "Fixed fee charged per occurrence when billable is true.",
                    "example": 25
                  },
                  {
                    "name": "invoiceRate",
                    "kind": "optional",
                    "type": "number",
                    "description": "<p>Rate-based fee charged per occurrence when billable is true. Client-specific — may not be available on all deployments.</p>",
                    "example": 0.15
                  },
                  {
                    "name": "ownerName",
                    "kind": "optional",
                    "type": "string",
                    "description": "Name of the owner responsible for this rule.",
                    "example": "Marketing Team"
                  },
                  {
                    "name": "taxable",
                    "kind": "optional",
                    "type": "boolean",
                    "description": "<p>When true, points awarded by this rule are treated as taxable income.</p>",
                    "example": false
                  }
                ]
              }
            ],
            "modelRef": "#/components/schemas/EarningRule",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Bad request",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "ErrorResponse",
            "schema": [
              {
                "name": "errors",
                "kind": "optional",
                "type": "array",
                "description": "List of errors",
                "modelRef": "#/components/schemas/ValidationError",
                "customType": "ValidationError[]",
                "schema": [
                  {
                    "name": "code",
                    "kind": "optional",
                    "type": "string",
                    "description": "Error code assigned to this violation"
                  },
                  {
                    "name": "fieldName",
                    "kind": "optional",
                    "type": "string",
                    "description": "<p>Name of field that violated validation constraint (optional)</p>"
                  },
                  {
                    "name": "message",
                    "kind": "optional",
                    "type": "string",
                    "description": "Internal message describing the error"
                  },
                  {
                    "name": "messageParameters",
                    "kind": "optional",
                    "type": "array",
                    "description": "Error message parameters",
                    "example": "",
                    "itemType": "object",
                    "customType": "object[]",
                    "schema": []
                  }
                ]
              }
            ],
            "modelRef": "#/components/schemas/ErrorResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "401",
        "description": "Unauthorized",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "403",
        "description": "Forbidden",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "500",
        "description": "Internal error",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "mh3lbavmf8-a4NZeFpl7o",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.b.preview.loyaltyservices.io/api/v3/earning-rules \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"name\": \"Base Earn Rule 2026\",\n     \"statusCode\": \"A\",\n     \"startDate\": \"2026-01-01\",\n     \"results\": {\n     \"typeCode\": \"F\"\n     }\n     }'"
        },
        {
          "id": "4oGMdZZd-7Q3t1YmlDxcM",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.b.preview.loyaltyservices.io/api/v3/earning-rules\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"name\": \"Base Earn Rule 2026\",\n   \"statusCode\": \"A\",\n   \"startDate\": \"2026-01-01\",\n   \"results\": {\n      \"typeCode\": \"F\"\n   }\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "VYFEFIpGnHeIo9kk_q7CJ",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.b.preview.loyaltyservices.io/api/v3/earning-rules\"\n\npayload = json.dumps({\n   \"name\": \"Base Earn Rule 2026\",\n   \"statusCode\": \"A\",\n   \"startDate\": \"2026-01-01\",\n   \"results\": {\n      \"typeCode\": \"F\"\n   }\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        },
        {
          "id": "d1PChMxF7r9kQVW2lHx6Y",
          "language": "java",
          "label": "Java",
          "code": "OkHttpClient client = new OkHttpClient().newBuilder()\n   .build();\nMediaType mediaType = MediaType.parse(\"application/json\");\nRequestBody body = RequestBody.create(mediaType, \"{\\n  \\\"name\\\": \\\"Base Earn Rule 2026\\\",\\n  \\\"statusCode\\\": \\\"A\\\",\\n  \\\"startDate\\\": \\\"2026-01-01\\\",\\n  \\\"results\\\": {\\n    \\\"typeCode\\\": \\\"F\\\"\\n  }\\n}\");\nRequest request = new Request.Builder()\n   .url(\"https://api.b.preview.loyaltyservices.io/api/v3/earning-rules\")\n   .method(\"POST\", body)\n   .addHeader(\"accept\", \"application/json\")\n   .addHeader(\"content-type\", \"application/json\")\n   .build();\nResponse response = client.newCall(request).execute();"
        }
      ],
      "selectedLanguageId": "mh3lbavmf8-a4NZeFpl7o"
    },
    "results": {
      "languages": [
        {
          "id": "hnLq7mcHsVJBAB3-ZBqlQ",
          "language": "200",
          "code": "// Success\n{\n  \"name\": \"Base Earn Rule 2026\",\n  \"statusCode\": \"A\",\n  \"startDate\": \"2026-01-01\",\n  \"endDate\": \"2026-12-31\",\n  \"rank\": 10,\n  \"information\": \"Standard base earn rate for all transactions\",\n  \"rawExpression\": \"\",\n  \"workflowStatus\": \"WORKING\",\n  \"dataReleaseName\": \"Rules Release 2025\",\n  \"dataReleaseItemStatus\": \"LIVE\",\n  \"results\": {\n    \"pointCategoryCode\": \"Base\",\n    \"typeCode\": \"F\",\n    \"amount\": 500,\n    \"tierQualifier\": false,\n    \"rounding\": \"Round\",\n    \"transactionRounding\": \"Round\",\n    \"numberOfDecimals\": \"\"\n  },\n  \"limits\": {\n    \"minimumEarn\": 1,\n    \"maximumEarn\": 10000,\n    \"pendingDays\": 3\n  },\n  \"invoicing\": {\n    \"billable\": false,\n    \"billableToTypeCode\": \"Hotel\",\n    \"invoiceTypeCode\": \"Standard\",\n    \"invoiceAmount\": 25,\n    \"invoiceRate\": 0.15,\n    \"ownerName\": \"Marketing Team\",\n    \"taxable\": false\n  }\n}"
        },
        {
          "id": "m9tgaObMjxawDE5HEjW9o",
          "language": "400",
          "code": "// Bad request\n{\n  \"errors\": [\n    {\n      \"code\": \"\",\n      \"fieldName\": \"\",\n      \"message\": \"\",\n      \"messageParameters\": [\n        {}\n      ]\n    }\n  ]\n}"
        },
        {
          "id": "ZVG2sRhLAiN7T5NWO9b43",
          "language": "401",
          "code": "// Unauthorized\n"
        },
        {
          "id": "C0d-vzTQCLf2TQP-gWMas",
          "language": "403",
          "code": "// Forbidden\n"
        },
        {
          "id": "7crhIVnY7_7_vSw1RN2GM",
          "language": "500",
          "code": "// Internal error\n"
        }
      ],
      "selectedLanguageId": "hnLq7mcHsVJBAB3-ZBqlQ"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}