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

# Estimate a subscription

> Gets a pricing estimate for a subscription including the billing schedule and grand total.



## OpenAPI

````yaml https://api.salesbricks.com/api/v2/openapi.yaml post /subscriptions/estimate
openapi: 3.0.3
info:
  title: Salesbricks REST API
  version: 2.0.0
  description: API reference for external integrations
servers:
  - url: https://api.salesbricks.com/api/v2
    description: Production
  - url: https://api.staging.salesbricks.com/api/v2
    description: Staging
security:
  - ApiKeyAuth: []
tags:
  - name: Subscriptions
    description: >-
      Operations related to subscription management, including creation,
      updates, and retrieving subscription details. Subscriptions can be
      upgraded to add / remove add-ons by using the POST
      /subscriptions/{subscription_id}/upgrade endpoint and can be recasted for
      replacing the current agreement using the POST
      /subscriptions/{subscription_id}/recast endpoint
  - name: Customers
    description: >-
      Operations related to customer management, including creation, updates,
      and managing customer person objects.
  - name: Invoices
    description: Operations related to subscription's invoicing details.
  - name: Plans
    description: >-
      Operations related to listing and getting plan details including bricks in
      the plan.
  - name: Payment Methods
    description: Operations related to subscription's payment method.
paths:
  /subscriptions/estimate:
    post:
      tags:
        - Subscriptions
      summary: Estimate a subscription
      description: >-
        Gets a pricing estimate for a subscription including the billing
        schedule and grand total.
      operationId: getSubscriptionEstimate
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubscriptionInputEstimate'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/SubscriptionInputEstimate'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/SubscriptionInputEstimate'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionEstimateOutput'
          description: ''
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                BadRequestResponse:
                  value:
                    error:
                      code: ERR_BAD_REQUEST
                      message: >-
                        Bad request — the input payload is malformed, missing
                        required fields, or contains invalid data.
                  summary: Bad Request Response
          description: ''
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                NotFoundResponse:
                  value:
                    error:
                      code: ERR_NOT_FOUND
                      message: >-
                        Not found — the resource you are looking for does not
                        exist.
                  summary: Not Found Response
          description: ''
