{"spec":"iugu.actions/v1","app":{"client_id":"33qqIXOLGKohFVkWBN1Apf","tag":"billing","name":"Central de cobranças","service_api_url":"https://billing.iugu.com/api","docs_url":"https://billing.iugu.com/docs"},"actions":[{"name":"get_plan","title":"Get billing plan","label":"The plan of an app, with its versions","description":"The billing plan of your app with every version (draft or published), which one is the default for new subscriptions and how many prices each has. 404 plan_not_found until create_plan. Workspace header = the app's publisher workspace.","authorization":{"action":"billing:plans.read","acr":"informations"},"url":"https://billing.iugu.com/api/apps/:app_id/plan","method":"GET","annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false},"parameters":[{"name":"app_id","type":"string","required":true,"direction":"ParamInput","description":"Your app's id (22 characters). The workspace of the call must be the app's publisher.","source":"path"},{"name":"plan","type":"json","required":true,"direction":"ParamOutput","description":"The plan"}]},{"name":"create_plan","title":"Create billing plan","label":"Creates the plan of an app (first time; empty draft v1)","description":"Creates the billing plan of your app with an empty draft version 1, or returns the existing plan (idempotent). The plan's name defaults to the app's name. Workspace header = the app's publisher workspace.","authorization":{"action":"billing:plans.edit","acr":"informations"},"url":"https://billing.iugu.com/api/apps/:app_id/plan","method":"PUT","annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false},"parameters":[{"name":"app_id","type":"string","required":true,"direction":"ParamInput","description":"Your app's id (22 characters). The workspace of the call must be the app's publisher.","source":"path"},{"name":"name","type":"string","required":false,"direction":"ParamInput","description":"Plan name (default: the app's name)","label":"Nome"},{"name":"plan","type":"json","required":true,"direction":"ParamOutput","description":"The plan"}]},{"name":"create_plan_version","title":"Create plan version","label":"A new draft version, cloning the prices of another","description":"Creates the next draft version of the plan, cloning the prices of `clone_from` (default: the current default version). Only one draft at a time (409 draft_exists with details.draft_version_id). A draft has no effect until published. Workspace header = the app's publisher workspace.","authorization":{"action":"billing:plans.edit","acr":"informations"},"url":"https://billing.iugu.com/api/plans/:plan_id/plan_versions","method":"POST","annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false},"parameters":[{"name":"plan_id","type":"string","required":true,"direction":"ParamInput","description":"Plan id (22 characters)","source":"path"},{"name":"clone_from","type":"string","required":false,"direction":"ParamInput","description":"Version id whose prices start the draft (default: the default version)"},{"name":"plan_version","type":"json","required":true,"direction":"ParamOutput","description":"The new draft with its prices"}]},{"name":"get_plan_version","title":"Get plan version","label":"One version of the plan, with its prices","description":"One version of the plan: status (draft | published), whether it is the default, and the full price list (name, event, model, config). Workspace header = the app's publisher workspace.","authorization":{"action":"billing:plans.read","acr":"informations"},"url":"https://billing.iugu.com/api/plan_versions/:plan_version_id","method":"GET","annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false},"parameters":[{"name":"plan_version_id","type":"string","required":true,"direction":"ParamInput","description":"Plan version id (22 characters)","source":"path"},{"name":"plan_version","type":"json","required":true,"direction":"ParamOutput","description":"The version"}]},{"name":"set_prices","title":"Set prices","label":"Replaces the whole price list of a draft version","description":"Declarative: the price list of a draft version becomes exactly `prices`. Each price: name, event (the name your app reports to Billing — must match exactly), model (unit | package | tiered | bulk), config ({amount} | {amount, size} | {tiers: [{amount, maximum_count}]}, amounts as strings in BRL) and optional billing_unit. Published versions cannot change (409 version_published). Workspace header = the app's publisher workspace.","authorization":{"action":"billing:plans.edit","acr":"informations"},"url":"https://billing.iugu.com/api/plan_versions/:plan_version_id/prices","method":"PUT","annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false},"parameters":[{"name":"plan_version_id","type":"string","required":true,"direction":"ParamInput","description":"Plan version id (22 characters)","source":"path"},{"name":"prices","type":"json","required":true,"direction":"ParamInput","description":"The complete price list: [{name, event, model, config, billing_unit?}]","label":"Preços","items":{"name":{"label":"Nome"},"event":{"label":"Evento"},"model":{"label":"Modelo"},"billing_unit":{"label":"Unidade"},"config":{"label":"Configuração"}}},{"name":"plan_version","type":"json","required":true,"direction":"ParamOutput","description":"The version with its prices"}]},{"name":"add_price","title":"Add price","label":"Adds one price to a draft version","description":"Adds one price to a draft version. Workspace header = the app's publisher workspace.","authorization":{"action":"billing:plans.edit","acr":"informations"},"url":"https://billing.iugu.com/api/plan_versions/:plan_version_id/prices","method":"POST","annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false,"openWorldHint":false},"parameters":[{"name":"plan_version_id","type":"string","required":true,"direction":"ParamInput","description":"Plan version id (22 characters)","source":"path"},{"name":"name","type":"string","required":true,"direction":"ParamInput","description":"Price name (unique in the version)","label":"Nome"},{"name":"event","type":"string","required":true,"direction":"ParamInput","description":"Event name your app reports (must match exactly)","label":"Evento"},{"name":"model","type":"select","required":true,"direction":"ParamInput","description":"Pricing model","options":[{"value":"unit","label":"Por unidade"},{"value":"package","label":"Por pacote"},{"value":"tiered","label":"Escalonado"},{"value":"bulk","label":"Por volume"}],"label":"Modelo"},{"name":"config","type":"json","required":true,"direction":"ParamInput","description":"{amount} (unit) | {amount, size} (package) | {tiers: [{amount, maximum_count}]} (tiered, bulk)","label":"Configuração"},{"name":"billing_unit","type":"string","required":false,"direction":"ParamInput","description":"Optional unit label","label":"Unidade"},{"name":"price","type":"json","required":true,"direction":"ParamOutput","description":"The price"},{"name":"plan_version","type":"json","required":true,"direction":"ParamOutput","description":"Version summary"}]},{"name":"update_price","title":"Update price","label":"Changes one price of a draft version","description":"Partial update of one price of a draft version: what is not sent is kept. Workspace header = the app's publisher workspace.","authorization":{"action":"billing:plans.edit","acr":"informations"},"url":"https://billing.iugu.com/api/plan_versions/:plan_version_id/prices/:price_id","method":"PUT","annotations":{"readOnlyHint":false,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false},"parameters":[{"name":"plan_version_id","type":"string","required":true,"direction":"ParamInput","description":"Plan version id (22 characters)","source":"path"},{"name":"price_id","type":"string","required":true,"direction":"ParamInput","description":"Price id","source":"path"},{"name":"name","type":"string","required":false,"direction":"ParamInput","description":"Price name (unique in the version)","label":"Nome"},{"name":"event","type":"string","required":false,"direction":"ParamInput","description":"Event name your app reports (must match exactly)","label":"Evento"},{"name":"model","type":"select","required":false,"direction":"ParamInput","description":"Pricing model","options":[{"value":"unit","label":"Por unidade"},{"value":"package","label":"Por pacote"},{"value":"tiered","label":"Escalonado"},{"value":"bulk","label":"Por volume"}],"label":"Modelo"},{"name":"config","type":"json","required":false,"direction":"ParamInput","description":"{amount} (unit) | {amount, size} (package) | {tiers: [{amount, maximum_count}]} (tiered, bulk)","label":"Configuração"},{"name":"billing_unit","type":"string","required":false,"direction":"ParamInput","description":"Optional unit label","label":"Unidade"},{"name":"price","type":"json","required":true,"direction":"ParamOutput","description":"The price"},{"name":"plan_version","type":"json","required":true,"direction":"ParamOutput","description":"Version summary"}]},{"name":"remove_price","title":"Remove price","label":"Removes one price from a draft version","description":"Removes one price from a draft version. Workspace header = the app's publisher workspace.","authorization":{"action":"billing:plans.edit","acr":"informations"},"url":"https://billing.iugu.com/api/plan_versions/:plan_version_id/prices/:price_id","method":"DELETE","annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":false},"parameters":[{"name":"plan_version_id","type":"string","required":true,"direction":"ParamInput","description":"Plan version id (22 characters)","source":"path"},{"name":"price_id","type":"string","required":true,"direction":"ParamInput","description":"Price id","source":"path"}]},{"name":"preview_pricing","title":"Preview pricing","label":"What one month of usage would cost with this version's prices","description":"Dry run: given quantities per event name for one month, returns the amount per price and the total, with the same code that builds invoices. Nothing is stored — run it before publishing. Workspace header = the app's publisher workspace.","authorization":{"action":"billing:plans.read","acr":"informations"},"url":"https://billing.iugu.com/api/plan_versions/:plan_version_id/preview","method":"POST","annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false},"parameters":[{"name":"plan_version_id","type":"string","required":true,"direction":"ParamInput","description":"Plan version id (22 characters)","source":"path"},{"name":"quantities","type":"json","required":true,"direction":"ParamInput","description":"Quantities per event name for the month, e.g. {\"invoice.created\": 230}","label":"Quantidades"},{"name":"preview","type":"json","required":true,"direction":"ParamOutput","description":"{ lines: [{price_name, event, quantity, amount}], total }"}]},{"name":"publish_version","title":"Publish plan version","label":"Publishes a draft — from then on it prices subscriptions","description":"Publishes a draft version: its prices start pricing the subscriptions on it, and it cannot change any more (create a new version instead). The app must be billable in Console (422 not_billable). `set_as_default` also makes it the version new subscriptions get. The person confirms this call. Workspace header = the app's publisher workspace.","authorization":{"action":"billing:plans.publish","acr":"config"},"url":"https://billing.iugu.com/api/plan_versions/:plan_version_id/publish","method":"POST","annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":false},"parameters":[{"name":"plan_version_id","type":"string","required":true,"direction":"ParamInput","description":"Plan version id (22 characters)","source":"path"},{"name":"set_as_default","type":"boolean","required":false,"direction":"ParamInput","description":"Also make it the default for new subscriptions","label":"Tornar padrão"},{"name":"plan_version","type":"json","required":true,"direction":"ParamOutput","description":"The published version"},{"name":"plan","type":"json","required":true,"direction":"ParamOutput","description":"The plan"}],"confirmation":{"url":"https://billing.iugu.com/api/plan_versions/:plan_version_id/publish_preview","method":"GET"}},{"name":"set_default_version","title":"Set default plan version","label":"Which published version new subscriptions get","description":"Makes a published version the one new subscriptions get. Existing subscriptions keep their version. The person confirms this call. Workspace header = the app's publisher workspace.","authorization":{"action":"billing:plans.publish","acr":"config"},"url":"https://billing.iugu.com/api/plans/:plan_id/default_version","method":"PUT","annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":false},"parameters":[{"name":"plan_id","type":"string","required":true,"direction":"ParamInput","description":"Plan id (22 characters)","source":"path"},{"name":"plan_version_id","type":"string","required":true,"direction":"ParamInput","description":"A published version id","label":"Versão"},{"name":"plan","type":"json","required":true,"direction":"ParamOutput","description":"The plan"}],"confirmation":{"url":"https://billing.iugu.com/api/plans/:plan_id/default_version_preview","method":"GET"}},{"name":"discard_plan","title":"Discard billing plan","label":"Stops offering the plan and cancels every active subscription","description":"Discards the plan of your app: it stops being offered now, every active subscription is cancelled and Console is told the app is no longer published for billing. Irreversible for customers. The person confirms this call. Workspace header = the app's publisher workspace.","authorization":{"action":"billing:plans.discard","acr":"config"},"url":"https://billing.iugu.com/api/plans/:plan_id","method":"DELETE","annotations":{"readOnlyHint":false,"destructiveHint":true,"idempotentHint":false,"openWorldHint":false},"parameters":[{"name":"plan_id","type":"string","required":true,"direction":"ParamInput","description":"Plan id (22 characters)","source":"path"},{"name":"plan","type":"json","required":true,"direction":"ParamOutput","description":"The discarded plan"}],"confirmation":{"url":"https://billing.iugu.com/api/plans/:plan_id/discard_preview","method":"GET"}},{"name":"get_events_summary","title":"Get billing events summary","label":"Usage of your app as Billing counts it, per day and event","description":"Quantity per day and event name across the workspaces that use your app — what the invoices are priced from. An event name no price uses shows here and is never priced. Range defaults to the last 30 days, at most 366. Workspace header = the app's publisher workspace.","authorization":{"action":"billing:plans.read","acr":"informations"},"url":"https://billing.iugu.com/api/apps/:app_id/event_summaries","method":"GET","annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false},"parameters":[{"name":"app_id","type":"string","required":true,"direction":"ParamInput","description":"Your app's id (22 characters). The workspace of the call must be the app's publisher.","source":"path"},{"name":"from","type":"string","required":false,"direction":"ParamInput","description":"YYYY-MM-DD (default 30 days before `to`)","source":"query"},{"name":"to","type":"string","required":false,"direction":"ParamInput","description":"YYYY-MM-DD (default today)","source":"query"},{"name":"summaries","type":"json","required":true,"direction":"ParamOutput","description":"[{date, event, quantity, workspaces}]"}]},{"name":"get_revenue","title":"Get billing revenue","label":"What the workspace's apps billed, received and have outstanding","description":"Per competency and app/plan: total billed, paid and pending — issued invoices only. Workspace header = the app's publisher workspace.","authorization":{"action":"billing:reports.read","acr":"informations"},"url":"https://billing.iugu.com/api/reports/revenue","method":"GET","annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false},"parameters":[{"name":"periods","type":"json","required":true,"direction":"ParamOutput","description":"[{competency, apps: [...]}]"}]},{"name":"list_invoices","title":"List billing invoices","label":"Invoices the workspace owes for the apps it uses","description":"The workspace's invoices (draft, issued, paid…) for the apps it subscribes to, newest first; filter by status and competency. Workspace header = the workspace that uses the apps (Billing's customer).","authorization":{"action":"billing:invoices.show","acr":"informations"},"url":"https://billing.iugu.com/api/reports/invoices","method":"GET","annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false},"parameters":[{"name":"status","type":"string","required":false,"direction":"ParamInput","description":"Comma-separated: draft, issued, issued_and_paid, canceled, in_protest","source":"query"},{"name":"competency","type":"string","required":false,"direction":"ParamInput","description":"YYYY-MM","source":"query"},{"name":"invoices","type":"json","required":true,"direction":"ParamOutput","description":"[{id, app_id, plan_name, competency, status, total_amount, …}]"}]},{"name":"get_invoice","title":"Get billing invoice","label":"One invoice with its lines and payments","description":"One invoice of the workspace with its lines (price, event, quantity, amount) and payments. Workspace header = the workspace that uses the apps (Billing's customer).","authorization":{"action":"billing:invoices.show","acr":"informations"},"url":"https://billing.iugu.com/api/reports/invoices/:invoice_id","method":"GET","annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false},"parameters":[{"name":"invoice_id","type":"string","required":true,"direction":"ParamInput","description":"Invoice id (22 characters)","source":"path"},{"name":"invoice","type":"json","required":true,"direction":"ParamOutput","description":"The invoice"}]},{"name":"get_pending_amount","title":"Get billing pending amount","label":"What the workspace still owes","description":"Amount due over the workspace's open invoices (draft and issued), optionally for one app. Workspace header = the workspace that uses the apps (Billing's customer).","authorization":{"action":"billing:invoices.show","acr":"informations"},"url":"https://billing.iugu.com/api/reports/pending_amount","method":"GET","annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false},"parameters":[{"name":"app_id","type":"string","required":false,"direction":"ParamInput","description":"Only the invoices of this app","source":"query"},{"name":"pending_amount","type":"string","required":true,"direction":"ParamOutput","description":"BRL, four decimals"},{"name":"invoices_count","type":"integer","required":true,"direction":"ParamOutput","description":"Open invoices"}]},{"name":"list_subscriptions","title":"List billing subscriptions","label":"The apps the workspace subscribes to, and on which plan version","description":"The workspace's subscriptions: app, plan, version, since when, active or ended. Workspace header = the workspace that uses the apps (Billing's customer).","authorization":{"action":"billing:reports.read","acr":"informations"},"url":"https://billing.iugu.com/api/reports/subscriptions","method":"GET","annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false},"parameters":[{"name":"subscriptions","type":"json","required":true,"direction":"ParamOutput","description":"[{id, app_id, plan_name, version, …}]"}]},{"name":"revenue_widget","title":"Receita","label":"Faturado, recebido e em aberto nas últimas competências","description":"What the workspace's apps billed, received and still have outstanding, per competency (issued invoices). Workspace header = the app's publisher workspace.","authorization":{"action":"billing:reports.read","acr":"informations"},"url":"https://billing.iugu.com/api/widgets/revenue","method":"GET","annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false},"parameters":[{"name":"stat","type":"json","required":true,"direction":"ParamOutput","description":"Display document: stat, items, series, table"}],"widget":{"title":"Receita","size":{"w":2,"h":2},"refresh":300,"link":"https://billing.iugu.com/developer"}},{"name":"pending_amount_widget","title":"Em aberto","label":"O que a área de trabalho deve pelos aplicativos que usa","description":"Amount due over the workspace's open invoices (issued and draft), with the invoices behind it. Workspace header = the workspace that uses the apps (Billing's customer).","authorization":{"action":"billing:invoices.show","acr":"informations"},"url":"https://billing.iugu.com/api/widgets/pending_amount","method":"GET","annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false},"parameters":[{"name":"stat","type":"json","required":true,"direction":"ParamOutput","description":"Display document: stat, items, table"}],"widget":{"title":"Em aberto","size":{"w":2,"h":2},"refresh":300,"link":"https://billing.iugu.com/customers/invoices"}},{"name":"pending_invoices_widget","title":"Faturas pendentes","label":"Faturas aguardando pagamento, com a página de pagamento de cada uma","description":"The workspace's invoices awaiting payment — overdue first — each with its due date and payment page. Workspace header = the workspace that uses the apps (Billing's customer).","authorization":{"action":"billing:invoices.show","acr":"informations"},"url":"https://billing.iugu.com/api/widgets/pending_invoices","method":"GET","annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false},"parameters":[{"name":"stat","type":"json","required":true,"direction":"ParamOutput","description":"Display document: stat, items, table"}],"widget":{"title":"Faturas pendentes","size":{"w":3,"h":2},"refresh":300,"link":"https://billing.iugu.com/customers/invoices"}}],"triggers":[]}