Create Document of Any Type

The CreateAnyDocument API in OCS.io provides a comprehensive solution for generating documents of various types. This API allows users to create documents such as invoices, credit notes, reciprocal commitments, among others. The flexibility of this API enables users to create documents that meet their specific requirements and workflows.

API Overview

Fields Required for Any Document Creation

The following table lists and describes the fields required to create any type of document through the CreateAnyDocument API:

Field Description

account

ID (Ref ID/ External ID ) of the Account.

externalDocumentNo

External number of the Document (generated by external system, e.g. OCS or CRM).

documentCategory

Category of the Document. Enumeration.

documentSource

Source of the Document.

documentType

Type of the Document.

documentIssuedDate

Date when Document was issued.

documentCode

Code of the Document as configured in external Product Catalogue.

documentName

Name of the Document as configured in external Product Catalogue.

documentDueDate

Due date of the Document.

currency

Currency ISO Code.

paymentMethod

Override configured Payment Method.

deliveryMethod

Override configured Delivery Method.

paymentRef1

Payment Reference No.1 associated with the Document.

paymentRef2

Payment Reference No.2 associated with the Document.

paymentRef3

Payment Reference No.3 associated with the Document.

previewMode

Indicates whether Document is created in 'Preview Mode'.

customAttributes

Custom attributes, Key - Value (String) Map.

amount

Amount of the Document. Including or Excluding Tax depends on 'taxIncluded' attribute.

taxIncluded

Indicates whether amount is inclusive of Tax.

tax

Code of Tax.

Detailed API documentation and endpoint specifics are available here.

Request Validations

The following validations are performed when creating a document:

Create Document Example

Use the following request’s body to create a document of any type:

{
  "requestId": "{{$guid}}",
  "user": "crm",
  "account": {
    "externalId": "account_external_id"
  },
  "externalDocumentNo": "external_document_no",
  "documentCategory": "document_category",
  "documentSource": "document_source",
  "documentType": "document_type",
  "documentIssuedDate": "2023-10-01T00:00:00Z",
  "documentCode": "document_code",
  "documentName": "document_name",
  "documentDueDate": "2023-11-01T00:00:00Z",
  "currency": "EUR",
  "paymentMethod": "payment_method",
  "deliveryMethod": "delivery_method",
  "paymentRef1": "payment_ref1",
  "paymentRef2": "payment_ref2",
  "paymentRef3": "payment_ref3",
  "previewMode": true,
  "customAttributes": {
    "key1": "value1",
    "key2": "value2"
  },
  "amount": 100,
  "taxIncluded": true,
  "tax": "tax_code"
}

The outcome of the API call is as follows:

  • The document is created with the specified details.

  • The amount of the document is 100 and the currency is EUR.

  • The document is created in 'Preview Mode' if previewMode is set to true.