{
  "basePath": "",
  "swaggerVersion": "0.1a",
  "apiVersion": "1.0",
  "apis": [
    {
      "path": "/api/accounts/{account_id}/invoices.xml",
      "responseClass": "List[invoice]",
      "operations": [
        {
          "httpMethod": "GET",
          "summary": "Invoice List by Account",
          "description": "Returns the list of all invoices by account. Note that results can be paginated and you can apply filters by month and state.",
          "group": "finance",
          "parameters": [
            {
              "name": "access_token",
              "description": "A personal Access Token",
              "dataType": "string",
              "required": true,
              "paramType": "query",
              "threescale_name": "access_token"
            },
            {
              "name": "account_id",
              "description": "ID of the account.",
              "dataType": "int",
              "required": true,
              "paramType": "path",
              "threescale_name": "account_ids"
            },
            {
              "name": "state",
              "description": "Filter invoices by state. 'open': line items can be added (via web interface). 'pending': the invoice has been issued, no items can be added, the PDF has been generated and the invoice is waiting to be charged. 'paid': sucessfully paid. 'unpaid': charging failed at least once. 'cancelled': the invoice was explicitly cancelled and is out of the normal life-cycle.",
              "dataType": "string",
              "paramType": "query",
              "required": false,
              "defaultValue": "",
              "allowableValues": {
                "values": [
                  "open",
                  "pending",
                  "paid",
                  "unpaid",
                  "cancelled"
                ],
                "valueType": "LIST"
              }
            },
            {
              "name": "month",
              "description": "Filter invoices by month. Format YYYY-MM, e.g. '2012-03'.",
              "dataType": "string",
              "paramType": "query"
            },
            {
              "name": "page",
              "description": "Page in the paginated list. Defaults to 1.",
              "dataType": "int",
              "paramType": "query",
              "defaultValue": "1"
            },
            {
              "name": "per_page",
              "description": "Number of results per page. Default and max is 20.",
              "dataType": "int",
              "paramType": "query",
              "defaultValue": "20"
            }
          ]
        }
      ]
    },
    {
      "path": "/api/accounts/{account_id}/invoices/{id}.xml",
      "responseClass": "invoice",
      "operations": [
        {
          "httpMethod": "GET",
          "summary": "Invoice by Account",
          "description": "Returns an invoice by id.",
          "group": "finance",
          "parameters": [
            {
              "name": "access_token",
              "description": "A personal Access Token",
              "dataType": "string",
              "required": true,
              "paramType": "query",
              "threescale_name": "access_token"
            },
            {
              "name": "account_id",
              "description": "ID of the account.",
              "dataType": "int",
              "required": true,
              "paramType": "path",
              "threescale_name": "account_ids"
            },
            {
              "name": "id",
              "description": "ID of the invoice.",
              "dataType": "int",
              "allowMultiple": false,
              "required": true,
              "paramType": "path"
            }
          ]
        }
      ]
    },
    {
      "path": "/api/invoices.xml",
      "responseClass": "List[invoice]",
      "operations": [
        {
          "httpMethod": "GET",
          "summary": "Invoice List",
          "description": "Returns the list of all invoices. Note that results can be paginated and you can apply filters by month and state.",
          "group": "finance",
          "parameters": [
            {
              "name": "access_token",
              "description": "A personal Access Token",
              "dataType": "string",
              "required": true,
              "paramType": "query",
              "threescale_name": "access_token"
            },
            {
              "name": "state",
              "description": "Filter invoices by state. 'open': line items can be added (via web interface). 'pending': the invoice has been issued, no items can be added, the PDF has been generated and the invoice is waiting to be charged. 'paid': sucessfully paid. 'unpaid': charging failed at least once. 'cancelled': the invoice was explicitly cancelled and is out of the normal life-cycle.",
              "dataType": "string",
              "paramType": "query",
              "required": false,
              "defaultValue": "",
              "allowableValues": {
                "values": [
                  "open",
                  "pending",
                  "paid",
                  "unpaid",
                  "cancelled"
                ],
                "valueType": "LIST"
              }
            },
            {
              "name": "month",
              "description": "Filter invoices by month. Format YYYY-MM, e.g. '2012-03'.",
              "dataType": "string",
              "paramType": "query"
            },
            {
              "name": "page",
              "description": "Page in the paginated list. Defaults to 1.",
              "dataType": "int",
              "paramType": "query",
              "defaultValue": "1"
            },
            {
              "name": "per_page",
              "description": "Number of results per page. Default and max is 20.",
              "dataType": "int",
              "paramType": "query",
              "defaultValue": "20"
            }
          ]
        }
      ]
    },
    {
      "path": "/api/invoices/{id}.xml",
      "responseClass": "invoice",
      "operations": [
        {
          "httpMethod": "GET",
          "summary": "Invoice",
          "description": "Returns an invoice by ID.",
          "group": "finance",
          "parameters": [
            {
              "name": "access_token",
              "description": "A personal Access Token",
              "dataType": "string",
              "required": true,
              "paramType": "query",
              "threescale_name": "access_token"
            },
            {
              "name": "id",
              "description": "ID of the invoice.",
              "dataType": "int",
              "allowMultiple": false,
              "required": true,
              "paramType": "path"
            }
          ]
        }
      ]
    },
    {
      "path": "/api/invoices/{id}/state.xml",
      "responseClass": "invoice",
      "operations": [
        {
          "httpMethod": "PUT",
          "summary": "Invoice",
          "description": "Modifies the state of the invoice.",
          "group": "finance",
          "parameters": [
            {
              "name": "access_token",
              "description": "A personal Access Token",
              "dataType": "string",
              "required": true,
              "paramType": "query",
              "threescale_name": "access_token"
            },
            {
              "name": "id",
              "description": "ID of the invoice.",
              "dataType": "int",
              "allowMultiple": false,
              "required": true,
              "paramType": "path"
            },
            {
              "name": "state",
              "description": "State of the invoice to set. Only 'cancel' value is allowed",
              "dataType": "string",
              "required": true,
              "paramType": "query",
              "threescale_name": "state"
            }
          ]
        }
      ]
    },
    {
      "path": "/api/invoices/{invoice_id}/line_items.xml",
      "responseClass": "List[line_items]",
      "operations": [
        {
          "httpMethod": "GET",
          "summary": "Invoice Line Items List",
          "description": "Returns the list of all line items of an invoice.",
          "group": "finance",
          "parameters": [
            {
              "name": "access_token",
              "description": "A personal Access Token",
              "dataType": "string",
              "required": true,
              "paramType": "query",
              "threescale_name": "access_token"
            },
            {
              "name": "invoice_id",
              "description": "ID of the invoice.",
              "dataType": "int",
              "required": true,
              "paramType": "path"
            }
          ]
        }
      ]
    },
    {
      "path": "/api/invoices/{invoice_id}/payment_transactions.xml",
      "responseClass": "List[payment_transactions]",
      "operations": [
        {
          "httpMethod": "GET",
          "summary": "Invoice Payment Transactions List",
          "description": "Returns the list of all payment transactions of an invoice.",
          "group": "finance",
          "parameters": [
            {
              "name": "access_token",
              "description": "A personal Access Token",
              "dataType": "string",
              "required": true,
              "paramType": "query",
              "threescale_name": "access_token"
            },
            {
              "name": "invoice_id",
              "description": "ID of the invoice.",
              "dataType": "int",
              "required": true,
              "paramType": "path"
            }
          ]
        }
      ]
    }
  ]
}
