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

# Get all purchases for an account

> Get Purchase information for an account using account_id and price_plan_id



## OpenAPI

````yaml get /accounts/{account_id}/purchases
openapi: 3.0.3
info:
  version: '1.0'
  title: Togai Apis
  contact:
    email: engg@togai.com
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  description: APIs for Togai App
servers:
  - description: Api endpoint
    url: https://api.togai.com/
  - description: Sandbox api endpoint
    url: https://sandbox-api.togai.com/
security:
  - bearerAuth: []
tags:
  - name: Customers
    description: Customer level calls
  - name: Accounts
    description: Account level calls
  - name: Event Schemas
    description: Event Schema level calls
  - name: Usage Meters
    description: Usage Meter level calls
  - name: Price Plans
    description: Price Plan level calls
  - name: Settings
    description: Settings
  - name: Price Experimentation
    description: Price Experimentation apis
  - name: InvoiceGroups
    description: Invoice Group level calls
  - name: Organization
    description: Organization level calls
  - name: FileStorage
    description: File Storage level calls
  - name: Aliases
    description: Alias level calls
  - name: Event Management
    description: APIs for getting events ingested in Togai
    externalDocs:
      description: docs
      url: https://togai.com/docs/billing/events
  - name: Metrics
    description: APIs for getting Togai metrics
    externalDocs:
      description: docs
      url: https://togai.com/docs/metrics
  - name: Licenses
    description: APIs for getting or updating license records in Togai
  - name: Entitlements
    description: APIs related to entitlements
  - name: Invoices
    description: Invoices API
  - name: Credits
    description: Credits API
  - name: Wallet
    description: Wallet API
  - name: InvoiceTemplates
    description: InvoiceTemplates API
  - name: Payments
    description: Payments API
  - name: Authentication
    description: Authentication API
externalDocs:
  description: Find out more about Togai
  url: https://docs.togai.com/docs
paths:
  /accounts/{account_id}/purchases:
    get:
      tags:
        - Accounts
      summary: Get all purchases for an account
      description: >-
        Get Purchase information for an account using account_id and
        price_plan_id
      operationId: listAccountPurchases
      parameters:
        - $ref: '#/components/parameters/account_id'
      responses:
        '200':
          $ref: '#/components/responses/PurchasePaginatedResponse'
        '400':
          $ref: '#/components/responses/ErrorResponse'
        '401':
          $ref: '#/components/responses/ErrorResponse'
        '403':
          $ref: '#/components/responses/ErrorResponse'
        '404':
          $ref: '#/components/responses/ErrorResponse'
        '429':
          $ref: '#/components/responses/ErrorResponse'
        default:
          $ref: '#/components/responses/ErrorResponse'
