Quick Start
This guide will help you get up and running with the Framer Server API.
Authentication
In order to interact with the Server API, you will need an API key. These keys authenticate your script as the user who created them, and are bound to a specific project.
You can generate a new API key by going to the General section in Site Settings for a project.
Save the key for future use; keep it in a secure location, such as an .env file or your password manager.
Installation
You can install the Server API node package with npm:
Create a script
Create a JavaScript or TypeScript file:
Note that if your runtime supports it (e.g. TypeScript 5.2+), you can use the new using syntax to avoid needing to call framer.disconnect. In which case it would simply be:
Running your script
With your credentials (you can also put them in a .env file):
Examples
Here is a quick example of how to connect, publish a new preview, and promote it to production.
You can find a list of other real-world examples on the following GitHub repository: https://github.com/framer/server-api-examples.