Skip to main content

How to use the API

Purpose

Monitor Space Hazards exposes the REST API for gathering all the data available via the application frontend. The same content can be fetched via API (with the same data restrictions). The REST API is intended to be used for integrating with other web applications, but can also be used directly. JSON format is used by the API as the output format.

API URL and interactive documentation

To access the API, the API Key is needed. Users can also use the API with their Monitor Space Hazards credentials. API can be accessed in Swagger/OpenAPI tool: https://api.monitor-space-hazards.service.gov.uk/docs

There’s also a ReDOC version of the documentation (easier to read but not interactive): https://api.monitor-space-hazards.service.gov.uk/redoc

Authentication

Go to https://www.monitor-space-hazards.service.gov.uk/account/credentials to generate your user credentials (client_id and client_secret) which you can exchange for the Bearer token by sending following request:

curl --request POST \
  --url https://monitor-your-satellites.eu.auth0.com/oauth/token \
  --header 'content-type: application/json' \
  --data '{"client_id":"----","client_secret":"----","audience":"monitor-your-satellites.service.gov.uk/api","grant_type":"client_credentials"}'

This request will return a response in the following format:

{
      "access_token": "eyJ…qWZdPAc80Q",
      "token_type": "Bearer"
}

The access_token value should be used to authorise requests to protected endpoints. If using the Swagger/OpenAPI tool: https://api.monitor-space-hazards.service.gov.uk/docs then you should insert the bearer token in the APIKeyHeader (apiKey) value field in the Authorize popup in the format Bearer eyJ…qWZdPAc80Q.

API methods

The API methods are documented using OpenAPI and can be seen and tried out using the interface below.

Please note Interacting with the API using the interface below will create real API calls.
This page was last reviewed on 12 June 2023. It needs to be reviewed again on 12 December 2023 .
This page was set to be reviewed before 12 December 2023. This might mean the content is out of date.