components:
  schemas:
    SubscriptionInputEstimate:
      type: object
      description: >-
        Subscription estimate input serializer for generating a pricing
        estimate.
      properties:
        starts_at:
          type: string
          format: date
          description: The start date of the subscription.
        contract_length:
          type: integer
          minimum: 1
          description: The length of the contract in months.
        billing_frequency:
          enum:
            - MONTHLY
            - QUARTERLY
            - SEMI_ANNUALLY
            - ANNUALLY
            - ALL_UPFRONT
          type: string
          x-spec-enum-id: f41da4a34f13f89b
          description: |-
            The billing frequency

            * `MONTHLY` - Monthly
            * `QUARTERLY` - Quarterly
            * `SEMI_ANNUALLY` - Semi-annually
            * `ANNUALLY` - Annually
            * `ALL_UPFRONT` - All upfront
        plan_id:
          type: string
          format: uuid
          description: The ID of the plan.
        bricks:
          type: array
          items:
            $ref: '#/components/schemas/LineItemInput'
          description: The bricks included in the subscription.
        currency:
          enum:
            - USD
            - EUR
            - GBP
            - AUD
            - CAD
            - INR
          type: string
          x-spec-enum-id: fde863feba7c4cf4
          default: USD
          description: |-
            Optional currency to be used for the subscription. Defaults to USD.

            * `USD` - United States Dollar
            * `EUR` - Euros
            * `GBP` - Great British Pound
            * `AUD` - Australian Dollar
            * `CAD` - Canadian Dollar
            * `INR` - Indian Rupee
        discount_coupons:
          type: array
          items:
            type: string
          description: >-
            Discount coupon codes to apply to the subscription. Currently only
            supports one discount coupon - only the first one in the list will
            be applied.
      required:
        - billing_frequency
        - bricks
        - contract_length
        - plan_id
        - starts_at
    SubscriptionEstimateOutput:
      type: object
      description: Subscription /estimate output serializer from OrderPricing
      properties:
        ends_at:
          type: string
          format: date
          description: The end date of the subscription
        sub_total:
          type: integer
          description: Subtotal before taxes and discounts
        grand_total:
          type: integer
          description: Final total after taxes and discounts
        line_items:
          type: array
          items:
            $ref: '#/components/schemas/LineItem'
          description: The line items of the subscription
        billing_schedule:
          type: array
          items:
            $ref: '#/components/schemas/BillingPeriodItem'
          description: The billing schedule of the subscription
        grand_total_details:
          description: Breakdown containing total discount and tax amounts
      required:
        - billing_schedule
        - ends_at
        - grand_total
        - grand_total_details
        - line_items
        - sub_total
    ErrorResponse:
      type: object
      description: >-
        Standardizes API error responses with a consistent structure containing
        error code and message.
      properties:
        error:
          $ref: '#/components/schemas/Error'
      required:
        - error
    LineItemInput:
      type: object
      description: Line item input serializer for creating a new estimate
      properties:
        brick_id:
          type: string
          format: uuid
        quantity:
          type: integer
        discount:
          type: array
          items:
            $ref: '#/components/schemas/LineItemDiscount'
          nullable: true
          description: >-
            A list of discounts to apply to the line item — at most one renewing
            rate, one one-time rate, and one fixed amount.
      required:
        - brick_id
    LineItem:
      type: object
      description: Line item serializer for a subscription estimate
      properties:
        quantity:
          oneOf:
            - type: integer
            - type: number
              format: double
          readOnly: true
          description: The quantity of the brick
        brick_id:
          type: string
          format: uuid
          description: The brick id
        brick_name:
          type: string
          description: The name of the brick
        sub_total:
          type: integer
          description: Subtotal for the line item before taxes and discounts
        plan_id:
          type: string
          readOnly: true
          description: ID of the plan this line item belongs to
        plan_name:
          type: string
          description: Name of the plan this line item belongs to
        grand_total:
          type: string
          readOnly: true
          description: Final total for the line item after taxes and discounts
        grand_total_details:
          type: string
          readOnly: true
          description: Breakdown containing total discount amounts for the line item
        tiers_breakdown:
          type: array
          items:
            $ref: '#/components/schemas/TierBreakdown'
          readOnly: true
          description: Tiers breakdown for the line item
        pre_commitment_schedule:
          type: string
          readOnly: true
          nullable: true
          description: The pre-commitment schedule for usage-based line items
        discount:
          type: array
          items:
            $ref: '#/components/schemas/LineItemDiscount'
          readOnly: true
          description: >-
            Per-brick discount(s) in the same shape accepted on input, so they
            can be read off a subscription and carried forward explicitly on
            upgrade, recast, or renewal. Empty when the line item has no
            discount.
      required:
        - brick_id
        - brick_name
        - discount
        - grand_total
        - grand_total_details
        - plan_id
        - plan_name
        - pre_commitment_schedule
        - quantity
        - sub_total
        - tiers_breakdown
    BillingPeriodItem:
      type: object
      description: Billing schedule for a subscription
      properties:
        starts_at:
          type: string
          readOnly: true
          description: Start date of the billing period
        ends_at:
          type: string
          readOnly: true
          description: End date of the billing period
        sub_total:
          type: integer
          description: Subtotal for the billing period before taxes and discounts
        grand_total:
          type: string
          readOnly: true
          description: Final total for the billing period after taxes and discounts
        grand_total_details:
          type: string
          readOnly: true
          description: Breakdown containing total discount for the billing period
      required:
        - ends_at
        - grand_total
        - grand_total_details
        - starts_at
        - sub_total
    Error:
      type: object
      description: >-
        Represents individual error details with a standardized code and
        descriptive message.
      properties:
        code:
          enum:
            - ERR_NOT_FOUND
            - ERR_BAD_REQUEST
            - ERR_SERVER_ERROR
          type: string
          x-spec-enum-id: dc5a5d6feae1b697
          description: >-
            Error code indicating the type of error: NOT_FOUND for missing
            resources, BAD_REQUEST for invalid input, SERVER_ERROR for internal
            server issues


            * `ERR_NOT_FOUND` - ERR_NOT_FOUND

            * `ERR_BAD_REQUEST` - ERR_BAD_REQUEST

            * `ERR_SERVER_ERROR` - ERR_SERVER_ERROR
        message:
          type: string
        error_id:
          type: string
          format: uuid
          description: >-
            Correlation handle for SERVER_ERROR responses — quote this when
            contacting support; it joins to the structured server log line for
            the failure. Not present on 4xx responses.
      required:
        - code
        - message
    LineItemDiscount:
      type: object
      description: Discount serializer for a subscription estimate line item
      properties:
        rate:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,6})?$
          description: >-
            The discount rate as a percentage with up to six decimal places
            (e.g. 10 = 10%, 62.6758 = 62.6758%). Mutually exclusive with
            `amount`.
        amount:
          type: integer
          description: >-
            A fixed discount amount in cents (e.g. 1000 = $10.00). One-time only
            — `renews` must be false when `amount` is set. Mutually exclusive
            with `rate`. The amount is applied as-is and is not clamped to the
            line item total, so it should not exceed the brick's price.
        renews:
          type: boolean
          default: false
          description: >-
            If the discount is carried over at renewal. Must be false when
            `amount` is set, as fixed discounts are one-time only.
    TierBreakdown:
      type: object
      description: Tier breakdown serializer for line item tiers
      properties:
        quantity:
          type: number
          format: double
          maximum: 100000000000000
          minimum: -100000000000000
          exclusiveMaximum: true
          exclusiveMinimum: true
          description: Number of units in this tier
        unit_price:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,6})?$
          description: Unit price for this tier
        sub_total:
          type: string
          format: decimal
          pattern: ^-?\d{0,18}(?:\.\d{0,2})?$
          description: Subtotal for this tier
        duration_text:
          type: string
          description: Duration text for frontend display
      required:
        - duration_text
        - quantity
        - sub_total
        - unit_price
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-SALESBRICKS-KEY
      description: API key for authentication

````

## Related topics

- [Subscription Inactive Payload](/api-reference/webhooks/subscription/payload.md)
- [MCP](/integrations/mcp.md)
- [subscription.inactive](/api-reference/webhooks/subscription/inactive.md)
