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

# Create a supplier invoice

> Create a new record with optional child records.



## OpenAPI

````yaml /api-reference/openapi.json post /account_payable/invoice/
openapi: 3.0.3
info:
  title: Fail Fast API
  version: v1
  description: >-
    REST API for the Fail Fast platform. Authenticate with a workspace API key
    sent as a bearer token. Every response uses the `{message, error, data}`
    envelope.
servers:
  - url: https://api.failfast.ai
security: []
paths:
  /account_payable/invoice/:
    post:
      tags:
        - Accounts payable
      summary: Create a supplier invoice
      description: Create a new record with optional child records.
      operationId: account_payable_invoice_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AccountPayableInvoice'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/AccountPayableInvoice'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/AccountPayableInvoice'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                type: object
                required:
                  - message
                  - error
                  - data
                properties:
                  message:
                    type: string
                    description: Human-readable outcome of the request.
                  error:
                    type: boolean
                    description: true when the request failed.
                    example: false
                  data:
                    $ref: '#/components/schemas/AccountPayableInvoice'
          description: ''
      security:
        - apiKey: []
components:
  schemas:
    AccountPayableInvoice:
      type: object
      description: |-
        A ModelSerializer that takes an additional `fields` argument that
        controls which fields should be displayed.
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        name:
          type: string
          readOnly: true
        custom_fields:
          nullable: true
        operation_number:
          type: integer
          maximum: 2147483647
          minimum: 0
          default: 0
        operation_date:
          type: string
          format: date-time
        description:
          type: string
          nullable: true
        operation_status:
          $ref: '#/components/schemas/OperationStatusEnum'
        status_description:
          type: string
          nullable: true
        created_at:
          type: string
          format: date-time
          readOnly: true
        updated_at:
          type: string
          format: date-time
          readOnly: true
          nullable: true
        deleted_at:
          type: string
          format: date-time
          readOnly: true
          nullable: true
        audit_status:
          allOf:
            - $ref: '#/components/schemas/AuditStatusEnum'
          readOnly: true
        prefix:
          type: string
          nullable: true
        invoice_number:
          type: integer
          maximum: 2147483647
          minimum: 0
        issue_date:
          type: string
          format: date-time
        document_type:
          $ref: '#/components/schemas/DocumentTypeEnum'
        is_pay_authorized:
          type: boolean
        discount_percentage:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,6})?$
        discount_value:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,6})?$
        other_discount_value:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,6})?$
        subtotal:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,6})?$
        total:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,6})?$
        vat_value_included:
          type: string
          format: decimal
          pattern: ^-?\d{0,14}(?:\.\d{0,6})?$
        order_number:
          type: integer
          maximum: 9223372036854776000
          minimum: -9223372036854776000
          format: int64
          nullable: true
        invoice_electronic:
          type: boolean
        is_directly_created:
          type: boolean
        member:
          type: string
          format: uuid
          readOnly: true
        operation:
          type: string
          format: uuid
        market_exchange_rate:
          type: string
          format: uuid
          nullable: true
        branch_office:
          type: string
          format: uuid
        created_by:
          type: string
          format: uuid
          readOnly: true
        updated_by:
          type: string
          format: uuid
          readOnly: true
          nullable: true
        deleted_by:
          type: string
          format: uuid
          readOnly: true
          nullable: true
        supplier:
          type: string
          format: uuid
        supplier_detail:
          type: string
          format: uuid
        supplier_type:
          type: string
          format: uuid
        account:
          type: string
          format: uuid
        cost_center:
          type: string
          format: uuid
          nullable: true
        location:
          type: string
          format: uuid
        international_trade_term:
          type: string
          format: uuid
          nullable: true
        commercial_condition:
          type: string
          format: uuid
        discount_type:
          type: string
          format: uuid
          nullable: true
        tree_hash:
          type: string
          format: uuid
          nullable: true
      required:
        - account
        - audit_status
        - branch_office
        - commercial_condition
        - created_at
        - created_by
        - deleted_at
        - deleted_by
        - discount_percentage
        - discount_value
        - document_type
        - id
        - invoice_number
        - is_pay_authorized
        - issue_date
        - location
        - member
        - name
        - operation
        - operation_date
        - other_discount_value
        - subtotal
        - supplier
        - supplier_detail
        - supplier_type
        - total
        - updated_at
        - updated_by
        - vat_value_included
    OperationStatusEnum:
      enum:
        - PR
        - CO
        - ER
      type: string
      description: |-
        * `PR` - Provisional
        * `CO` - Complete
        * `ER` - Error
    AuditStatusEnum:
      enum:
        - C
        - U
        - D
      type: string
      description: |-
        * `C` - Created
        * `U` - Updated
        * `D` - Deleted
    DocumentTypeEnum:
      enum:
        - ADV
        - INV
        - CRN
      type: string
      description: |-
        * `ADV` - Advance
        * `INV` - Invoice
        * `CRN` - Credit Note
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        Workspace API key sent as a bearer token: `Authorization: Bearer
        failfast_...`. Create keys in Settings -> Workspace -> API Keys.

````