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

# Get past orders report with detailed filtering

> Retrieves a detailed report of past billing attempts with advanced filtering options. This endpoint provides comprehensive data for analytics, troubleshooting, and reporting purposes.

**Filter Options:**
- By status: SUCCESS, FAILED, SKIPPED
- By date range: Filter by billing date range
- By attempt count: Filter by number of retry attempts
- By contract status: Filter by subscription contract status
- By contract ID: Get report for specific subscription

**Response Includes:**
- Detailed billing attempt information
- Shopify exception details for failed attempts (optional)
- Retry attempt count
- Processing timestamps
- Order totals and line items

**Authentication:** Requires valid X-API-Key header



## OpenAPI

````yaml /subscription/admin-api-swagger.json get /api/external/v2/subscription-billing-attempts/past-orders/report
openapi: 3.0.1
info:
  description: >-
    Comprehensive API documentation for managing subscriptions, payments, and
    related operations. These APIs allow you to programmatically manage
    subscription lifecycles, handle payments, configure products, and integrate
    subscription functionality into your applications.
  title: Admin APIs
  version: 0.0.1
servers:
  - url: https://subscription-admin.appstle.com
security: []
tags:
  - description: >-
      Core APIs for managing the complete subscription lifecycle including
      creation, updates, pausing, resuming, and cancellation of subscriptions.
    name: Subscription Management
  - description: >-
      APIs for managing subscription payment methods, processing payments,
      handling payment retries, and updating billing information.
    name: Subscription Payments
  - description: >-
      APIs for managing subscription contracts including delivery schedules,
      pricing, order notes, billing cycles, and shipping addresses.
    name: Subscription Contracts
  - description: >-
      APIs for managing products within subscriptions including adding,
      removing, updating quantities, and swapping products.
    name: Subscription Products
  - description: >-
      APIs for handling billing operations, payment processing, and financial
      transactions related to subscriptions.
    name: Billing & Payments
  - description: >-
      APIs for managing discounts and promotional codes applied to
      subscriptions.
    name: Subscription Discounts
  - description: >-
      APIs for managing one-time add-on products that can be purchased alongside
      recurring subscription items.
    name: Subscription One-Time Products
  - description: >-
      APIs for managing subscription plans, pricing tiers, and plan
      configurations.
    name: Subscription Plans
  - description: >-
      APIs for managing customizable product boxes and bundles where customers
      can select multiple items.
    name: Build-a-Box & Bundles
  - description: >-
      APIs for managing the product catalog including product information,
      variants, and inventory.
    name: Product Catalog
  - description: >-
      APIs for managing operational settings, configurations, and administrative
      functions.
    name: Operations & Settings
  - description: >-
      APIs powering the customer-facing portal where subscribers can manage
      their own subscriptions.
    name: Customer Portal
  - description: APIs for managing customer information, profiles, and account details.
    name: Customers
  - description: >-
      APIs for retrieving aggregated subscription data, customer subscription
      history, and account-level subscription information.
    name: Subscription Data
  - description: >-
      APIs for managing delivery profiles, shipping rates, free shipping
      configuration, and delivery method options on subscriptions.
    name: Delivery & Shipping
  - description: >-
      APIs for managing storefront customization including custom CSS, theme
      settings, label translations, and merchant-defined widget configuration.
    name: Customization
  - description: >-
      APIs for configuring cancellation flows, retention offers, cancellation
      reason management, and win-back automation.
    name: Customer Retention
