Skip to main content

Get started

This guide walks you through using the GOV.UK Content API for the first time.

You can use this guide if you are a developer or a non-developer who understands the basics of APIs. You’ll retrieve GOV.UK content by making a GET request to the API, which returns the content as JSON.

Before you start

Make sure you have one of the following tools:

  • a terminal with a data transfer utility, such as curl
  • a web browser, such as Google Chrome, Microsoft Edge or Firefox

Authentication

You do not need to authenticate or include any custom HTTP headers to use the GOV.UK Content API.

Base URL

The base URL for all requests to the GOV.UK Content API is:

https://www.gov.uk/api/content/

Make your first API request

To make your first request to the GOV.UK Content API:

  1. Choose a page on the GOV.UK website, for example https://www.gov.uk/take-pet-abroad.
  2. Make a note of the URL component after the domain, which for our example is: /take-pet-abroad. This URL component is the path that you will send to the API.
  3. Add this path to the end of the API’s base URL: https://www.gov.uk/api/content/take-pet-abroad
  4. Using your preferred tool, make a GET request to the resulting URL. For example, with the curl utility in your terminal:
    curl https://www.gov.uk/api/content/take-pet-abroad
    Alternatively, you can use your web browser to make the GET request. Navigate to the API URL by entering it in your browser’s address bar.

You get a JSON response containing the GOV.UK content and metadata. The fields contained in this response are explained in the API reference.

Next steps

Now that you’ve made your first API request, you can: