API keys on Restash allow you to access your account and perform actions on your behalf. They are used to authenticate requests made to the Restash API. You can create multiple API keys for different purposes, such as development, production, or testing.

API keys on Restash are divided into two types:

Public API keys

Public API keys can only be used to upload files from your browser. Most of the time they will be used alongside a private key. Public keys follow the format:

.env
RESTASH_PUBLIC_KEY=pk_xxxxxxxxx

Whitelist domains

For a public key to work, you must also set your allowed origins on that key. This is just a list of domains that are allowed to use your public key. You can set this in the Restash dashboard.

Private API keys

Private API keys can be used to perform any action on your account such as uploading, retrieving, and deleting files. They are used to authenticate requests made to the Restash API from the server. Private keys follow the format:

.env
RESTASH_SECRET_KEY=sk_xxxxxxxxx

Create an API key

1

Go to Restash dashboard

Go to API keys in the Restash dashboard.

2

Create an API key

Click on the Create API key button. A popup will open prompting you to enter a name for your key. You can also add the allowed origins if needed.

3

Use your API key

You can now use your newly created API key to access your account’s resources programatically via our SDKs.

new Restash(process.env.RESTASH_SECRET_KEY);