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

# Get all invoices



## OpenAPI

````yaml get /v1/invoices
openapi: 3.1.0
info:
  title: Flextell API
  version: 0.0.1
  description: >-
    Flextell REST API referansı. Kimlik doğrulama, scope ve istek kuralları için
    API sekmesindeki rehberlere bakın.
servers:
  - url: https://app.flextell.ai/api
    description: Üretim
security:
  - oauth2: []
  - bearer: []
paths:
  /v1/invoices:
    get:
      tags:
        - Invoice
      summary: Get all invoices
      operationId: invoice.index
      parameters:
        - name: search
          in: query
          description: The search query.
          schema:
            type:
              - string
              - 'null'
            maxLength: 255
        - name: status
          in: query
          description: Filter by status.
          schema:
            type:
              - string
              - 'null'
            enum:
              - draft
              - success
              - sent
              - waiting
              - error
              - cancelled
              - null
        - name: is_archived
          in: query
          description: Filter by archived status.
          schema:
            type:
              - boolean
              - 'null'
        - name: is_draft
          in: query
          description: Filter by draft status.
          schema:
            type:
              - boolean
              - 'null'
        - name: is_cancelled
          in: query
          description: Filter by cancelled status.
          schema:
            type:
              - boolean
              - 'null'
        - name: document_class
          in: query
          description: Filter by document class (EFATURA, EARSIV or SMM).
          schema:
            type:
              - string
              - 'null'
            enum:
              - EFATURA
              - EARSIV
              - SMM
              - null
        - name: sale_id
          in: query
          description: Filter by the sale the invoice belongs to.
          schema:
            type:
              - integer
              - 'null'
            minimum: 1
        - name: customer_id
          in: query
          description: Filter by the customer the invoice belongs to.
          schema:
            type:
              - integer
              - 'null'
            minimum: 1
        - name: issue_date_from
          in: query
          description: Filter records from this issue date (inclusive, YYYY-MM-DD).
          schema:
            type:
              - string
              - 'null'
            format: date-time
        - name: issue_date_to
          in: query
          description: Filter records up to this issue date (inclusive, YYYY-MM-DD).
          schema:
            type:
              - string
              - 'null'
            format: date-time
        - name: sort_by
          in: query
          description: The field to sort by.
          schema:
            type:
              - string
              - 'null'
            enum:
              - created_at
              - issue_date
              - document_number
              - amount_payable
              - status
              - null
        - name: sort_order
          in: query
          description: The sort direction (asc or desc).
          schema:
            type:
              - string
              - 'null'
            enum:
              - asc
              - desc
              - null
        - name: per_page
          in: query
          description: The number of items per page.
          schema:
            type:
              - integer
              - 'null'
            minimum: 1
            maximum: 100
        - name: X-Tenant
          in: header
          required: true
          description: >-
            Tenant identifier. Send the Tenant ID in the `X-Tenant` header to
            scope API requests to a specific tenant.
          schema:
            type: number
      responses:
        '200':
          description: Paginated set of `InvoiceResource`
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/InvoiceResource'
                  links:
                    type: object
                    properties:
                      first:
                        type:
                          - string
                          - 'null'
                      last:
                        type:
                          - string
                          - 'null'
                      prev:
                        type:
                          - string
                          - 'null'
                      next:
                        type:
                          - string
                          - 'null'
                    required:
                      - first
                      - last
                      - prev
                      - next
                  meta:
                    type: object
                    properties:
                      current_page:
                        type: integer
                        minimum: 1
                      from:
                        type:
                          - integer
                          - 'null'
                        minimum: 1
                      last_page:
                        type: integer
                        minimum: 1
                      links:
                        type: array
                        description: Generated paginator links.
                        items:
                          type: object
                          properties:
                            url:
                              type:
                                - string
                                - 'null'
                            label:
                              type: string
                            active:
                              type: boolean
                          required:
                            - url
                            - label
                            - active
                      path:
                        type:
                          - string
                          - 'null'
                        description: Base path for paginator generated URLs.
                      per_page:
                        type: integer
                        description: Number of items shown per page.
                        minimum: 0
                      to:
                        type:
                          - integer
                          - 'null'
                        description: Number of the last item in the slice.
                        minimum: 1
                      total:
                        type: integer
                        description: Total number of items being paginated.
                        minimum: 0
                    required:
                      - current_page
                      - from
                      - last_page
                      - links
                      - path
                      - per_page
                      - to
                      - total
                required:
                  - data
                  - links
                  - meta
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '422':
          $ref: '#/components/responses/ValidationException'
        '428':
          description: >-
            Mandatory setup is incomplete. Finish the setup wizard first;
            `data.next_step` names the step to continue with.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    examples:
                      - false
                  error_code:
                    type: string
                    enum:
                      - SETUP_REQUIRED
                    examples:
                      - SETUP_REQUIRED
                  message:
                    type: string
                    examples:
                      - Complete the required setup steps to continue.
                  data:
                    type: object
                    properties:
                      next_step:
                        type:
                          - string
                          - 'null'
                        examples:
                          - clinic_info
                    required:
                      - next_step
                required:
                  - success
                  - error_code
                  - message
                  - data
