---
updatedAt: 2026-04-30T23:09:10.000Z
---

Fetch the complete documentation index at: https://developers.pismo.io/pismo-docs/llms.txt. Use this file to discover all available pages before exploring further.

# Create accounting script V2

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": {
      "AccountingAccountAccountSctiptPost": {
        "required": [
          "description",
          "account"
        ],
        "type": "object",
        "properties": {
          "description": {
            "type": "string",
            "description": "Description that helps to identify the accounting account.  Can be `0` or any value if there's no corresponding account.",
            "maximum": 100
          },
          "account": {
            "type": "string",
            "description": "Accounting account number.  Can be `0` or any value if there's no corresponding account.",
            "maximum": 50
          }
        },
        "example": {
          "description": "SAMPLE ACCOUNT",
          "account": "123123132-x"
        }
      },
      "AccountingScriptBucket": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Bucket name",
            "example": "bacen_pre_2039"
          },
          "account": {
            "type": "integer",
            "format": "int64",
            "description": "Account ID",
            "example": 123456
          }
        }
      },
      "AccountingScriptParameters": {
        "required": [
          "name",
          "value"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Parameter name [pismo:timing or bacen:classification]",
            "example": "pismo:timing"
          },
          "value": {
            "type": "string",
            "description": "Parameter value [REGULAR, DUEDATE, TRUE, or 3]",
            "example": "REGULAR, DUEDATE"
          }
        }
      },
      "AccountingScriptV2": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "description": "Accounting script ID"
          },
          "program_id": {
            "type": "integer",
            "format": "int64",
            "description": "Program ID"
          },
          "event_type_id": {
            "type": "integer",
            "format": "int64",
            "description": "Event type ID"
          },
          "entry_type_id": {
            "type": "integer",
            "format": "int64",
            "description": "Entry type ID"
          },
          "debit_accounting": {
            "$ref": "#/components/schemas/AccountingAccountAccountSctiptPost"
          },
          "credit_accounting": {
            "$ref": "#/components/schemas/AccountingAccountAccountSctiptPost"
          },
          "cost_center": {
            "$ref": "#/components/schemas/CostCenterAccountingScriptPost"
          },
          "processing_code": {
            "type": "string",
            "description": "Processing code"
          },
          "expression": {
            "type": "string",
            "description": "Expression to calculate the value of the accounting entry.\nIt can be a simple mathematical expression or a more complex one using functions.\n"
          },
          "fee_information": {
            "type": "object",
            "description": "Information about the fee applied to the accounting entry.\nIt can include details such as fee type, amount, and currency.\n"
          },
          "parameters": {
            "$ref": "#/components/schemas/AccountingScriptParameters"
          },
          "cash_in_bucket": {
            "$ref": "#/components/schemas/AccountingScriptBucket"
          },
          "cash_out_bucket": {
            "$ref": "#/components/schemas/AccountingScriptBucket"
          },
          "is_database_stage": {
            "type": "string",
            "description": "Indicates if the accounting script is for a database stage.\nIf yes, the script is used for testing purposes and does not affect production data.\n",
            "default": "no",
            "example": "yes"
          },
          "min_days_due": {
            "type": "integer",
            "format": "int64",
            "description": "Minimum number of days for the due date",
            "example": 30
          },
          "max_days_due": {
            "type": "integer",
            "format": "int64",
            "description": "Maximum number of days for the due date",
            "example": 90
          },
          "history": {
            "$ref": "#/components/schemas/History"
          }
        }
      },
      "AccountingScriptPostV2": {
        "type": "object",
        "required": [
          "entry_type_id",
          "debit_accounting",
          "credit_accounting",
          "expression"
        ],
        "properties": {
          "credit_accounting": {
            "$ref": "#/components/schemas/AccountingAccountAccountSctiptPost"
          },
          "debit_accounting": {
            "$ref": "#/components/schemas/AccountingAccountAccountSctiptPost"
          },
          "entry_type_id": {
            "$ref": "#/components/schemas/EntryTypePost"
          },
          "expression": {
            "type": "string",
            "description": "Expression to calculate the value of the accounting entry.\nIt can be a simple mathematical expression or a more complex one using functions.\n"
          },
          "cash_in_bucket": {
            "$ref": "#/components/schemas/AccountingScriptBucket"
          },
          "cash_out_bucket": {
            "$ref": "#/components/schemas/AccountingScriptBucket"
          },
          "cost_center": {
            "$ref": "#/components/schemas/CostCenterAccountingScriptPost"
          },
          "event_type_id": {
            "type": "integer",
            "format": "int64",
            "description": "Event type ID"
          },
          "except_program_ids": {
            "items": {
              "type": "integer",
              "description": "List of program IDs to exclude"
            },
            "example": [
              78,
              91
            ]
          },
          "fee_information": {
            "type": "object",
            "description": "Information about the fee applied to the accounting entry.\nIt can include details such as fee type, amount, and currency.\n"
          },
          "is_database_stage": {
            "type": "string",
            "description": "Is this accounting script for database staging?\nIf yes, the script is used for testing purposes and does not affect production data.\n",
            "default": "no",
            "example": "yes"
          },
          "max_days_due": {
            "type": "integer",
            "format": "int64",
            "description": "Maximum number of days for the due date",
            "example": 90
          },
          "min_days_due": {
            "type": "integer",
            "format": "int64",
            "description": "Minimum number of days for the due date",
            "example": 30
          },
          "parameters": {
            "$ref": "#/components/schemas/AccountingScriptParameters"
          },
          "processing_code": {
            "type": "string",
            "description": "Processing code"
          },
          "program_id": {
            "type": "integer",
            "format": "int64",
            "description": "Program ID"
          },
          "program_list_id": {
            "type": "array",
            "items": {
              "type": "integer",
              "description": "List of program IDs to include"
            },
            "example": [
              12,
              34,
              56
            ]
          },
          "program_types": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "Program types"
            },
            "example": [
              "CREDIT",
              "DEBIT"
            ]
          },
          "reason": {
            "$ref": "#/components/schemas/HistoryReason"
          },
          "responsible": {
            "$ref": "#/components/schemas/HistoryResponsible"
          }
        }
      },
      "CostCenterAccountingScriptPost": {
        "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"
          }
        },
        "example": {
          "debit_org": "999999",
          "credit_org": "999999",
          "debit_cost": "999999",
          "credit_cost": "999999"
        }
      },
      "EntryTypeDescription": {
        "type": "string",
        "maximum": 250,
        "description": "Entry type description.",
        "example": "CREDIT"
      },
      "EntryTypeID": {
        "type": "integer",
        "format": "int64",
        "description": "Entry type ID",
        "example": 101
      },
      "EntryTypePost": {
        "required": [
          "id",
          "description",
          "type",
          "reason"
        ],
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/EntryTypeID"
          },
          "description": {
            "$ref": "#/components/schemas/EntryTypeDescription"
          },
          "type": {
            "$ref": "#/components/schemas/EntryTypeType"
          },
          "reason": {
            "$ref": "#/components/schemas/HistoryReason"
          },
          "responsible": {
            "$ref": "#/components/schemas/HistoryResponsible"
          }
        }
      },
      "EntryTypeType": {
        "type": "string",
        "maximum": 100,
        "description": "Set the entry type:\n\n* `CREATION`: Default value for new entries. Also, this value is assumed when type is not provided.\n* `DUE_DATE`: Used only with a credit program to indicate a due date entry.\n",
        "enum": [
          "DUE_DATE",
          "CREATION"
        ],
        "example": "DUE_DATE"
      },
      "History": {
        "type": "object",
        "description": "Historical information for auditing the entity.",
        "properties": {
          "org_id": {
            "$ref": "#/components/schemas/OrgID"
          },
          "action": {
            "type": "string",
            "description": "Action performed on the entity.",
            "example": "Created"
          },
          "reason": {
            "$ref": "#/components/schemas/HistoryReason"
          },
          "responsible": {
            "$ref": "#/components/schemas/HistoryResponsible"
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "description": "Entity version.",
            "example": 1
          },
          "jsonb": {
            "type": "string",
            "description": "JSON representation of the request body.",
            "example": "{\"id\": 101, \"description\": \"CREDIT\", \"type\": \"DUE_DATE\", \"reason\": \"Creation of a new entry type configuration.\", \"responsible\": \"John Doe\", \"created_at\": \"2021-10-10T10:10:00Z\"}"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Date and time when the history was created (ISO 8601). Format: YYYY-MM-DDThh:mm:ssZ.",
            "example": "2021-10-10T10:10:00Z"
          }
        }
      },
      "HistoryReason": {
        "type": "string",
        "maximum": 250,
        "description": "Reason for the operation.",
        "example": "Creation of a new entry type configuration."
      },
      "HistoryResponsible": {
        "type": "string",
        "maximum": 100,
        "description": "User name or ID of the person performing the operation.",
        "example": "John Doe"
      },
      "OrgID": {
        "type": "string",
        "description": "Organization ID",
        "example": "TN-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
      }
    }
  },
  "tags": [
    {
      "name": "Accounting scripts V2",
      "description": "Endpoints to manage accounting scripts V2"
    }
  ],
  "paths": {
    "/v2/accounting-scripts": {
      "post": {
        "operationId": "CreateAccountingScriptV2",
        "summary": "Create accounting script V2",
        "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 V2"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountingScriptPostV2"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AccountingScriptV2"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request"
          },
          "409": {
            "description": "Conflict"
          }
        },
        "deprecated": false
      }
    }
  }
}
```