Quickstart

Get up and running with the Autoderm API

Looking to use the models from your web browser? Head to the model interface.

The Autoderm API provides a simple interface for developers to create an intelligent layer in their applications, powered by Autoderm's AI models. The api inference endpoints provide a simple way to take an image, and use our AI models to generate an output of the most likely skin conditions.

This quickstarts aims to help your local development environment set up and send your first API request. If you are an experienced developer or just want to dive into using the API, the Redoc API reference is a great place to start. Throughout this quickstart, you will learn:

If you run into any challenge or have questions getting started, please reach out to us.

Account Creation

First, create an Autoderm account or log in. Next, navigate to your personal space to obtain your API secret key. Make sure to keep it safe, and do not share with anyone.

Programming Language Selection

The Autoderm API follows REST principles and can be integrated from any language. For example in different programming languages on how to use our API, you can check our Redoc Examples. On most examples here, we'll use Python which is a popular programming language commonly used for data applications, web development and many other programming tasks due to its ease of use.

Feel free to let us know if you'd like examples in another language.

Setting up your API key

In your personal space, you can retrieve your API key. For the purpose of these examples, let's assume our API key is:

Pk566ZkEQRLr9vNwo2Gkr1uL6pr-4VjZUkvdJHAdFsA

Setting Up API Key in Your Environment

Storing your API key in an environment variable is a secure practice. Here's how you can set it up on different operating systems:

macOS and Linux

Open your terminal and enter the following command:

export AUTODERM_API_KEY='Your-API-Key-Here'

This will set the API key for your current session. To make it permanent, add the line to your ~/.bashrc or ~/.zshrc file.

Windows

On Windows, you can set an environment variable through the command line:

set AUTODERM_API_KEY=Your-API-Key-Here

For a permanent solution, set it via 'System Properties' > 'Environment Variables'.

Using the API Key in Your Application

It's common to use an .env file in your project to manage environment variables. Here's an example:

AUTODERM_API_KEY='Your-API-Key-Here'

Make sure to add the .env file to your .gitignore to prevent it from being committed to version control.

Once set, you can access the API key in your application using the appropriate method for your programming language or framework.

Sending your first API request

After you have your API key setup, the final step is to send an API request. To do this if you use python in this example, create a file named python_requests.py using the terminal or an IDE. Ideally, have a picture of a skin condition in the same folder named skin.jpg to test it.

Inside the file, copy and paste the python example below:

                import requests
                import os

                API_URL = "https://autoderm.ai/v1/query"

                # set sensitive data as environment variables
                API_KEY = os.getenv("AUTODERM_API_KEY")

                # open the test image and read the bytes
                with open("skin.jpg", "rb") as f:
                    image_contents = f.read()

                # send the query
                response = requests.post(
                    API_URL,
                    headers={{"Api-Key": API_KEY}},
                    files={{"file": image_contents}},
                    params={{"language": "en", "model": "autoderm_v2_2"}},
                )

                # get the JSON data returned
                data = response.json()

                print(data)

                # get only the predictions
                predictions = data["predictions"]

                print(predictions)

            

In order to run the script:

AUTODERM_API_KEY=YourActualAPIKey python3 python_requests.py

The result is a JSON-content mime type containing the predictions ranked in order based on their probabilities. They also contains their ICD-10 codes, medical and laymans names of the condition, a links to read more about the disease.

Next steps

Jump to our selection of models and test them to unlock new powers in dermatology. For more examples and details about the API and models, check our Redoc Page.