PolicyEngine logo
menu
Research
About
Donate
Learn ▼

How developers can explore the PolicyEngine API

The UK API explorer and US API explorer describe variables and policy parameters in our models.

By nikhil woodruff

April 29, 2022

3 min read

How developers can explore the PolicyEngine API

Contents

What the PolicyEngine API does

The API explorer

Most of our users interact with PolicyEngine via our UK and US web apps, where they enter household information and policy reforms to compute the impact of customisable tax and benefit policy. We’ve also made this information available to developers through our Python packages and web API. Today, we’re launching companion tools in the UK and US to explore core components of our API: variables and policy parameters.

What the PolicyEngine API does#

Anything you can do with the PolicyEngine app, you can do with our API. Here are some examples:

  1. Get parameters in our tax-benefit model, along with details about their current value, their data type and their descriptions (policyengine.org/uk/parameters)

  2. Get variables in our tax-benefit model, along with details about their current value, their data type and their descriptions (policyengine.org/uk/parameters)

  3. Calculate tax-benefit variables for a given household (policyengine.org/us/calculate)

A Google Colab notebook showing how to use PolicyEngine’s /us/calculate endpoint to calculate a household’s Supplemental Nutrition Assistance Program benefit based on their employment income.

A Google Colab notebook showing how to use PolicyEngine’s /us/calculate endpoint to calculate a household’s Supplemental Nutrition Assistance Program benefit based on their employment income.

A Google Colab notebook showing how to use PolicyEngine’s /us/calculate endpoint to calculate a household’s Supplemental Nutrition Assistance Program benefit based on their employment income.

Using this requires knowing the variables and parameters available, and what they represent. Until now, API users had to extract all of them, or consult our openfisca-us or openfisca-uk repos. Now, it’s as simple as searching in policyengine.org/uk/api-explorer or policyengine.org/us/api-explorer.

The API explorer#

Inspired by other OpenFisca country models (for example, OpenFisca-France’s legislation explorer), policyengine.org/uk/api-explorer and policyengine.org/us/api-explorer display metadata for any variable or policy parameter.

The API explorer includes a search interface, which lists variables and parameters with similar names. Selecting one provides detail about it on the right, such as the entity, period, and default value for variables.

PolicyEngine’s US API explorer after searching for “snap” and selecting the snap variable.

PolicyEngine’s US API explorer after searching for “snap” and selecting the snap variable.

PolicyEngine’s US API explorer after searching for “snap” and selecting the snap variable.

For parameters, the API explorer shows the description, the location in the Python package’s parameter tree, and the current value.

PolicyEngine’s UK API explorer after searching for “personal allowance” and selecting the personal_allowance parameter.

PolicyEngine’s UK API explorer after searching for “personal allowance” and selecting the personal_allowance parameter.

PolicyEngine’s UK API explorer after searching for “personal allowance” and selecting the personal_allowance parameter.

If you’d like to use the PolicyEngine API, please get in touch. We’re excited to see what new products developers build using our open-source tax-benefit models!

PolicyEngine logo

Subscribe to PolicyEngine

Get the latests posts delivered right to your inbox.


© 2025 PolicyEngine. All rights reserved.