paths:
  /api/external/v2/subscription-billing-attempts/past-orders/report:
    get:
      tags:
        - Billing & Payments
      summary: Get past orders report with detailed filtering
      description: >-
        Retrieves a detailed report of past billing attempts with advanced
        filtering options. This endpoint provides comprehensive data for
        analytics, troubleshooting, and reporting purposes.


        **Filter Options:**

        - By status: SUCCESS, FAILED, SKIPPED

        - By date range: Filter by billing date range

        - By attempt count: Filter by number of retry attempts

        - By contract status: Filter by subscription contract status

        - By contract ID: Get report for specific subscription


        **Response Includes:**

        - Detailed billing attempt information

        - Shopify exception details for failed attempts (optional)

        - Retry attempt count

        - Processing timestamps

        - Order totals and line items


        **Authentication:** Requires valid X-API-Key header
      operationId: getPastOrdersReport
      parameters:
        - description: API Key (Deprecated - Use Header X-API-Key instead)
          in: query
          name: api_key
          required: false
          schema:
            type: string
        - in: header
          name: X-API-Key
          required: false
          schema:
            type: string
        - description: Filter by contract Id
          in: query
          name: contractId
          required: false
          schema:
            format: int64
            type: integer
        - description: Filter by status
          in: query
          name: status
          required: true
          schema:
            enum:
              - SUCCESS
              - FAILURE
              - REQUESTING
              - PROGRESS
              - QUEUED
              - SKIPPED
              - SOCIAL_CONNECTION_NULL
              - CONTRACT_CANCELLED
              - CONTRACT_ENDED
              - CONTRACT_PAUSED
              - AUTO_CHARGE_DISABLED
              - SHOPIFY_EXCEPTION
              - SKIPPED_DUNNING_MGMT
              - SKIPPED_INVENTORY_MGMT
              - IMMEDIATE_TRIGGERED
              - SECURITY_CHALLENGE
              - CONTRACT_PAUSED_MAX_CYCLES
              - REFUNDED
              - SKIPPED_DEMO_SHOP
              - SKIPPED_SHOP_INFO_NOT_FOUND
              - SKIPPED_BILLING_DATE_STALE
              - SKIPPED_DUNNING_NOT_CONFIGURED
              - PENDING_CONSOLIDATION
            type: string
        - description: Include Shopify Exception in case of Failure
          in: query
          name: includeShopifyException
          required: false
          schema:
            default: false
            type: boolean
        - description: Filter date range from
          in: query
          name: fromDay
          required: false
          schema:
            format: date-time
            type: string
        - description: Filter by date range to
          in: query
          name: toDay
          required: false
          schema:
            format: date-time
            type: string
        - description: Filter by retry attempts
          in: query
          name: attemptCount
          required: false
          schema:
            format: int32
            type: integer
        - description: Filter by Contract Status
          in: query
          name: contractStatus
          required: false
          schema:
            type: string
        - description: Pagination parameters (page number and size)
          example:
            page: 0
            size: 5
            sort:
              - id,desc
          in: query
          name: pageable
          required: true
          schema:
            $ref: '#/components/schemas/Pageable'
      responses:
        '200':
          content:
            '*/*':
              schema:
                items:
                  $ref: '#/components/schemas/SubscriptionBillingAttemptDetails'
                type: array
          description: Successfully retrieved report
        '400':
          content:
            '*/*':
              schema:
                items:
                  $ref: '#/components/schemas/SubscriptionBillingAttemptDetails'
                type: array
          description: Invalid filter parameters
        '401':
          content:
            '*/*':
              schema:
                items:
                  $ref: '#/components/schemas/SubscriptionBillingAttemptDetails'
                type: array
          description: Authentication required
        '403':
          content:
            '*/*':
              schema:
                items:
                  $ref: '#/components/schemas/SubscriptionBillingAttemptDetails'
                type: array
          description: Insufficient permissions
