Create your API key

You can provision an API key from the Leonardo.Ai web application.

Subscribe to an API Plan

Navigate to the API Access menu in the Leonardo web app. Click Subscribe to API Plan to launch subscription options.

Navigate to the API Access Menu

Navigate to the API Access Menu

Choose from the available plans: API Basic, API Standard, API Pro or contact us directly to discuss setting up a Custom Plan. Purchasing an API plan gives you programmatic access to Leonardo.Ai’s platform.

🚧

Note

An API plan is different from a web-app plan (eg. Free, Apprentice, Artisan, and Maestro).

An API plan gives you access to Leonardo’s Production API, whereas the web app plan only gives you access to functionalities in the Leonardo.Ai web app, mobile app, and the User API.

Provision an API key

After subscribing to an API plan, you’ll see the API Access Page. Here, you can create your first API key by clicking the Create New Key button.

Click on Create New Key

Click on Create New Key

To create your API key, input your API key name and optional webhook callback details. If you set up a webhook callback, Leonardo will send you a message containing your generations. For more information on setting up a webhook callback, see Guide to the Webhook Callback Feature.

Type in your key name and webhook callback details

Type in your key name and webhook callback details

📘

API Best Practice

  • Limit the number of API keys you generate for easy management.
  • Have a system for naming API keys based on factors like application names, environment or teams. For example, mywebapp-dev, mywebapp-prod, myiosapp-dev etc.
  • Leverage the webhook callback feature to receive a message containing the links to your image instead of polling for generations.

Test the API key

Test your API key on the Get User Information page in the API documentation. Here, you can input your key under Bearer and click Try It to test your key.

Test your API key in the Get User Information API

Test your API key in the Get User Information API