After Effects: How to make 3D path
Create a path with the Pen Tool first, copy the property path under:


  Contents > Shape 1 > Path > Path


Create a NULL object and paste the value you just copied to its position property.

You now have a NULL that follows your 2D path.



To enable the Z-axis of the NULL position, toggle the 3D Layer setting.

Click on the NULL position property and then get into the Graph Editor, in the bottom bar click the icon Separate Dimensions, this way you now have the 3 axis as separate properties.



You can see the Z Position is set at 0 without keyframes, despite the other 2 axis, play now with the Z Position and add keyframes as wished to give a 3rd dimension to your previously created 2D path.