---
updatedAt: 2026-04-30T22:53:04.000Z
agentTools:
  siteIndex: https://developers.pismo.io/llms.txt
  projectIndex: https://developers.pismo.io/pismo-docs/llms.txt
---

# 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"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "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"
          }
        }
      },
      "AccountingScriptV1CreateError": {
        "type": "object",
        "description": "V1 error response for `POST /v1/accounting-scripts`.\nThe `error` field carries a **descriptive** message: it wraps a stable sentinel prefix with a\ncontextual detail that always includes the offending **numeric ID** (`program_id`,\n`event_type_id`, `entry_type_id`, `debit_accounting_account_id`,\n`credit_accounting_account_id`) or the offending **field name** (`entry_name`, `cost_center.*`,\n`debit_account.account`, etc.) so the caller can self-serve the fix.\nUser-supplied **string values** (account numbers, cosif, descriptions, tenant identifiers) are\n**never echoed back** — they remain in server-side logs and can be correlated with the `cid`\nfield also echoed in every 4xx/5xx response body. When a scenario names multiple offenders,\nthe additional structured field `invalid_fields` accompanies the `error` string.\nWhen the request body fails to deserialize because a field was sent with the **wrong JSON\ntype** (e.g. a numeric ID sent as a quoted string), the `error` names the offending field and\nthe expected/received JSON type and the singular `invalid_field` key carries that field name\n(see `V1BindTypeMismatchError`, which describes the same shape shared across all V1 JSON body\nendpoints).\n",
        "properties": {
          "error": {
            "type": "string",
            "description": "Descriptive error message wrapping a sentinel prefix and a contextual detail. Examples:\n  - `the following fields must be positive integers greater than zero: entry_type_id, program_id`\n  - `Validation error, entry Type doesn't exist: entry_type_id 300 not found for the tenant`\n  - `Validation error, invalid programId: program_id 42 not found for the tenant`\n  - `Validation error, debit account doesn't exist: debit_accounting_account_id 987 not found for the tenant`\n  - `Validation error, credit account doesn't exist: credit_accounting_account_id 987 is deactivated for the tenant`\n  - `Validation error, invalid entry name: accepted values: [amount, amount-advancement, ...]`\n  - `Validation error, invalid company: onboard the tenant via /v1/accounting-companies before creating accounting scripts`\n  - `Accounting Script already exists`\n",
            "example": "Validation error, entry Type doesn't exist: entry_type_id 300 not found for the tenant"
          },
          "cid": {
            "type": "string",
            "description": "Correlation ID echoed in every 4xx/5xx response body so support can locate the offending user-supplied strings in server-side logs."
          },
          "invalid_fields": {
            "type": "array",
            "description": "Present on the positive-integer aggregator branch of `POST /v1/accounting-scripts`.\nEnumerates every top-level field that violated the \"must be a positive integer greater\nthan zero\" rule, so the caller can fix them all in a single retry.\n",
            "items": {
              "type": "string"
            },
            "example": [
              "entry_type_id",
              "program_id"
            ]
          },
          "invalid_field": {
            "type": "string",
            "description": "Present when the request body could not be deserialized because a field was sent with the\nwrong JSON type (a `*json.UnmarshalTypeError`). Carries the JSON path of the offending\nfield. See `V1BindTypeMismatchError`.\n",
            "example": "credit_accounting_account_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-clearing-without-match",
              "amount-contract",
              "amount-dueDate",
              "amount-dueDate-cancelment",
              "amount-interest-iof",
              "amount-interest-iof-dueDate",
              "amount-reversal",
              "contractAmount",
              "daily-interest",
              "fine",
              "interest",
              "interest-advancement",
              "interest-advancement-dueDate",
              "interest-advancement-shift",
              "interest-advancement-shift-dueDate",
              "interest-anticipation",
              "interest-dueDate",
              "interest-not-appropriated",
              "interest-partial",
              "iof",
              "iof-dueDate",
              "overdue",
              "fine"
            ],
            "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"
        }
      }
    },
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Account access token. Tokens can expire quickly, which can result in an \"Unauthorized\" error.",
        "bearerFormat": "JWT"
      }
    }
  },
  "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 — one or more parameters are invalid. Every 4xx body carries the descriptive\n`error` string plus the `cid` correlation ID. Depending on the failure scenario, the body\nmay also carry `invalid_fields` (positive-integer aggregator) enumerating the offending\ntop-level fields. Refer to `AccountingScriptV1CreateError` for the full contract.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountingScriptV1CreateError"
                },
                "examples": {
                  "entryTypeNotFound": {
                    "summary": "Entry type not found for the tenant",
                    "value": {
                      "error": "Validation error, entry Type doesn't exist: entry_type_id 300 not found for the tenant",
                      "cid": "b0d4d7fb-1f38-4c3f-8b3b-8f4f0b2c1a20"
                    }
                  },
                  "invalidPositiveIDs": {
                    "summary": "One or more required IDs are non-positive",
                    "value": {
                      "error": "the following fields must be positive integers greater than zero: entry_type_id, program_id",
                      "invalid_fields": [
                        "entry_type_id",
                        "program_id"
                      ],
                      "cid": "c1e5b7f9-2a44-4b3d-9e1b-3f2a0c4d5e6f"
                    }
                  },
                  "debitAccountNotFound": {
                    "summary": "Debit accounting account not found for the tenant",
                    "value": {
                      "error": "Validation error, debit account doesn't exist: debit_accounting_account_id 987 not found for the tenant",
                      "cid": "d2f6c8a0-3b55-4c4e-af2c-4a3b1d5e6f70"
                    }
                  },
                  "invalidEntryName": {
                    "summary": "entry_name is not in the accepted allow-list",
                    "value": {
                      "error": "Validation error, invalid entry name: accepted values: [amount, amount-advancement, ...]",
                      "cid": "e3a7d9b1-4c66-4d5f-b03d-5b4c2e6f7081"
                    }
                  },
                  "tenantNotOnboarded": {
                    "summary": "Tenant has no accounting company configured",
                    "value": {
                      "error": "Validation error, invalid company: onboard the tenant via /v1/accounting-companies before creating accounting scripts",
                      "cid": "f4b8eac2-5d77-4e60-c14e-6c5d3f708192"
                    }
                  },
                  "jsonTypeMismatch": {
                    "summary": "A field was sent with the wrong JSON type (see V1BindTypeMismatchError)",
                    "value": {
                      "error": "field 'debit_accounting_account_id' must be of type integer number (unquoted) but received a string value",
                      "invalid_field": "debit_accounting_account_id",
                      "cid": "6fdd31b0-c5b9-911a-a713-10158c1fd6ea"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Accounting script already exists — the tuple (program_id, event_type_id, entry_type_id, entry_name) already has an active script for the tenant."
          }
        }
      }
    }
  }
}
```