Document sequences

Use document sequencing to generate new IDs automatically for common transactions and records, such as new customers, vendors, invoices, and more. For example, you can create a document sequence for invoices. This new sequence automatically creates a new ID, such as 'INV-0100' and increments the number each time a new invoice is created.

Note: Document sequences are called "accounting sequences" in the General Ledger.

List document sequences

get/objects/company-config/document-sequence

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

SecurityOAuth2
Responses
200

OK

400

Bad Request

Request samples
Response samples
application/json
{
  • "ia::result": [
    • {
      • "key": "37",
      • "id": "BOA_ACH_BatchNo",
      • "href": "/objects/company-config/document-sequence/37"
      },
    • {
      • "key": "27",
      • "id": "Purchase Order",
      • "href": "/objects/company-config/document-sequence/27"
      }
    ],
  • "ia::meta": {
    • "totalCount": 2,
    • "start": 1,
    • "pageSize": 100,
    • "next": null,
    • "previous": null
    }
}

Create a document sequence

post/objects/company-config/document-sequence

Creates a new document sequence.

SecurityOAuth2
Request
Request Body schema: application/json

Document sequence to create

id
required
string

Unique name for the document sequence.

Example: "Vendors"
printTitle
string

The sequence name that prints on invoice PDFs.

Example: "Vendors"
type
string
Default: "numeric"

Numeric or alpha sequence. Alpha sequences are currently only available for use with Cash Management, or French companies.

Enum: "alpha" "numeric"
Example: "numeric"
fixedLength
string

The total length of the primary sequence, includingn any padding characters, up to 16 characters. Numeric sequences will be padded with zeroes and alpha sequence will be padded with a's.

Example: "16"
fixedPrefix
string

Characters that appear before the primary sequence.

Example: "INV"
prefixSeparator
string

Characters to use between the prefix and the auto-generated sequence.

Example: "-"
fixedSuffix
string

Characters that appear after the primary sequence.

Example: "COMPANY"
suffixSeparator
string

Characters to use between the auto-generated sequence and the suffix.

Example: "-"
startingNumber
integer

Starting number for numeric sequences.

Example: 1
endingNumber
integer

Ending number for numeric sequences.

Example: 100
nextNumber
integer

Next number

Example: 1
startingSequence
string

Starting sequence

Example: "a"
endingSequence
string

Ending sequence

Example: "zzz"
nextSequence
string

Next sequence

Example: "a"
whenModified
string <date-time>

Date and time when the document sequence was last modified.

Example: "2024-04-01T11:28:12Z"
object

Fiscal year rollover configuration for the document sequence, which will automatically restart the document sequence for each fiscal year. Use the fiscalYears to configure the next number or alpha values used to generate sequences for the fiscal years. If the configuration for a fiscal year is missing then it will be generated by the system when the first sequence is generated. The next number or alpha values will be taken from the base start values.

isEnabled
boolean
Default: false

Set to true to enable sequence rollover by fiscal years.

Example: false
enabledDate
string <date>

The date the rollover configuration was enabled for the first time.

Example: "2021-01-23"
fiscalYearAffixPosition
string
Default: "none"

Where to insert the fiscal year in document sequence values.

** Valid values **

  • none Do not automatically insert the fiscal year into the document sequence.
  • prefix Use the fiscal year and the rollover `separator`` as a prefix to the document sequence.
  • suffix Append the rollover `separator`` and the fiscal year as a suffix to the document sequence.
Enum: "none" "prefix" "suffix"
Example: "prefix"
separator
string

Rollover separator used when the fiscalYearAffixPosition is set to prefix or suffix

Example: "-"
Array of objects

Array of document-sequence-rollover objects that define the next number or alpha values to use to generate sequences for specific fiscal years.

Array
fiscalYear
integer

Fiscal year during which this rollover configuration is used.

Example: 2024
nextNumber
integer

Next number used to generate sequences for the fiscal year when the document-sequence type is numeric. Must be within the limits set by the startingNumber and endingNumber fields in the document-sequence.

Example: 1
nextSequence
string

Next sequence used to generate sequences for the fiscal year when the document-sequence type is alpha. Must be within the limits set by the startingSequence and endingSequence fields in the document-sequence.

