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

# Upload a credit note from a file

> Upload an incoming credit note (payable) in PDF, PNG, or JPEG format and scan its contents. The maximum file size is 20MB.



## OpenAPI

````yaml /.tooling/schemas/rest/tags/product-finops.json post /finops/v1/payable-credit-notes/upload-from-file
openapi: 3.1.0
info:
  title: Tesouro Partner API
  version: '2025-06-23'
  description: The Tesouro REST API, for Tesouro partners to integrate with our solution.
  termsOfService: https://tesouro.com/terms
  contact:
    name: Tesouro team
    url: https://tesouro.com/about/
    email: developers@tesouro.com
servers:
  - url: https://api.sandbox.tesouro.com
    description: Sandbox
security: []
tags:
  - name: Accounting connections
  - name: Accounting data pull
  - name: Accounting synchronized records
  - name: Accounting tax rates
  - name: Analytics
  - name: Approval policies
  - name: Approval requests
  - name: Bank details
  - name: Comments
  - name: Cost centers
  - name: Counterpart VAT IDs
  - name: Counterpart addresses
  - name: Counterpart bank accounts
  - name: Counterpart contacts
  - name: Counterparts
  - name: Credit notes
  - name: Custom tax rates
  - name: Delivery notes
  - name: Documents
  - name: Entities
  - name: Entity users
  - name: Events
  - name: Files
  - name: Identity
  - name: Ledger accounts
  - name: Mail templates
  - name: Mailbox domains
  - name: Mailboxes
  - name: Measure units
  - name: OCR
  - name: Overdue reminders
  - name: PDF templates
  - name: Payable line items
  - name: Payables
  - name: Payment intents
  - name: Payment links
  - name: Payment methods
  - name: Payment records
  - name: Payment reminders
  - name: Payment terms
  - name: Products
  - name: Projects
  - name: Purchase orders
  - name: Receipts
  - name: Receivables
  - name: Recurrences
  - name: Tags
  - name: Text templates
  - name: Transactions
  - name: VAT rates
  - name: Webhook deliveries
  - name: Webhook subscriptions
paths:
  /finops/v1/payable-credit-notes/upload-from-file:
    post:
      tags:
        - Credit notes
      summary: Upload a credit note from a file
      description: >-
        Upload an incoming credit note (payable) in PDF, PNG, or JPEG format and
        scan its contents. The maximum file size is 20MB.
      operationId: post_payable-credit-notes_upload-from-file
      parameters:
        - required: true
          schema:
            type: string
            format: date
          example: '2025-06-23'
          name: x-finops-version
          in: header
        - description: The ID of the entity that owns the requested resource.
          required: true
          schema:
            type: string
            format: uuid
            examples:
              - 9d2b4c8f-2087-4738-ba91-7359683c49a4
          name: x-organization-id
          in: header
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/CreditNoteUploadFile'
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreditNoteResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchemaResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchemaResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchemaResponse'
        '405':
          description: Method Not Allowed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchemaResponse'
        '409':
          description: Error uploading the file.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchemaResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchemaResponse'
      security:
        - HTTPBearer: []
