Out of the box Blender has no pre-installed API that can be accessed from the outside. Although there are 3 ways how to accomplish this.
- Use BlenderAsPyModule. This is a headless blender that can be accessed and controlled from any Python Interpreter.
- Use Pythons
http.server
module to create a custom API that you can access from other processes (even on different machines) using the HTTP protocol. You write an addon that starts the http server. and your external client can connect to it.
- Use blender command line with a startup script. This will start blender run a python script and stops executing when the script is finished.
All three options have pro's and cons and depends on your specific use case what will work best.
BlenderAsPyModule I use for generating thumbnails (also animations) on a webserver of blend files that users upload. Here Blender runs inside a celery process to be sure that only one generation is happen at once.
server.http
I typically for render farms or when networking comes into play or when the client has no python possibilities.
And the command line I used for simple automation tasks or when I want to do many tasks at a time (start 5 blender instances doing something)