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

# Delete Client

> Deletes a client by its unique identifier. If the client has invoices or credits, the client is archived (soft-delete). Otherwise the client is hard deleted. Returns the client in both cases (200 OK).



## OpenAPI

````yaml /api-reference/specs/billing.json delete /clients/{clientId}
openapi: 3.0.1
info:
  title: Billing Service
  description: Billing API for FlowPayroll
  contact:
    name: FlowPayroll
    email: support@flowpayroll.com
  version: v1
servers:
  - url: https://api.sandbox.flowpayroll.ai/v1/billing
security:
  - X-Auth-Token: []
tags:
  - name: Account codes
    description: Create, update, archive, and delete accounting ledger codes.
  - name: Tax rates
    description: Manage default and custom tax rates.
  - name: Invoice & credit note templates
    description: >-
      Configure invoice and credit note templates, and list the available
      reference and description tokens.
  - name: Finance defaults
    description: >-
      Organisation finance defaults, pay element mappings, and attachment
      limits.
  - name: Invoices
  - name: Credit Notes
  - name: Clients
  - name: Integrations
  - name: Accounting Sync
paths:
  /clients/{clientId}:
    delete:
      tags:
        - Clients
      summary: Delete Client
      description: >-
        Deletes a client by its unique identifier. If the client has invoices or
        credits, the client is archived (soft-delete). Otherwise the client is
        hard deleted. Returns the client in both cases (200 OK).
      operationId: DeleteClient
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse_ClientDto'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse_Object'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse_Object'
components:
  schemas:
    ApiResponse_ClientDto:
      type: object
      properties:
        content:
          $ref: '#/components/schemas/Content_ClientDto'
        metadata:
          $ref: '#/components/schemas/Metadata'
        errors:
          type: array
          items:
            $ref: '#/components/schemas/Error'
          nullable: true
        message:
          $ref: '#/components/schemas/Message'
      additionalProperties: false
    ApiResponse_Object:
      type: object
      properties:
        content:
          $ref: '#/components/schemas/Content_Object'
        metadata:
          $ref: '#/components/schemas/Metadata'
        errors:
          type: array
          items:
            $ref: '#/components/schemas/Error'
          nullable: true
        message:
          $ref: '#/components/schemas/Message'
      additionalProperties: false
    Content_ClientDto:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/ClientDto'
        metadata:
          $ref: '#/components/schemas/Metadata'
      additionalProperties: false
    Metadata:
      type: object
      properties:
        dateFormat:
          type: string
          nullable: true
        dateTimeFormat:
          type: string
          nullable: true
      additionalProperties: false
    Error:
      type: object
      properties:
        field:
          type: string
          nullable: true
        reasonText:
          type: string
          nullable: true
        reasonId:
          type: string
          nullable: true
        reasonParameters:
          type: array
          items:
            $ref: '#/components/schemas/Pair'
          nullable: true
      additionalProperties: false
    Message:
      type: object
      properties:
        text:
          type: string
          nullable: true
        textId:
          type: string
          nullable: true
        textParameters:
          type: array
          items:
            $ref: '#/components/schemas/Pair'
          nullable: true
      additionalProperties: false
    Content_Object:
      type: object
      properties:
        data:
          nullable: true
        metadata:
          $ref: '#/components/schemas/Metadata'
      additionalProperties: false
    ClientDto:
      allOf:
        - $ref: '#/components/schemas/UpdatableClientDto'
        - required:
            - createdBy
            - createdDate
            - organisationId
            - updatedBy
            - updatedDate
          type: object
          properties:
            organisationId:
              type: string
            createdDate:
              type: string
            createdBy:
              type: string
            updatedDate:
              type: string
            updatedBy:
              type: string
            financeSettings:
              $ref: '#/components/schemas/ClientFinanceSettingsDto'
          additionalProperties: false
    Pair:
      type: object
      properties:
        key:
          type: string
          nullable: true
        value:
          type: string
          nullable: true
      additionalProperties: false
    UpdatableClientDto:
      required:
        - name
        - typeDiscriminator
      type: object
      properties:
        typeDiscriminator:
          type: string
        id:
          type: string
        name:
          type: string
        poRequirement:
          enum:
            - None
            - Warning
            - Required
          type: string
        attachmentRequirement:
          enum:
            - None
            - Warning
            - Required
          type: string
        invoiceFormat:
          enum:
            - None
            - Date
            - PayElementId
            - PoNumber
            - TagGroup
            - PayrollConfigId
          type: string
        invoiceFormatTagGroup:
          type: string
          nullable: true
        invoiceFormatTagName:
          type: string
          nullable: true
        invoiceNumberFormat:
          enum:
            - None
            - TagLookup
          type: string
        invoiceNumberTagGroup:
          type: string
          nullable: true
        invoiceNumberTagName:
          type: string
          nullable: true
        subtotalGroupBy:
          enum:
            - None
            - PayElement
            - TagGroup
          type: string
        subtotalTagGroupName:
          type: string
          nullable: true
        rebatePercentage:
          type: number
          format: double
          nullable: true
        vatNumber:
          type: string
          nullable: true
        registrationNumber:
          type: string
          nullable: true
        contacts:
          type: array
          items:
            $ref: '#/components/schemas/UpdatableContactDto'
          nullable: true
        tags:
          type: array
          items:
            $ref: '#/components/schemas/TagDto'
          nullable: true
        status:
          enum:
            - Active
            - Archived
          type: string
        defaultRevenueAccountCode:
          type: string
          nullable: true
        defaultTaxType:
          type: string
          nullable: true
        providerId:
          type: string
          nullable: true
        externalProvider:
          type: string
          nullable: true
        syncStatus:
          enum:
            - NotSynced
            - Synced
            - SyncFailed
            - Pending
          type: string
          nullable: true
        lastSyncedAt:
          type: string
          nullable: true
        syncErrorMessage:
          type: string
          nullable: true
        billingAddress:
          $ref: '#/components/schemas/AddressDto'
        physicalAddress:
          $ref: '#/components/schemas/AddressDto'
      additionalProperties: false
      discriminator:
        propertyName: typeDiscriminator
        mapping:
          UpdatableClientDto:
            $ref: '#/components/schemas/UpdatableClientDto'
          ClientDto:
            $ref: '#/components/schemas/ClientDto'
    ClientFinanceSettingsDto:
      type: object
      properties:
        defaultRevenueAccount:
          type: string
          nullable: true
        defaultTaxRate:
          type: string
          nullable: true
        payElementMappings:
          type: array
          items:
            $ref: '#/components/schemas/PayElementMappingItemDto'
        defaultDueDateDays:
          type: integer
          format: int32
          nullable: true
        defaultDueDateType:
          enum:
            - DaysAfterInvoiceDate
            - DaysAfterInvoiceMonth
            - OfCurrentMonth
            - OfFollowingMonth
          type: string
          nullable: true
        defaultCurrencyCode:
          type: string
          nullable: true
        defaultLineAmountTypes:
          type: string
          nullable: true
        invoiceTemplateOverride:
          $ref: '#/components/schemas/DocumentTemplateDto'
        creditNoteTemplateOverride:
          $ref: '#/components/schemas/DocumentTemplateDto'
        invoiceReferenceFormula:
          type: string
          nullable: true
        invoiceReferenceDateFormat:
          type: string
          nullable: true
      additionalProperties: false
    UpdatableContactDto:
      required:
        - email
        - firstName
        - lastName
      type: object
      properties:
        id:
          type: string
          nullable: true
        firstName:
          type: string
        lastName:
          type: string
        email:
          type: string
        phone:
          type: string
          nullable: true
        role:
          type: string
          nullable: true
        tags:
          type: array
          items:
            $ref: '#/components/schemas/TagDto'
          nullable: true
        includeInEmails:
          type: boolean
      additionalProperties: false
    TagDto:
      type: object
      properties:
        name:
          type: string
        group:
          type: string
        value:
          type: string
      additionalProperties: false
    AddressDto:
      type: object
      properties:
        line1:
          type: string
          nullable: true
        line2:
          type: string
          nullable: true
        city:
          type: string
          nullable: true
        county:
          type: string
          nullable: true
        postcode:
          type: string
          nullable: true
        countryCode:
          type: string
          nullable: true
      additionalProperties: false
    PayElementMappingItemDto:
      type: object
      properties:
        payElementId:
          type: string
        accountCode:
          type: string
        taxType:
          type: string
      additionalProperties: false
    DocumentTemplateDto:
      type: object
      properties:
        showSubsectionHeader:
          type: boolean
        showSubtotalInSubsection:
          type: boolean
        showSubtotalVatInSubsection:
          type: boolean
        showQuantitySumInSubsection:
          type: boolean
        showBottomSubtotals:
          type: boolean
        showVatInBottomSubtotals:
          type: boolean
        showQuantitySumInBottomSubtotals:
          type: boolean
        lineItemSortOrder:
          enum:
            - None
            - ByEmployee
            - ByPayElementThenEmployee
          type: string
        lineDescriptionFormula:
          type: string
          nullable: true
        lineDescriptionTagGroupId:
          type: string
          nullable: true
        attachmentStrategy:
          enum:
            - ExcessLost
            - MergeOnIntegration
          type: string
        includeAttachmentsWithOnlineInvoice:
          type: boolean
      additionalProperties: false
  securitySchemes:
    X-Auth-Token:
      type: apiKey
      description: Authentication token for API access
      name: X-Auth-Token
      in: header

````