openapi: 3.0.0
info:
  title: 'Price Lists'
  description: 'Price list is a list containing a set of different prices for the items you sell.'
  contact: {}
  version: 1.0.0
servers:
  -
    url: 'https://www.zohoapis.com/invoice/v3'
    description: 'API Endpoint'
tags:
  -
    name: price-lists
    description: 'Price-Lists Module'
paths:
  /pricebooks:
    post:
      tags:
        - price-lists
      operationId: 'create_price_list'
      summary: 'Create a Price List'
      description: 'Create a new Price List.'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/create-a-price-list-request'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/create-a-price-list-response'
      deprecated: false
      security:
        -
          Zoho_Auth:
            - ZohoInvoice.settings.CREATE
    get:
      tags:
        - price-lists
      operationId: 'list_price_lists'
      summary: 'List of all the Price Lists'
      description: 'Get the list of all the Price Lists with pagination.'
      parameters:
        - name: page
          in: query
          description: 'Page number to be fetched. Default value is 1.'
          required: false
          schema:
            type: integer
            default: 1
          example: 1
        - name: per_page
          in: query
          description: 'Number of records to be fetched per page. Default value is 200.'
          required: false
          schema:
            type: integer
            default: 200
          example: 200
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/list-of-all-the-price-lists-response'
      deprecated: false
      security:
        -
          Zoho_Auth:
            - ZohoInvoice.settings.READ
    parameters:
      -
        $ref: '#/components/parameters/organization_id'
  '/pricebooks/{pricebook_id}':
    put:
      tags:
        - price-lists
      operationId: 'update_price_list'
      summary: 'Update a Price List'
      description: 'Update an existing Price List.'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/update-a-price-list-request'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/update-a-price-list-response'
      deprecated: false
      security:
        -
          Zoho_Auth:
            - ZohoInvoice.settings.UPDATE
    get:
      tags:
        - price-lists
      operationId: 'get_price_list'
      summary: 'Retrieve a Price list'
      description: 'Fetch the details of an existing Price List.'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/retrieve-a-price-list-response'
      deprecated: false
      security:
        -
          Zoho_Auth:
            - ZohoInvoice.settings.READ
    delete:
      tags:
        - price-lists
      operationId: 'delete_price_list'
      summary: 'Delete a Price List'
      description: 'Delete a Price List.'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/delete-a-price-list-response'
      deprecated: false
      security:
        -
          Zoho_Auth:
            - ZohoInvoice.settings.DELETE
    parameters:
      -
        name: pricebook_id
        in: path
        required: true
        schema:
          type: string
        example: 1152891000000265000
      -
        $ref: '#/components/parameters/organization_id'
