Create an API key
- Open the API Keys page in the dashboard.
- Click New API key.
- Enter a name and click Create.
- Copy the key with the Copy key button on its row.
Send the key
How you send the key depends on the endpoint.
The API reads the key from the body or the query. It ignores the
Authorization header.
BAD_REQUEST and the message Invalid api key.
Keep the key safe
Anyone who has your key can generate files that count toward your quota, so keep it on the server.- Store the key in an environment variable or a secret manager.
- Do not commit it to git, and do not put it in browser code or a mobile app.
- To show a generated image in a browser, build a signed URL on your server. It carries a signature and not the key.
Replace a key
If a key leaks, or you no longer need it:- Create a new key.
- Update your servers and workflows to use it.
- Delete the old key. Click Delete key on its row on the API Keys page.