Attachments

An attachment object contains an array of one more files that are stored in Sage Intacct. You can attach multiple files of any type to a transaction using an attachment, such as scanned images, spreadsheets, and word-processor documents. For example, you might add ten scanned images to a single attachment for a bill. You can also add attachments to some other objects, such as customers, vendors, and employees.

It's important to note that each transaction or object can only have one attachment assigned to it. After you add an attachment, you can add or delete individual files to and from the attachment, ensuring your supporting documents are always up-to-date.

All attachments are stored in attachment folders. The folder to hold an attachment must exist before you create the attachment. You can also move an attachment to a different folder after it's created.

List attachments

get/objects/company-config/attachment

Returns a collection with a key, ID, and link for each attachment. This operation is mostly for use in testing; use the query service to find attachments that meet certain criteria and specify the properties that are returned.

Permissions and other requirements
SubscriptionCompany
User typeBusiness, Employee, Project Manager, Platform, and Warehouse
PermissionsList Attachments
SecurityOAuth2
Responses
200

OK

400

Bad Request

Request samples
Response samples
application/json
{
  • "ia::result": [
    • {
      • "key": "8",
      • "id": "PROJ-159",
      • "href": "/objects/company-config/attachment/8"
      },
    • {
      • "key": "1",
      • "id": "INVOICES",
      • "href": "/objects/company-config/attachment/1"
      },
    • {
      • "key": "2",
      • "id": "2024 Taxes",
      • "href": "/objects/company-config/attachment/2"
      }
    ],
  • "ia::meta": {
    • "totalCount": 3,
    • "start": 1,
    • "pageSize": 100,
    • "next": null,
    • "previous": null
    }
}

Create an attachment

post/objects/company-config/attachment

Creates a new attachment in a specified folder. The folder must exist before you create the attachment. You can add files when you create an attachment, or use a PATCH request to add files later.

Permissions and other requirements
SubscriptionCompany
User typeBusiness
PermissionsAdd Attachments
SecurityOAuth2
Request
Request Body schema: application/json

Attachment to create

id
required
string

Unique ID for the attachment container

Example: "2024 Taxes"
name
string

Brief name for the attachment container

Example: "2022 tax forms"
description
string

Description of the attachment container

Example: "February invoices"
object

Folder that this attachment is in

key
string

Unique key of the folder

Example: "4"
id
string

Unique name of the folder

Example: "SupDocFolder1"
object

The entity that the attachment is associated with. Attachments created at the top level do not have an entity reference so the key, id, and name properties will be null.

key
string

Entity key

Example: "30"
id
string

Entity ID

Example: "SEA"
Array of objects

Files contained in the attachment.

Array
name
string

File name with extension

Example: "02-28-2022-invoice.txt"
size
integer

Size of the attachment in bytes

Example: 27449
data
string <base64zip>

Attached file data, Base64 encoded

Example: "Y2V2YSwgYWx0Y2V2YQ0Kc2kgaW5jYSBjZXZh"
object

Attachment object that this file belongs to

object
Responses
201

Created

400

Bad Request

Request samples
application/json
{
  • "id": "2024 Tax",
  • "name": "2024 Tax Forms",
  • "folder": {
    • "key": "27"
    }
}
Response samples
application/json
{
  • "ia::result": {
    • "key": "17",
    • "id": "2022 Tax",
    • "href": "/objects/company-config/attachment/17"
    },
  • "ia::meta": {
    • "totalCount": 1,
    • "totalSuccess": 1,
    • "totalError": 0
    }
}

Get an attachment

get/objects/company-config/attachment/{key}

Returns detailed information for a specified attachment, including Base64-encoded versions of all files in the attachment.

Permissions and other requirements
SubscriptionCompany
User typeBusiness, Employee, Project Manager, Platform, and Warehouse
PermissionsList Attachments
SecurityOAuth2
Request
path Parameters
key
required
string

System-assigned key for the attachment.

Example: 43
Responses
200

OK

400

Bad Request