components:
  parameters:
    organization_id:
      name: X-com-zoho-invoice-organizationid
      description: 'ID of the organization'
      in: header
      required: true
      schema:
        type: string
      example: '10234695'
  schemas:
    gendoc-attributes-schema:
      $ref: '#/components/schemas/pricebook'
    pricebook_type:
      description: 'Type of the Pricebook. Allowed Values <code>fixed_percentage</code>, <code>per_item</code>'
      type: string
      example: per_item
    pricebook_id:
      description: 'Unique ID generated by the server for a price list.'
      type: string
      example: 1152891000000265000
    percentage:
      description: 'The percentage at which you want to increase or decrease the rate of the items.'
      type: number
      format: double
      example: 10
    rounding_type:
      description: 'Type of the Rounding type. Allowed Values <code>no_rounding</code>, <code>round_to_dollar_minus_01</code>, <code>round_to_half_dollar</code>, <code>round_to_half_dollar_minus_01</code> and <code>round_to_dollar</code>'
      type: string
      example: no_rounding
    pricebook_items:
      description: 'Items of a price book. It is mandatory for the price list type "per_item".'
      type: array
      items:
        type: object
        properties:
          item_id:
            $ref: '#/components/schemas/item_id'
          pricebook_rate:
            $ref: '#/components/schemas/pricebook_rate'
    pricebook_rate:
      description: 'The rate of the item for your price list.'
      type: number
      format: double
      example: 120
    is_increase:
      description: 'Markup or Markdown the item rates by a percentage. Allowed Values <code>true</code>, <code>false</code>'
      type: boolean
      example: false
    page:
      description: 'Number of pages.'
      type: integer
      example: 1
    per_page:
      description: 'Values per page.'
      type: integer
      example: 200
    has_more_page:
      description: 'Check if more pages are available.'
      type: boolean
      example: false
    sort_order:
      description: 'The order for sorting.'
      type: string
      example: A
    applied_filter:
      description: 'The filer applied.'
      type: string
      example: SalesOrPurchaseType.All
    sort_column:
      description: 'Param Description.'
      type: string
      example: name
    report_name:
      description: 'The displaying the report name.'
      type: string
      example: Items
    name:
      description: 'Name of the price list. <code>Maximum length of the name [100]</code>'
      type: string
      example: 'Price List Per Item'
    description:
      description: 'Description for the price list. <code>Maximum characters to be used for describing the price list [2000]</code>'
      type: string
      example: checktest
    currency_id:
      description: 'A unique ID for the currency.'
      type: string
      example: 982000000004012
    item_id:
      description: 'ID of the item for which the price list is created.'
      type: string
      example: 982000000030049
    currency_code:
      description: 'A unique code for the currency. <code>Maximum length [100]</code>'
      type: string
      example: INR
    sales_or_purchase_type:
      description: 'Sales Type.'
      type: string
      example: sales
    is_default:
      description: 'Is default.'
      type: boolean
      example: false
    status:
      description: 'Status of the price list. It can be <code>active</code> or <code>inactive</code>. It tells whether the Item is available for transactions.'
      type: string
      example: active
    pricebook:
      type: object
      properties:
        pricebook_id:
          $ref: '#/components/schemas/pricebook_id'
        name:
          $ref: '#/components/schemas/name'
        description:
          $ref: '#/components/schemas/description'
        currency_id:
          $ref: '#/components/schemas/currency_id'
        currency_code:
          $ref: '#/components/schemas/currency_code'
        pricebook_items:
          $ref: '#/components/schemas/pricebook_items'
        status:
          $ref: '#/components/schemas/status'
        is_default:
          $ref: '#/components/schemas/is_default'
        pricebook_type:
          $ref: '#/components/schemas/pricebook_type'
        is_increase:
          $ref: '#/components/schemas/is_increase'
        rounding_type:
          $ref: '#/components/schemas/rounding_type'
        sales_or_purchase_type:
          $ref: '#/components/schemas/sales_or_purchase_type'
    create-a-price-list-request:
      required:
        - name
        - pricebook_type
        - rounding_type
        - is_increase
      type: object
      properties:
        name:
          $ref: '#/components/schemas/name'
        pricebook_items:
          $ref: '#/components/schemas/pricebook_items'
        currency_id:
          $ref: '#/components/schemas/currency_id'
        pricebook_type:
          $ref: '#/components/schemas/pricebook_type'
        is_increase:
          $ref: '#/components/schemas/is_increase'
        rounding_type:
          $ref: '#/components/schemas/rounding_type'
    create-a-price-list-response:
      type: object
      properties:
        code:
          type: integer
          example: 0
          readOnly: true
        message:
          type: string
          example: 'Price list has been created.'
          readOnly: true
        pricebook:
          $ref: '#/components/schemas/pricebook'
    list-of-all-the-price-lists-response:
      type: object
      properties:
        code:
          type: integer
          example: 0
          readOnly: true
        message:
          type: string
          example: success
          readOnly: true
        pricebooks:
          type: array
          items:
            type: object
            properties:
              pricebook_id:
                $ref: '#/components/schemas/pricebook_id'
              name:
                $ref: '#/components/schemas/name'
              description:
                $ref: '#/components/schemas/description'
              currency_id:
                $ref: '#/components/schemas/currency_id'
              currency_code:
                $ref: '#/components/schemas/currency_code'
              pricebook_items:
                $ref: '#/components/schemas/pricebook_items'
              status:
                $ref: '#/components/schemas/status'
              is_default:
                $ref: '#/components/schemas/is_default'
              pricebook_type:
                $ref: '#/components/schemas/pricebook_type'
              is_increase:
                $ref: '#/components/schemas/is_increase'
              rounding_type:
                $ref: '#/components/schemas/rounding_type'
              sales_or_purchase_type:
                $ref: '#/components/schemas/sales_or_purchase_type'
    update-a-price-list-request:
      required:
        - name
        - pricebook_type
        - rounding_type
        - is_increase
      type: object
      properties:
        name:
          $ref: '#/components/schemas/name'
        currency_id:
          $ref: '#/components/schemas/currency_id'
        pricebook_type:
          $ref: '#/components/schemas/pricebook_type'
        is_increase:
          $ref: '#/components/schemas/is_increase'
        rounding_type:
          $ref: '#/components/schemas/rounding_type'
        pricebook_items:
          $ref: '#/components/schemas/pricebook_items'
    update-a-price-list-response:
      type: object
      properties:
        code:
          type: integer
          example: 0
          readOnly: true
        message:
          type: string
          example: 'Price list has been updated.'
          readOnly: true
        pricebook:
          $ref: '#/components/schemas/pricebook'
    retrieve-a-price-list-response:
      type: object
      properties:
        code:
          type: integer
          example: 0
          readOnly: true
        message:
          type: string
          example: success
          readOnly: true
        pricebook:
          $ref: '#/components/schemas/pricebook'
    delete-a-price-list-response:
      type: object
      properties:
        code:
          type: integer
          example: 0
          readOnly: true
        message:
          type: string
          example: 'Price list has been deleted.'
          readOnly: true
  securitySchemes:
    Zoho_Auth:
      type: oauth2
      flows:
        implicit:
          authorizationUrl: 'https://accounts.zoho.com/oauth/v2/auth'
          scopes:
            ZohoInvoice.settings.CREATE: 'Create Settings'
            ZohoInvoice.settings.UPDATE: 'Update Settings'
            ZohoInvoice.settings.READ: 'Read Settings'
            ZohoInvoice.settings.DELETE: 'Delete Settings'
