  /api/v1/invoices:
    get:
      tags:
        - invoices
      summary: "List invoices"
      description: |
        ##  GET /api/v1/invoices

        Lists invoices with the option to chain multiple query parameters allowing fine grained filtering of the list.  
      
      x-codeSamples:
      - lang: php
        label: php
        source: |
          $ninja = new InvoiceNinja("your_token");
          $invoices = $ninja->invoices->all([
            'per_page' => 10,
            'page' => 1,
            'sort' => 'number|asc'
          ]);
      - lang: curl
        label: curl
        source: |
          curl --request GET \
            --url 'https://invoicing.co/api/v1/invoices?per_page=10&page=1&sort=number&sort_dir=asc' \
            --header 'X-API-TOKEN: YOUR_API_TOKEN_HERE' \
            --header 'Accept: application/json'
      operationId: getInvoices
      parameters:
        - $ref: "#/components/parameters/X-API-TOKEN"
        - $ref: "#/components/parameters/X-Requested-With"
        - $ref: "#/components/parameters/include"
        - $ref: "#/components/parameters/status"
        - $ref: "#/components/parameters/client_id"
        - $ref: "#/components/parameters/created_at"
        - $ref: "#/components/parameters/updated_at"
        - $ref: "#/components/parameters/is_deleted"
        - $ref: "#/components/parameters/filter_deleted_clients"
        - $ref: "#/components/parameters/vendor_id"
        - name: client_status
          in: query
          description: |
            A comma separated list of invoice status strings. Valid options include:  
            - all
            - paid  
            - unpaid  
            - overdue   
          required: false
          schema:
            type: string
          example: ?client_status=paid,unpaid
        - name: number
          in: query
          description: |
            Search invoices by invoice number 
          required: false
          schema:
            type: string
          example: ?number=INV-001
        - name: filter
          in: query
          description: |
            Searches across a range of columns including:  
            - number  
            - po_number  
            - date  
            - amount  
            - balance  
            - custom_value1  
            - custom_value2  
            - custom_value3  
            - custom_value4
            - client.name
            - client.contacts.[first_name, last_name, email]
            - line_items.[product_key, notes]
          required: false
          schema:
            type: string
          example: ?filter=bob
        - name: without_deleted_clients
          in: query
          description: |
            Returns the invoice list without the invoices of deleted clients.
          required: false
          schema:
            type: string
          example: ?without_deleted_clients=
        - name: overdue
          in: query
          description: |
            Returns the list of invoices that are overdue
          required: false
          schema:
            type: string
          example: ?overdue=
        - name: payable
          in: query
          description: |
            Returns the invoice list that are payable for a defined client. Please note, you must pass the client_id as the value for this query parameter
          required: false
          schema:
            type: string
          example: ?payable={client_id}
        - name: sort
          in: query
          description: Returns the list sorted by column in ascending or descending order.
          required: false
          schema:
            type: string
          example: id|desc number|desc balance|asc 
        - name: private_notes
          in: query
          description: |
            Searches on the private_notes field of the invoices
          required: false
          schema:
            type: string
          example: ?private_notes=super secret
        - name: date
          in: query
          description: |
            Filters the invoices by invoice date returns a list of invoices after (and including) the date
          required: false
          schema:
            type: string
          example: ?date=2022-01-01
        - name: date_range
          in: query
          description: |
            Filters the invoices by invoice date returns a list of invoices between two dates
          required: false
          schema:
            type: string
          example: ?date_range=2022-01-01,2022-01-31
        - name: status_id
          in: query
          description: |
            Filters the invoices by status id

            ```html
              STATUS_DRAFT = 1;
              STATUS_SENT = 2;
              STATUS_PARTIAL = 3;
              STATUS_PAID = 4;
              STATUS_CANCELLED = 5;
              STATUS_REVERSED = 6;
            ```
          required: false
          schema:
            type: integer
          example: ?status_id=1
      responses:
        200:
          description: "A list of invoices"
          headers:
            X-MINIMUM-CLIENT-VERSION:
              $ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
            X-RateLimit-Remaining:
              $ref: "#/components/headers/X-RateLimit-Remaining"
            X-RateLimit-Limit:
              $ref: "#/components/headers/X-RateLimit-Limit"
          content:
            application/json:
              schema:  
                type: object
                properties:
                  data: 
                    type: array
                    items:
                      $ref: '#/components/schemas/Invoice'
                  meta:
                    type: object
                    $ref: '#/components/schemas/Meta'
        401:
          $ref: "#/components/responses/401"
        403:
          $ref: "#/components/responses/403"
        422:
          $ref: '#/components/responses/422'
        429:
          $ref: '#/components/responses/429'
        5XX:
          description: 'Server error'
        default:
          $ref: "#/components/responses/default"
    post:
      tags:
        - invoices
      summary: "Create invoice"
      description: | 
        ## POST /api/v1/invoices
        Creates an invoice for a client.

        Triggered actions are available when updating or creating an invoice.

        These are query parameters that can be chained in order to perform additional actions on the entity, these include:

          ```
          ?send_email=true [Saves and sends the invoice]
          ?mark_sent=true [Saves and marks the invoice as sent]
          ?paid=true [Saves and marks the invoice as paid]
          ?amount_paid=100 [Saves and marks the invoice as paid with the given amount]
          ?cancel=true [Saves and marks the invoice as cancelled]
          ?save_default_footer=true [Saves the current footer as the default footer]
          ?save_default_terms=true [Saves the current terms as the default terms]
          ?retry_e_send=true [Saves and retries the e-send for the invoice]
          ?redirect=https://example.com [Saves and redirects to the given url]
          ```
      x-codeSamples:
      - lang: php
        label: php
        source: |
          $ninja = new InvoiceNinja("your_token");
          $invoices = $ninja->invoices->create([
            'client_id' => 'AxP7K9nY5z',
            'date' => '2022-01-01',
            'due_date' => '2022-01-31',
            'frequency_id' => '1',
            'remaining_cycles' => '5',
            'private_notes' => 'super secret',
            'public_notes' => 'public notes',
            'custom_value1' => 'custom value 1',
            'custom_value2' => 'custom value 2',
            'line_items' => [
              [
                    'quantity' => 1,
                    'cost' => 14,
                    'product_key' => 'sku_4_u',
                    'notes' => 'The actual product description',
                    'discount' => 0,
                    'is_amount_discount' => true,
                    'tax_name1' => '',
                    'tax_rate1' => 0,
                    'tax_name2' => '',
                    'tax_rate2' => 0,
                    'tax_name3' => '',
                    'tax_rate3' => 0,
                    'sort_id' => '0',
                    'custom_value1' => 'https://picsum.photos/200',
                    'custom_value2' => '94',
                    'custom_value3' => 'Alias vel eveniet.',
                    'custom_value4' => 'Iusto aut quis qui.',
                    'type_id' => '1',
                    'tax_id' => '1'
              ]
            ]
          ]);
      - lang: curl
        label: curl
        source: |
          curl --request POST \
            --url 'https://invoicing.co/api/v1/invoices' \
            --header 'X-API-TOKEN: YOUR_API_TOKEN_HERE' \
            --header 'Accept: application/json' \
            --header 'Content-Type: application/json' \
            --data '{
              "client_id": "AxP7K9nY5z",
              "date": "2022-01-01",
              "due_date": "2022-01-31",
              "private_notes": "super secret",
              "public_notes": "public notes",
              "custom_value1": "custom value 1",
              "custom_value2": "custom value 2",
              "frequency_id": "1",
              "remaining_cycles": "5",
              "line_items": [
                {
                  "quantity": 1,
                  "cost": 14,
                  "product_key": "sku_4_u",
                  "notes": "The actual product description",
                  "discount": 0,
                  "is_amount_discount": true,
                  "tax_name1": "",
                  "tax_rate1": 0,
                  "tax_name2": "",
                  "tax_rate2": 0,
                  "tax_name3": "",
                  "tax_rate3": 0,
                  "sort_id": "0",
                  "custom_value1": "https://picsum.photos/200",
                  "custom_value2": "94",
                  "custom_value3": "Alias vel eveniet.",
                  "custom_value4": "Iusto aut quis qui.",
                  "type_id": "1",
                  "tax_id": "1"
                }
              ]
            }'
      operationId: storeInvoice
      parameters:
        - $ref: "#/components/parameters/X-API-TOKEN"
        - $ref: "#/components/parameters/X-Requested-With"
        - $ref: "#/components/parameters/include"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/InvoiceRequest"
      responses:
        200:
          description: "Returns the saved invoice entity"
          headers:
            X-MINIMUM-CLIENT-VERSION:
              $ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
            X-RateLimit-Remaining:
              $ref: "#/components/headers/X-RateLimit-Remaining"
            X-RateLimit-Limit:
              $ref: "#/components/headers/X-RateLimit-Limit"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Invoice"
        401:
          $ref: "#/components/responses/401"
        403:
          $ref: "#/components/responses/403"
        422:
          $ref: '#/components/responses/422'
        429:
          $ref: '#/components/responses/429'
        5XX:
          description: 'Server error'
        default:
          $ref: "#/components/responses/default"

  "/api/v1/invoices/{id}":
    get:
      tags:
        - invoices
      summary: "Show invoice"
      description: |
        ## GET /api/v1/invoices/{id}

        Displays an invoice by id
      x-codeSamples:
      - lang: php
        label: php
        source: |
          $ninja = new InvoiceNinja("your_token");
          $invoice = $ninja->invoices->get("D2J234DFA");
      - lang: curl
        label: curl
        source: |
          curl --request GET \
            --url 'https://invoicing.co/api/v1/invoices/D2J234DFA' \
            --header 'X-API-TOKEN: YOUR_API_TOKEN_HERE' \
            --header 'Accept: application/json'
      operationId: showInvoice
      parameters:
        - $ref: "#/components/parameters/X-API-TOKEN"
        - $ref: "#/components/parameters/X-Requested-With"
        - $ref: "#/components/parameters/include"
        - name: id
          in: path
          description: "The Invoice Hashed ID"
          required: true
          schema:
            type: string
            format: string
          example: D2J234DFA
      responses:
        200:
          description: "Returns the invoice object"
          headers:
            X-MINIMUM-CLIENT-VERSION:
              $ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
            X-RateLimit-Remaining:
              $ref: "#/components/headers/X-RateLimit-Remaining"
            X-RateLimit-Limit:
              $ref: "#/components/headers/X-RateLimit-Limit"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Invoice"
        401:
          $ref: "#/components/responses/401"
        403:
          $ref: "#/components/responses/403"
        422:
          $ref: '#/components/responses/422'
        429:
          $ref: '#/components/responses/429'
        5XX:
          description: 'Server error'
        default:
          $ref: "#/components/responses/default"

    put:
      tags:
        - invoices
      summary: "Update invoice"
      description: |
        ## PUT /api/v1/invoices/{id}
        Handles the updating of an invoice by id.

        Triggered actions are available when updating or creating an invoice.  
        These are query parameters that can be chained in order to perform additional actions on the entity, these include:

          ```
          ?send_email=true [Saves and sends the invoice]
          ?mark_sent=true [Saves and marks the invoice as sent]
          ?paid=true [Saves and marks the invoice as paid]
          ?amount_paid=100 [Saves and marks the invoice as paid with the given amount]
          ?cancel=true [Saves and marks the invoice as cancelled]
          ?save_default_footer=true [Saves the current footer as the default footer]
          ?save_default_terms=true [Saves the current terms as the default terms]
          ?retry_e_send=true [Saves and retries the e-send for the invoice]
          ?redirect=https://example.com [Saves and redirects to the given url]
          ```

      x-codeSamples:
      - lang: php
        label: php
        source: |
          $ninja = new InvoiceNinja("your_token");
          $invoice = $ninja->invoices->update("D2J234DFA", [
            'date' => '2022-01-01',
            'due_date' => '2022-01-31',
            'private_notes' => 'super secret',
            'public_notes' => 'public notes',
            'line_items' => [
              [
                'product_key' => 'sku_4_u',
                'notes' => 'The actual product description',
              ]
            ]
          ]);
      - lang: curl
        label: curl
        source: |
          curl --request PUT \
            --url 'https://invoicing.co/api/v1/invoices/D2J234DFA' \
            --header 'X-API-TOKEN: YOUR_API_TOKEN_HERE' \
            --header 'Accept: application/json' \
            --header 'Content-Type: application/json' \
            --data '{
              "date": "2022-01-01",
              "due_date": "2022-01-31",
              "private_notes": "super secret",
              "public_notes": "public notes",
              "line_items": [
                {
                  "product_key": "sku_4_u",
                  "notes": "The actual product description"
                }
              ]
            }'
      operationId: updateInvoice
      parameters:
        - $ref: "#/components/parameters/X-API-TOKEN"
        - $ref: "#/components/parameters/X-Requested-With"
        - $ref: "#/components/parameters/include"
        - name: id
          in: path
          description: "The Invoice Hashed ID"
          required: true
          schema:
            type: string
            format: string
          example: D2J234DFA
      responses:
        200:
          description: "Returns the invoice object"
          headers:
            X-MINIMUM-CLIENT-VERSION:
              $ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
            X-RateLimit-Remaining:
              $ref: "#/components/headers/X-RateLimit-Remaining"
            X-RateLimit-Limit:
              $ref: "#/components/headers/X-RateLimit-Limit"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Invoice"
        401:
          $ref: "#/components/responses/401"
        403:
          $ref: "#/components/responses/403"
        422:
          $ref: '#/components/responses/422'
        429:
          $ref: '#/components/responses/429'
        5XX:
          description: 'Server error'
        default:
          $ref: "#/components/responses/default"  
    delete:
      tags:
        - invoices
      summary: "Delete invoice"
      description: |
        ## DELETE /api/v1/invoices/{id}

        Handles the deletion of an invoice by id.

      x-codeSamples:
      - lang: php
        label: php
        source: |
          $ninja = new InvoiceNinja("your_token");
          $ninja->invoices->delete("D2J234DFA");
      - lang: curl
        label: curl
        source: |
          curl --request DELETE \
            --url 'https://invoicing.co/api/v1/invoices/D2J234DFA' \
            --header 'X-API-TOKEN: YOUR_API_TOKEN_HERE' \
            --header 'Accept: application/json'
      operationId: deleteInvoice
      parameters:
        - $ref: "#/components/parameters/X-API-TOKEN"
        - $ref: "#/components/parameters/X-Requested-With"
        - $ref: "#/components/parameters/include"
        - name: id
          in: path
          description: "The Invoice Hashed ID"
          required: true
          schema:
            type: string
            format: string
          example: D2J234DFA
      responses:
        200:
          description: "Returns a HTTP status"
          headers:
            X-MINIMUM-CLIENT-VERSION:
              $ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
            X-RateLimit-Remaining:
              $ref: "#/components/headers/X-RateLimit-Remaining"
            X-RateLimit-Limit:
              $ref: "#/components/headers/X-RateLimit-Limit"
        401:
          $ref: "#/components/responses/401"
        403:
          $ref: "#/components/responses/403"
        422:
          $ref: '#/components/responses/422'
        429:
          $ref: '#/components/responses/429'
        5XX:
          description: 'Server error'
        default:
          $ref: "#/components/responses/default"
  "/api/v1/invoices/{id}/edit":
    get:
      tags:
        - invoices
      summary: "Edit invoice"
      description: |
        ## GET /api/v1/invoices/{id}/edit

        Displays an invoice by id for editting

      x-codeSamples:
      - lang: php
        label: php
        source: |
          $ninja = new InvoiceNinja("your_token");
          $invoice = $ninja->invoices->show("D2J234DFA");
      - lang: curl
        label: curl
        source: |
          curl --request GET \
            --url 'https://invoicing.co/api/v1/invoices/D2J234DFA/edit' \
            --header 'X-API-TOKEN: YOUR_API_TOKEN_HERE' \
            --header 'Accept: application/json'
      operationId: editInvoice
      parameters:
        - $ref: "#/components/parameters/X-API-TOKEN"
        - $ref: "#/components/parameters/X-Requested-With"
        - $ref: "#/components/parameters/include"
        - name: id
          in: path
          description: "The Invoice Hashed ID"
          required: true
          schema:
            type: string
            format: string
          example: D2J234DFA
      responses:
        200:
          description: "Returns the invoice object"
          headers:
            X-MINIMUM-CLIENT-VERSION:
              $ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
            X-RateLimit-Remaining:
              $ref: "#/components/headers/X-RateLimit-Remaining"
            X-RateLimit-Limit:
              $ref: "#/components/headers/X-RateLimit-Limit"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Invoice"
        401:
          $ref: "#/components/responses/401"
        403:
          $ref: "#/components/responses/403"
        422:
          $ref: '#/components/responses/422'
        429:
          $ref: '#/components/responses/429'
        5XX:
          description: 'Server error'
        default:
          $ref: "#/components/responses/default"

  /api/v1/invoices/create:
    get:
      tags:
        - invoices
      summary: "Blank invoice"
      description: |
        ## GET /api/v1/invoices/create

        Returns a blank object with default values

      x-codeSamples:
      - lang: php
        label: php
        source: |
          $ninja = new InvoiceNinja("your_token");
          $invoice = $ninja->invoices->model();
      - lang: curl
        label: curl
        source: |
          curl --request GET \
            --url 'https://invoicing.co/api/v1/invoices/create' \
            --header 'X-API-TOKEN: YOUR_API_TOKEN_HERE' \
            --header 'Accept: application/json'
      responses:
        200:
          description: "A blank invoice object"
          headers:
            X-MINIMUM-CLIENT-VERSION:
              $ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
            X-RateLimit-Remaining:
              $ref: "#/components/headers/X-RateLimit-Remaining"
            X-RateLimit-Limit:
              $ref: "#/components/headers/X-RateLimit-Limit"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Invoice"
        401:
          $ref: "#/components/responses/401"
        403:
          $ref: "#/components/responses/403"
        422:
          $ref: '#/components/responses/422'
        429:
          $ref: '#/components/responses/429'
        5XX:
          description: 'Server error'
        default:
          $ref: "#/components/responses/default"

  /api/v1/invoices/bulk:
    post:
      tags:
        - invoices
      summary: "Bulk invoice actions"
      description: |
        ## POST /api/v1/invoices/bulk

        There are multiple actions that are available including:  

      operationId: bulkInvoices
      parameters:
        - $ref: "#/components/parameters/X-API-TOKEN"
        - $ref: "#/components/parameters/X-Requested-With"
        - $ref: "#/components/parameters/index"
      x-codeSamples:
      - lang: php
        label: php
        source: |
          $ninja = new InvoiceNinja("your_token");
          $response = $ninja->invoices->bulk([
            'action' => 'bulk_download',
            'ids' => ['D2J234DFA','D2J234DFA','D2J234DFA']
          ]);
      - lang: curl
        label: curl
        source: |
          curl --request POST \
            --url 'https://invoicing.co/api/v1/invoices/bulk' \
            --header 'X-API-TOKEN: YOUR_API_TOKEN_HERE' \
            --header 'Accept: application/json' \
            --header 'Content-Type: application/json' \
            --data '{
              "action": "bulk_download",
              "ids": ["D2J234DFA","D2J234DFA","D2J234DFA"]
            }'
      requestBody:
        description: "Bulk action details"
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                email_type:
                  type: string
                  description: |
                    The email type to be sent, when bulk emailing invoices options include:
                    - `invoice` (default)
                    - `quote`
                    - `credit`
                    - `payment`
                    - `payment_partial`
                    - `statement`
                    - `reminder1`
                    - `reminder2`
                    - `reminder3`
                    - `reminder_endless`
                    - `custom1`
                    - `custom2`
                    - `custom3`
                    - `purchase_order`
                    - `email_quote_template_reminder1`
                action:
                  type: string
                  description: |
                    The action to be performed, options include:  
                    - `bulk_download`  
                      Bulk download an array of invoice PDFs (These are sent to the admin via email.)  
                    - `download`  
                      Download a single PDF. (Returns a single PDF object)  
                    - `bulk_print`  
                      Merges an array of Invoice PDFs for easy one click printing.  
                    - `auto_bill`  
                      Attempts to automatically bill the invoices with the payment method on file.  
                    - `clone_to_invoice`  
                      Returns a clone of the invoice.  
                    - `clone_to_quote`  
                      Returns a quote cloned using the properties of the given invoice.  
                    - `mark_paid`  
                      Marks an array of invoices as paid.  
                    - `mark_sent`  
                      Marks an array of invoices as sent.  
                    - `restore`  
                      Restores an array of invoices  
                    - `delete`  
                      Deletes an array of invoices  
                    - `archive`  
                      Archives an array of invoices  
                    - `cancel`  
                      Cancels an array of invoices  
                    - `email`  
                      Emails an array of invoices  
                    - `send_email`  
                      Emails an array of invoices. Requires additional properties to be sent. `email_type`  
                ids:
                  type: array
                  items:
                    description: "Array of hashed IDs to be bulk 'actioned - ['D2J234DFA','D2J234DFA','D2J234DFA']"
                    type: string
              example:
                action: bulk_download
                ids: ['D2J234DFA','D2J234DFA','D2J234DFA']
              
      responses:
        200:
          description: "The Bulk Action response"
          headers:
            X-MINIMUM-CLIENT-VERSION:
              $ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
            X-RateLimit-Remaining:
              $ref: "#/components/headers/X-RateLimit-Remaining"
            X-RateLimit-Limit:
              $ref: "#/components/headers/X-RateLimit-Limit"
        401:
          $ref: "#/components/responses/401"
        403:
          $ref: "#/components/responses/403"
        422:
          $ref: '#/components/responses/422'
        429:
          $ref: '#/components/responses/429'
        5XX:
          description: 'Server error'
        default:
          $ref: "#/components/responses/default"

  "/api/v1/invoices/{id}/{action}":
    get:
      deprecated: true
      tags:
        - invoices
      summary: "Custom invoice action"
      description: |
        Performs a custom action on an invoice.  
        The current range of actions are as follows  
        - clone_to_invoice  
        - clone_to_quote  
        - history  
        - delivery_note  
        - mark_paid  
        - download  
        - archive  
        - delete  
        - email  
      operationId: actionInvoice
      parameters:
        - $ref: "#/components/parameters/X-API-TOKEN"
        - $ref: "#/components/parameters/X-Requested-With"
        - $ref: "#/components/parameters/include"
        - name: id
          in: path
          description: "The Invoice Hashed ID"
          required: true
          schema:
            type: string
            format: string
          example: D2J234DFA
        - name: action
          in: path
          description: "The action string to be performed"
          required: true
          schema:
            type: string
            format: string
          example: clone_to_quote
      responses:
        200:
          description: "Returns the invoice object"
          headers:
            X-MINIMUM-CLIENT-VERSION:
              $ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
            X-RateLimit-Remaining:
              $ref: "#/components/headers/X-RateLimit-Remaining"
            X-RateLimit-Limit:
              $ref: "#/components/headers/X-RateLimit-Limit"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Invoice"
        401:
          $ref: "#/components/responses/401"
        403:
          $ref: "#/components/responses/403"
        422:
          $ref: '#/components/responses/422'
        429:
          $ref: '#/components/responses/429'
        5XX:
          description: 'Server error'
        default:
          $ref: "#/components/responses/default"
  "/api/v1/invoice/{invitation_key}/download":
    get:
      tags:
        - invoices
      summary: "Download invoice PDF"
      description: |
        ## GET /api/v1/invoice/{invitation_key}/download

        Downloads a specific invoice

      x-codeSamples:
      - lang: php
        label: php
        source: |
          $ninja = new InvoiceNinja("your_token");
          $invoice = $ninja->invoices->download("D2J234DFA");
      - lang: curl
        label: curl
        source: |
          curl --request GET \
            --url 'https://invoicing.co/api/v1/invoice/D2J234DFA/download' \
            --header 'X-API-TOKEN: YOUR_API_TOKEN_HERE' \
            --header 'Accept: application/json'
      parameters:
        - $ref: "#/components/parameters/X-API-TOKEN"
        - $ref: "#/components/parameters/X-Requested-With"
        - $ref: "#/components/parameters/include"
        - name: invitation_key
          in: path
          description: "The Invoice Invitation Key"
          required: true
          schema:
            type: string
            format: string
          example: D2J234DFA
      responses:
        200:
          description: "Returns the invoice pdf"
          headers:
            X-MINIMUM-CLIENT-VERSION:
              $ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
            X-RateLimit-Remaining:
              $ref: "#/components/headers/X-RateLimit-Remaining"
            X-RateLimit-Limit:
              $ref: "#/components/headers/X-RateLimit-Limit"
        401:
          $ref: "#/components/responses/401"
        403:
          $ref: "#/components/responses/403"
        422:
          $ref: '#/components/responses/422'
        429:
          $ref: '#/components/responses/429'
        5XX:
          description: 'Server error'
        default:
          $ref: "#/components/responses/default"
  "/api/v1/invoices/{id}/delivery_note":
    get:
      tags:
        - invoices
      summary: "Download delivery note"
      description: |
        ## GET /api/v1/invoices/{id}/delivery_note

        Downloads a specific invoice delivery notes

      x-codeSamples:
      - lang: php
        label: php
        source: |
          $ninja = new InvoiceNinja("your_token");
          $invoice = $ninja->invoices->deliveryNote("D2J234DFA");
      - lang: curl
        label: curl
        source: |
          curl --request GET \
            --url 'https://invoicing.co/api/v1/invoices/D2J234DFA/delivery_note' \
            --header 'X-API-TOKEN: YOUR_API_TOKEN_HERE' \
            --header 'Accept: application/json'
      parameters:
        - $ref: "#/components/parameters/X-API-TOKEN"
        - $ref: "#/components/parameters/X-Requested-With"
        - $ref: "#/components/parameters/include"
        - name: id
          in: path
          description: "The Invoice Hahsed Id"
          required: true
          schema:
            type: string
            format: string
          example: D2J234DFA
      responses:
        200:
          description: "Returns the invoice delivery note pdf"
          headers:
            X-MINIMUM-CLIENT-VERSION:
              $ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
            X-RateLimit-Remaining:
              $ref: "#/components/headers/X-RateLimit-Remaining"
            X-RateLimit-Limit:
              $ref: "#/components/headers/X-RateLimit-Limit"
        401:
          $ref: "#/components/responses/401"
        403:
          $ref: "#/components/responses/403"
        422:
          $ref: '#/components/responses/422'
        429:
          $ref: '#/components/responses/429'
        5XX:
          description: 'Server error'
        default:
          $ref: "#/components/responses/default"
  "/api/v1/invoices/{id}/upload":
    post:
      tags:
        - invoices
      summary: "Add invoice document"
      description: |
        ## POST /api/v1/invoices/{id}/upload

        Handles the uploading of a document to a invoice

      x-codeSamples:
      - lang: php
        label: php
        source: |
          $ninja = new InvoiceNinja("your_token");
          $invoice = $ninja->invoices->upload("D2J234DFA");
      - lang: curl
        label: curl
        source: |
          curl --request POST \
            --url 'https://invoicing.co/api/v1/invoices/D2J234DFA/upload' \
            --header 'X-API-TOKEN: YOUR_API_TOKEN_HERE' \
            --header 'Accept: application/json'
      parameters:
        - $ref: "#/components/parameters/X-API-TOKEN"
        - $ref: "#/components/parameters/X-Requested-With"
        - $ref: "#/components/parameters/include"
        - name: id
          in: path
          description: "The Invoice Hashed ID"
          required: true
          schema:
            type: string
            format: string
          example: D2J234DFA
      requestBody:
        description: "File Upload Body"
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                _method:
                  type: string
                  example: PUT
                documents:
                  type: array
                  items:
                    description: "Array of binary documents for upload"
                    type: string
                    format: binary
      responses:
        200:
          description: "Returns the Invoice object"
          headers:
            X-MINIMUM-CLIENT-VERSION:
              $ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
            X-RateLimit-Remaining:
              $ref: "#/components/headers/X-RateLimit-Remaining"
            X-RateLimit-Limit:
              $ref: "#/components/headers/X-RateLimit-Limit"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Invoice"
        401:
          $ref: "#/components/responses/401"
        403:
          $ref: "#/components/responses/403"
        422:
          $ref: '#/components/responses/422'
        429:
          $ref: '#/components/responses/429'
        5XX:
          description: 'Server error'
        default:
          $ref: "#/components/responses/default"