{
  "swagger": "2.0",
  "info": {
    "title": "Front Accounting Simple API",
    "description": "This is a simple REST API as a Front Accounting module [https://github.com/cambell-prince/FrontAccountingSimpleAPI](https://github.com/cambell-prince/FrontAccountingSimpleAPI).",
    "contact": {
      "email": "cambell.prince@gmail.com"
    },
    "license": {
      "name": "GPL V2.0",
      "url": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html"
    },
    "version": "2.4-1.6"
  },
  "host": "demo.saygoweb.com",
  "basePath": "/frontaccounting/modules/api",
  "paths": {
    "/bankaccounts": {
      "get": {
        "tags": [
          "bankaccounts"
        ],
        "summary": "List Bank Accounts",
        "operationId": "listBankAccounts",
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/BankAccount"
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [
          "bankaccounts"
        ],
        "summary": "Add Bank Account",
        "operationId": "addBankAccount",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "description": "Bank Account to be added",
            "required": true,
            "schema": {
              "$ref": "#/definitions/BankAccount"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "successful operation",
            "schema": {
              "properties": {
                "account_code": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        },
        "deprecated": false
      }
    },
    "/bankaccounts/{id}": {
      "get": {
        "tags": [
          "bankaccounts"
        ],
        "summary": "Get Bank Account by id",
        "operationId": "getBankAccount",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "bankAccountId",
            "in": "path",
            "description": "ID of Bank Account to return",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "type": "object",
              "$ref": "#/definitions/BankAccount"
            }
          }
        },
        "deprecated": false
      },
      "put": {
        "tags": [
          "bankaccounts"
        ],
        "summary": "Update Bank Account",
        "operationId": "updateBankAccount",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "bankAccountId",
            "in": "path",
            "description": "ID of Bank Account to update",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "description": "Bank Account to be updated",
            "required": true,
            "schema": {
              "$ref": "#/definitions/BankAccount"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "properties": {
                "account_code": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        },
        "deprecated": false
      },
      "delete": {
        "tags": [
          "bankaccounts"
        ],
        "summary": "Delete Bank Account",
        "operationId": "deleteBankAccount",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "bankAccountId",
            "in": "path",
            "description": "ID of Bank Account to delete",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation"
          }
        },
        "deprecated": false
      }
    },
    "/dimensions": {
      "get": {
        "tags": [
          "dimensions"
        ],
        "summary": "List all Dimensions",
        "operationId": "listDimensions",
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/Dimension"
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [
          "dimensions"
        ],
        "summary": "Add Dimension",
        "operationId": "addDimension",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "description": "Dimension to be added",
            "required": true,
            "schema": {
              "$ref": "#/definitions/Dimension"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "successful operation",
            "schema": {
              "properties": {
                "id": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        },
        "deprecated": false
      }
    },
    "/dimensions/{id}": {
      "get": {
        "tags": [
          "dimensions"
        ],
        "summary": "Get Dimension by id",
        "operationId": "getDimension",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "dimensionId",
            "in": "path",
            "description": "ID of Dimension to return",
            "required": true,
            "type": "integer",
            "format": "int64"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "type": "object",
              "$ref": "#/definitions/Dimension"
            }
          }
        },
        "deprecated": false
      },
      "put": {
        "tags": [
          "dimensions"
        ],
        "summary": "Update Dimension",
        "operationId": "updateDimension",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "dimensionId",
            "in": "path",
            "description": "ID of Dimension to update",
            "required": true,
            "type": "integer",
            "format": "int64"
          },
          {
            "name": "body",
            "in": "body",
            "description": "Dimension to be updated",
            "required": true,
            "schema": {
              "$ref": "#/definitions/Dimension"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "properties": {
                "id": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        },
        "deprecated": false
      },
      "delete": {
        "tags": [
          "dimensions"
        ],
        "summary": "Delete Dimension",
        "operationId": "deleteDimension",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "dimensionId",
            "in": "path",
            "description": "ID of Dimension to delete",
            "required": true,
            "type": "integer",
            "format": "int64"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation"
          }
        },
        "deprecated": false
      }
    },
    "/exchangerates/{currency}": {
      "get": {
        "tags": [
          "exchangerates"
        ],
        "summary": "List all ExchangeRates for a given currency",
        "operationId": "listExchangeRates",
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/ExchangeRate"
              }
            }
          },
          "412": {
            "description": "failed precondition",
            "schema": {
              "type": "object",
              "items": {
                "$ref": "#/definitions/Error"
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [
          "exchangerates"
        ],
        "summary": "Add ExchangeRate",
        "operationId": "addExchangeRate",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "currency",
            "in": "path",
            "description": "Currency of ExchangeRate to return",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "description": "ExchangeRate to be added",
            "required": true,
            "schema": {
              "$ref": "#/definitions/ExchangeRate"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "successful operation",
            "schema": {
              "properties": {
                "id": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        },
        "deprecated": false
      }
    },
    "/exchangerates/{currency}/current": {
      "get": {
        "tags": [
          "exchangerates"
        ],
        "summary": "Get current exchange rate for the given currency",
        "operationId": "getCurrentExchangeRate",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "currency",
            "in": "path",
            "description": "Currency of ExchangeRate to return",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "type": "object",
              "$ref": "#/definitions/ExchangeRate"
            }
          }
        },
        "deprecated": false
      }
    },
    "/exchangerates/{currency}/{id}": {
      "get": {
        "tags": [
          "exchangerates"
        ],
        "summary": "Get ExchangeRate by id",
        "operationId": "getExchangeRate",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "currency",
            "in": "path",
            "description": "Currency of ExchangeRate to return",
            "required": true,
            "type": "string"
          },
          {
            "name": "exchangeRateId",
            "in": "path",
            "description": "ID of ExchangeRate to return",
            "required": true,
            "type": "integer",
            "format": "int64"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "type": "object",
              "$ref": "#/definitions/ExchangeRate"
            }
          }
        },
        "deprecated": false
      },
      "put": {
        "tags": [
          "exchangerates"
        ],
        "summary": "Update ExchangeRate",
        "operationId": "updateExchangeRate",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "currency",
            "in": "path",
            "description": "Currency of ExchangeRate to return",
            "required": true,
            "type": "string"
          },
          {
            "name": "exchangeRateId",
            "in": "path",
            "description": "ID of ExchangeRate to update",
            "required": true,
            "type": "integer",
            "format": "int64"
          },
          {
            "name": "body",
            "in": "body",
            "description": "ExchangeRate to be updated",
            "required": true,
            "schema": {
              "$ref": "#/definitions/ExchangeRate"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "properties": {
                "id": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        },
        "deprecated": false
      },
      "delete": {
        "tags": [
          "exchangerates"
        ],
        "summary": "Delete ExchangeRate",
        "operationId": "deleteExchangeRate",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "currency",
            "in": "path",
            "description": "Currency of ExchangeRate to delete",
            "required": true,
            "type": "string"
          },
          {
            "name": "exchangeRateId",
            "in": "path",
            "description": "ID of ExchangeRate to delete",
            "required": true,
            "type": "integer",
            "format": "int64"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation"
          }
        },
        "deprecated": false
      }
    },
    "/glaccounts": {
      "get": {
        "tags": [
          "glaccounts"
        ],
        "summary": "List all GL Accounts",
        "operationId": "listGLAccounts",
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/GLAccount"
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [
          "glaccounts"
        ],
        "summary": "Add GL Account",
        "operationId": "addGLAccount",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "description": "GL Account to be added",
            "required": true,
            "schema": {
              "$ref": "#/definitions/GLAccount"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "successful operation",
            "schema": {
              "properties": {
                "account_code": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        },
        "deprecated": false
      }
    },
    "/glaccounts/{id}": {
      "get": {
        "tags": [
          "glaccounts"
        ],
        "summary": "Get GL Account by id",
        "operationId": "getGLAccount",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "glAccountId",
            "in": "path",
            "description": "ID of GL Account to return",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "type": "object",
              "$ref": "#/definitions/GLAccount"
            }
          }
        },
        "deprecated": false
      },
      "put": {
        "tags": [
          "glaccounts"
        ],
        "summary": "Update GL Account",
        "operationId": "updateGLAccount",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "glAccountId",
            "in": "path",
            "description": "ID of GL Account to update",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "description": "GL Account to be updated",
            "required": true,
            "schema": {
              "$ref": "#/definitions/GLAccount"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "properties": {
                "account_code": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        },
        "deprecated": false
      },
      "delete": {
        "tags": [
          "glaccounts"
        ],
        "summary": "Delete GL Account",
        "operationId": "deleteGLAccount",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "glAccountId",
            "in": "path",
            "description": "ID of GL Account to delete",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation"
          }
        },
        "deprecated": false
      }
    },
    "/journal": {
      "get": {
        "tags": [
          "journal"
        ],
        "summary": "List Journal Entries",
        "operationId": "listJournalEntries",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "path",
            "description": "filter start date",
            "required": false,
            "type": "string"
          },
          {
            "name": "to",
            "in": "path",
            "description": "filter end date",
            "required": false,
            "type": "string"
          },
          {
            "name": "ref",
            "in": "path",
            "description": "reference to filter by",
            "required": false,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/JournalEntry"
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [
          "journal"
        ],
        "summary": "Add Journal Entry",
        "operationId": "addJournalEntry",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "description": "Journal Entry to be added",
            "required": true,
            "schema": {
              "$ref": "#/definitions/JournalEntry"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "successful operation",
            "schema": {
              "properties": {
                "account_code": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        },
        "deprecated": false
      }
    },
    "/journal/{type}/{id}": {
      "get": {
        "tags": [
          "journal"
        ],
        "summary": "Get Journal Entry by type and id",
        "operationId": "getJournalEntry",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "journalType",
            "in": "path",
            "description": "Type of Journal Entry to return",
            "required": true,
            "type": "string"
          },
          {
            "name": "journalId",
            "in": "path",
            "description": "ID of Journal Entry to return",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "type": "object",
              "$ref": "#/definitions/JournalEntry"
            }
          }
        },
        "deprecated": false
      },
      "delete": {
        "tags": [
          "journal"
        ],
        "summary": "Void Journal Entry",
        "operationId": "voidJournalEntry",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "journalType",
            "in": "path",
            "description": "Type of Journal Entry to void",
            "required": true,
            "type": "string"
          },
          {
            "name": "journalId",
            "in": "path",
            "description": "ID of Journal Entry to void",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation"
          }
        },
        "deprecated": false
      }
    },
    "/journal/{id}": {
      "put": {
        "tags": [
          "journal"
        ],
        "summary": "Update Journal Entry",
        "operationId": "updateJournalEntry",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "journalId",
            "in": "path",
            "description": "ID of Journal Entry to update",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "description": "Journal Entry to be updated",
            "required": true,
            "schema": {
              "$ref": "#/definitions/JournalEntry"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "properties": {
                "account_code": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        },
        "deprecated": false
      }
    },
    "/sales": {
      "get": {
        "tags": [
          "sales"
        ],
        "summary": "List Sales",
        "operationId": "getSales",
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "type": "object",
              "$ref": "#/definitions/Sale"
            }
          }
        },
        "deprecated": false
      },
      "put": {
        "tags": [
          "sales"
        ],
        "summary": "Update Sale",
        "operationId": "addSale",
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "type": "object",
              "$ref": "#/definitions/Sale"
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [
          "sales"
        ],
        "summary": "Add Sale",
        "operationId": "addSale",
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "type": "object",
              "$ref": "#/definitions/Sale"
            }
          }
        },
        "deprecated": false
      }
    },
    "/sales/id": {
      "get": {
        "tags": [
          "sales"
        ],
        "summary": "Fetch Sale by id",
        "operationId": "getSale",
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "type": "object",
              "$ref": "#/definitions/Sale"
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "definitions": {
    "BankAccount": {
      "description": "A Bank Account",
      "properties": {
        "id": {
          "description": "Unique id used to reference a Bank Account",
          "type": "integer",
          "example": "1"
        },
        "account_code": {
          "description": "Account GL code",
          "type": "string",
          "example": "1060"
        },
        "account_type": {
          "description": "Type of the account",
          "type": "integer",
          "example": "0"
        },
        "bank_name": {
          "description": "Name of the bank at which this account is held",
          "type": "string",
          "example": "Some Bank"
        },
        "bank_address": {
          "description": "Address of the Bank",
          "type": "string"
        },
        "bank_account_name": {
          "description": "Name of the account",
          "type": "string",
          "example": "Anne X Ample"
        },
        "bank_account_number": {
          "description": "Account number used by the Bank",
          "type": "string",
          "example": "12-3456-789123-00"
        },
        "bank_curr_code": {
          "description": "Currency of the account",
          "type": "string",
          "example": "USD"
        },
        "dflt_curr_act": {
          "description": "True (1) if this account is the default account",
          "type": "boolean",
          "example": "0"
        },
        "bank_charge_act": {
          "description": "GL account to which bank charges are assigned",
          "type": "string",
          "example": "5690"
        },
        "last_reconciled_date": {
          "description": "Date up to which this account was reconciled",
          "type": "date",
          "example": "2017-12-01"
        },
        "ending_reconcile_balance": {
          "description": "Account balance at last reconcile",
          "type": "number",
          "example": "12.34"
        },
        "inactive": {
          "description": "True if this account is not active",
          "type": "boolean",
          "example": "0"
        }
      },
      "type": "object",
      "format": ""
    },
    "Dimension": {
      "description": "A Dimension",
      "properties": {
        "id": {
          "description": "Unique id used to reference a Dimension",
          "type": "integer",
          "example": "1"
        },
        "reference": {
          "description": "Unique short human readable reference",
          "type": "string",
          "example": "PROJECT1"
        },
        "name": {
          "description": "A longer human readable name",
          "type": "string",
          "example": "Project 1: Building buildings"
        },
        "memo": {
          "description": "A longer memo",
          "type": "string",
          "example": "Some memo"
        }
      },
      "type": "object",
      "format": ""
    },
    "ExchangeRate": {
      "description": "An ExchangeRate",
      "properties": {
        "id": {
          "description": "Unique id used to reference an ExchangeRate",
          "type": "integer",
          "example": "1"
        },
        "currency": {
          "description": "Standard currency code",
          "type": "string",
          "example": "USD"
        },
        "rateBuy": {
          "description": "The 'buy' exchange rate",
          "type": "float",
          "example": "1.12"
        },
        "rateSell": {
          "description": "The 'sell' exchange rate, if not set the 'rateBuy' is used",
          "type": "float",
          "example": "1.12"
        },
        "date": {
          "description": "The effective date from which to use this exchange rate",
          "type": "date",
          "example": "2018-06-26"
        }
      },
      "type": "object",
      "format": ""
    },
    "GLAccount": {
      "description": "A GLAccount",
      "properties": {
        "account_code": {
          "description": "Unique short human readable id used to reference a GLAccount",
          "type": "string",
          "example": "1060"
        },
        "account_code2": {
          "description": "Secondary account code, may be blank",
          "type": "string",
          "example": ""
        },
        "account_name": {
          "description": "A longer name for the account",
          "type": "string",
          "example": "My Bank Savings Account"
        },
        "account_type": {
          "description": "Type of the account",
          "type": "string",
          "example": ""
        },
        "inactive": {
          "description": "Zero if account is active",
          "type": "int",
          "example": "0"
        }
      },
      "type": "object",
      "format": ""
    },
    "JournalEntry": {
      "description": "A single Journal Entry",
      "properties": {
        "id": {
          "description": "Unique id used to reference a Journal Entry",
          "type": "integer",
          "example": "1"
        },
        "type": {
          "description": "Transaction type is the type of document this Journal Entry represents, e.g. Invoice, Delivery, GRN etc.",
          "type": "integer",
          "example": "10"
        },
        "journal_date": {
          "description": "Date of Journal Entry",
          "type": "date",
          "example": "2018-06-21"
        },
        "document_date": {
          "description": "Date of related document",
          "type": "date",
          "example": "2018-06-21"
        },
        "event_date": {
          "description": "Date of related event",
          "type": "date",
          "example": "2018-06-21"
        },
        "currency": {
          "description": "Currency ",
          "type": "string",
          "example": "USD"
        },
        "document_ref": {
          "description": "Reference of the related document",
          "type": "string",
          "example": "INV123456"
        },
        "reference": {
          "description": "Reference for this Journal Entry",
          "required": "false",
          "type": "string",
          "example": "18 001"
        }
      },
      "type": "object",
      "format": ""
    },
    "Sale": {
      "description": "A Sale",
      "properties": {
        "id": {
          "description": "Unique id used to reference a Sale",
          "type": "integer",
          "example": "1"
        }
      },
      "type": "object",
      "format": ""
    }
  },
  "externalDocs": {
    "description": "Find out more about Front Accounting Simple API",
    "url": "https://github.com/cambell-prince/FrontAccountingSimpleAPI"
  }
}