{"components":{"headers":{"Country-Package":{"description":"The name of the country package currently loaded in this API server","schema":{"type":"string"}},"Country-Package-Version":{"description":"The version of the country package currently loaded in this API server","schema":{"pattern":"^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:-((?:0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$","type":"string"}}},"schemas":{"Brackets":{"additionalProperties":{"format":"float","type":"number"},"type":"object"},"Entities":{"properties":{"description":{"type":"string"},"documentation":{"type":"string"},"plural":{"type":"string"},"roles":{"additionalProperties":{"$ref":"#\/components\/schemas\/Roles"},"type":"object"}},"type":"object"},"Formula":{"properties":{"content":{"type":"string"},"source":{"type":"string"}},"type":"object"},"Household":{"additionalProperties":false,"properties":{"accommodation_size":{"additionalProperties":{"type":"number"},"type":"object"},"adults":{"items":{"type":"string"},"type":"array"},"children":{"items":{"type":"string"},"type":"array"},"disposable_income":{"additionalProperties":{"type":"number"},"type":"object"},"household_income":{"additionalProperties":{"type":"number"},"type":"object"},"housing_allowance":{"additionalProperties":{"type":"number"},"type":"object"},"housing_occupancy_status":{"additionalProperties":{"enum":["owner","tenant","free_lodger","homeless"],"type":"string"},"type":"object"},"housing_tax":{"additionalProperties":{"type":"number"},"type":"object"},"parenting_allowance":{"additionalProperties":{"type":"number"},"type":"object"},"postal_code":{"additionalProperties":{"type":"string"},"type":"object"},"rent":{"additionalProperties":{"type":"number"},"type":"object"},"total_benefits":{"additionalProperties":{"type":"number"},"type":"object"},"total_taxes":{"additionalProperties":{"type":"number"},"type":"object"}},"type":"object"},"Parameter":{"example":{"description":"Income tax rate","id":"taxes.income_tax_rate","metadata":{"unit":"\/1"},"source":"https:\/\/github.com\/openfisca\/country-template\/blob\/8.0.3\/openfisca_country_template\/parameters\/taxes\/income_tax_rate.yaml","values":{"2012-01-01":0.16,"2013-01-01":0.13,"2014-01-01":0.14,"2015-01-01":0.15}},"properties":{"brackets":{"additionalProperties":{"$ref":"#\/components\/schemas\/Brackets"},"type":"object"},"description":{"type":"string"},"id":{"format":"string","type":"integer"},"metadata":{"type":"object"},"source":{"type":"string"},"subparams":{"additionalProperties":{"properties":{"definition":{"type":"string"}},"type":"object"},"type":"object"},"values":{"$ref":"#\/components\/schemas\/Values"}},"type":"object"},"Parameters":{"additionalProperties":{"properties":{"description":{"type":"string"},"href":{"type":"string"}},"type":"object"},"type":"object"},"Person":{"additionalProperties":false,"properties":{"age":{"additionalProperties":{"type":"integer"},"type":"object"},"basic_income":{"additionalProperties":{"type":"number"},"type":"object"},"birth":{"additionalProperties":{"type":"string"},"type":"object"},"capital_returns":{"additionalProperties":{"type":"number"},"type":"object"},"income_tax":{"additionalProperties":{"type":"number"},"type":"object"},"pension":{"additionalProperties":{"type":"number"},"type":"object"},"salary":{"additionalProperties":{"type":"number"},"type":"object"},"social_security_contribution":{"additionalProperties":{"type":"number"},"type":"object"}},"type":"object"},"Roles":{"properties":{"description":{"type":"string"},"max":{"type":"integer"},"plural":{"type":"string"}},"type":"object"},"SituationInput":{"additionalProperties":false,"example":{"households":{"_":{"adults":["Alicia","Javier"],"disposable_income":{"2017-01":null},"total_benefits":{"2017-01":null},"total_taxes":{"2017-01":null}}},"persons":{"Alicia":{"birth":{"ETERNITY":"1980-01-01"},"salary":{"2017-01":4000}},"Javier":{"birth":{"ETERNITY":"1984-01-01"},"salary":{"2017-01":2500}}}},"properties":{"households":{"additionalProperties":{"$ref":"#\/components\/schemas\/Household"},"type":"object"},"persons":{"additionalProperties":{"$ref":"#\/components\/schemas\/Person"},"type":"object"}},"type":"object"},"SituationOutput":{"additionalProperties":false,"example":{"households":{"_":{"adults":["Alicia","Javier"],"disposable_income":{"2017-01":6578.3335},"total_benefits":{"2017-01":1200},"total_taxes":{"2017-01":1121.6666}}},"persons":{"Alicia":{"birth":{"ETERNITY":"1980-01-01"},"salary":{"2017-01":4000}},"Javier":{"birth":{"ETERNITY":"1984-01-01"},"salary":{"2017-01":2500}}}},"properties":{"households":{"additionalProperties":{"$ref":"#\/components\/schemas\/Household"},"type":"object"},"persons":{"additionalProperties":{"$ref":"#\/components\/schemas\/Person"},"type":"object"}},"type":"object"},"Trace":{"example":{"entitiesDescription":{"households":["_"],"persons":["Alicia","Javier"]},"requestedCalculations":["disposable_income<2017-01>","total_benefits<2017-01>","total_taxes<2017-01>"],"trace":{"accommodation_size<2017-01>":{"calculation_time":3.147e-5,"dependencies":[],"formula_time":3.147e-5,"parameters":{},"value":[0]},"age<2017-01>":{"calculation_time":0.008275,"dependencies":["birth<2017-01>"],"formula_time":0.00826,"parameters":{},"value":[37,33]},"basic_income<2017-01>":{"calculation_time":0.0001938,"dependencies":["age<2017-01>"],"formula_time":0.0001767,"parameters":{"benefits.basic_income<2017-01-01>":600,"general.age_of_majority<2017-01-01>":18},"value":[600,600]},"birth<2017-01>":{"calculation_time":1.454e-5,"dependencies":[],"formula_time":1.454e-5,"parameters":{},"value":["Tue, 01 Jan 1980 00:00:00 GMT","Sun, 01 Jan 1984 00:00:00 GMT"]},"capital_returns<2017-01>":{"calculation_time":4.053e-5,"dependencies":[],"formula_time":4.053e-5,"parameters":{},"value":[0,0]},"disposable_income<2017-01>":{"calculation_time":0.01826,"dependencies":["salary<2017-01>","capital_returns<2017-01>","pension<2017-01>","basic_income<2017-01>","housing_allowance<2017-01>","parenting_allowance<2017-01>","income_tax<2017-01>","housing_tax<2017>","social_security_contribution<2017-01>"],"formula_time":0.0004094,"parameters":{},"value":[6578.33349609375]},"household_income<2017-01>":{"calculation_time":5.794e-5,"dependencies":["salary<2017-01>"],"formula_time":4.959e-5,"parameters":{},"value":[6500]},"housing_allowance<2017-01>":{"calculation_time":4.22e-5,"dependencies":[],"formula_time":4.22e-5,"parameters":{},"value":[0]},"housing_occupancy_status<2017-01>":{"calculation_time":4.673e-5,"dependencies":[],"formula_time":4.673e-5,"parameters":{},"value":["tenant"]},"housing_tax<2017>":{"calculation_time":0.0002654,"dependencies":["accommodation_size<2017-01>","housing_occupancy_status<2017-01>"],"formula_time":0.0001872,"parameters":{"taxes.housing_tax.minimal_amount<2017-01-01>":200,"taxes.housing_tax.rate<2017-01-01>":10},"value":[200]},"income_tax<2017-01>":{"calculation_time":0.008284,"dependencies":["salary<2017-01>","capital_returns<2017-01>","pension<2017-01>"],"formula_time":0.008238,"parameters":{"taxes.income_tax_rate<2017-01-01>":0.15},"value":[600,375]},"parenting_allowance<2017-01>":{"calculation_time":0.000304,"dependencies":["household_income<2017-01>","age<2017-01>"],"formula_time":0.000237,"parameters":{"benefits.parenting_allowance.amount<2017-01-01>":600,"benefits.parenting_allowance.income_threshold<2017-01-01>":500},"value":[0]},"pension<2017-01>":{"calculation_time":0.008461,"dependencies":["age<2017-01>"],"formula_time":0.0001864,"parameters":{"general.age_of_retirement<2017-01-01>":62},"value":[0,0]},"salary<2017-01>":{"calculation_time":2.003e-5,"dependencies":[],"formula_time":2.003e-5,"parameters":{},"value":[4000,2500]},"social_security_contribution<2017-01>":{"calculation_time":0.0002346,"dependencies":["salary<2017-01>"],"formula_time":0.000227,"parameters":{},"value":[80,50]},"total_benefits<2017-01>":{"calculation_time":0.01435,"dependencies":["basic_income<2017-01>","housing_allowance<2017-01>"],"formula_time":0.01424,"parameters":{},"value":[1200]},"total_taxes<2017-01>":{"calculation_time":0.0003157,"dependencies":["income_tax<2017-01>","social_security_contribution<2017-01>","housing_tax<2017>"],"formula_time":0.0002565,"parameters":{},"value":[1121.6666259765625]}}},"properties":{"entitiesDescription":{"additionalProperties":false,"properties":{"households":{"items":{"type":"string"},"type":"array"},"persons":{"items":{"type":"string"},"type":"array"}},"type":"object"},"requestedCalculations":{"items":{"type":"string"},"type":"array"},"trace":{"additionalProperties":{"properties":{"dependencies":{"items":{"type":"string"},"type":"array"},"parameters":{"additionalProperties":{"type":"object"},"type":"object"},"value":{"items":{},"type":"array"}},"type":"object"},"type":"object"}},"type":"object"},"Value":{"oneOf":[{"type":"boolean"},{"format":"float","type":"number"},{"items":{"oneOf":[{"type":"string"},{"type":"number"}]},"type":"array"}]},"Values":{"additionalProperties":{"$ref":"#\/components\/schemas\/Value"},"description":"All keys are ISO dates. Values can be numbers, booleans, or arrays of a single type (number, boolean or string).","type":"object"},"Variable":{"example":{"defaultValue":0,"definitionPeriod":"MONTH","description":"Actual amount available to the household at the end of the month","entity":"household","formulas":{"0001-01-01":{"content":"def formula(household, period, _parameters):\n    \"\"\"Disposable income.\"\"\"\n    # Household's job returns is the sum of all its members' salary.\n    salary = household.sum(household.members(\"salary\", period))\n    # Household's capital returns is the sum of all its members' capital returns.\n    capital_returns = household.sum(household.members(\"capital_returns\", period))\n    # Pension is an age-tested amount given to non-working people in the household.\n    pension = household.sum(household.members(\"pension\", period))\n    # Basic income is a lump sum given any adult regardless of income.\n    basic_income = household.sum(household.members(\"basic_income\", period))\n    # Housing allowance is an amount given to people the household for rent.\n    housing_allowance = household(\"housing_allowance\", period)\n    # Parenting allowance is an amount given to the household for childraise.\n    parenting_allowance = household(\"parenting_allowance\", period)\n    # Income tax is the sum of all household members' income tax.\n    income_tax = household.sum(household.members(\"income_tax\", period))\n    # Housing tax is a household's payment for housing.\n    housing_tax = household(\"housing_tax\", period, [DIVIDE])\n    # Social security contribution is the sum of all household members'\n    # contribution to the financing of the social security.\n    social_security_contribution = household.sum(\n        household.members(\"social_security_contribution\", period)\n    )\n\n    return (\n        salary\n        + capital_returns\n        + pension\n        + basic_income\n        + housing_allowance\n        + parenting_allowance\n        - income_tax\n        - housing_tax\n        - social_security_contribution\n    )\n","documentation":"Disposable income.","source":"https:\/\/github.com\/openfisca\/country-template\/blob\/8.0.3\/openfisca_country_template\/variables\/income.py#L53-L87"}},"id":"disposable_income","references":["https:\/\/stats.gov.example\/disposable_income"],"source":"https:\/\/github.com\/openfisca\/country-template\/blob\/8.0.3\/openfisca_country_template\/variables\/income.py#L43-L86","valueType":"Float"},"properties":{"defaultValue":{"type":"string"},"definitionPeriod":{"enum":["MONTH","YEAR","ETERNITY"],"type":"string"},"description":{"type":"string"},"entity":{"type":"string"},"formulas":{"additionalProperties":{"$ref":"#\/components\/schemas\/Formula"},"type":"object"},"id":{"type":"string"},"reference":{"items":{"type":"string"},"type":"array"},"source":{"type":"string"},"valueType":{"enum":["Int","Float","Boolean","Date","String"],"type":"string"}},"type":"object"},"Variables":{"additionalProperties":{"properties":{"description":{"type":"string"},"href":{"type":"string"}},"type":"object"},"type":"object"}}},"info":{"contact":{"email":"contact@openfisca.org"},"description":"The OpenFisca Web API lets you get up-to-date information and formulas included in the Openfisca-Country_Template legislation.","license":{"name":"AGPL","url":"https:\/\/www.gnu.org\/licenses\/agpl-3.0"},"termsOfService":"https:\/\/openfisca.org\/doc\/licence.html","title":"Openfisca-Country_Template Web API","version":"8.0.3"},"openapi":"3.0.0","paths":{"\/calculate":{"post":{"operationId":"calculate","requestBody":{"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SituationInput"}}},"description":"Describe the situation (persons and entities). Add the variable you wish to calculate in the proper entity, with null as the value. Learn more in our official documentation: https:\/\/openfisca.org\/doc\/openfisca-web-api\/input-output-data.html","required":true},"responses":{"200":{"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SituationOutput"}}},"description":"The calculation result is sent back in the response body","headers":{"Country-Package":{"$ref":"#\/components\/headers\/Country-Package"},"Country-Package-Version":{"$ref":"#\/components\/headers\/Country-Package-Version"}}},"400":{"description":"The request is invalid. Details about the error are sent back in the response body","headers":{"Country-Package":{"$ref":"#\/components\/headers\/Country-Package"},"Country-Package-Version":{"$ref":"#\/components\/headers\/Country-Package-Version"}}},"404":{"description":"A variable mentioned in the input situation does not exist in the loaded tax and benefit system. Details are sent back in the response body","headers":{"Country-Package":{"$ref":"#\/components\/headers\/Country-Package"},"Country-Package-Version":{"$ref":"#\/components\/headers\/Country-Package-Version"}}}},"summary":"Run a simulation","tags":["Calculations"]}},"\/entities":{"get":{"operationId":"getEntities","responses":{"200":{"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Entities"}}},"description":"The list of the entities as well as their information is sent back in the response body","headers":{"Country-Package":{"$ref":"#\/components\/headers\/Country-Package"},"Country-Package-Version":{"$ref":"#\/components\/headers\/Country-Package-Version"}}}},"summary":"List all available Entities","tags":["Entities"]}},"\/parameter\/{parameterID}":{"get":{"operationId":"getParameter","parameters":[{"description":"ID of parameter. IDs can be obtained by enumerating the \/parameters endpoint","in":"path","name":"parameterID","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Parameter"}}},"description":"The requested parameter's information is sent back in the response body","headers":{"Country-Package":{"$ref":"#\/components\/headers\/Country-Package"},"Country-Package-Version":{"$ref":"#\/components\/headers\/Country-Package-Version"}}},"404":{"description":"The requested parameter does not exist","headers":{"Country-Package":{"$ref":"#\/components\/headers\/Country-Package"},"Country-Package-Version":{"$ref":"#\/components\/headers\/Country-Package-Version"}}}},"summary":"Get information about a specific parameter","tags":["Parameters"]}},"\/parameters":{"get":{"operationId":"getParameters","responses":{"200":{"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Parameters"}}},"description":"The list of parameters is sent back in the response body","headers":{"Country-Package":{"$ref":"#\/components\/headers\/Country-Package"},"Country-Package-Version":{"$ref":"#\/components\/headers\/Country-Package-Version"}}}},"summary":"List all available parameters","tags":["Parameters"]}},"\/spec":{"get":{"operationId":"spec","responses":{"200":{"description":"The API documentation is sent back in the response body","headers":{"Country-Package":{"$ref":"#\/components\/headers\/Country-Package"},"Country-Package-Version":{"$ref":"#\/components\/headers\/Country-Package-Version"}}}},"summary":"Provide the API documentation in an OpenAPI format","tags":["Documentation"]}},"\/trace":{"post":{"operationId":"trace","requestBody":{"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/SituationInput"}}},"description":"Describe the situation (persons and entities). Add the variable you wish to calculate in the proper entity, with null as the value.","required":true},"responses":{"200":{"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Trace"}}},"description":"The calculation details are sent back in the response body","headers":{"Country-Package":{"$ref":"#\/components\/headers\/Country-Package"},"Country-Package-Version":{"$ref":"#\/components\/headers\/Country-Package-Version"}}},"400":{"description":"The request is invalid. Details about the error are sent back in the response body","headers":{"Country-Package":{"$ref":"#\/components\/headers\/Country-Package"},"Country-Package-Version":{"$ref":"#\/components\/headers\/Country-Package-Version"}}},"404":{"description":"A variable mentioned in the input situation does not exist in the loaded tax and benefit system. Details are sent back in the response body","headers":{"Country-Package":{"$ref":"#\/components\/headers\/Country-Package"},"Country-Package-Version":{"$ref":"#\/components\/headers\/Country-Package-Version"}}}},"summary":"Explore a simulation's steps in details.","tags":["Calculations"]}},"\/variable\/{variableID}":{"get":{"operationId":"getVariable","parameters":[{"description":"ID of a variable. IDs can be obtained by enumerating the \/variables endpoint.","in":"path","name":"variableID","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Variable"}}},"description":"The requested variable's information is sent back in the response body","headers":{"Country-Package":{"$ref":"#\/components\/headers\/Country-Package"},"Country-Package-Version":{"$ref":"#\/components\/headers\/Country-Package-Version"}}},"404":{"description":"The requested variable does not exist","headers":{"Country-Package":{"$ref":"#\/components\/headers\/Country-Package"},"Country-Package-Version":{"$ref":"#\/components\/headers\/Country-Package-Version"}}}},"summary":"Get information about a specific variable","tags":["Variables"]}},"\/variables":{"get":{"operationId":"getVariables","responses":{"200":{"content":{"application\/json":{"schema":{"$ref":"#\/components\/schemas\/Variables"}}},"description":"The list of variables is sent back in the response body","headers":{"Country-Package":{"$ref":"#\/components\/headers\/Country-Package"},"Country-Package-Version":{"$ref":"#\/components\/headers\/Country-Package-Version"}}}},"summary":"List all available variables","tags":["Variables"]}}},"servers":[{"url":"https:\/\/api.demo.openfisca.org\/latest"}],"tags":[{"description":"A parameter is a numeric property of the legislation that can evolve over time.","externalDocs":{"description":"Parameters documentation","url":"https:\/\/openfisca.org\/doc\/key-concepts\/parameters.html"},"name":"Parameters"},{"description":"A variable depends on a person, or an entity (e.g. zip code, salary, income tax).","externalDocs":{"description":"Variables documentation","url":"https:\/\/openfisca.org\/doc\/key-concepts\/variables.html"},"name":"Variables"},{"description":"An entity is a person of a group of individuals (such as a household).","externalDocs":{"description":"Entities documentation","url":"https:\/\/openfisca.org\/doc\/key-concepts\/person,_entities,_role.html"},"name":"Entities"},{"name":"Calculations"},{"name":"Documentation"}]}