{
  "opencollection": "1.0.0",
  "info": {
    "name": "Amigo Account Billing API",
    "version": "0.1.0"
  },
  "request": {
    "auth": {
      "type": "bearer",
      "token": "{{bearerToken}}"
    }
  },
  "items": [
    {
      "info": {
        "name": "Billing",
        "type": "folder"
      },
      "items": [
        {
          "info": {
            "name": "Get Billing Dashboard",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://api.amigo.ai/v1/:workspace_id/billing/dashboard",
            "params": [
              {
                "name": "workspace_id",
                "value": "",
                "type": "path"
              }
            ]
          },
          "docs": "Composite billing dashboard — KPIs, period comparison, top meters, invoice summary.\n\nAll computation is server-side. Frontend is a pure renderer."
        },
        {
          "info": {
            "name": "Get Workspace Usage",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://api.amigo.ai/v1/:workspace_id/billing/usage",
            "params": [
              {
                "name": "workspace_id",
                "value": "",
                "type": "path"
              }
            ]
          },
          "docs": "Aggregated billing summary — meters grouped by key, period range, totals.\n\nAll computation is server-side. Frontend is a pure renderer."
        },
        {
          "info": {
            "name": "Get Workspace Usage Trends",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://api.amigo.ai/v1/:workspace_id/billing/usage/trends",
            "params": [
              {
                "name": "workspace_id",
                "value": "",
                "type": "path"
              },
              {
                "name": "days",
                "value": "",
                "type": "query"
              },
              {
                "name": "date_from",
                "value": "",
                "type": "query"
              },
              {
                "name": "date_to",
                "value": "",
                "type": "query"
              },
              {
                "name": "meter_key",
                "value": "",
                "type": "query"
              }
            ]
          },
          "docs": "Usage time-series per meter for trend charts.\n\nReturns one entry per (period, meter_key) within the date range.\nDefault: last 30 days. Use date_from/date_to for custom ranges."
        },
        {
          "info": {
            "name": "List Workspace Invoices",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://api.amigo.ai/v1/:workspace_id/billing/invoices",
            "params": [
              {
                "name": "workspace_id",
                "value": "",
                "type": "path"
              },
              {
                "name": "status",
                "value": "",
                "type": "query"
              },
              {
                "name": "date_from",
                "value": "",
                "type": "query",
                "description": "Filter invoices with period_start on or after this date"
              },
              {
                "name": "date_to",
                "value": "",
                "type": "query",
                "description": "Filter invoices with period_end on or before this date"
              },
              {
                "name": "limit",
                "value": "",
                "type": "query"
              },
              {
                "name": "continuation_token",
                "value": "",
                "type": "query"
              }
            ]
          },
          "docs": "Paginated invoice list for this workspace's billing customer.\n\nSupports status filter and date range."
        },
        {
          "info": {
            "name": "Get Workspace Invoice",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://api.amigo.ai/v1/:workspace_id/billing/invoices/:invoice_id",
            "params": [
              {
                "name": "workspace_id",
                "value": "",
                "type": "path"
              },
              {
                "name": "invoice_id",
                "value": "",
                "type": "path"
              }
            ]
          },
          "docs": "Get invoice detail — scoped to workspace's billing customer."
        },
        {
          "info": {
            "name": "Get Invoice Pdf",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://api.amigo.ai/v1/:workspace_id/billing/invoices/:invoice_id/pdf",
            "params": [
              {
                "name": "workspace_id",
                "value": "",
                "type": "path"
              },
              {
                "name": "invoice_id",
                "value": "",
                "type": "path"
              }
            ]
          },
          "docs": "Get presigned S3 URL for invoice PDF download — scoped to workspace's billing customer."
        },
        {
          "info": {
            "name": "List Customers",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://api.amigo.ai/v1/billing/customers",
            "params": [
              {
                "name": "status",
                "value": "",
                "type": "query"
              },
              {
                "name": "search",
                "value": "",
                "type": "query",
                "description": "Search by name or slug"
              },
              {
                "name": "limit",
                "value": "",
                "type": "query"
              },
              {
                "name": "continuation_token",
                "value": "",
                "type": "query"
              }
            ]
          },
          "docs": "Paginated customer list with optional status filter and search."
        },
        {
          "info": {
            "name": "Create Customer",
            "type": "http"
          },
          "http": {
            "method": "POST",
            "url": "https://api.amigo.ai/v1/billing/customers",
            "body": {
              "type": "json",
              "data": "{}"
            }
          },
          "docs": "Create a billing customer."
        },
        {
          "info": {
            "name": "Get Customer",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://api.amigo.ai/v1/billing/customers/:customer_id",
            "params": [
              {
                "name": "customer_id",
                "value": "",
                "type": "path"
              }
            ]
          },
          "docs": "Get customer detail with workspace mappings."
        },
        {
          "info": {
            "name": "Update Customer",
            "type": "http"
          },
          "http": {
            "method": "PUT",
            "url": "https://api.amigo.ai/v1/billing/customers/:customer_id",
            "params": [
              {
                "name": "customer_id",
                "value": "",
                "type": "path"
              }
            ],
            "body": {
              "type": "json",
              "data": "{}"
            }
          },
          "docs": "Update a billing customer."
        },
        {
          "info": {
            "name": "Attach Workspace",
            "type": "http"
          },
          "http": {
            "method": "POST",
            "url": "https://api.amigo.ai/v1/billing/customers/:customer_id/workspaces",
            "params": [
              {
                "name": "customer_id",
                "value": "",
                "type": "path"
              }
            ],
            "body": {
              "type": "json",
              "data": "{}"
            }
          },
          "docs": "Attach a workspace to a billing customer."
        },
        {
          "info": {
            "name": "Detach Workspace",
            "type": "http"
          },
          "http": {
            "method": "DELETE",
            "url": "https://api.amigo.ai/v1/billing/customers/:customer_id/workspaces/:workspace_id",
            "params": [
              {
                "name": "customer_id",
                "value": "",
                "type": "path"
              },
              {
                "name": "workspace_id",
                "value": "",
                "type": "path"
              }
            ]
          },
          "docs": "Detach a workspace from a billing customer."
        },
        {
          "info": {
            "name": "Get Config",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://api.amigo.ai/v1/billing/customers/:customer_id/config",
            "params": [
              {
                "name": "customer_id",
                "value": "",
                "type": "path"
              }
            ]
          },
          "docs": "Get billing configuration for a customer."
        },
        {
          "info": {
            "name": "Update Config",
            "type": "http"
          },
          "http": {
            "method": "PUT",
            "url": "https://api.amigo.ai/v1/billing/customers/:customer_id/config",
            "params": [
              {
                "name": "customer_id",
                "value": "",
                "type": "path"
              }
            ],
            "body": {
              "type": "json",
              "data": "{}"
            }
          },
          "docs": "Update billing config and price rules."
        },
        {
          "info": {
            "name": "Get Customer Usage",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://api.amigo.ai/v1/billing/customers/:customer_id/usage",
            "params": [
              {
                "name": "customer_id",
                "value": "",
                "type": "path"
              },
              {
                "name": "date_from",
                "value": "",
                "type": "query",
                "description": "Filter meter values with period_start on or after"
              },
              {
                "name": "date_to",
                "value": "",
                "type": "query",
                "description": "Filter meter values with period_end on or before"
              },
              {
                "name": "meter_key",
                "value": "",
                "type": "query",
                "description": "Filter by meter key"
              },
              {
                "name": "limit",
                "value": "",
                "type": "query"
              },
              {
                "name": "continuation_token",
                "value": "",
                "type": "query"
              }
            ]
          },
          "docs": "Paginated meter values for a customer with date range and meter filter."
        },
        {
          "info": {
            "name": "List Customer Invoices",
            "type": "http"
          },
          "http": {
            "method": "GET",
            "url": "https://api.amigo.ai/v1/billing/customers/:customer_id/invoices",
            "params": [
              {
                "name": "customer_id",
                "value": "",
                "type": "path"
              },
              {
                "name": "status",
                "value": "",
                "type": "query"
              },
              {
                "name": "date_from",
                "value": "",
                "type": "query",
                "description": "Filter invoices with period_start on or after"
              },
              {
                "name": "date_to",
                "value": "",
                "type": "query",
                "description": "Filter invoices with period_end on or before"
              },
              {
                "name": "limit",
                "value": "",
                "type": "query"
              },
              {
                "name": "continuation_token",
                "value": "",
                "type": "query"
              }
            ]
          },
          "docs": "Paginated invoice list for a customer with status and date filters."
        },
        {
          "info": {
            "name": "Generate Invoice",
            "type": "http"
          },
          "http": {
            "method": "POST",
            "url": "https://api.amigo.ai/v1/billing/customers/:customer_id/generate-invoice",
            "params": [
              {
                "name": "customer_id",
                "value": "",
                "type": "path"
              }
            ]
          },
          "docs": "Generate invoice for the most recently closed billing period.\n\nReads meter_values (populated by Databricks SDP pipeline), applies\nprice rules, computes line items, creates invoice. Idempotent."
        },
        {
          "info": {
            "name": "Send Invoice",
            "type": "http"
          },
          "http": {
            "method": "POST",
            "url": "https://api.amigo.ai/v1/billing/customers/:customer_id/invoices/:invoice_id/send",
            "params": [
              {
                "name": "customer_id",
                "value": "",
                "type": "path"
              },
              {
                "name": "invoice_id",
                "value": "",
                "type": "path"
              }
            ]
          },
          "docs": "Mark invoice as sent."
        },
        {
          "info": {
            "name": "Mark Paid",
            "type": "http"
          },
          "http": {
            "method": "POST",
            "url": "https://api.amigo.ai/v1/billing/customers/:customer_id/invoices/:invoice_id/paid",
            "params": [
              {
                "name": "customer_id",
                "value": "",
                "type": "path"
              },
              {
                "name": "invoice_id",
                "value": "",
                "type": "path"
              }
            ]
          },
          "docs": "Mark invoice as paid."
        },
        {
          "info": {
            "name": "Void Invoice",
            "type": "http"
          },
          "http": {
            "method": "POST",
            "url": "https://api.amigo.ai/v1/billing/customers/:customer_id/invoices/:invoice_id/void",
            "params": [
              {
                "name": "customer_id",
                "value": "",
                "type": "path"
              },
              {
                "name": "invoice_id",
                "value": "",
                "type": "path"
              }
            ]
          },
          "docs": "Void an invoice."
        }
      ]
    }
  ],
  "bundled": true
}