Skip to main content
The GSS StatsBank API is built on PxWeb technology, a standard API framework used by statistical agencies worldwide. Understanding the PxWeb API specification will help you work more effectively with the GSS API.

Official PxWeb Documentation

The complete PxWeb API specification is available from Statistics Sweden (SCB):

PxWeb API 1.0 Description

Official PDF documentation covering the complete PxWeb API specification, including request formats, response types, and filtering options.

Key Concepts

API Structure

The PxWeb API uses a hierarchical structure similar to a file system:
  • Folders - Databases and levels that contain other folders or tables
  • Tables - Data endpoints identified by the .px file extension
  • Variables - Columns or dimensions within tables
  • Values - Specific data points or categories within variables

Request Methods

GET Requests

Used to navigate the API structure and retrieve metadata about databases, folders, and tables.

POST Requests

Used to retrieve actual data from tables by submitting a JSON query with variable selections and response format.

Response Formats

The PxWeb API supports multiple response formats. Specify your preferred format in the response.format field of your query:
FormatDescriptionUse Case
csvComma-separated valuesEasy import into R, Excel, or other tools
jsonJavaScript Object NotationStructured data for web applications
json-statJSON-stat formatSpecialized statistical data format
json-stat2JSON-stat 2.0 formatUpdated statistical data format
pxPX-file formatNative PxWeb format

Query Filters

The PxWeb API documentation describes several filter types for selecting data:

Item Filter

Select specific values from a variable:
list(
  code = "WaterDisposal",
  selection = list(
    filter = "item",
    values = list(
      "Through the sewerage system",
      "Flows or thrown into drains/gutter"
    )
  )
)

All Filter

Select all available values using the wildcard:
list(
  code = "Geographic_Area",
  selection = list(
    filter = "all",
    values = list("*")
  )
)

Additional Filters

Refer to the official PxWeb documentation for more advanced filtering options including:
  • top - Select top N values
  • bottom - Select bottom N values
  • agg - Aggregate values based on groupings

Other Statistical Agencies Using PxWeb

Many national statistical agencies worldwide use the PxWeb API:
  • Statistics Sweden (SCB)
  • Statistics Norway (SSB)
  • Statistics Denmark (DST)
  • Statistics Finland
  • And many others
Examples and code from other PxWeb implementations may be adaptable to the GSS StatsBank API with minimal modifications.

Additional Resources

Available Databases

Browse the complete list of GSS databases

Troubleshooting

Solutions to common issues

Build docs developers (and LLMs) love