SpaceX publishes live Starship telemetry in one public JSON file. This page tells you where the file is, what it contains and how to read it.
The file
The file is public. It needs no key, no token and no account.
https://sxcontent9668.blob.core.usgovcloudapi.net/cms-assets/starship_tracker_public.json
The content is plain JSON. SpaceX makes a new version of the file approximately each 10 seconds. The file contains the last measured position of each vehicle. It does not contain a history.
A browser cannot read this file directly. The server does not send a CORS header. Thus the browser does not accept the response. Read the file from a server, a worker or a command line. Then send the result to your page from your own origin.
What is in it
The top level is one object. It contains a metadata key
and one key for each vehicle. A vehicle key is the name of the ship in
lower case. For example, ship40 is Flight 13 and
ship41 is Flight 14. Do not write the vehicle keys into
your code. Read all the keys that are not metadata.
{
"metadata": {
"generation_time": 1468968678.0,
"trajectory_version": 7
},
"ship40": {
"current": {
"gps_time": 1468968678.0,
"mission_time": 512.4,
"altitude": 146820.0,
"speed": 0.0,
"latitude": 24.9312,
"longitude": -71.4408,
"r_ecef": [ 4102133.2, -5493218.7, 2732004.1 ]
},
"trajectory": [
{ "latitude": 25.1, "longitude": -70.2, "altitude": 152300.0, "time": 1468968738.0 }
]
}
}
metadata
- generation_time
- The time when SpaceX made this version of the file, in GPS seconds. Refer to Time below.
- trajectory_version
- An integer. SpaceX increases it when it publishes a new predicted
path. Use it with
gps_timeto find duplicate samples. Two samples are the same sample if the two numbers are equal.
current
This object contains the last measured position of the vehicle. It is one sample.
- gps_time
- The time of the sample, in GPS seconds.
- mission_time
- The clock of the vehicle, in seconds after liftoff. Read Traps before you use this field.
- altitude
- Height above the ellipsoid, in metres.
- speed
- The speed, in metres per second. This field can stay at 0 for all of a flight. Read Traps.
- latitude, longitude
- In degrees. South and west are negative.
- r_ecef
- The position as an Earth-centred, Earth-fixed vector of three numbers, in metres. This is the most useful field in the file. The other position values agree with it. Use two of these vectors to calculate a velocity with three components.
trajectory
An array of approximately 16 objects. Each object has
latitude, longitude, altitude in
metres and time in GPS seconds. The interval between the
points is 60 seconds.
These points are a prediction, not a record. They
show where SpaceX thinks that the vehicle will go. They do not show
where the vehicle was. To make a flight history, keep each
current sample yourself.
Time
All the time values in this file are in GPS seconds. This
applies to gps_time, to generation_time and
to the time field of each trajectory point.
GPS seconds are not Unix seconds. To change a GPS value to a Unix value, add the GPS epoch offset. Then subtract the leap seconds:
unix = gps + 315964800 - 18
Change the value before you compare it. The difference between the two scales is more than 10 years. If you do not change the value, you get a date in 2016. Each interval that you calculate against the clock of the user is then incorrect by the same quantity.
The number of leap seconds is a constant. It changes only when the international authorities add a leap second.
How to read it
Do the steps that follow.
- Request the file from a server, not from a browser.
- Read the body as bytes. If the first two bytes are
0x1F 0x8B, the body is gzip. Decompress it before you parse it. Most runtimes decompress the body automatically. Do not think that yours does. Make sure. - Parse the JSON. Change each value to a number. Keep a value only if
the number is finite. Write
nullfor all the other values. Do not use a bad value in a calculation. - Compare
gps_timeandtrajectory_versionwith the last sample that you kept. If the two values are equal, discard the sample. - Keep the new sample. The samples that you keep are your flight history.
This example uses curl to read the file at a command
line.
curl -s --compressed \
https://sxcontent9668.blob.core.usgovcloudapi.net/cms-assets/starship_tracker_public.json \
| python3 -m json.tool | head -40
Between flights, the file can be an empty object,
{}. Your code must accept this condition. It must show
nothing. It must not stop.
Traps
Each item below is a real fault that occurred in flight. Each fault can make your display incorrect, and the display can continue to look correct.
- speed can be 0 for all of a flight
- On Flight 13 and on Flight 14, the field was
0from liftoff to splashdown. On Flight 13 this was true at an altitude of 184 km. Do not make a function that uses only one value of the feed. If the published speed is missing or clearly incorrect, calculate the speed from the change in position. A speed from position is relative to the Earth. The published speed is inertial. Thus the two values are different near the pad. - mission_time is wrong before liftoff
- On the pad, the field is a large positive number, between approximately 3600 and 4000 seconds, and it increases. It is not a countdown. At liftoff it goes back to near 0. Do not show this field as a mission clock before you find the liftoff.
- mission_time can recycle
- On Flight 13, the mission clock counted from -1.5 s to +108.5 s
while the vehicle was on the pad, at an altitude of 92 m. Then the
clock went back to the start. The real count started two minutes
later. If
mission_timedecreases, the count started again. Discard the events that you found before the decrease. - Distance from the pad is not distance flown
- The straight distance between two points on the Earth cannot be more than approximately 20,015 km. It decreases when the vehicle comes back towards the pad from the other side. On Flight 13, this value increased to 19,697 km. Then it decreased by 2,312 km, but the ship continued to fly away. To get the distance flown, add each step of the ground track.
- The samples arrive late
- When your server first gets a sample, the sample is approximately 5.6 seconds old. This is because SpaceX makes the file only each 10 seconds. Caches and your poll interval add more time. Show the age of the data. Do not calculate a position ahead of the last sample. A calculation 10 seconds ahead can be incorrect by 4,189 m. The error is largest at engine cutoff and at entry.
- There are gaps
- Your history contains only the samples that you read. The record of Flight 13 on this site has a gap of 220 seconds. Show a gap as a gap. Do not draw a line across it.
- The rate can be lower than 10 seconds
- On Flight 14, SpaceX sent a new position for the ship only each 30
seconds. Do not think that each version of the file has a new
sample. Use
gps_timeto find the new samples. - A position can be late along the track
- On Flight 14, from T+1:47 to T+2:41, some positions were up to 12 km behind the ship. The altitude was correct. A speed from two of these positions can be incorrect by more than 1,500 km/h. Before you calculate a speed, compare each position with the positions near it.
- There is no attitude
- The file contains only the position. It does not contain a quaternion, rates or an angle of attack. An orientation that you draw is not data from the vehicle. Show a label that tells this.
Use the file correctly
The file belongs to SpaceX. Read it carefully.
- Do not read the file more frequently than it changes. A new version comes approximately each 10 seconds.
- Keep the response in a cache for all your users. Use one reader for many viewers. Do not use one reader for each viewer.
- Send a user agent that gives the name of your client.
- Continue after a failure. If the file does not come, show an empty display and a clear message. Do not show a broken page.
The file gives you one sample at a time. You must make the record of a flight yourself. When you have a record, publish it. This site publishes its records at Flight Data Archives.