> ## 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.

# Unarchive an invoice (idempotent)



## OpenAPI

````yaml delete /v1/invoices/{id}/archive
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/{id}/archive:
    delete:
      tags:
        - Invoice
      summary: Unarchive an invoice (idempotent)
      operationId: invoice.unarchive
      parameters:
        - name: id
          in: path
          required: true
          description: The invoice identifier
          schema:
            type: integer
        - name: id
          in: query
          required: true
          description: The invoice unarchive identifier.
          schema:
            type: integer
            minimum: 1
        - 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: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: string
                  data:
                    $ref: '#/components/schemas/InvoiceResource'
                required:
                  - success
                  - data
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '404':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  error_code:
                    type: string
                    const: RESOURCE_NOT_FOUND
                  message:
                    type: string
                  errors:
                    type: 'null'
                  data:
                    type: 'null'
                required:
                  - success
                  - error_code
                  - message
                  - errors
                  - data
        '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.