# Create accounting script V1 Create an accounting script. Refer to the [How to create accounting script](doc:create-an-accounting-script) guide for more information. # OpenAPI definition ```json { "openapi": "3.1.0", "info": { "title": "Core platform - Accounting", "version": "1.0.0", "description": "API used to manage the accounting context", "contact": { "name": "API Support", "url": "https://developers.pismo.io/support/" }, "license": { "name": "Copyright Pismo" } }, "servers": [ { "url": "https://sandbox.pismolabs.io/accounting", "description": "Sandbox API server for testing" } ], "components": { "schemas": { "AccountingAccount": { "type": "object", "properties": { "id": { "type": "integer", "format": "int64", "description": "Accounting account ID" }, "description": { "type": "string", "description": "Description of the accounting account", "maximum": 100 }, "account": { "type": "string", "description": "Accounting account number", "maximum": 50 }, "program_id": { "type": "integer", "format": "int64", "description": "Program ID" }, "created_at": { "type": "string", "format": "date-time", "description": "Date and time when the accounting account was created (ISO 8601)." }, "deactivated_at": { "type": "string", "format": "date-time", "description": "Date and time when the accounting account was deactivated (ISO 8601). Filled when the account is deactivated." } }, "example": { "id": 1, "description": "SAMPLE ACCOUNT", "account": "123123132-x", "program_id": 12, "created_at": "2021-10-10T10:10:00.000Z" } }, "AccountingScript": { "type": "object", "properties": { "credit_accounting": { "$ref": "#/components/schemas/AccountingAccount" }, "cost_center": { "$ref": "#/components/schemas/CostCenter" }, "debit_accounting": { "$ref": "#/components/schemas/AccountingAccount" }, "entry_name": { "type": "string", "description": "Base entry ID" }, "entry_type_id": { "type": "integer", "format": "int64", "description": "Related entry type ID" }, "event_type_id": { "type": "integer", "format": "int64", "description": "Related event type ID" }, "id": { "type": "integer", "format": "int64", "description": "Account script ID" }, "processing_code": { "type": "string", "description": "Processing code. When the script is based on a processing code, this field is **REQUIRED**." }, "program_id": { "type": "integer", "format": "int64", "description": "Related program ID" } } }, "AccountingScriptPost": { "required": [ "program_id", "event_type_id", "entry_type_id", "debit_accounting_account_id", "credit_accounting_account_id" ], "type": "object", "properties": { "entry_type_id": { "type": "integer", "format": "int64", "description": "Related entry type ID" }, "event_type_id": { "type": "integer", "format": "int64", "description": "Related event type ID" }, "credit_accounting_account_id": { "type": "integer", "format": "int64", "description": "Accounting account ID assigned as credit account" }, "debit_accounting_account_id": { "type": "integer", "format": "int64", "description": "Accounting account ID assigned as debit account" }, "program_id": { "type": "integer", "format": "int64", "description": "Related program ID" }, "cost_center": { "$ref": "#/components/schemas/CostCenter" }, "entry_name": { "type": "string", "enum": [ "amount", "amount-advancement", "amount-advancement-dueDate", "amount-advancement-shift", "amount-advancement-shift-dueDate", "amount-anticipation", "amount-cancelment-anticipation", "amount-clearing", "amount-contract", "amount-dueDate", "amount-dueDate-cancelment", "amount-reversal", "contractAmount", "daily-interest", "fine", "interest", "interest-advancement", "interest-advancement-dueDate", "interest-anticipation", "interest-dueDate", "interest-not-appropriated", "interest-partial", "iof", "iof-dueDate", "overdue" ], "default": "amount", "description": "Base entry ID. If not provided, defaults to 'amount'.\n* `amount`: Principal amount of the transaction on the event date. It usually represents the gross value of the operation associated with the corresponding flow/`entry_type`.\n* `amount-advancement`: Principal amount of the advance (excluding interest/charges), that is, the principal being advanced (for example, installment agreement advance, invoice advance, receivables advance).\n* `amount-advancement-dueDate`: Principal amount of the advance, posted on the due date of the cycle to which the transaction was advanced.\n* `amount-advancement-shift`: Principal amount of the advance using the “shift” API (date change / flow adjustment), for example advance of an installment or invoice where there is a replacement/change of the original flow. Used to represent the principal of the installment/amount that is being moved from a future date to a present date through an advance.\n* `amount-advancement-shift-dueDate`: Same concept as `amount-advancement-shift`, but related to the due date. It represents the principal of the advance associated with the original due date of the obligation that was “shifted” (moved/adjusted) by the advance process.\n* `amount-anticipation`: This amount name is deprecated. Standard routings that were eventually created with it are deprecated and have corresponding routings with `-advancement` amount values.\n* `amount-cancelment-anticipation`: This amount name is deprecated. Standard routings that were created with it are deprecated and have corresponding routings with `-advancement` amount values.\n* `amount-clearing`: Amount used exclusively for configuring the posting of the installment principal (without interest) upon the clearing arrival of each installment.\n* `amount-contract`: This amount name is deprecated. Standard routings that were created with it are deprecated and have corresponding routings with `amount` values.\n* `amount-dueDate`: Principal amount of the transaction related to the due date (for example, an installment or invoice that is due). Used when the amount to be posted is linked to a specific due date, even if the event occurs before that date. It represents the due date posting of the `amount`. \n* `amount-dueDate-cancelment`: This amount name is deprecated. \n* `amount-reversal`: This amount name is deprecated and has no corresponding movement, as there are no mapped usage scenarios for it.\n* `contractAmount`: This amount is deprecated. The transactions for which it may be configured are transactions 608 and 612. If it is currently used, the recommendation is to create routings with `amount`, which will return the total transaction value. Used as a reference for the total obligation assumed at the time of contracting.\n* `daily-interest`: Amount of daily interest calculated for a period (for example, between two specific dates), usually used in scenarios such as pro-rata interest calculation.\n* `fine`: Fine amount included in a payment (amount that is discharged). This type should only be used when linked to transaction 201 (payment). When used, it provides details of how much of that payment corresponds to the fine.\n* `interest`: Amount of interest calculated/incurred on the transaction, whether it is a contract transaction or an installment. Important: this should only be used if the interest is included together with the transaction's total amount, so that the `interest` is explicitly identified as such. If the interest is already in a separate transaction, `amount` should be used instead.\n* `interest-advancement`: Interest amount related to the advance operation, for example, interest amount of an advanced installment.\n* `interest-advancement-dueDate`: Interest amount of the advance, posted on the due date of the cycle to which the transaction was advanced.\n* `interest-anticipation`: This amount name is deprecated. Standard routings that were created with it are deprecated and have corresponding routings with `-advancement` amount values.\n* `interest-dueDate`: Interest amount of an operation at the due date. The usage logic is the same as for `interest`, but in this case the posting occurs on the due date.\n* `interest-not-appropriated`: Amount exclusively used for posting interest from transaction 706 (invoice installment cancellation). It obtains the interest amount to be posted from the original contracting transaction.\n* `interest-partial`: This amount name is deprecated and has been replaced by `daily-interest`.\n* `iof`: IOF amount (financial transactions tax) associated with the event operation. As with interest, the same logic applies: if the IOF is already in a specific and separate transaction, this option should not be used, and `amount` is the correct option.\n* `iof-dueDate`: IOF amount (financial transactions tax) associated with the event operation. As with interest, the same logic applies: if the IOF is already in a specific and separate transaction, this option should not be used, and `amount`` is the correct option. This due-date option posts the value on the due date of the invoice that contains the transaction.\n* `overdue`: Late interest (penalty interest) amount included in a payment (amount that is discharged). This type should only be used when linked to transaction 201 (payment). When used, it provides details of how much of that payment corresponds to late interest.\n" }, "processing_code": { "type": "string", "maximum": 6, "description": "Processint code. When the script is based on a processing code, this field is **REQUIRED**." } } }, "CostCenter": { "required": [ "debit_org", "credit_org", "debit_cost", "credit_cost" ], "type": "object", "properties": { "debit_org": { "type": "string", "maximum": 50, "description": "Number of your Org’s debit accounting account" }, "credit_org": { "type": "string", "maximum": 50, "description": "Number of your Org’s credit accounting account" }, "debit_cost": { "type": "string", "maximum": 50, "description": "Number of the cost center of the debit accounting account" }, "credit_cost": { "type": "string", "maximum": 50, "description": "Number of the cost center of the credit accounting account" }, "deactivated_at": { "type": "string", "format": "date-time", "description": "Date and time when the cost center was deactivated (ISO 8601). Filled when the account is deactivated." } }, "example": { "debit_org": "999999", "credit_org": "999999", "debit_cost": "999999", "credit_cost": "999999", "deactivated_at": "2021-10-10T10:10:00.000Z" } } } }, "tags": [ { "name": "Accounting scripts V1", "description": "Endpoints to manage accounting scripts V1" } ], "paths": { "/v1/accounting-scripts": { "post": { "operationId": "CreateAccountingScript", "summary": "Create accounting script V1", "description": "Create an accounting script. \n\nRefer to the [How to create accounting script](https://developers.pismo.io/pismo-docs/docs/create-an-accounting-script) guide for more information.\n", "tags": [ "Accounting scripts V1" ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AccountingScriptPost" } } } }, "responses": { "201": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AccountingScript" } } } }, "400": { "description": "Bad request when a provided parameter is invalid", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string", "description": "Error description", "example": "Validation error, entry Type doesn't exists" } } } } } }, "409": { "description": "Accounting script already exists" } } } } } } ```