Example: "a"
status
string
Default: "active"

Object status. Active objects are fully functional. Inactive objects are essentially hidden and cannot be used or referenced.

Enum: "active" "inactive"
Example: "active"
Responses
201

Created

400

Bad Request

Request samples
application/json
{
  • "id": "Vendor Invoice",
  • "printTitle": "Vendor Invoice",
  • "type": "numeric",
  • "fixedPrefix": "P",
  • "fixedSuffix": "S",
  • "prefixSeparator": "-",
  • "suffixSeparator": "-",
  • "startingNumber": 1,
  • "endingNumber": null,
  • "nextNumber": 1,
  • "fixedLength": "4",
  • "rollover": {
    • "isEnabled": true,
    • "fiscalYearAffixPosition": "prefix",
    • "separator": "-",
    • "fiscalYears": [
      • {
        },
      • {
        }
      ]
    }
}
Response samples
application/json
{
  • "ia::result": {
    • "key": "107",
    • "id": "Vendor Invoice",
    • "href": "/objects/company-config/document-sequence/107"
    },
  • "ia::meta": {
    • "totalCount": 1,
    • "totalSuccess": 1,
    • "totalError": 0
    }
}

Get a document sequence

get/objects/company-config/document-sequence/{key}

Returns detailed information for a particular document sequence.

SecurityOAuth2
Request
path Parameters
key
required
string

System-assigned key for the document sequence.

Example: 139
Responses
200

OK

400

Bad Request

Request samples
Response samples
application/json
{
  • "ia::result": {
    • "key": "107",
    • "id": "BOA_ACH_BatchNo",
    • "printTitle": "BOA_ACH_BatchNo",
    • "fixedPrefix": "P",
    • "fixedSuffix": "S",
    • "prefixSeparator": "-",
    • "suffixSeparator": "-",
    • "startingNumber": 1,
    • "endingNumber": null,
    • "nextNumber": 1,
    • "whenModified": "2014-01-08T11:28:12Z",
    • "fixedLength": null,
    • "status": "active",
    • "type": "numeric",
    • "startingSequence": null,
    • "endingSequence": null,
    • "nextSequence": null,
    • "entity": {
      • "key": "54",
      • "id": "Western Region",
      • "name": "Western Region",
      • "href": "/objects/company-config/entity/54"
      },
    • "rollover": {
      • "isEnabled": true,
      • "enabledDate": "2024-02-14",
      • "fiscalYearAffixPosition": "prefix",
      • "separator": "-"
      },
    • "audit": {
      • "createdDateTime": "2014-01-08T11:28:12Z",
      • "modifiedDateTime": "2014-01-08T11:28:12Z",
      • "createdBy": "109",
      • "modifiedBy": "109"
      },
    • "fiscalYears": [
      • {
        },
      • {
        }
      ],
    • "href": "/objects/company-config/document-sequence/107"
    },
  • "ia::meta": {
    • "totalCount": 1,
    • "totalSuccess": 1,
    • "totalError": 0
    }
}

Update a document sequence

patch/objects/company-config/document-sequence/{key}

Updates an existing document sequence by setting field values. Any fields not provided remain unchanged.

SecurityOAuth2
Request
path Parameters
key
required
string

System-assigned key for the document sequence.

Example: 139
Request Body schema: application/json
printTitle
string

The sequence name that prints on invoice PDFs.

Example: "Vendors"
type
string
Default: "numeric"

Numeric or alpha sequence. Alpha sequences are currently only available for use with Cash Management, or French companies.

Enum: "alpha" "numeric"
Example: "numeric"
fixedLength
string

The total length of the primary sequence, includingn any padding characters, up to 16 characters. Numeric sequences will be padded with zeroes and alpha sequence will be padded with a's.

Example: "16"
fixedPrefix
string

Characters that appear before the primary sequence.

Example: "INV"
prefixSeparator
string

Characters to use between the prefix and the auto-generated sequence.

Example: "-"
fixedSuffix
string

Characters that appear after the primary sequence.

Example: "COMPANY"
suffixSeparator
string

Characters to use between the auto-generated sequence and the suffix.

Example: "-"
startingNumber
integer

Starting number for numeric sequences.

