kinlane
10/22/2015 - 11:48 PM

3Scale Billing API

3Scale Billing API

{
  "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. You can apply filters by month and by state of the invoices.",
          "group": "finance",
          "parameters": [
            {
              "name": "provider_key",
              "description": "Your api key with 3scale",
              "dataType": "string",
              "required": true,
              "paramType": "query",
              "threescale_name": "api_keys"
            },
            {
              "name": "account_id",
              "description": "id of the account.",
              "dataType": "int",
              "required": true,
              "paramType": "path",
              "threescale_name": "account_ids"
            },
            {
              "name": "state",
              "description": "Filter the invoice by state. 'open': line items can be added (only 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 for. 'paid': sucessfully paid. 'unpaid': charging failed at least once. 'cancelled': the invoice was explicitely cancelled and is out of normal life-cycle.",
              "dataType": "string",
              "paramType": "query",
              "required": false,
              "defaultValue": "",
              "allowableValues": {
                "values": [
                  "open",
                  "pending",
                  "paid",
                  "unpaid",
                  "cancelled"
                ],
                "valueType": "LIST"
              }
            },
            {
              "name": "month",
              "description": "Filter the invoice by month. Format YYYY-MM, e.g. '2012-03' for march 2012",
              "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": "provider_key",
              "description": "Your api key with 3scale",
              "dataType": "string",
              "required": true,
              "paramType": "query",
              "threescale_name": "api_keys"
            },
            {
              "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. You can apply filters by month and by state of the invoices.",
          "group": "finance",
          "parameters": [
            {
              "name": "provider_key",
              "description": "Your api key with 3scale",
              "dataType": "string",
              "required": true,
              "paramType": "query",
              "threescale_name": "api_keys"
            },
            {
              "name": "state",
              "description": "Filter the invoice by state. 'open': line items can be added (only 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 for. 'paid': sucessfully paid. 'unpaid': charging failed at least once. 'cancelled': the invoice was explicitely cancelled and is out of normal life-cycle.",
              "dataType": "string",
              "paramType": "query",
              "required": false,
              "defaultValue": "",
              "allowableValues": {
                "values": [
                  "open",
                  "pending",
                  "paid",
                  "unpaid",
                  "cancelled"
                ],
                "valueType": "LIST"
              }
            },
            {
              "name": "month",
              "description": "Filter the invoice by month. Format YYYY-MM, e.g. '2012-03' for march 2012",
              "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": "provider_key",
              "description": "Your api key with 3scale",
              "dataType": "string",
              "required": true,
              "paramType": "query",
              "threescale_name": "api_keys"
            },
            {
              "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": "provider_key",
              "description": "Your api key with 3scale",
              "dataType": "string",
              "required": true,
              "paramType": "query",
              "threescale_name": "api_keys"
            },
            {
              "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": "provider_key",
              "description": "Your api key with 3scale",
              "dataType": "string",
              "required": true,
              "paramType": "query",
              "threescale_name": "api_keys"
            },
            {
              "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": "provider_key",
              "description": "Your api key with 3scale",
              "dataType": "string",
              "required": true,
              "paramType": "query",
              "threescale_name": "api_keys"
            },
            {
              "name": "invoice_id",
              "description": "id of the invoice.",
              "dataType": "int",
              "required": true,
              "paramType": "path"
            }
          ]
        }
      ]
    }
  ]
}