> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getruba.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Read Discount

> ### Intent

Reads the discount without changing it.

### When to call it

Call this after your application has received or stored the identifier for the discount.

### Access boundary

Authorize the request with a token that carries `discounts:read` or `discounts:write`.

### Successful result

A successful request returns `200`. The response schema below defines the body your integration receives.

export const RubaSocials = () => {
  if (typeof document === "undefined") {
    return null;
  }
  const inject = () => {
    const footer = document.getElementById("footer");
    if (!footer || document.getElementById("ruba-socials")) {
      return false;
    }
    const isDark = document.querySelector("html.dark") || document.querySelector('html[class*="dark"]');
    const lineColor = isDark ? "#383838" : "#e8e8ed";
    const iconColor = isDark ? "#8e8e93" : "#86868b";
    const markColor = isDark ? "#ffffff" : "#08080c";
    const hoverColor = "#0071e3";
    const div = document.createElement("div");
    div.id = "ruba-socials";
    div.style.cssText = `display:flex;align-items:center;gap:20px;padding-top:20px;margin-top:20px;border-top:1px solid ${lineColor};width:100%`;
    const logo = `<a href="https://getruba.com" style="display:inline-flex;height:24px;align-items:center;gap:8px;text-decoration:none;color:${markColor};line-height:1;"><svg width="24" height="24" viewBox="0 0 120 120" aria-hidden="true" style="display:block;flex:none;"><g transform="translate(2.5 0)"><path d="M19 25h59L65.43 47H19a4 4 0 0 1-4-4V29a4 4 0 0 1 4-4Z" fill="${markColor}"/><path d="M19 73h31.57L38 95H19a4 4 0 0 1-4-4V77a4 4 0 0 1 4-4Z" fill="${markColor}"/><path d="M85 25h25L70 95H45Z" fill="#007AFF"/></g></svg><span style="display:inline-flex;height:24px;align-items:center;font-weight:600;font-size:15px;color:${markColor};letter-spacing:-0.01em;line-height:1;">Ruba</span></a>`;
    const spacer = `<div style="flex:1"></div>`;
    const ig = `<a href="https://instagram.com/getruba" target="_blank" rel="noopener" aria-label="Instagram" style="display:flex;align-items:center;color:${iconColor};transition:color 0.15s ease;" onmouseover="this.style.color='${hoverColor}'" onmouseout="this.style.color='${iconColor}'"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="2" width="20" height="20" rx="5" ry="5"/><path d="M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z"/><line x1="17.5" y1="6.5" x2="17.51" y2="6.5"/></svg></a>`;
    const li = `<a href="https://linkedin.com/company/getruba" target="_blank" rel="noopener" aria-label="LinkedIn" style="display:flex;align-items:center;color:${iconColor};transition:color 0.15s ease;" onmouseover="this.style.color='${hoverColor}'" onmouseout="this.style.color='${iconColor}'"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z"/><rect x="2" y="9" width="4" height="12"/><circle cx="4" cy="4" r="2"/></svg></a>`;
    const x = `<a href="https://x.com/getruba" target="_blank" rel="noopener" aria-label="X" style="display:flex;align-items:center;color:${iconColor};transition:color 0.15s ease;" onmouseover="this.style.color='${hoverColor}'" onmouseout="this.style.color='${iconColor}'"><svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor"><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg></a>`;
    const github = `<a href="https://github.com/rubadot" target="_blank" rel="noopener" aria-label="GitHub" style="display:flex;align-items:center;color:${iconColor};transition:color 0.15s ease;" onmouseover="this.style.color='${hoverColor}'" onmouseout="this.style.color='${iconColor}'"><svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M12 .7a11.5 11.5 0 0 0-3.64 22.4c.58.1.79-.25.79-.56v-2.24c-3.22.7-3.9-1.37-3.9-1.37-.53-1.34-1.29-1.7-1.29-1.7-1.05-.72.08-.71.08-.71 1.16.08 1.78 1.2 1.78 1.2 1.04 1.77 2.72 1.26 3.38.96.1-.75.4-1.26.74-1.55-2.57-.3-5.27-1.29-5.27-5.69 0-1.26.45-2.29 1.19-3.09-.12-.29-.52-1.47.11-3.05 0 0 .97-.31 3.16 1.18A10.96 10.96 0 0 1 12 6.09c.98 0 1.94.13 2.86.39 2.2-1.49 3.16-1.18 3.16-1.18.63 1.58.23 2.76.11 3.05.74.8 1.19 1.83 1.19 3.09 0 4.42-2.7 5.39-5.28 5.68.42.36.79 1.06.79 2.14v3.28c0 .31.21.67.8.56A11.5 11.5 0 0 0 12 .7Z"/></svg></a>`;
    div.innerHTML = logo + spacer + ig + li + x + github;
    footer.appendChild(div);
    return true;
  };
  if (!document.documentElement.dataset.rubaSocialsObserver) {
    document.documentElement.dataset.rubaSocialsObserver = "true";
    const observer = new MutationObserver(() => {
      if (!document.getElementById("ruba-socials")) {
        inject();
      }
    });
    observer.observe(document.body, {
      childList: true,
      subtree: true
    });
  }
  setTimeout(() => {
    if (!inject()) {
      const interval = setInterval(() => {
        if (inject()) {
          clearInterval(interval);
        }
      }, 500);
      setTimeout(() => clearInterval(interval), 10000);
    }
  }, 300);
  return null;
};