Request samples
Response samples
application/json
{
  • "ia::result": {
    • "key": "17",
    • "id": "INV-V1",
    • "name": "Vendor 1 Invoices",
    • "folder": {
      • "id": "Invoices",
      • "key": "1",
      • "href": "/objects/company-config/folder/1"
      },
    • "description": "Invoices for Vendor 1",
    • "audit": {
      • "createdBy": "matthew.mikawber",
      • "modifiedBy": "matthew.mikawber",
      • "modifiedDate": "2023-05-25",
      • "createdDate": "2023-05-25"
      },
    • "files": [
      • {
        }
      ],
    • "href": "/objects/company-config/attachment/17"
    },
  • "ia::meta": {
    • "totalCount": 1,
    • "totalSuccess": 1,
    • "totalError": 0
    }
}

Update an attachment

patch/objects/company-config/attachment/{key}

Updates an existing attachment by setting field values. Any fields not provided remain unchanged. Use this operation to add, update, and delete files in attachments.

Permissions and other requirements
SubscriptionCompany
User typeBusiness
PermissionsEdit Attachments
SecurityOAuth2
Request
path Parameters
key
required
string

System-assigned key for the attachment.

Example: 43
Request Body schema: application/json
name
string

Brief name for the attachment container

Example: "2022 tax forms"
description
string

Description of the attachment container

Example: "February invoices"
object

Folder that this attachment is in

key
string

Unique key of the folder

Example: "4"
id
string

Unique name of the folder

Example: "SupDocFolder1"
object

The entity that the attachment is associated with. Attachments created at the top level do not have an entity reference so the key, id, and name properties will be null.

key
string

Entity key

Example: "30"
id
string

Entity ID

Example: "SEA"
Array of objects

Files contained in the attachment.

Array
name
string

File name with extension

Example: "02-28-2022-invoice.txt"
size
integer

Size of the attachment in bytes

Example: 27449
data
string <base64zip>

Attached file data, Base64 encoded

Example: "Y2V2YSwgYWx0Y2V2YQ0Kc2kgaW5jYSBjZXZh"
object

Attachment object that this file belongs to

object
Responses
200

OK

400

Bad Request

Request samples
application/json
{
  • "files": [
    • {
      • "name": "short file 2.txt",
      • "data": "aGVsbG8gd29ybGQhIHRoaXMgaXMgYmFzZTY0IGVuY29kZWQgZGF0YQ=="
      }
    ]
}
Response samples
application/json
{
  • "ia::result": {
    • "key": "17",
    • "id": "attach-02",
    • "href": "/objects/company-config/attachment/17"
    },
  • "ia::meta": {
    • "totalCount": 1,
    • "totalSuccess": 1,
    • "totalError": 0
    }
}

Delete an attachment

delete/objects/company-config/attachment/{key}

Deletes an attachment and all files that it contains. You must first remove the attachment from any objects or transactions.

Permissions and other requirements
SubscriptionCompany
User typeBusiness, Employee, Project Manager, Platform, and Warehouse
PermissionsList Attachments
SecurityOAuth2
Request
path Parameters
key
required
string

System-assigned key for the attachment.

Example: 43
Responses
204

No Content

400

Bad Request

Request samples
Response samples
application/json
{
  • "ia::result": {
    • "ia::error": {
      • "code": "invalidRequest",
      • "message": "A POST request requires a payload",
      • "errorId": "REST-1028",
      • "additionalInfo": {
        },
      • "supportId": "Kxi78%7EZuyXBDEGVHD2UmO1phYXDQAAAAo"
      }
    },
  • "ia::meta": {
    • "totalCount": 1,
    • "totalSuccess": 0,
    • "totalError": 1
    }
}

Query attachments

post/services/core/query

Queries an object for filtered data.

SecurityOAuth2
Request
Request Body schema: application/json
object
string

Object type to query, in the form <application-name>/<object name>. For custom objects use platform-apps/nsp::<object-name>.

Example: "company-config/attachment"
fields
Array of strings

List of fields to include in the response. Can be any combination of these:

  • The name of a field in the object that you are querying, such as id.

  • The name of a field in a related object, using the form relatedObjectName.fieldName, such as vendor.id.

  • The result of an aggregate function run against the values in the returned objects. Use the form function:fieldName, such as min:startDate to return the earliest starting date. Valid function names are:

    • count
    • avg
    • sum
    • min
    • max
  • The result of an aggregate function run against the values in related objects, using the form function:relatedObjectName.fieldName, such as max:vendor.creditLimit. The same functions are supported as for object fields.