Example: 1
endingNumber
integer

Ending number for numeric sequences.

Example: 100
nextNumber
integer

Next number

Example: 1
startingSequence
string

Starting sequence

Example: "a"
endingSequence
string

Ending sequence

Example: "zzz"
nextSequence
string

Next sequence

Example: "a"
whenModified
string <date-time>

Date and time when the document sequence was last modified.

Example: "2024-04-01T11:28:12Z"
object

Fiscal year rollover configuration for the document sequence, which will automatically restart the document sequence for each fiscal year. Use the fiscalYears to configure the next number or alpha values used to generate sequences for the fiscal years. If the configuration for a fiscal year is missing then it will be generated by the system when the first sequence is generated. The next number or alpha values will be taken from the base start values.

isEnabled
boolean
Default: false

Set to true to enable sequence rollover by fiscal years.

Example: false
enabledDate
string <date>

The date the rollover configuration was enabled for the first time.

Example: "2021-01-23"
fiscalYearAffixPosition
string
Default: "none"

Where to insert the fiscal year in document sequence values.

** Valid values **

  • none Do not automatically insert the fiscal year into the document sequence.
  • prefix Use the fiscal year and the rollover `separator`` as a prefix to the document sequence.
  • suffix Append the rollover `separator`` and the fiscal year as a suffix to the document sequence.
Enum: "none" "prefix" "suffix"
Example: "prefix"
separator
string

Rollover separator used when the fiscalYearAffixPosition is set to prefix or suffix

Example: "-"
Array of objects

Array of document-sequence-rollover objects that define the next number or alpha values to use to generate sequences for specific fiscal years.

Array
fiscalYear
integer

Fiscal year during which this rollover configuration is used.

Example: 2024
nextNumber
integer

Next number used to generate sequences for the fiscal year when the document-sequence type is numeric. Must be within the limits set by the startingNumber and endingNumber fields in the document-sequence.

Example: 1
nextSequence
string

Next sequence used to generate sequences for the fiscal year when the document-sequence type is alpha. Must be within the limits set by the startingSequence and endingSequence fields in the document-sequence.

Example: "a"
status
string
Default: "active"

Object status. Active objects are fully functional. Inactive objects are essentially hidden and cannot be used or referenced.

Enum: "active" "inactive"
Example: "active"
Responses
200

OK

400

Bad Request

Request samples
application/json
{
  • "prefixSeparator": "-"
}
Response samples
application/json
{
  • "ia::result": {
    • "key": "107",
    • "id": "BOA_ACH_BatchNo",
    • "href": "/objects/company-config/document-sequence/107"
    },
  • "ia::meta": {
    • "totalCount": 1,
    • "totalSuccess": 1,
    • "totalError": 0
    }
}

Delete a document sequence

delete/objects/company-config/document-sequence/{key}

Deletes a document sequence.

SecurityOAuth2
Request
path Parameters
key
required
string

System-assigned key for the document sequence.

Example: 139
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 document sequences

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/document-sequence"
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/document-sequence",
  • "filters": [
    • {
      • "$eq": {
        }
      }
    ],
  • "fields": [
    • "key",
    • "id",
    • "nextNumber",
    • "href"
    ],
  • "orderBy": [
    • {
      • "id": "asc"
      }
    ]
}
Response samples
application/json
{
  • "ia::result": [
    • {
      • "key": "11",
      • "id": "ACH Batch No.",
      • "nextNumber": 1,
      • "href": "/objects/company-config/document-sequence/11"
      },
    • {
      • "key": "6",
      • "id": "ActivationNo",
      • "nextNumber": 654,
      • "href": "/objects/company-config/document-sequence/6"
      },
    • {
      • "key": "18",
      • "id": "Adjustment Decrease",
      • "nextNumber": 6,
      • "href": "/objects/company-config/document-sequence/18"
      },
    • {
      • "key": "19",
      • "id": "Adjustment Increase",
      • "nextNumber": 22,
      • "href": "/objects/company-config/document-sequence/19"
      }
    ],
  • "ia::meta": {
    • "totalCount": 4,
    • "start": 1,
    • "pageSize": 100,
    • "next": null,
    • "previous": null
    }
}