<link rel="stylesheet" href="/style.css" />

<RubaSocials />


## OpenAPI

````yaml get /v1/discounts/{id}
openapi: 3.1.0
info:
  title: Ruba API
  summary: Ruba HTTP and Webhooks API
  description: '**Details:** Read the docs at https://docs.getruba.com/api-reference.'
  version: 2026-04
servers:
  - url: https://api.getruba.com
    description: '**Details:** Production environment.'
    x-speakeasy-server-id: production
  - url: https://sandbox-api.getruba.com
    description: '**Details:** Sandbox environment.'
    x-speakeasy-server-id: sandbox
security: []
tags:
  - name: public
    description: >-
      **Details:** Endpoints shown and documented in the Ruba API documentation
      and available in our SDKs.
  - name: private
    description: >-
      **Details:** Endpoints that should appear in the schema only in
      development to generate our internal JS SDK.
paths:
  /v1/discounts/{id}:
    get:
      tags:
        - discounts
        - public
      summary: Read Discount
      description: >-
        ### Intent


        Reads the discount without changing it.


        ### When to call it


        Call this after your application has received or stored the identifier
        for the discount.


        ### Access boundary


        Authorize the request with a token that carries `discounts:read` or
        `discounts:write`.


        ### Successful result


        A successful request returns `200`. The response schema below defines
        the body your integration receives.
      operationId: discounts:get
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid4
            description: Identifier of the discount.
            title: Id
          description: Identifier of the discount.
      responses:
        '200':
          description: Request completed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Discount'
                title: Discount
        '404':
          description: '**Response:** Discount could not be found.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResourceNotFound'
        '422':
          description: Request validation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - oidc:
            - discounts:read
            - discounts:write
        - pat:
            - discounts:read
            - discounts:write
        - oat:
            - discounts:read
            - discounts:write
