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

# Preview studio offer margin

> Requires margins:read. The preview uses server catalog and provider-cost evidence. Unknown or stale cost facts remain explicitly marked in cost_status and are never replaced with caller-supplied costs.



## OpenAPI

````yaml https://api.batchrelay.com/openapi.json post /v1/studios/{studio_id}/offers/{offer_id}/margin-preview
openapi: 3.1.0
info:
  description: >-
    Provider-neutral print catalog and prepared-media validation. This document
    covers only routes owned by the Go service; it deliberately excludes
    migration-proxied order lifecycle routes and all provider payloads.
  license:
    name: Proprietary
    url: https://github.com/SENTINELITE/Batch-Relay-Go/blob/main/README.md
  title: Batch Relay API
  version: 1.0.1
servers:
  - url: https://api.batchrelay.com
security: []
tags:
  - description: Service health and the public API description.
    name: System
  - description: Test Mode session creation and API credential entry points.
    name: Authentication
  - description: >-
      Provider-neutral canonical catalog resources and platform-owned semantic
      definitions.
    name: Catalog
  - description: Studio-scoped guest checkout-link management.
    name: Checkout links
  - description: >-
      One-way operational event messages. Alert emails contain no message body
      and recipients read messages after Batch Relay authentication.
    name: Studio messages
  - description: >-
      Explicit, reviewable sandbox-to-Live promotion plans for forms, catalog,
      and storefront configuration.
    name: Sandbox promotions
  - description: Provider-neutral validation, quoting, and order lifecycle operations.
    name: Print orders
  - description: Managed fulfillment asset ingestion and metadata.
    name: Managed assets
  - description: Studio-scoped original asset upload sessions and objects.
    name: Studio assets
  - description: Prepared and confirmed event roster team changes.
    name: Event team changes
  - description: Authenticated studio, event, and form-management operations.
    name: Studio management
  - description: >-
      Authenticated studio retail catalog management. Draft and publication
      lifecycles are explicit per product or package.
    name: Studio catalog
  - description: >-
      Authenticated singular storefront assortment management. PATCH atomically
      publishes a new immutable assortment revision; no storefront draft
      lifecycle exists yet.
    name: Storefront
  - description: Managed media used by the studio retail catalog.
    name: Studio catalog assets
  - description: Template rendering job creation and retrieval.
    name: Template renders
  - description: >-
      Published browser-side template packages and short-lived server proof
      renders. Preview artifacts are never fulfillment artwork.
    name: Browser previews
  - description: API account and credential administration.
    name: API accounts
paths:
  /v1/studios/{studio_id}/offers/{offer_id}/margin-preview:
    parameters:
      - $ref: '#/components/parameters/ClientSurface'
      - $ref: '#/components/parameters/ClientVersion'
      - $ref: '#/components/parameters/InvocationMode'
    post:
      tags:
        - Studio offers
      summary: Preview studio offer margin
      description: >-
        Requires margins:read. The preview uses server catalog and provider-cost
        evidence. Unknown or stale cost facts remain explicitly marked in
        cost_status and are never replaced with caller-supplied costs.
      operationId: previewStudioOfferMargin
      parameters:
        - $ref: '#/components/parameters/StudioID'
        - in: path
          name: offer_id
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StudioOfferMarginPreviewRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StudioOfferMarginPreview'
          description: Offer margin preview
        '401':
          $ref: '#/components/responses/APIKeyAuthenticationRequired'
        '403':
          $ref: '#/components/responses/StudioOfferForbidden'
        '404':
          $ref: '#/components/responses/StudioOfferNotFound'
        '422':
          $ref: '#/components/responses/InvalidStudioOffer'
        '503':
          $ref: '#/components/responses/StudioOfferUnavailable'
      security:
        - bearerAuth: []
