Skip to main content

Guides

Authentication

All HTTP requests made against the Spacescope API must be validated with an API key.

Please sign in to view your API key. Don't have an account? Register now to activate your API key for free!

Quick Start

Quick Start Code Example

Code
import requests

url = "https://api.spacescope.io/v2/power/network_storage_capacity?end_date=2022-07-01&start_date=2022-07-01"

payload={}
headers = {
'authorization': 'Bearer <--Please replace your API key here-->'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Return Data Example

All endpoints return data in JSON format with the results of your query under data if the call is successful.

Response
{
"request_id": "4e14a4aa-2368-4029-a660-5a883c0c29f1#606",
"code": 0,
"message": "success.",
"data": [
{
"stat_date": "2022-07-01T00:00:00Z",
"total_qa_bytes_power": 20431876696867700000,
"total_raw_bytes_power": 19307467099059780000,
"baseline_power": 10430930206272310000
}
]
}

Errors

HTTP Status Codes

The API uses standard HTTP status codes to indicate the success or failure of an API call.

  • 200 (OK): Standard response for successful HTTP requests. The actual response will depend on the request method used.
  • 400 (Bad Request): The server cannot or will not process the request due to an apparent client error.
  • 401 (Unauthorized): The user does not have valid authentication credentials for the target resource.
  • 500 (Internal Server Error): A generic error message is given when an unexpected condition is encountered, and no other error message is suitable.
  • 502 (Bad Gateway): The server was acting as a gateway or proxy and received an invalid response from the upstream server.

Error Response Codes

In the event that an error occurs, you may reference the code and message properties. One of the API error codes below will be returned if applicable.

HTTP StatusCodeMessage
40110011The token format error. It should have 'Bearer $token' set in the 'authorization' header.
40110012The token has expired.
20030001Spacescope API forbidden: quota limited / historical limited / API limited.
20030002Spacescope API parameters error.
20030003Spacescope API internal server error.
20030004Spacescope API data are not ready yet.

Daily Update Time

If unspecified, the daily updates (for T-1 data) will normally be available at 09:00 PM UTC every day.

For example, the data for July 1, 2022 UTC should be ready at 09:00 PM, July 2, 2022 UTC.