components:
  schemas:
    Discount:
      oneOf:
        - $ref: '#/components/schemas/DiscountFixedOnceForeverDuration'
        - $ref: '#/components/schemas/DiscountFixedRepeatDuration'
        - $ref: '#/components/schemas/DiscountPercentageOnceForeverDuration'
        - $ref: '#/components/schemas/DiscountPercentageRepeatDuration'
    ResourceNotFound:
      properties:
        error:
          type: string
          const: ResourceNotFound
          title: Error
          examples:
            - ResourceNotFound
        detail:
          type: string
          title: Detail
      type: object
      required:
        - error
        - detail
      title: ResourceNotFound
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    DiscountFixedOnceForeverDuration:
      properties:
        duration:
          $ref: '#/components/schemas/DiscountDuration'
        type:
          $ref: '#/components/schemas/DiscountType'
        amount:
          type: integer
          title: Amount
          deprecated: true
          examples:
            - 1000
        currency:
          type: string
          title: Currency
          deprecated: true
          examples:
            - usd
        amounts:
          additionalProperties:
            type: integer
          type: object
          title: Amounts
          description: >-
            **Amounts:** Map of currency to fixed amount to discount from the
            total.
          examples:
            - eur: 900
              usd: 1000
        created_at:
          type: string
          format: date-time
          title: Created At
          description: The time Ruba created this record.
        modified_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Modified At
          description: The time this record last changed.
        id:
          type: string
          format: uuid4
          title: Id
          description: The stable identifier for this record.
        metadata:
          $ref: '#/components/schemas/MetadataOutputType'
        name:
          type: string
          title: Name
          description: >-
            **Name:** Name of the discount. Will be displayed to the customer
            when the discount is applied.
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
          description: >-
            **Code:** Code customers can use to apply the discount during
            checkout.
        starts_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Starts At
          description: '**Starts At:** Timestamp after which the discount is redeemable.'
        ends_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Ends At
          description: >-
            **Ends At:** Timestamp after which the discount is no longer
            redeemable.
        max_redemptions:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Redemptions
          description: >-
            **Max Redemptions:** Maximum number of times the discount can be
            redeemed.
        redemptions_count:
          type: integer
          title: Redemptions Count
          description: Count of times the discount has been redeemed.
        organization_id:
          type: string
          format: uuid4
          title: Organization Id
          description: Identifier of the organization.
          examples:
            - 1dbfc517-0bbf-4301-9ba8-555ca42b9737
          x-ruba-selector-widget:
            displayProperty: name
            resourceName: Organization
            resourceRoot: /v1/organizations
        products:
          items:
            $ref: '#/components/schemas/DiscountProduct'
          type: array
          title: Products
      type: object
      required:
        - duration
        - type
        - amount
        - currency
        - amounts
        - created_at
        - modified_at
        - id
        - metadata
        - name
        - code
        - starts_at
        - ends_at
        - max_redemptions
        - redemptions_count
        - organization_id
        - products
      title: DiscountFixedOnceForeverDuration
      description: Schema for a fixed amount discount that is applied once or forever.
    DiscountFixedRepeatDuration:
      properties:
        duration:
          $ref: '#/components/schemas/DiscountDuration'
        duration_in_months:
          type: integer
          title: Duration In Months
        type:
          $ref: '#/components/schemas/DiscountType'
        amount:
          type: integer
          title: Amount
          deprecated: true
          examples:
            - 1000
        currency:
          type: string
          title: Currency
          deprecated: true
          examples:
            - usd
        amounts:
          additionalProperties:
            type: integer
          type: object
          title: Amounts
          description: >-
            **Amounts:** Map of currency to fixed amount to discount from the
            total.
          examples:
            - eur: 900
              usd: 1000
        created_at:
          type: string
          format: date-time
          title: Created At
          description: The time Ruba created this record.
        modified_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Modified At
          description: The time this record last changed.
        id:
          type: string
          format: uuid4
          title: Id
          description: The stable identifier for this record.
        metadata:
          $ref: '#/components/schemas/MetadataOutputType'
        name:
          type: string
          title: Name
          description: >-
            **Name:** Name of the discount. Will be displayed to the customer
            when the discount is applied.
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
          description: >-
            **Code:** Code customers can use to apply the discount during
            checkout.
        starts_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Starts At
          description: '**Starts At:** Timestamp after which the discount is redeemable.'
        ends_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Ends At
          description: >-
            **Ends At:** Timestamp after which the discount is no longer
            redeemable.
        max_redemptions:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Redemptions
          description: >-
            **Max Redemptions:** Maximum number of times the discount can be
            redeemed.
        redemptions_count:
          type: integer
          title: Redemptions Count
          description: Count of times the discount has been redeemed.
        organization_id:
          type: string
          format: uuid4
          title: Organization Id
          description: Identifier of the organization.
          examples:
            - 1dbfc517-0bbf-4301-9ba8-555ca42b9737
          x-ruba-selector-widget:
            displayProperty: name
            resourceName: Organization
            resourceRoot: /v1/organizations
        products:
          items:
            $ref: '#/components/schemas/DiscountProduct'
          type: array
          title: Products
      type: object
      required:
        - duration
        - duration_in_months
        - type
        - amount
        - currency
        - amounts
        - created_at
        - modified_at
        - id
        - metadata
        - name
        - code
        - starts_at
        - ends_at
        - max_redemptions
        - redemptions_count
        - organization_id
        - products
      title: DiscountFixedRepeatDuration
      description: |-
        Schema for a fixed amount discount that is applied on every invoice
        for a certain number of months.
    DiscountPercentageOnceForeverDuration:
      properties:
        duration:
          $ref: '#/components/schemas/DiscountDuration'
        type:
          $ref: '#/components/schemas/DiscountType'
        basis_points:
          type: integer
          title: Basis Points
          description: >-
            **Basis Points:** Discount percentage in basis points. A basis point
            is 1/100th of a percent. For example, 1000 basis points equals a 10%
            discount.
          examples:
            - 1000
        created_at:
          type: string
          format: date-time
          title: Created At
          description: The time Ruba created this record.
        modified_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Modified At
          description: The time this record last changed.
        id:
          type: string
          format: uuid4
          title: Id
          description: The stable identifier for this record.
        metadata:
          $ref: '#/components/schemas/MetadataOutputType'
        name:
          type: string
          title: Name
          description: >-
            **Name:** Name of the discount. Will be displayed to the customer
            when the discount is applied.
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
          description: >-
            **Code:** Code customers can use to apply the discount during
            checkout.
        starts_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Starts At
          description: '**Starts At:** Timestamp after which the discount is redeemable.'
        ends_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Ends At
          description: >-
            **Ends At:** Timestamp after which the discount is no longer
            redeemable.
        max_redemptions:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Redemptions
          description: >-
            **Max Redemptions:** Maximum number of times the discount can be
            redeemed.
        redemptions_count:
          type: integer
          title: Redemptions Count
          description: Count of times the discount has been redeemed.
        organization_id:
          type: string
          format: uuid4
          title: Organization Id
          description: Identifier of the organization.
          examples:
            - 1dbfc517-0bbf-4301-9ba8-555ca42b9737
          x-ruba-selector-widget:
            displayProperty: name
            resourceName: Organization
            resourceRoot: /v1/organizations
        products:
          items:
            $ref: '#/components/schemas/DiscountProduct'
          type: array
          title: Products
      type: object
      required:
        - duration
        - type
        - basis_points
        - created_at
        - modified_at
        - id
        - metadata
        - name
        - code
        - starts_at
        - ends_at
        - max_redemptions
        - redemptions_count
        - organization_id
        - products
      title: DiscountPercentageOnceForeverDuration
      description: Schema for a percentage discount that is applied once or forever.
    DiscountPercentageRepeatDuration:
      properties:
        duration:
          $ref: '#/components/schemas/DiscountDuration'
        duration_in_months:
          type: integer
          title: Duration In Months
        type:
          $ref: '#/components/schemas/DiscountType'
        basis_points:
          type: integer
          title: Basis Points
          description: >-
            **Basis Points:** Discount percentage in basis points. A basis point
            is 1/100th of a percent. For example, 1000 basis points equals a 10%
            discount.
          examples:
            - 1000
        created_at:
          type: string
          format: date-time
          title: Created At
          description: The time Ruba created this record.
        modified_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Modified At
          description: The time this record last changed.
        id:
          type: string
          format: uuid4
          title: Id
          description: The stable identifier for this record.
        metadata:
          $ref: '#/components/schemas/MetadataOutputType'
        name:
          type: string
          title: Name
          description: >-
            **Name:** Name of the discount. Will be displayed to the customer
            when the discount is applied.
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
          description: >-
            **Code:** Code customers can use to apply the discount during
            checkout.
        starts_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Starts At
          description: '**Starts At:** Timestamp after which the discount is redeemable.'
        ends_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Ends At
          description: >-
            **Ends At:** Timestamp after which the discount is no longer
            redeemable.
        max_redemptions:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Redemptions
          description: >-
            **Max Redemptions:** Maximum number of times the discount can be
            redeemed.
        redemptions_count:
          type: integer
          title: Redemptions Count
          description: Count of times the discount has been redeemed.
        organization_id:
          type: string
          format: uuid4
          title: Organization Id
          description: Identifier of the organization.
          examples:
            - 1dbfc517-0bbf-4301-9ba8-555ca42b9737
          x-ruba-selector-widget:
            displayProperty: name
            resourceName: Organization
            resourceRoot: /v1/organizations
        products:
          items:
            $ref: '#/components/schemas/DiscountProduct'
          type: array
          title: Products
      type: object
      required:
        - duration
        - duration_in_months
        - type
        - basis_points
        - created_at
        - modified_at
        - id
        - metadata
        - name
        - code
        - starts_at
        - ends_at
        - max_redemptions
        - redemptions_count
        - organization_id
        - products
      title: DiscountPercentageRepeatDuration
      description: |-
        Schema for a percentage discount that is applied on every invoice
        for a certain number of months.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    DiscountDuration:
      type: string
      enum:
        - once
        - forever
        - repeating
      title: DiscountDuration
    DiscountType:
      type: string
      enum:
        - fixed
        - percentage
      title: DiscountType
    MetadataOutputType:
      additionalProperties:
        anyOf:
          - type: string
          - type: integer
          - type: number
          - type: boolean
      type: object
    DiscountProduct:
      properties:
        metadata:
          $ref: '#/components/schemas/MetadataOutputType'
        id:
          type: string
          format: uuid4
          title: Id
          description: The stable identifier for this record.
        created_at:
          type: string
          format: date-time
          title: Created At
          description: The time Ruba created this record.
        modified_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Modified At
          description: The time this record last changed.
        trial_interval:
          anyOf:
            - $ref: '#/components/schemas/TrialInterval'
            - type: 'null'
          description: Unit used to measure the trial period.
        trial_interval_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Trial Interval Count
          description: Length of the trial measured in the selected interval.
        name:
          type: string
          title: Name
          description: Customer-facing name assigned to the product.
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Customer-facing description attached to the product.
        visibility:
          $ref: '#/components/schemas/ProductVisibility'
          description: Controls where customers can discover the product.
        recurring_interval:
          anyOf:
            - $ref: '#/components/schemas/RecurringInterval'
            - type: 'null'
          description: >-
            **Recurring Interval:** Recurring interval of the product. If
            `None`, the product is a one-time purchase.
        recurring_interval_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Recurring Interval Count
          description: >-
            Count of interval units of the subscription. If this is set to 1 the
            charge will happen every interval (e.g. every month), if set to 2 it
            will be every other month, and so on. None for one-time products.
        is_recurring:
          type: boolean
          title: Is Recurring
          description: Indicates whether the product is a subscription.
        is_archived:
          type: boolean
          title: Is Archived
          description: Indicates whether the product is archived and no longer available.
        organization_id:
          type: string
          format: uuid4
          title: Organization Id
          description: Unique identifier for the organization owning the product.
      type: object
      required:
        - metadata
        - id
        - created_at
        - modified_at
        - trial_interval
        - trial_interval_count
        - name
        - description
        - visibility
        - recurring_interval
        - recurring_interval_count
        - is_recurring
        - is_archived
        - organization_id
      title: DiscountProduct
      description: Object representing product that a discount can be applied to.
    TrialInterval:
      type: string
      enum:
        - day
        - week
        - month
        - year
      title: TrialInterval
    ProductVisibility:
      type: string
      enum:
        - draft
        - private
        - public
      title: Visibility
    RecurringInterval:
      type: string
      enum:
        - day
        - week
        - month
        - year
      title: RecurringInterval
  securitySchemes:
    oidc:
      type: openIdConnect
      openIdConnectUrl: /.well-known/openid-configuration
    pat:
      type: http
      description: >-
        **Authentication:** You can generate a **Personal Access Token** from
        your [settings](https://getruba.com/settings).
      scheme: bearer
    oat:
      type: http
      description: >-
        **Authentication:** You can generate an **Organization Access Token**
        from your organization's settings.
      scheme: bearer

````