openapi: 3.0.3
info:
  description: Methods for working with iReceipt PRO API
  version: 1.0.0
  title: IReceipt PRO API
servers:
  - url: https://api.ireceipt.pro/v1
    description: Production API server v1
externalDocs:
  url: https://dashboard.ireceipt.pro
  description: IReceipt PRO Dashboard
components:
  securitySchemes:
    accessBearerAuth:
      type: http
      scheme: bearer
  parameters:
    token:
      in: query
      name: token
      description: Access Token (instead of a header)
      schema:
        type: string
      required: false
      example: eVZYMnFYZ1F6RHJRenA3RmJrTkFFUTh6bGluSzdJdDFkb2RoTFlCbDVQbE41WkUy
    template:
      in: path
      name: template
      description: "Template ID, you can find standard IDs here or create private ones at: [dashboard.ireceipt.pro](https://dashboard.ireceipt.pro)"
      schema:
        type: string
      required: true
      example: invoice_universal_vzrt6k1s
    variables:
      description: Template Variables that need to be transferred to a public template or you have used in your own template.
      in: query
      name: variables
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/BasicTemplateVars"
      required: false
    format:
      description: Page format (default A4 Portrait)
      in: query
      name: format
      schema:
        $ref: "#/components/schemas/BasicTemplateFormat"
      required: false
    size:
      description: Page size (default 796px*1126 px), less priority than "format" option
      in: query
      name: size
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/BasicTemplateSize"
      required: false
  schemas:
    BasicTemplateFormat:
      description: Page format (default A4 Portrait)
      type: string
      enum:
        - a1-portrait
        - a1-landscape
        - a2-portrait
        - a2-landscape
        - a3-portrait
        - a3-landscape
        - a4-portrait
        - a4-landscape
        - a5-portrait
        - a5-landscape
        - a6-portrait
        - a6-landscape
        - a7-portrait
        - a7-landscape
      example: a4-portrait
    BasicTemplateSize:
      description: Page size (default 796px*1126 px), less priority than "format" option
      type: object
      required:
        - width
        - height
      properties:
        width:
          type: number
          example: 796
        height:
          type: number
          example: 1126
    BasicTemplateVars:
      description: Template Variables that need to be transferred to a public template or you have used in your own template.
      type: object
      additionalProperties: true
      example:
        invoice:
          number: "13"
          date: "2023-10-03"
          table:
            headers:
              - NAME
              - PRICE
              - QTY
              - AMOUNT
            rows:
              - values:
                  - Gorgeous Fresh Car
                  - $100.99
                  - "6"
                  - $605.94
              - values:
                  - Incredible Rubber Bike
                  - $356.00
                  - "1"
                  - $356.00
              - values:
                  - UX Services
                  - $100.00
                  - "2"
                  - $200.00
              - values:
                  - Development Service
                  - $2000.00
                  - "1"
                  - $2000.00
          total: $3161.94
          terms:
            - Payment is due within 5 days
            - Payment method CARD
            - "Card Details:"
            - "Card Number: 4242-4242-4242-4242"
            - Sergey Dudko
        from:
          companyName: IReceipt PRO
          lines:
            - "Identification Number: 55891434"
            - 911 Reece Freeway
            - 32390 Kraig Station
            - East Rhea
            - IR
            - support@ireceipt.pro
        to:
          companyName: Morissette - Bogisich
          lines:
            - 969 Harber Expressway
            - South Aishaton
            - GB
        localization:
          invoice: INVOICE
          bill_to: BILL TO
          date: DATE
          total: Total
          terms_and_conditions: TERMS & CONDITIONS
    BasicRequestBody:
      description: Settings
      type: object
      properties:
        variables:
          $ref: "#/components/schemas/BasicTemplateVars"
        format:
          $ref: "#/components/schemas/BasicTemplateFormat"
        size:
          $ref: "#/components/schemas/BasicTemplateSize"
  responses:
    PdfResponse:
      description: PDF file
      content:
        application/pdf:
          schema:
            type: string
            format: binary
    JpgResponse:
      description: JPG image
      content:
        image/jpg:
          schema:
            type: string
            format: binary
    PngResponse:
      description: PNG image
      content:
        image/png:
          schema:
            type: string
            format: binary
    WebPResponse:
      description: WEBP image
      content:
        image/webp:
          schema:
            type: string
            format: binary
    PingPongResponse:
      description: Pong
      content:
        application/json:
          schema:
            type: object
            properties:
              pong:
                type: boolean
                enum:
                  - true
    ErrorResponse:
      description: Error
      content:
        application/json:
          schema:
            description: Response error
            type: object
            example:
              message: Invalid arguments
