How to use Keyframes and the Python API programmatically?
Figured it out!
Here's how to use the Python API to set it:
# X, Y, and Z location to set
default_cube.location = (0.0, 0.0, 0.0)
# Set the keyframe with that location, and which frame.
default_cube.keyframe_insert(data_path=&quot;location&quot;, frame=1)

# do it again!
default_cube.location = (3.0, 2.0, 1.0)
# setting it for frame 10
default_cube.keyframe_insert(data_path=&quot;location&quot;, frame=10)

Details on .keyframe_insert() can be found in Blender's manual.