Files

Creates a new file association

Changed on

By passing in the appropriate options, you can create a new folder

post/Files/{FileId}/Associations

Request

  • Base URL
    https://api.xero.com/files.xro/1.0
  • URL
    https://api.xero.com/files.xro/1.0/Files/{FileId}/Associations
  • Auth
    OAuth 2
    Authorization code: https://login.xero.com/identity/connect/authorize
    Token URL: https://identity.xero.com/connect/token scopes: files

Path parameters

FileIdstring uuid required
Example:4ff1e5cc-9835-40d5-bb18-09fdb118db9c

File id for single object

Headers

Idempotency-Keystring

This allows you to safely retry requests without the risk of duplicate processing. 128 character max.

Request body

SendWithObjectboolean

Boolean flag to determines whether the file is sent with the document it is attached to on client facing communications. Note- The SendWithObject element is only returned when using /Associations/{ObjectId} endpoint.

Namestring

The name of the associated file. Note- The Name element is only returned when using /Associations/{ObjectId} endpoint.

Sizeinteger

The size of the associated file in bytes. Note- The Size element is only returned when using /Associations/{ObjectId} endpoint.

CreatedDateUtcstring date-time

The date the file was created (UTC). Note- The CreatedDateUtc element is only returned when using /Associations/{ObjectId} endpoint.

AssociationDateUtcstring date-time

The date the file was associated with the object (UTC). Note- The AssociationDateUtc element is only returned when using /Associations/{ObjectId} endpoint.

FileIdstring uuid

The unique identifier of the file

ObjectIdstring uuid

The identifier of the object that the file is being associated with (e.g. InvoiceID, BankTransactionID, ContactID)

ObjectGroup'Account' | 'BankTransaction' | 'Contact' | 'CreditNote' | 'Invoice' | 'Item' | 'ManualJournal' | 'Overpayment' | 'Payment' | 'Prepayment' | 'Quote' | 'Receipt'

The Object Group that the object is in. These roughly correlate to the endpoints that can be used to retrieve the object via the core accounting API.

ObjectType'Unknown' | 'Accpay' | 'AccPayCredit' | 'AccPayPayment' | 'AccRec' | 'AccRecCredit' | 'AccRecPayment' | 'Adjustment' | 'ApCreditPayment' | 'ApOverPayment' | 'ApOverPaymentPayment' | 'ApOverPaymentSourcePayment' | 'ApPrepayment' | 'ApPrepaymentPayment' | 'ApPrepaymentSourcePayment' | 'ArCreditPayment' | 'ArOverPayment' | 'ArOverpaymentPayment' | 'ArOverpaymentSourcePayment' | 'ArPrepayment' | 'ArPrepaymentPayment' | 'ArPrepaymentSourcePayment' | 'CashPaid' | 'CashRec' | 'ExpPayment' | 'ManJournal' | 'PurchaseOrder' | 'Receipt' | 'Transfer' | 'Account' | 'Contact' | 'Business' | 'Employee' | 'Person' | 'User' | 'Org' | 'FixedAsset' | 'PayRun' | 'PriceListItem' | 'Bank' | 'Current' | 'Equity' | 'Expense' | 'Fixed' | 'Liability' | 'Prepayment' | 'Revenue' | 'Sales' | 'Overheads' | 'Depreciatn' | 'OtherIncome' | 'DirectCosts' | 'Currliab' | 'Termliab' | 'NonCurrent' | 'SalesQuote'

The Object Type

Example request

{
  "SendWithObject": true,
  "Name": "Test.pdf",
  "Size": 12357,
  "CreatedDateUtc": "2020-12-10T01:22:00.0000000",
  "AssociationDateUtc": "2020-12-10T01:22:00.0000000"
}

Response

A successful request

SendWithObjectboolean

Boolean flag to determines whether the file is sent with the document it is attached to on client facing communications. Note- The SendWithObject element is only returned when using /Associations/{ObjectId} endpoint.

Namestring

The name of the associated file. Note- The Name element is only returned when using /Associations/{ObjectId} endpoint.

Sizeinteger

The size of the associated file in bytes. Note- The Size element is only returned when using /Associations/{ObjectId} endpoint.

CreatedDateUtcstring date-time

The date the file was created (UTC). Note- The CreatedDateUtc element is only returned when using /Associations/{ObjectId} endpoint.

AssociationDateUtcstring date-time

The date the file was associated with the object (UTC). Note- The AssociationDateUtc element is only returned when using /Associations/{ObjectId} endpoint.

FileIdstring uuid

The unique identifier of the file

ObjectIdstring uuid

The identifier of the object that the file is being associated with (e.g. InvoiceID, BankTransactionID, ContactID)

ObjectGroup'Account' | 'BankTransaction' | 'Contact' | 'CreditNote' | 'Invoice' | 'Item' | 'ManualJournal' | 'Overpayment' | 'Payment' | 'Prepayment' | 'Quote' | 'Receipt'

The Object Group that the object is in. These roughly correlate to the endpoints that can be used to retrieve the object via the core accounting API.

ObjectType'Unknown' | 'Accpay' | 'AccPayCredit' | 'AccPayPayment' | 'AccRec' | 'AccRecCredit' | 'AccRecPayment' | 'Adjustment' | 'ApCreditPayment' | 'ApOverPayment' | 'ApOverPaymentPayment' | 'ApOverPaymentSourcePayment' | 'ApPrepayment' | 'ApPrepaymentPayment' | 'ApPrepaymentSourcePayment' | 'ArCreditPayment' | 'ArOverPayment' | 'ArOverpaymentPayment' | 'ArOverpaymentSourcePayment' | 'ArPrepayment' | 'ArPrepaymentPayment' | 'ArPrepaymentSourcePayment' | 'CashPaid' | 'CashRec' | 'ExpPayment' | 'ManJournal' | 'PurchaseOrder' | 'Receipt' | 'Transfer' | 'Account' | 'Contact' | 'Business' | 'Employee' | 'Person' | 'User' | 'Org' | 'FixedAsset' | 'PayRun' | 'PriceListItem' | 'Bank' | 'Current' | 'Equity' | 'Expense' | 'Fixed' | 'Liability' | 'Prepayment' | 'Revenue' | 'Sales' | 'Overheads' | 'Depreciatn' | 'OtherIncome' | 'DirectCosts' | 'Currliab' | 'Termliab' | 'NonCurrent' | 'SalesQuote'

The Object Type

Example response

{
  "SendWithObject": true,
  "Name": "Test.pdf",
  "Size": 12357,
  "CreatedDateUtc": "2020-12-10T01:22:00.0000000",
  "AssociationDateUtc": "2020-12-10T01:22:00.0000000"
}

Changes

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • breaking

      added the new required header request parameter xero-tenant-id to all path's operations

    • breaking

      the request's body type changed from no type to object

    • breaking

      the response's body type changed from no type to object for status

    • info

      added the new optional header request parameter Idempotency-Key

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status