components:
  schemas:
    CreditNoteUploadFile:
      properties:
        file:
          type: string
          format: binary
      type: object
      required:
        - file
    CreditNoteResponse:
      properties:
        id:
          type: string
          format: uuid
          description: The unique identifier of the credit note
          example: 123e4567-e89b-12d3-a456-426614174000
        created_at:
          type: string
          format: date-time
          description: Date and time when the credit note was created in the system
          example: '2024-01-15T14:30:00Z'
        updated_at:
          type: string
          format: date-time
          description: Date and time of the last update to the credit note
          example: '2024-01-15T14:30:00Z'
        based_on:
          type: string
          format: uuid
          description: ID of the payable this credit note is based on
          example: 123e4567-e89b-12d3-a456-426614174000
        based_on_document_id:
          type: string
          maxLength: 255
          description: >-
            The document ID of the original payable that this credit note refers
            to
          example: INV-2287
        counterpart:
          allOf:
            - $ref: '#/components/schemas/CounterpartRawData'
          description: Object representing de-normalized counterpart data
        counterpart_address_id:
          type: string
          format: uuid
          description: ID of the counterpart's address
          example: 123e4567-e89b-12d3-a456-426614174000
        counterpart_bank_account_id:
          type: string
          format: uuid
          description: ID of the counterpart's bank account
          example: 123e4567-e89b-12d3-a456-426614174000
        counterpart_id:
          type: string
          format: uuid
          description: ID of the counterpart
          example: 123e4567-e89b-12d3-a456-426614174000
        counterpart_raw:
          allOf:
            - $ref: '#/components/schemas/CounterpartRawData'
          description: >-
            Object representing counterpart data which was extracted by OCR.
            Used for informational purposes.
        counterpart_vat_id_id:
          type: string
          format: uuid
          description: ID of the counterpart's VAT registration
          example: 123e4567-e89b-12d3-a456-426614174000
        created_by_external_user_id:
          type: string
          maxLength: 255
          description: External system's user ID for the creator
          example: ext_user_123
        created_by_external_user_name:
          type: string
          maxLength: 255
          description: Name of the external user who created the credit note
          example: John Doe
        created_by_user_id:
          type: string
          format: uuid
          description: ID of the user who created the credit note
          example: 123e4567-e89b-12d3-a456-426614174000
        currency:
          type: string
          maxLength: 5
          description: The currency code
          example: USD
        currency_exchange:
          $ref: '#/components/schemas/CurrencyExchangeSchema'
        description:
          type: string
          maxLength: 255
          description: Description of the credit note
          example: Credit note for returned items from invoice INV-2287
        document_id:
          type: string
          maxLength: 255
          description: The credit note's unique document number
          example: CN-2287
        entity_id:
          type: string
          format: uuid
          description: The ID of the entity to which the credit note belongs
          example: 123e4567-e89b-12d3-a456-426614174000
        file_id:
          type: string
          format: uuid
          description: The id of the credit note file stored in the file saver.
          example: 123e4567-e89b-12d3-a456-426614174000
        file_url:
          type: string
          description: The URL of the credit note file stored in the file saver.
        issued_at:
          type: string
          format: date
          description: Date when the credit note was issued
          example: '2024-01-15'
        ocr_request_id:
          type: string
          format: uuid
          description: ID of the OCR processing request
          example: 123e4567-e89b-12d3-a456-426614174000
        ocr_status:
          type: string
          maxLength: 10
          description: Status of OCR processing
          example: completed
        origin:
          type: string
          maxLength: 128
          description: The origin or source system of the credit note
          example: SAP
        project_id:
          type: string
          format: uuid
          description: ID of the associated project
          example: 123e4567-e89b-12d3-a456-426614174000
        sender:
          type: string
          maxLength: 255
          description: Email address of the sender
          example: supplier@example.com
        source_of_data:
          type: string
          maxLength: 128
          description: How the data was input (ocr/user_specified)
          example: user_specified
        status:
          type: string
          maxLength: 30
          description: The current status of the credit note in its lifecycle
          example: submitted_for_approval
        subtotal:
          type: integer
          description: The subtotal amount before taxes
          example: 1000
        tags:
          items:
            $ref: '#/components/schemas/TagReadSchema'
          type: array
          description: List of tags associated with this credit note
          example:
            - id: 123e4567-e89b-12d3-a456-426614174000
              name: Department A
              category: department
        tax:
          type: integer
          description: The tax percentage
          example: 20
        tax_amount:
          type: integer
          description: The calculated tax amount
          example: 200
        total_amount:
          type: integer
          description: The total amount including taxes
          example: 1200
      type: object
      required:
        - id
        - created_at
        - updated_at
        - entity_id
        - origin
        - source_of_data
        - status
      description: >-
        Schema for credit note response. Includes all fields that can be
        returned from the API.
    ErrorSchemaResponse:
      properties:
        error:
          $ref: '#/components/schemas/ErrorSchema'
      type: object
      required:
        - error
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
      type: object
    CounterpartRawData:
      properties:
        address:
          allOf:
            - $ref: '#/components/schemas/CounterpartRawAddress'
          description: The address of the vendor or supplier.
        bank_account:
          allOf:
            - $ref: '#/components/schemas/CounterpartRawBankAccount'
          description: Object representing counterpart bank account.
        email:
          type: string
          format: email
          description: The email address of the organization
          example: acme@example.com
        name:
          type: string
          description: Vendor or supplier name.
          example: Acme Inc.
        phone:
          type: string
          description: The phone number of the organization
          example: '5551231234'
        tax_id:
          type: string
          description: The tax id of the counterpart.
          example: '123456789'
        vat_id:
          allOf:
            - $ref: '#/components/schemas/CounterpartRawVatID'
          description: VAT ID of the vendor or supplier which was used in the invoice.
      type: object
    CurrencyExchangeSchema:
      properties:
        default_currency_code:
          type: string
        rate:
          type: number
          exclusiveMinimum: 0
        total:
          type: number
      additionalProperties: false
      type: object
      required:
        - default_currency_code
        - rate
        - total
    TagReadSchema:
      properties:
        id:
          type: string
          format: uuid
          description: A unique ID of this tag.
          example: ea837e28-509b-4b6a-a600-d54b6aa0b1f5
        created_at:
          type: string
          format: date-time
          description: >-
            Date and time when the tag was created. Timestamps follow the [ISO
            8601](https://en.wikipedia.org/wiki/ISO_8601) standard.
          example: '2022-09-07T16:35:18.484507+00:00'
        updated_at:
          type: string
          format: date-time
          description: >-
            Date and time when the tag was last updated. Timestamps follow the
            [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard.
          example: '2022-09-07T16:35:18.484507+00:00'
        category:
          allOf:
            - $ref: '#/components/schemas/TagCategory'
          description: The tag category.
          example: department
        created_by_entity_user_id:
          type: string
          format: uuid
          description: ID of the user who created the tag.
          example: ea837e28-509b-4b6a-a600-d54b6aa0b1f5
        description:
          type: string
          maxLength: 255
          minLength: 1
          description: The tag description.
          example: Tag for the Marketing Department
        name:
          type: string
          description: The tag name.
          example: Marketing
      type: object
      required:
        - id
        - created_at
        - updated_at
        - name
      description: >-
        Represents a user-defined tag that can be assigned to resources to
        filter them.
    ErrorSchema:
      properties:
        message:
          type: string
      type: object
      required:
        - message
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
        msg:
          type: string
        type:
          type: string
      type: object
      required:
        - loc
        - msg
        - type
    CounterpartRawAddress:
      properties:
        city:
          type: string
          description: City name.
          example: New York
        country:
          allOf:
            - $ref: '#/components/schemas/AllowedCountries'
          description: >-
            Two-letter ISO country code ([ISO 3166-1
            alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
          example: US
        line1:
          type: string
          description: Street address.
          example: 456 Fifth Avenue
        line2:
          type: string
          description: Additional address information (if any).
        postal_code:
          type: string
          description: ZIP or postal code.
          example: '10001'
        state:
          type: string
          description: State, region, province, or county.
      type: object
      description: Address information.
    CounterpartRawBankAccount:
      properties:
        account_holder_name:
          type: string
          description: Vendor's bank account name.
        account_number:
          type: string
          description: >-
            Vendor's bank account number, IBAN, or similar (if specified in the
            payable document).
          example: '123456789012'
        bic:
          type: string
          description: SWIFT code (BIC) of the vendor's bank.
          example: CHASUS33XXX
        iban:
          type: string
          description: required for non-GB bank accounts
        routing_number:
          type: string
          description: required for US bank accounts
        sort_code:
          type: string
          description: required for GB bank accounts
      type: object
    CounterpartRawVatID:
      properties:
        country:
          $ref: '#/components/schemas/AllowedCountries'
        type:
          type: string
        value:
          type: string
      type: object
    TagCategory:
      type: string
      enum:
        - document_type
        - department
        - project
        - cost_center
        - vendor_type
        - payment_method
        - approval_status
    AllowedCountries:
      type: string
      enum:
        - AF
        - AX
        - AL
        - DZ
        - AS
        - AD
        - AO
        - AI
        - AQ
        - AG
        - AR
        - AM
        - AW
        - AU
        - AT
        - AZ
        - BS
        - BH
        - BD
        - BB
        - BY
        - BE
        - BZ
        - BJ
        - BM
        - BT
        - BO
        - BA
        - BW
        - BV
        - BR
        - IO
        - BN
        - BG
        - BF
        - BI
        - KH
        - CM
        - CA
        - IC
        - CV
        - KY
        - CF
        - EA
        - TD
        - CL
        - CN
        - CX
        - CC
        - CO
        - KM
        - CG
        - CD
        - CK
        - CR
        - CI
        - HR
        - CU
        - CY
        - CZ
        - DK
        - DJ
        - DM
        - DO
        - EC
        - EG
        - SV
        - GQ
        - ER
        - EE
        - SZ
        - ET
        - FK
        - FO
        - FJ
        - FI
        - FR
        - GF
        - PF
        - TF
        - GA
        - GM
        - GE
        - DE
        - GH
        - GI
        - GR
        - GL
        - GD
        - GP
        - GU
        - GT
        - GG
        - GN
        - GW
        - GY
        - HT
        - HM
        - VA
        - HN
        - HK
        - HU
        - IS
        - IN
        - ID
        - IR
        - IQ
        - IE
        - IM
        - IL
        - IT
        - JM
        - JP
        - JE
        - JO
        - KZ
        - KE
        - KI
        - KP
        - KR
        - KW
        - KG
        - LA
        - LV
        - LB
        - LS
        - LR
        - LY
        - LI
        - LT
        - LU
        - MO
        - MG
        - MW
        - MY
        - MV
        - ML
        - MT
        - MH
        - MQ
        - MR
        - MU
        - YT
        - MX
        - FM
        - MD
        - MC
        - MN
        - ME
        - MS
        - MA
        - MZ
        - MM
        - NA
        - NR
        - NP
        - NL
        - AN
        - NC
        - NZ
        - NI
        - NE
        - NG
        - NU
        - NF
        - MP
        - MK
        - 'NO'
        - OM
        - PK
        - PW
        - PS
        - PA
        - PG
        - PY
        - PE
        - PH
        - PN
        - PL
        - PT
        - PR
        - QA
        - RE
        - RO
        - RU
        - RW
        - SH
        - KN
        - LC
        - PM
        - VC
        - WS
        - SM
        - ST
        - SA
        - SN
        - RS
        - SC
        - SL
        - SG
        - SK
        - SI
        - SB
        - SO
        - ZA
        - SS
        - GS
        - ES
        - LK
        - SD
        - SR
        - SJ
        - SE
        - CH
        - SY
        - TW
        - TJ
        - TZ
        - TH
        - TL
        - TG
        - TK
        - TO
        - TT
        - TN
        - TR
        - TM
        - TC
        - TV
        - UG
        - UA
        - AE
        - GB
        - US
        - UM
        - UY
        - UZ
        - VU
        - VE
        - VN
        - VG
        - VI
        - WF
        - EH
        - YE
        - ZM
        - ZW
        - BL
        - BQ
        - CW
        - MF
        - SX
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````