# Developer API

## How to Use[​](https://docs.algovera.ai/docs/Developer/Flow%20API#using-algoveras-api) <a href="#using-algoveras-api" id="using-algoveras-api"></a>

### Step 1 - Get your API key[​](https://docs.algovera.ai/docs/Developer/Flow%20API#step-1---get-your-api-key) <a href="#step-1---get-your-api-key" id="step-1---get-your-api-key"></a>

To interact with Algovera's API, you first need to generate an API key, which you can generate from the [Algovera Flow](https://app.algovera.ai/) app. Once you are logged in and purchased the credits, select `Account` from your profile.&#x20;

<figure><img src="/files/8Kr4U0l3Td7aDd0UfaL5" alt=""><figcaption></figcaption></figure>

There you can generate your API key under the `API Keys` section by selecting Create new key

<figure><img src="/files/DaRlN3okd60Ipx6liaps" alt=""><figcaption></figcaption></figure>

Make sure to copy and keep your key carefully. Keys will only be shown at creation.

<figure><img src="/files/209yGmb3rzP793bXeCGF" alt=""><figcaption></figcaption></figure>

### Step 2 - Interacting with the API key in Python[​](https://docs.algovera.ai/docs/Developer/Flow%20API#step-2---interacting-with-the-api-key-in-python) <a href="#step-2---interacting-with-the-api-key-in-python" id="step-2---interacting-with-the-api-key-in-python"></a>

**Note:** For API documentation, you can refer to [api.algovera.ai/docs](https://api.algovera.ai/docs)

`APIEndpoint` : `https://api.algovera.ai`

**Getting the available base models**[**​**](https://docs.algovera.ai/docs/Developer/Flow%20API#getting-the-available-base-models)

```
import json
import requests

response = requests.get(f"{APIEndpoint}/api/basemodels")
models = json.loads(response.content)['base_models']
print(models)
['dalle',
 'stable',
 'stable diffusion v1.5',
 'stable diffusion v2-512x512',
 'stable diffusion v2-768x768',
 'stable diffusion v2.1-512x512',
 'stable diffusion v2.1-768x768']
```

The above call will return all the available models.

**Posting a job**[**​**](https://docs.algovera.ai/docs/Developer/Flow%20API#posting-a-job)

```
ept = f"{APIEndpoint}/api/txt2img"

payload = {
        'prompt':"What a beautiful world",
        'height':512,
        'width': 512,
        'inf_steps': 30,
        'guidance_scale':7.0,
        'seed':23165161,
        'base_model':"stable",
        "api_key": "YOUR_API_KEY"
    }

response = requests.post(ept, json=payload)
job_id = json.loads(response.content)['job_uuid']
print(f"job_id is {job_id}")
job_id is f988ff3ffa4b4145bd746c804cf39575
```

Once you post a job, it returns a `job_id` that your could use to check the status of the job as well as to retrieve the output of the job (in this case the image).

Payload contains params for the job as well as your api\_key

**Checking the status of your job**[**​**](https://docs.algovera.ai/docs/Developer/Flow%20API#checking-the-status-of-your-job)

```
ept = f"{APIEndpoint}/api/status?job_uuid={job_id}&api_key={YOUR_API_KEY}"

response = requests.get(ept)
job_status = json.loads(response.content)['job_status']
print(f"job_status is {job_status}")
job_status is done
```

job\_status can be `created` (the job is created and either is in queue or being processed), `done`, `failed`

#### Get the output of your job[​](https://docs.algovera.ai/docs/Developer/Flow%20API#get-the-output-of-your-job) <a href="#get-the-output-of-your-job" id="get-the-output-of-your-job"></a>

```
ept = f"{APIEndpoint}/api/getAsset"

payload = {
            "api_key": "YOUR_API_KEY",
            "job_uuid": job_id
            }

response = requests.get(ept, json=payload)

img = Image.open(io.BytesIO(res.content))
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.algovera.ai/hub/developer-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