components:
  parameters:
    ClientSurface:
      description: >-
        Untrusted optional analytics hint naming the calling client surface. It
        never affects authorization, routing, pricing, or behavior.
      in: header
      name: X-BatchRelay-Client-Surface
      required: false
      schema:
        maxLength: 100
        minLength: 1
        type: string
    ClientVersion:
      description: >-
        Untrusted optional analytics hint naming the calling client version. It
        never affects authorization, routing, pricing, or behavior.
      in: header
      name: X-BatchRelay-Client-Version
      required: false
      schema:
        maxLength: 100
        minLength: 1
        type: string
    InvocationMode:
      description: >-
        Untrusted optional analytics hint naming the invocation mode. It never
        affects authorization, routing, pricing, or behavior.
      in: header
      name: X-BatchRelay-Invocation-Mode
      required: false
      schema:
        maxLength: 100
        minLength: 1
        type: string
    StudioID:
      description: >-
        Stable public studio ID beginning with stu_. The API never selects a
        studio implicitly; a local CLI profile name is not a studio ID.
      in: path
      name: studio_id
      required: true
      schema:
        maxLength: 256
        minLength: 5
        pattern: ^stu_[A-Za-z0-9_-]+$
        type: string
  schemas:
    StudioOfferMarginPreviewRequest:
      additionalProperties: false
      properties:
        event_id:
          type: string
        recipient:
          $ref: '#/components/schemas/StudioOfferMarginRecipient'
        sellable:
          $ref: '#/components/schemas/CheckoutLinkSellable'
      required:
        - sellable
      type: object
    StudioOfferMarginPreview:
      additionalProperties: false
      properties:
        contribution_cents:
          type: integer
        contribution_percent:
          format: double
          type: number
        cost_status:
          enum:
            - verified
            - unknown
            - incomplete
            - stale
          type: string
        currency:
          const: USD
          type: string
        discount_cents:
          description: Omitted when any line promotion price is unknown.
          minimum: 0
          type: integer
        exclusions:
          items:
            type: string
          type: array
        generated_at:
          format: date-time
          type: string
        lines:
          items:
            $ref: '#/components/schemas/StudioOfferMarginLine'
          type: array
        normal_subtotal_cents:
          minimum: 0
          type: integer
        offer_id:
          type: string
        promo_subtotal_cents:
          description: Omitted when any line promotion price is unknown.
          minimum: 0
          type: integer
        revision:
          type: integer
      required:
        - offer_id
        - revision
        - currency
        - lines
        - normal_subtotal_cents
        - cost_status
        - generated_at
      type: object
    StudioOfferMarginRecipient:
      additionalProperties: false
      properties:
        athlete_event_entry_id:
          maxLength: 240
          minLength: 1
          type: string
        guardian_id:
          maxLength: 240
          minLength: 1
          type: string
      type: object
    CheckoutLinkSellable:
      additionalProperties: false
      properties:
        digital_configuration_id:
          maxLength: 240
          minLength: 1
          type: string
        id:
          maxLength: 240
          minLength: 1
          type: string
        prepared_asset_assignment_ids:
          items:
            maxLength: 240
            minLength: 1
            type: string
          maxItems: 32
          type: array
        quantity:
          maximum: 100
          minimum: 1
          type: integer
        type:
          enum:
            - item
            - package
          type: string
        variant_id:
          description: Allowed only for an item.
          maxLength: 240
          minLength: 1
          type: string
      required:
        - type
        - id
        - quantity
      type: object
    StudioOfferMarginLine:
      additionalProperties: false
      properties:
        contribution_cents:
          type: integer
        contribution_percent:
          format: double
          type: number
        cost_status:
          enum:
            - verified
            - unknown
            - incomplete
            - stale
          type: string
        discount_cents:
          description: Omitted when the promotion price is unknown.
          minimum: 0
          type: integer
        normal_selling_cents:
          minimum: 0
          type: integer
        promo_selling_cents:
          description: Omitted when the server cannot establish a promotion price.
          minimum: 0
          type: integer
        provider_cost_cents:
          minimum: 0
          type: integer
        quantity:
          minimum: 1
          type: integer
        sellable_id:
          type: string
      required:
        - sellable_id
        - quantity
        - normal_selling_cents
        - cost_status
      type: object
    Error:
      additionalProperties: false
      properties:
        code:
          description: Stable machine-readable error code.
          type: string
        docs_url:
          format: uri
          type: string
        error:
          description: Backward-compatible human-readable error.
          type: string
        message:
          type: string
        request_id:
          type: string
      required:
        - error
        - code
        - message
        - docs_url
        - request_id
      type: object
  responses:
    APIKeyAuthenticationRequired:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: A valid Batch Relay API key or anonymous Test Mode session is required.
    StudioOfferForbidden:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: >-
        The credential lacks the required offers or margins scope, is anonymous,
        or is not authorized for the named studio.
    StudioOfferNotFound:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: The studio offer does not exist or is not visible to this credential.
    InvalidStudioOffer:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: >-
        The offer terms, scope, schedule, margin selectors, or expected revision
        is invalid.
    StudioOfferUnavailable:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: >-
        The authoritative studio offer service is not configured or is
        temporarily unavailable.
  securitySchemes:
    bearerAuth:
      bearerFormat: Batch Relay API key or anonymous session
      description: >-
        Batch Relay scoped API key or an anonymous Test Mode session. Scope
        names document required capabilities. Anonymous sessions are
        sandbox-only and do not authorize studio, event, billing, or Live Mode
        operations.
      scheme: bearer
      type: http

````