components:
  schemas:
    InvoiceResource:
      type: object
      properties:
        id:
          type: integer
        record_state:
          $ref: '#/components/schemas/RecordStateResource'
          description: >-
            Invoices are under legal hold (VUK/TTK), so they stay writable after
            the patient's erasure; a salesperson is still locked out of another
            rep's lead.
        document_number:
          type: string
        document_class:
          type: string
        document_type:
          type: string
        profile_id:
          type:
            - string
            - 'null'
        ettn:
          type:
            - string
            - 'null'
        issue_date:
          type: string
        sent_at:
          type:
            - string
            - 'null'
          format: date-time
        sender_tax_number:
          type:
            - string
            - 'null'
        receiver_name:
          anyOf:
            - type: string
            - type: 'null'
        receiver_tax_number:
          anyOf:
            - type: string
            - type: 'null'
        receiver_email:
          anyOf:
            - type: string
            - type: 'null'
        exchange_rate:
          type: string
        amount_tax_exclusive:
          type:
            - string
            - 'null'
        amount_tax_total:
          type:
            - string
            - 'null'
        amount_payable:
          type: string
        invoice_amount:
          type:
            - string
            - 'null'
        status:
          type: string
        status_label:
          type: string
          enum:
            - Taslak
            - Başarılı
            - Gönderildi
            - Bekliyor
            - Hata
            - İptal Edildi
        is_printed:
          type: boolean
        is_cancelled:
          type: boolean
        is_read:
          type: boolean
        is_draft:
          type: boolean
        is_archived:
          type: boolean
        series_name:
          type:
            - string
            - 'null'
        notes:
          type:
            - string
            - 'null'
        customer:
          anyOf:
            - type: object
              properties:
                id:
                  type: integer
                tenant_id:
                  type: integer
                first_name:
                  type:
                    - string
                    - 'null'
                last_name:
                  type:
                    - string
                    - 'null'
                phone_number:
                  type:
                    - string
                    - 'null'
                email:
                  type:
                    - string
                    - 'null'
                date_of_birth:
                  type: 'null'
                gender:
                  anyOf:
                    - $ref: '#/components/schemas/Gender'
                    - type: 'null'
                country_id:
                  type:
                    - integer
                    - 'null'
                identity_number:
                  type:
                    - string
                    - 'null'
                address:
                  type:
                    - string
                    - 'null'
                deleted_at:
                  type:
                    - string
                    - 'null'
                  format: date-time
                created_at:
                  type:
                    - string
                    - 'null'
                  format: date-time
                updated_at:
                  type:
                    - string
                    - 'null'
                  format: date-time
                avatar_url:
                  type: 'null'
                avatar_updated_at:
                  type:
                    - string
                    - 'null'
                  format: date-time
                user_id:
                  type:
                    - integer
                    - 'null'
                city_id:
                  type:
                    - integer
                    - 'null'
                district_id:
                  type:
                    - integer
                    - 'null'
                import_source_id:
                  type:
                    - integer
                    - 'null'
                passport_number:
                  type:
                    - string
                    - 'null'
                search_vector:
                  type: 'null'
                is_intake_completed:
                  type: boolean
                default_channel_id:
                  type:
                    - integer
                    - 'null'
                lead_id:
                  type:
                    - integer
                    - 'null'
                converted_at:
                  type:
                    - string
                    - 'null'
                  format: date-time
                occupation_id:
                  type:
                    - integer
                    - 'null'
                minimized_at:
                  type:
                    - string
                    - 'null'
                erased_at:
                  type:
                    - string
                    - 'null'
                  format: date-time
                is_masked:
                  type: boolean
              required:
                - id
                - tenant_id
                - first_name
                - last_name
                - phone_number
                - email
                - date_of_birth
                - gender
                - country_id
                - identity_number
                - address
                - deleted_at
                - created_at
                - updated_at
                - avatar_url
                - avatar_updated_at
                - user_id
                - city_id
                - district_id
                - import_source_id
                - passport_number
                - search_vector
                - is_intake_completed
                - default_channel_id
                - lead_id
                - converted_at
                - occupation_id
                - minimized_at
                - erased_at
                - is_masked
            - $ref: '#/components/schemas/Customer'
        currency:
          $ref: '#/components/schemas/Currency'
        created_at:
          type:
            - string
            - 'null'
          format: date-time
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
      required:
        - id
        - record_state
        - document_number
        - document_class
        - document_type
        - profile_id
        - ettn
        - issue_date
        - sent_at
        - sender_tax_number
        - receiver_name
        - receiver_tax_number
        - receiver_email
        - exchange_rate
        - amount_tax_exclusive
        - amount_tax_total
        - amount_payable
        - invoice_amount
        - status
        - status_label
        - is_printed
        - is_cancelled
        - is_read
        - is_draft
        - is_archived
        - series_name
        - notes
        - created_at
        - updated_at
      title: InvoiceResource
    RecordStateResource:
      type: object
      properties:
        is_read_only:
          type: boolean
          description: >-
            True when every write on this record is refused; false does not
            imply the caller may write.
        reason_code:
          type:
            - string
            - 'null'
          description: >-
            Why the record is read-only (`CUSTOMER_ERASED`, or
            `LEAD_NOT_ASSIGNED` for a salesperson on another rep's lead), or
            null when it is not.
      required:
        - is_read_only
        - reason_code
      title: RecordStateResource
    Gender:
      type: string
      enum:
        - male
        - female
        - other
      title: Gender
    Customer:
      type: object
      properties:
        id:
          type: integer
        tenant_id:
          type: integer
        first_name:
          type:
            - string
            - 'null'
        last_name:
          type:
            - string
            - 'null'
        phone_number:
          type:
            - string
            - 'null'
        email:
          type:
            - string
            - 'null'
        date_of_birth:
          type:
            - string
            - 'null'
          format: date-time
        gender:
          anyOf:
            - $ref: '#/components/schemas/Gender'
            - type: 'null'
        country_id:
          type:
            - integer
            - 'null'
        identity_number:
          type:
            - string
            - 'null'
        address:
          type:
            - string
            - 'null'
        deleted_at:
          type:
            - string
            - 'null'
          format: date-time
        created_at:
          type:
            - string
            - 'null'
          format: date-time
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
        avatar_url:
          type:
            - string
            - 'null'
        avatar_updated_at:
          type:
            - string
            - 'null'
          format: date-time
        user_id:
          type:
            - integer
            - 'null'
        city_id:
          type:
            - integer
            - 'null'
        district_id:
          type:
            - integer
            - 'null'
        import_source_id:
          type:
            - integer
            - 'null'
        passport_number:
          type:
            - string
            - 'null'
        search_vector:
          type:
            - string
            - 'null'
        is_intake_completed:
          type: boolean
        default_channel_id:
          type:
            - integer
            - 'null'
        lead_id:
          type:
            - integer
            - 'null'
        converted_at:
          type:
            - string
            - 'null'
          format: date-time
        occupation_id:
          type:
            - integer
            - 'null'
        minimized_at:
          type:
            - string
            - 'null'
        erased_at:
          type:
            - string
            - 'null'
          format: date-time
      required:
        - id
        - tenant_id
        - first_name
        - last_name
        - phone_number
        - email
        - date_of_birth
        - gender
        - country_id
        - identity_number
        - address
        - deleted_at
        - created_at
        - updated_at
        - avatar_url
        - avatar_updated_at
        - user_id
        - city_id
        - district_id
        - import_source_id
        - passport_number
        - search_vector
        - is_intake_completed
        - default_channel_id
        - lead_id
        - converted_at
        - occupation_id
        - minimized_at
        - erased_at
      title: Customer
    Currency:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        code:
          type:
            - string
            - 'null'
        symbol:
          type:
            - string
            - 'null'
        is_active:
          type: string
        deleted_at:
          type:
            - string
            - 'null'
          format: date-time
        created_at:
          type:
            - string
            - 'null'
          format: date-time
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
        locale:
          type:
            - string
            - 'null'
        search_vector:
          type:
            - string
            - 'null'
      required:
        - id
        - name
        - code
        - symbol
        - is_active
        - deleted_at
        - created_at
        - updated_at
        - locale
        - search_vector
      title: Currency
  responses:
    AuthenticationException:
      description: Unauthenticated
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    AuthorizationException:
      description: Authorization error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Errors overview.
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://dev.flextell.ai/oauth/authorize
          tokenUrl: https://dev.flextell.ai/oauth/token
          scopes:
            '*': all
    bearer:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.