tags:
  - name: /pdf
    description: Get PDF file
  - name: /jpg
    description: Get JPG image
  - name: /png
    description: Get PNG image
  - name: /webp
    description: Get WEBP image
  - name: /ping
    description: Check the status of the API
paths:
  "/pdf/public/{template}":
    get:
      tags:
        - /pdf
      description: Get PDF file from public template
      operationId: pdfGetPublic
      parameters:
        - $ref: "#/components/parameters/template"
        - $ref: "#/components/parameters/token"
        - $ref: "#/components/parameters/variables"
        - $ref: "#/components/parameters/format"
        - $ref: "#/components/parameters/size"
      security:
        - accessBearerAuth: []
      responses:
        "201":
          $ref: "#/components/responses/PdfResponse"
        "400":
          $ref: "#/components/responses/ErrorResponse"
        "401":
          $ref: "#/components/responses/ErrorResponse"
        "403":
          $ref: "#/components/responses/ErrorResponse"
        "500":
          $ref: "#/components/responses/ErrorResponse"
    post:
      tags:
        - /pdf
      description: Get PDF file from public template
      operationId: pdfPostPublic
      parameters:
        - $ref: "#/components/parameters/template"
        - $ref: "#/components/parameters/token"
      requestBody:
        description: Settings
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/BasicRequestBody"
      security:
        - accessBearerAuth: []
      responses:
        "201":
          $ref: "#/components/responses/PdfResponse"
        "400":
          $ref: "#/components/responses/ErrorResponse"
        "401":
          $ref: "#/components/responses/ErrorResponse"
        "403":
          $ref: "#/components/responses/ErrorResponse"
        "500":
          $ref: "#/components/responses/ErrorResponse"
  "/pdf/private/{template}":
    get:
      tags:
        - /pdf
      description: Get PDF file from private template, paid subscription required
      operationId: pdfGetPrivate
      parameters:
        - $ref: "#/components/parameters/template"
        - $ref: "#/components/parameters/token"
        - $ref: "#/components/parameters/variables"
        - $ref: "#/components/parameters/format"
        - $ref: "#/components/parameters/size"
      security:
        - accessBearerAuth: []
      responses:
        "201":
          $ref: "#/components/responses/PdfResponse"
        "400":
          $ref: "#/components/responses/ErrorResponse"
        "401":
          $ref: "#/components/responses/ErrorResponse"
        "403":
          $ref: "#/components/responses/ErrorResponse"
        "500":
          $ref: "#/components/responses/ErrorResponse"
    post:
      tags:
        - /pdf
      description: Get PDF file from private template, paid subscription required
      operationId: pdfPostPrivate
      parameters:
        - $ref: "#/components/parameters/template"
        - $ref: "#/components/parameters/token"
      requestBody:
        description: Settings
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/BasicRequestBody"
      security:
        - accessBearerAuth: []
      responses:
        "201":
          $ref: "#/components/responses/PdfResponse"
        "400":
          $ref: "#/components/responses/ErrorResponse"
        "401":
          $ref: "#/components/responses/ErrorResponse"
        "403":
          $ref: "#/components/responses/ErrorResponse"
        "500":
          $ref: "#/components/responses/ErrorResponse"
  "/jpg/public/{template}":
    get:
      tags:
        - /jpg
      description: Get JPG image from public template
      operationId: jpgGetPublic
      parameters:
        - $ref: "#/components/parameters/template"
        - $ref: "#/components/parameters/token"
        - $ref: "#/components/parameters/variables"
        - $ref: "#/components/parameters/format"
        - $ref: "#/components/parameters/size"
      security:
        - accessBearerAuth: []
      responses:
        "201":
          $ref: "#/components/responses/JpgResponse"
        "400":
          $ref: "#/components/responses/ErrorResponse"
        "401":
          $ref: "#/components/responses/ErrorResponse"
        "403":
          $ref: "#/components/responses/ErrorResponse"
        "500":
          $ref: "#/components/responses/ErrorResponse"
    post:
      tags:
        - /jpg
      description: Get JPG image from public template
      operationId: jpgPostPublic
      parameters:
        - $ref: "#/components/parameters/template"
        - $ref: "#/components/parameters/token"
      requestBody:
        description: Settings
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/BasicRequestBody"
      security:
        - accessBearerAuth: []
      responses:
        "201":
          $ref: "#/components/responses/JpgResponse"
        "400":
          $ref: "#/components/responses/ErrorResponse"
        "401":
          $ref: "#/components/responses/ErrorResponse"
        "403":
          $ref: "#/components/responses/ErrorResponse"
        "500":
          $ref: "#/components/responses/ErrorResponse"
  "/jpg/private/{template}":
    get:
      tags:
        - /jpg
      description: Get JPG image from private template, paid subscription required
      operationId: jpgGetPrivate
      parameters:
        - $ref: "#/components/parameters/template"
        - $ref: "#/components/parameters/token"
        - $ref: "#/components/parameters/variables"
        - $ref: "#/components/parameters/format"
        - $ref: "#/components/parameters/size"
      security:
        - accessBearerAuth: []
      responses:
        "201":
          $ref: "#/components/responses/JpgResponse"
        "400":
          $ref: "#/components/responses/ErrorResponse"
        "401":
          $ref: "#/components/responses/ErrorResponse"
        "403":
          $ref: "#/components/responses/ErrorResponse"
        "500":
          $ref: "#/components/responses/ErrorResponse"
    post:
      tags:
        - /jpg
      description: Get JPG image from private template, paid subscription required
      operationId: jpgPostPrivate
      parameters:
        - $ref: "#/components/parameters/template"
        - $ref: "#/components/parameters/token"
      requestBody:
        description: Settings
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/BasicRequestBody"
      security:
        - accessBearerAuth: []
      responses:
        "201":
          $ref: "#/components/responses/JpgResponse"
        "400":
          $ref: "#/components/responses/ErrorResponse"
        "401":
          $ref: "#/components/responses/ErrorResponse"
        "403":
          $ref: "#/components/responses/ErrorResponse"
        "500":
          $ref: "#/components/responses/ErrorResponse"
  "/png/public/{template}":
    get:
      tags:
        - /png
      description: Get PNG image from public template
      operationId: pngGetPublic
      parameters:
        - $ref: "#/components/parameters/template"
        - $ref: "#/components/parameters/token"
        - $ref: "#/components/parameters/variables"
        - $ref: "#/components/parameters/format"
        - $ref: "#/components/parameters/size"
      security:
        - accessBearerAuth: []
      responses:
        "201":
          $ref: "#/components/responses/PngResponse"
        "400":
          $ref: "#/components/responses/ErrorResponse"
        "401":
          $ref: "#/components/responses/ErrorResponse"
        "403":
          $ref: "#/components/responses/ErrorResponse"
        "500":
          $ref: "#/components/responses/ErrorResponse"
    post:
      tags:
        - /png
      description: Get PNG image from public template
      operationId: pngPostPublic
      parameters:
        - $ref: "#/components/parameters/template"
        - $ref: "#/components/parameters/token"
      requestBody:
        description: Settings
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/BasicRequestBody"
      security:
        - accessBearerAuth: []
      responses:
        "201":
          $ref: "#/components/responses/PngResponse"
        "400":
          $ref: "#/components/responses/ErrorResponse"
        "401":
          $ref: "#/components/responses/ErrorResponse"
        "403":
          $ref: "#/components/responses/ErrorResponse"
        "500":
          $ref: "#/components/responses/ErrorResponse"
  "/png/private/{template}":
    get:
      tags:
        - /png
      description: Get PNG image from private template, paid subscription required
      operationId: pngGetPrivate
      parameters:
        - $ref: "#/components/parameters/template"
        - $ref: "#/components/parameters/token"
        - $ref: "#/components/parameters/variables"
        - $ref: "#/components/parameters/format"
        - $ref: "#/components/parameters/size"
      security:
        - accessBearerAuth: []
      responses:
        "201":
          $ref: "#/components/responses/PngResponse"
        "400":
          $ref: "#/components/responses/ErrorResponse"
        "401":
          $ref: "#/components/responses/ErrorResponse"
        "403":
          $ref: "#/components/responses/ErrorResponse"
        "500":
          $ref: "#/components/responses/ErrorResponse"
    post:
      tags:
        - /png
      description: Get PNG image from private template, paid subscription required
      operationId: pngPostPrivate
      parameters:
        - $ref: "#/components/parameters/template"
        - $ref: "#/components/parameters/token"
      requestBody:
        description: Settings
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/BasicRequestBody"
      security:
        - accessBearerAuth: []
      responses:
        "201":
          $ref: "#/components/responses/PngResponse"
        "400":
          $ref: "#/components/responses/ErrorResponse"
        "401":
          $ref: "#/components/responses/ErrorResponse"
        "403":
          $ref: "#/components/responses/ErrorResponse"
        "500":
          $ref: "#/components/responses/ErrorResponse"
  "/webp/public/{template}":
    get:
      tags:
        - /webp
      description: Get WEBP image from public template
      operationId: webpGetPublic
      parameters:
        - $ref: "#/components/parameters/template"
        - $ref: "#/components/parameters/token"
        - $ref: "#/components/parameters/variables"
        - $ref: "#/components/parameters/format"
        - $ref: "#/components/parameters/size"
      security:
        - accessBearerAuth: []
      responses:
        "201":
          $ref: "#/components/responses/WebPResponse"
        "400":
          $ref: "#/components/responses/ErrorResponse"
        "401":
          $ref: "#/components/responses/ErrorResponse"
        "403":
          $ref: "#/components/responses/ErrorResponse"
        "500":
          $ref: "#/components/responses/ErrorResponse"
    post:
      tags:
        - /webp
      description: Get WEBP image from public template
      operationId: webpPostPublic
      parameters:
        - $ref: "#/components/parameters/template"
        - $ref: "#/components/parameters/token"
      requestBody:
        description: Settings
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/BasicRequestBody"
      security:
        - accessBearerAuth: []
      responses:
        "201":
          $ref: "#/components/responses/WebPResponse"
        "400":
          $ref: "#/components/responses/ErrorResponse"
        "401":
          $ref: "#/components/responses/ErrorResponse"
        "403":
          $ref: "#/components/responses/ErrorResponse"
        "500":
          $ref: "#/components/responses/ErrorResponse"
  "/webp/private/{template}":
    get:
      tags:
        - /webp
      description: Get WEBP image from private template, paid subscription required
      operationId: webpGetPrivate
      parameters:
        - $ref: "#/components/parameters/template"
        - $ref: "#/components/parameters/token"
        - $ref: "#/components/parameters/variables"
        - $ref: "#/components/parameters/format"
        - $ref: "#/components/parameters/size"
      security:
        - accessBearerAuth: []
      responses:
        "201":
          $ref: "#/components/responses/WebPResponse"
        "400":
          $ref: "#/components/responses/ErrorResponse"
        "401":
          $ref: "#/components/responses/ErrorResponse"
        "403":
          $ref: "#/components/responses/ErrorResponse"
        "500":
          $ref: "#/components/responses/ErrorResponse"
    post:
      tags:
        - /webp
      description: Get WEBP image from private template, paid subscription required
      operationId: webpPostPrivate
      parameters:
        - $ref: "#/components/parameters/template"
        - $ref: "#/components/parameters/token"
      requestBody:
        description: Settings
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/BasicRequestBody"
      security:
        - accessBearerAuth: []
      responses:
        "201":
          $ref: "#/components/responses/WebPResponse"
        "400":
          $ref: "#/components/responses/ErrorResponse"
        "401":
          $ref: "#/components/responses/ErrorResponse"
        "403":
          $ref: "#/components/responses/ErrorResponse"
        "500":
          $ref: "#/components/responses/ErrorResponse"
  "/ping":
    get:
      tags:
        - /ping
      description: Check API status
      operationId: pingGet
      responses:
        "200":
          $ref: "#/components/responses/PingPongResponse"
        "500":
          $ref: "#/components/responses/ErrorResponse"
