{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/atlar/json-schema/atlar-create-glaccount-request-schema.json",
  "title": "CreateGLAccountRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/atlar-gl-accounts-api-openapi.yml#/components/schemas/CreateGLAccountRequest",
  "type": "object",
  "properties": {
    "externalId": {
      "$ref": "#/$defs/ExternalID"
    },
    "thirdPartyId": {
      "description": "ID of the associated third-party, e.g. the ERP in which the account is held.",
      "type": "string",
      "readOnly": true
    },
    "associatedConnections": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/AssociatedConnection"
      },
      "x-omitempty": true
    },
    "name": {
      "type": "string",
      "description": "The name of the general ledger account.",
      "minLength": 1,
      "maxLength": 64
    },
    "number": {
      "type": "string",
      "description": "The number of the general ledger account.",
      "minLength": 1,
      "maxLength": 255
    },
    "glEntityIds": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "The Atlar general ledger entity ids that this general ledger account is associated with.\nMay be empty for BANK accounts that have not been linked to a GL entity yet (e.g.\nunlinked Rillet CoA entries). Non-BANK accounts must have at least one entry.\n",
      "maxItems": 20
    },
    "currency": {
      "$ref": "#/$defs/CurrencyCode",
      "description": "The currency of the general ledger account."
    },
    "type": {
      "$ref": "#/$defs/GLAccountType"
    },
    "displayType": {
      "type": "string",
      "description": "The general ledger account types are not uniform across other third-party systems.\nSo instead, we accept the raw type from the third-party system that we can display to the user.\n",
      "minLength": 1,
      "maxLength": 64
    },
    "inactive": {
      "type": "boolean",
      "description": "Whether the GL account is inactive in the customer's ERP. Omit for false."
    }
  },
  "required": [
    "externalId",
    "name",
    "displayType",
    "glEntityIds"
  ],
  "$defs": {
    "AssociatedConnection": {
      "type": "object",
      "properties": {
        "connectionId": {
          "type": "string"
        }
      },
      "required": [
        "connectionId"
      ]
    },
    "CurrencyCode": {
      "type": "string",
      "description": "Three-letter ISO 4217 currency code.",
      "minLength": 3,
      "maxLength": 3,
      "pattern": "^[A-Z]{3,3}$"
    },
    "ExternalID": {
      "type": "string",
      "pattern": "^[a-zA-Z0-9._\\-+=]{1,64}$",
      "description": "External ID is optional to use, but if used, the Atlar platform will persist it, index it, as well as require it to be unique across all resources. It is possible to retrieve a resource using the external ID using the prefix `external:`.",
      "x-omitempty": true
    },
    "GLAccountType": {
      "type": "string",
      "description": "The general ledger account types are not uniform across other third-party systems.\nHowever, it is useful to have a consistent type for the general ledger account. For example,\nto suggest accounts one can match with a bank account.\n",
      "enum": [
        "UNSPECIFIED",
        "BANK",
        "ACCOUNTS_PAYABLE",
        "ACCOUNTS_RECEIVABLE"
      ]
    }
  }
}