components:
  schemas:
    Pageable:
      properties:
        page:
          format: int32
          minimum: 0
          type: integer
        size:
          format: int32
          minimum: 1
          type: integer
        sort:
          items:
            type: string
          type: array
      type: object
    SubscriptionBillingAttemptDetails:
      properties:
        subscriptionBillingAttempt:
          $ref: '#/components/schemas/SubscriptionBillingAttempt'
        subscriptionContractDetails:
          $ref: '#/components/schemas/SubscriptionContractDetails'
      type: object
    SubscriptionBillingAttempt:
      properties:
        applyUsageCharge:
          type: boolean
        attemptCount:
          format: int32
          type: integer
        attemptTime:
          format: date-time
          type: string
        billingAttemptId:
          type: string
        billingAttemptResponseMessage:
          type: string
        billingDate:
          format: date-time
          type: string
        consolidatedIntoAttemptId:
          format: int64
          type: integer
        contractId:
          format: int64
          type: integer
        graphOrderId:
          type: string
        id:
          format: int64
          type: integer
        inventorySkippedAttemptCount:
          format: int32
          type: integer
        inventorySkippedRetryingNeeded:
          type: boolean
        lastShippingUpdatedAt:
          format: date-time
          type: string
        orderAmount:
          format: double
          type: number
        orderAmountContractCurrency:
          format: double
          type: number
        orderAmountShopCurrency:
          format: double
          type: number
        orderAmountUSD:
          format: double
          type: number
        orderId:
          format: int64
          type: integer
        orderName:
          type: string
        orderNote:
          type: string
        partialLinesSkipped:
          enum:
            - INVENTORY_MANAGEMENT
            - MANUAL
          type: string
        progressAttemptCount:
          format: int32
          type: integer
        recurringChargeId:
          format: int64
          type: integer
        retryingNeeded:
          type: boolean
        securityChallengeSentStatus:
          enum:
            - SENT
            - UNSENT
            - FAILED
            - EMAIL_SETTINGS_DISABLED
            - CONTRACT_CANCELLED
          type: string
        shop:
          type: string
        status:
          enum:
            - SUCCESS
            - FAILURE
            - REQUESTING
            - PROGRESS
            - QUEUED
            - SKIPPED
            - SOCIAL_CONNECTION_NULL
            - CONTRACT_CANCELLED
            - CONTRACT_ENDED
            - CONTRACT_PAUSED
            - AUTO_CHARGE_DISABLED
            - SHOPIFY_EXCEPTION
            - SKIPPED_DUNNING_MGMT
            - SKIPPED_INVENTORY_MGMT
            - IMMEDIATE_TRIGGERED
            - SECURITY_CHALLENGE
            - CONTRACT_PAUSED_MAX_CYCLES
            - REFUNDED
            - SKIPPED_DEMO_SHOP
            - SKIPPED_SHOP_INFO_NOT_FOUND
            - SKIPPED_BILLING_DATE_STALE
            - SKIPPED_DUNNING_NOT_CONFIGURED
            - PENDING_CONSOLIDATION
          type: string
        transactionFailedEmailSentStatus:
          enum:
            - SENT
            - UNSENT
            - FAILED
            - EMAIL_SETTINGS_DISABLED
            - CUSTOMER_PAYMENT_EMPTY
            - CONTRACT_CANCELLED
          type: string
        transactionFailedSmsSentStatus:
          enum:
            - SENT
            - UNSENT
            - FAILED
            - SMS_SETTINGS_DISABLED
            - CUSTOMER_PAYMENT_EMPTY
            - CONTRACT_CANCELLED
            - PHONE_NUMBER_EMPTY
          type: string
        transactionRate:
          format: double
          type: number
        upcomingOrderEmailSentStatus:
          enum:
            - SENT
            - UNSENT
            - FAILED
            - EMAIL_SETTINGS_DISABLED
            - CUSTOMER_PAYMENT_EMPTY
            - CONTRACT_CANCELLED
            - STOP_FROM_CONTRACT
            - CONTRACT_PAUSED
          type: string
        upcomingOrderSmsSentStatus:
          enum:
            - SENT
            - UNSENT
            - FAILED
            - SMS_SETTINGS_DISABLED
            - CUSTOMER_PAYMENT_EMPTY
            - CONTRACT_CANCELLED
            - STOP_FROM_CONTRACT
            - CONTRACT_PAUSED
            - PHONE_NUMBER_EMPTY
          type: string
        usageChargeStatus:
          enum:
            - SUCCESS
            - FAILED
            - TO_BE_TRIED
          type: string
      required:
        - retryingNeeded
        - shop
      type: object
    SubscriptionContractDetails:
      properties:
        activatedOn:
          format: date-time
          type: string
        allowDeliveryAddressOverride:
          type: boolean
        allowDeliveryPriceOverride:
          type: boolean
        autoCharge:
          type: boolean
        billingCountryCode:
          type: string
        billingDateAfterTrial:
          format: date-time
          type: string
        billingPolicyInterval:
          type: string
        billingPolicyIntervalCount:
          format: int32
          type: integer
        cancellationFeedback:
          type: string
        cancellationNote:
          type: string
        cancelledOn:
          format: date-time
          type: string
        contractAmount:
          format: double
          type: number
        contractAmountUSD:
          format: double
          type: number
        contractDetailsJSON:
          type: string
        createdAt:
          format: date-time
          type: string
        currencyCode:
          type: string
        customerEmail:
          type: string
        customerFirstName:
          type: string
        customerId:
          format: int64
          type: integer
        customerLastName:
          type: string
        customerName:
          type: string
        customerTag:
          type: string
        deletedVariantIds:
          type: string
        deliveryCountryCode:
          type: string
        deliveryPolicyInterval:
          type: string
        deliveryPolicyIntervalCount:
          format: int32
          type: integer
        disableFixEmptyQueue:
          type: boolean
        emailBouncedOrFailed:
          type: boolean
        endsAt:
          format: date-time
          type: string
        graphCustomerId:
          type: string
        graphOrderId:
          type: string
        graphSubscriptionContractId:
          type: string
        id:
          format: int64
          type: integer
        importedId:
          type: string
        lastSuccessfulOrder:
          type: string
        lifetimeValue:
          format: double
          type: number
        lifetimeValueUSD:
          format: double
          type: number
        maxCycles:
          format: int32
          type: integer
        minCycles:
          format: int32
          type: integer
        nextBillingDate:
          format: date-time
          type: string
        orderAmount:
          format: double
          type: number
        orderAmountContractCurrency:
          format: double
          type: number
        orderAmountShopCurrency:
          format: double
          type: number
        orderAmountUSD:
          format: double
          type: number
        orderId:
          format: int64
          type: integer
        orderName:
          type: string
        orderNote:
          type: string
        orderNoteAttributes:
          type: string
        originType:
          enum:
            - STORE_FRONT
            - IMPORTED
            - SPLIT_ATTEMPT_BILLING
            - SPLIT_CONTRACT
          type: string
        originalContractId:
          format: int64
          type: integer
        pauseDurationCycle:
          format: int32
          type: integer
        pauseFeedback:
          type: string
        pauseReason:
          type: string
        pauseTillDate:
          format: date-time
          type: string
        pausedFromActive:
          type: boolean
        pausedOn:
          format: date-time
          type: string
        pendingCancellationCycle:
          format: int32
          type: integer
        pendingCancellationDate:
          format: date-time
          type: string
        phone:
          type: string
        queueUpdatedAt:
          format: date-time
          type: string
        shop:
          type: string
        skipPaymentCreateUnpaidOrder:
          type: boolean
        startsAt:
          format: date-time
          type: string
        status:
          type: string
        stopUpComingOrderEmail:
          type: boolean
        subscriptionContractId:
          format: int64
          type: integer
        subscriptionCreatedEmailSent:
          type: boolean
        subscriptionCreatedEmailSentStatus:
          enum:
            - SENT
            - UNSENT
            - FAILED
            - EMAIL_SETTINGS_DISABLED
            - CUSTOMER_PAYMENT_EMPTY
            - CONTRACT_PAUSED_STATUS
          type: string
        subscriptionCreatedSmsSentStatus:
          enum:
            - SENT
            - UNSENT
            - FAILED
            - SMS_SETTINGS_DISABLED
            - CUSTOMER_PAYMENT_EMPTY
            - CONTRACT_PAUSED_STATUS
            - PHONE_NUMBER_EMPTY
          type: string
        subscriptionType:
          enum:
            - REGULAR_SUBSCRIPTION
            - BUILD_A_BOX_CLASSIC
            - BUILD_A_BOX_SINGLE_PRODUCT
            - BUNDLING_CLASSIC
            - BUNDLING_MIX_AND_MATCH
            - SECTIONED_BUNDLE
            - VOLUME_DISCOUNT
          type: string
        subscriptionTypeIdentifier:
          type: string
        totalSuccessfulOrders:
          format: int32
          type: integer
        upcomingEmailBufferDays:
          format: int32
          type: integer
        upcomingEmailTaskUrl:
          type: string
        updatedAt:
          format: date-time
          type: string
        updatingQueue:
          type: boolean
      required:
        - shop
      type: object

````