Example: ["key","id","max:vendor.creditLimit"]
Array of equal (object) or not equal (object) or less than (object) or (less than or equal (object)) or greater than (object) or (greater than or equal (object)) or in (object) or not in (object) or between (object) or not between (object) or contains (object) or does not contain (object) or starts with (object) or does not start with (object) or ends with (object) or does not end with (object)

Filter conditions to select the objects to return based on their field values. You use operators and conditions to build your filter, such as {"$eq":{"status":"active"}} to select objects in which status is equal to "active".

Example: [{"$eq":{"status":"active"}},{"$gt":{"totalDue":"1000"}},{"$contains":{"name":"Acme"}}]
Array
Any of:

Field value must be equal to this specified value.

For date fields, you can use these macro values that are relative to the current date or the asOfDate in filterParameters, if set:

  • today
  • currentWeek
  • currentMonth
  • currentQuarter
  • currentYear
  • yesterday
  • lastWeek
  • priorMonth
  • priorQuarter
  • priorYear

These are most useful for queries that you want to save and use repeatedly, such as for views or reports. Just change the asOfDate each time to retrieve the same data set for different time periods.

For example, {"eq":{"postingDate":"priorYear"}}.

object

The field name and value to be compared with object values.

Example: {"status":"active"}
filterExpression
string
Default: "and"

Logical operators to apply when there are multiple filter conditions. The conditions in the filters array are implicitly numbered starting at 1. Supports and, or, and grouping with parentheses.

Shortcuts:

  • and by itself means that all conditions must be true.
  • or by itself means that at least one condition must be true.
Example: "(1 and 2) or 3"
object

Pre-defined filter options.

asOfDate
string <date>

The "as of" date to use with any relative date comparisons in filters. For example, if asOfDate is set to "2022-04-01" then priorMonth will be "03".

The current date is used if asOfDate is not set.

Example: "2022-04-01"
includeHierarchyFields
boolean
Default: false

Set to true to include hierarchical structure information with each object in the response.

Example: false
caseSensitiveComparison
boolean
Default: true

Queries are case-sensitive by default. Set to false to ignore case in a query.

Example: true
includePrivate
boolean
Default: false

By default, in a multi-entity company queries from the top-level entity do not access data in private entities. Set includePrivate to true if you want to query data in private entities.

Example: false
Array of objects

Set the order of the results by specifying field names to sort by and whether they should be in ascending or descending order.

Example: [{"totalDue":"asc"},{"lastPaymentMadeDate":"desc"}]
Array
property name*
additional property
string
Enum: "asc" "desc"
start
integer

First record of the result set to include in the response.

Example: 1
size
integer

Number of records to include in the result set, 4000 maximum.

Example: 100
Responses
200

OK

400

Bad Request

Request samples
application/json
{
  • "object": "company-config/attachment",
  • "filters": [
    • {
      • "$contains": {
        }
      }
    ],
  • "fields": [
    • "key",
    • "id",
    • "name",
    • "folder.id",
    • "href"
    ],
  • "orderBy": [
    • {
      • "id": "asc"
      }
    ]
}
Response samples
application/json
{
  • "ia::result": [
    • {
      • "key": "5",
      • "id": "123",
      • "name": "Sales support doc",
      • "folder.id": "Invoice Docs",
      • "href": "/objects/company-config/attachment/5"
      },
    • {
      • "key": "8",
      • "id": "59",
      • "name": "InterestExpense",
      • "folder.id": "Invoice Docs",
      • "href": "/objects/company-config/attachment/8"
      },
    • {
      • "key": "6",
      • "id": "Sales 01",
      • "name": "Sales support doc",
      • "folder.id": "Invoice Docs",
      • "href": "/objects/company-config/attachment/6"
      }
    ],
  • "ia::meta": {
    • "totalCount": 3,
    • "start": 1,
    • "pageSize": 100,
    • "next": null,
    • "previous": null
    }
}