components:
  parameters:
    account_id:
      in: path
      description: account_id corresponding to an account
      name: account_id
      required: true
      schema:
        type: string
        maxLength: 50
        example: ACC00001
  responses:
    PurchasePaginatedResponse:
      description: Response for list Purchase for an account request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/PurchasePaginatedListData'
          examples:
            PurchasePaginatedResponse:
              $ref: '#/components/examples/PurchasePaginatedResponse'
    ErrorResponse:
      description: Error response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            ErrorResponse:
              summary: Error message
              value:
                message: <Reason message>
  schemas:
    PurchasePaginatedListData:
      type: object
      additionalProperties: false
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/PurchaseListResponse'
        nextToken:
          type: string
        context:
          $ref: '#/components/schemas/PaginationOptions'
    ErrorResponse:
      type: object
      additionalProperties: false
      required:
        - message
      properties:
        message:
          type: string
          description: error description
          maxLength: 500
    PurchaseListResponse:
      type: object
      description: Represents a Purchase for List Response
      additionalProperties: false
      required:
        - id
        - pricePlanId
        - pricePlanName
        - pricePlanVersion
        - status
        - purchasePlan
        - createdAt
        - type
      properties:
        id:
          type: string
        pricePlanId:
          type: string
        pricePlanName:
          type: string
        quantity:
          type: integer
          format: int32
        rateCardQuantities:
          type: object
          additionalProperties:
            type: number
        pricePlanVersion:
          type: integer
          format: int32
        status:
          $ref: '#/components/schemas/PurchaseStatus'
        idempotencyKey:
          type: string
        purchasePlan:
          $ref: '#/components/schemas/PurchasePlanOverride'
        price:
          type: number
        invoiceCurrency:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        type:
          type: string
          enum:
            - ENTITLEMENT_GRANT
            - ASSOCIATION
    PaginationOptions:
      type: object
      additionalProperties: false
      properties:
        pageSize:
          type: integer
        sortOrder:
          type: string
          enum:
            - ASC
            - DESC
    PurchaseStatus:
      type: string
      enum:
        - SUCCESS
        - FAILURE
        - PENDING
        - IN_PROGRESS
        - PROPOSAL_ACTIVE
        - PROPOSAL_APPROVED
        - PROPOSAL_DECLINED
        - PROPOSAL_EXPIRED
      description: Status of the purchase
    PurchasePlanOverride:
      description: >-
        entitlements override options for purchase of a price plan for an
        account
      type: object
      additionalProperties: false
      properties:
        rateDetails:
          $ref: '#/components/schemas/RateDetails'
        entitlementRateCards:
          type: array
          maxItems: 50
          items:
            $ref: '#/components/schemas/EntitlementRateCard'
        billingEntitlementRateCards:
          type: array
          maxItems: 50
          items:
            $ref: '#/components/schemas/BillingEntitlementRateCard'
        creditGrantRateCards:
          type: array
          maxItems: 50
          items:
            $ref: '#/components/schemas/CreditGrantRateCard'
    RateDetails:
      type: object
      description: rate details for a price plan
      additionalProperties: false
      required:
        - rateValues
        - ratePlan
      properties:
        rateValues:
          type: array
          items:
            $ref: '#/components/schemas/RateValue'
        ratePlan:
          $ref: '#/components/schemas/RatePlan'
    EntitlementRateCard:
      description: Entitlement type rate card
      type: object
      additionalProperties: false
      required:
        - featureId
        - featureConfigs
      properties:
        featureId:
          type: string
        featureConfigs:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/FeatureConfig'
    BillingEntitlementRateCard:
      allOf:
        - $ref: '#/components/schemas/EntitlementRateCard'
        - type: object
          required:
            - ratePlan
            - rateValues
            - invoiceTiming
          properties:
            tag:
              type: string
              description: A tag string to group rate cards
            invoiceTiming:
              $ref: '#/components/schemas/InvoiceTiming'
            displayName:
              type: string
              description: Name your rate card, this will be used in invoice
            ratePlan:
              $ref: '#/components/schemas/RatePlan'
            rateValues:
              type: array
              items:
                $ref: '#/components/schemas/RateValue'
            recurrenceConfig:
              $ref: '#/components/schemas/RecurrenceConfig'
    CreditGrantRateCard:
      description: Credit grant rate card
      type: object
      additionalProperties: false
      required:
        - id
        - rateDetails
        - grantDetails
      properties:
        id:
          type: string
        displayName:
          type: string
        tag:
          type: string
          description: A tag string to group creditGrantRateCard
        grantDetails:
          $ref: '#/components/schemas/GrantDetails'
        rateDetails:
          $ref: '#/components/schemas/CreditRateDetails'
        invoiceTiming:
          $ref: '#/components/schemas/InvoiceTiming'
        type:
          $ref: '#/components/schemas/CreditGrantType'
        recurrenceConfig:
          $ref: '#/components/schemas/RecurrenceConfig'
    RateValue:
      type: object
      description: Represents a rate
      required:
        - currency
        - slabRates
      properties:
        currency:
          type: string
        slabRates:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/SlabRate'
    RatePlan:
      type: object
      description: Contains all rate related configurations
      required:
        - pricingModel
        - slabs
      properties:
        pricingModel:
          $ref: '#/components/schemas/PricingModel'
        slabs:
          description: Rate cards can have single or multiple slab up to 100.
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/Slab'
    FeatureConfig:
      description: Feature configuration object
      type: object
      additionalProperties: false
      required:
        - effectiveUntil
        - featureCreditLimit
      properties:
        effectiveFrom:
          type: string
          format: duration
        effectiveUntil:
          type: string
          format: duration
        featureCreditLimit:
          type: number
          minimum: 0
    InvoiceTiming:
      type: string
      enum:
        - IN_ADVANCE
        - IN_ARREARS
      x-enum-varnames:
        - IN_ADVANCE
        - IN_ARREARS
      description: >
        If IN_ADVANCE, the fixed fee will be invoiced in the previous billing
        cycle.

        If IN_ARREARS, the fixed fee will be invoiced in the current billing
        cycle.
    RecurrenceConfig:
      type: object
      properties:
        interval:
          description: >-
            Represents the number of pricing cycles after which the rate card
            will be charged
          type: integer
          format: int64
          example: 3
        offset:
          description: >-
            Represents the offset for pricing cycles after which the rate card
            will be charged
          type: integer
          format: int64
          example: 5
    GrantDetails:
      description: Grant details of Credit Grant Rate Card
      type: object
      additionalProperties: false
      required:
        - priority
        - expiryType
      properties:
        priority:
          type: integer
          minimum: 0
        expiryType:
          $ref: '#/components/schemas/ExpiryType'
        expiryDuration:
          type: string
          format: duration
        applicableEntityIds:
          type: array
          items:
            type: string
    CreditRateDetails:
      type: object
      description: Amount to be credited
      additionalProperties: false
      required:
        - pricingModel
        - currencySlabRateDetails
      properties:
        pricingModel:
          $ref: '#/components/schemas/PricingModel'
        currencySlabRateDetails:
          type: array
          items:
            $ref: '#/components/schemas/CurrencySlabRateDetail'
    CreditGrantType:
      type: string
      enum:
        - ONE_TIME
        - RECURRING
      description: Credit grant applies either for a one-time occurrence or for each cycle.
    SlabRate:
      type: object
      description: Represents a rate for a slab
      required:
        - order
        - rate
      properties:
        order:
          type: integer
          format: int32
        rate:
          type: number
        slabRateConfig:
          type: object
          additionalProperties:
            type: string
    PricingModel:
      type: string
      description: >
        Togai supports two type of pricing model Tiered and Volume. Tiered
        pricing model applies respective slab and its rate to the usage value
        while volume pricing model applies the latest matching slab of the usage
        value and applies respective rate. 

        For more understanding read [Rate
        Cards](https://docs.togai.com/docs/priceplan#setting-up-multiple-rate-cards)
      enum:
        - TIERED
        - VOLUME
    Slab:
      type: object
      description: Represents a pricing priceType (rates + slabs) for usage price plan
      required:
        - order
        - startAfter
        - priceType
      properties:
        order:
          type: integer
          format: int32
          minimum: 1
          maximum: 10
        startAfter:
          type: number
        priceType:
          $ref: '#/components/schemas/PriceType'
        slabConfig:
          type: object
          additionalProperties:
            type: string
    ExpiryType:
      type: string
      description: Expiry type of grant
      enum:
        - PRICING_CYCLE
        - NO_EXPIRY
        - CUSTOM
    CurrencySlabRateDetail:
      type: object
      description: The association of a currency along with its slab detail
      additionalProperties: false
      required:
        - currency
        - creditAmount
        - slabDetails
      properties:
        currency:
          type: string
        creditAmount:
          type: number
          description: The amount of credit that needs to be credited
          minimum: 0
        slabDetails:
          type: array
          items:
            $ref: '#/components/schemas/SlabDetail'
    PriceType:
      type: string
      enum:
        - FLAT
        - PER_UNIT
        - PACKAGE
    SlabDetail:
      type: object
      description: The details of a slab
      additionalProperties: false
      required:
        - startAfter
        - priceType
        - rate
      properties:
        startAfter:
          type: number
        priceType:
          $ref: '#/components/schemas/PriceType'
        slabConfig:
          type: object
          additionalProperties:
            type: string
        rate:
          type: number
        slabRateConfig:
          type: object
          additionalProperties:
            type: string
  examples:
    PurchasePaginatedResponse:
      value:
        data:
          - id: purchase.1zYnCiM9Bpg.lv25y
            pricePlanId: pp.20dINmd0lBg.05sKa
            pricePlanName: Entitlement Plan
            quantity: 1
            pricePlanVersion: 1
            status: SUCCESS
            idempotencyKey: AAAAABBBBDDDD7730
            createdAt: '2020-01-01T00:00:00Z'
            updatedAt: '2020-01-01T00:00:00Z'
          - id: purchase.20txx14r0m8.VKxaB
            pricePlanId: pp.20txw0FrqjQ.byM8V
            pricePlanName: pp_feature_purchase
            pricePlanVersion: 1
            status: SUCCESS
            purchasePlan:
              rateDetails: null
              entitlementRateCards: null
              billingEntitlementRateCards:
                - featureId: feature.20txvOAhiIS.m3X3d
                  featureConfigs:
                    - effectiveUntil: P20D
                      featureCreditLimit: 100
                      effectiveFrom: PT0S
                  invoiceTiming: IN_ADVANCE
                  ratePlan:
                    pricingModel: TIERED
                    slabs:
                      - order: 1
                        startAfter: 0
                        priceType: PER_UNIT
                        slabConfig: null
                  rateValues:
                    - currency: USD
                      slabRates:
                        - order: 1
                          rate: 1
                          slabRateConfig: null
                  displayName: feature1
            createdAt: '2023-07-31T15:49:25.007848Z'
            quantity: null
            rateCardQuantities:
              feature.20txvOAhiIS.m3X3d: 1.2
            price: 120
            invoiceCurrency: USD
            updatedAt: '2023-07-31T15:51:35.093598Z'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Bearer <credential>

````