> For the complete documentation index, see [llms.txt](https://developer.topazlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.topazlabs.com/getting-started/image-quickstart.md).

# Image Quickstart

Get started with our Image API

Before we proceed, you need to create an [API key](https://account.topazlabs.com/manage-api).

This key will be used to authenticate your requests to the Topaz Labs API.

<details>

<summary>How do I get my API key?</summary>

In order to get access to the API, you'll need to [log into](http://topazlabs.com/account) your Topaz Labs account and create your unique API key. If you don't have an account, please follow the link [here](https://topazlabs.com/wp-login.php?action=register) to register.

Once you have an account, follow the below steps:

1. Log into your Topaz Labs account from our [website](https://topazlabs.com/my-account/)
2. Navigate to the **API** tab section on your account page
3. Click "Create API Key", then enter a "Key name" and other prompted information
4. Click "Create API Key" to confirm your inputted information
5. Click "Copy API Key" to copy it to your clipboard and store it in a safe place

{% hint style="warning" %}
You may only view your API key on creation, so please be sure to copy the key as it will no longer be visible to you once you exit the page. If you lose your key, you may log into your account portal to manage your existing keys and generate new ones.
{% endhint %}

</details>

Now, proceed with the below steps.

{% tabs %}
{% tab title="JavaScript" %}

```javascript
npm install form-data
```

{% endtab %}

{% tab title="Python" %}

```python
pip install requests
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="JavaScript" %}

```javascript
export TOPAZ_API_KEY="PASTE_YOUR_API_KEY_HERE"
```

{% endtab %}

{% tab title="Python" %}

```python
export TOPAZ_API_KEY="PASTE_YOUR_API_KEY_HERE"
```

{% endtab %}
{% endtabs %}

Now you can call the [Enhance Generative endpoint](https://developer.topazlabs.com/reference/image/enhance/enhance-generative):

{% tabs %}
{% tab title="JavaScript" %}

```javascript
import fs from 'fs';
import FormData from 'form-data';

const API_KEY = process.env.TOPAZ_API_KEY;
const HEADERS = { 'X-API-KEY': API_KEY };
const IMAGE_BASE = 'https://api.topazlabs.com/image/v1';

// Submit the job
const form = new FormData();
form.append('model', 'Wonder 3.5');
form.append('output_format', 'jpeg');
form.append('image', fs.createReadStream('photo.jpg'));

const response = await fetch(`${IMAGE_BASE}/enhance-gen/async`, {
  method: 'POST',
  headers: { ...HEADERS, ...form.getHeaders() },
  body: form,
});
const { process_id } = await response.json();

// Poll for completion
let status;
do {
  await new Promise(resolve => setTimeout(resolve, 2000));
  const statusRes = await fetch(`${IMAGE_BASE}/status/${process_id}`, {
    headers: HEADERS,
  });
  ({ status } = await statusRes.json());
  console.log(`Status: ${status}`);
  if (status === 'Failed' || status === 'Cancelled') {
    throw new Error(`Job ended with status: ${status}`);
  }
} while (status !== 'Completed');

// Download the result
const downloadRes = await fetch(`${IMAGE_BASE}/download/${process_id}`, {
  headers: HEADERS,
});
const { download_url } = await downloadRes.json();
console.log(`Download your image: ${download_url}`);
```

{% endtab %}

{% tab title="Python" %}

```python
import os
import time
import requests

API_KEY = os.environ["TOPAZ_API_KEY"]
HEADERS = {"X-API-KEY": API_KEY}
IMAGE_BASE = "https://api.topazlabs.com/image/v1"

# Submit the job
response = requests.post(
    f"{IMAGE_BASE}/enhance-gen/async",
    headers=HEADERS,
    data={
        "model": "Wonder 3.5",
        "output_format": "jpeg"
    },
    files={"image": open("photo.jpg", "rb")}
)
process_id = response.json()["process_id"]

# Poll for completion
while True:
    status = requests.get(
        f"{IMAGE_BASE}/status/{process_id}",
        headers=HEADERS
    ).json()["status"]

    print(f"Status: {status}")
    if status == "Completed":
        break
    elif status in ("Failed", "Cancelled"):
        raise Exception(f"Job ended with status: {status}")
    time.sleep(2)

# Download the result
download_url = requests.get(
    f"{IMAGE_BASE}/download/{process_id}",
    headers=HEADERS
).json()["download_url"]

print(f"Download your image: {download_url}")
```

{% endtab %}

{% tab title="cURL" %}

```bash
IMAGE_BASE="https://api.topazlabs.com/image/v1"

# Submit the job
response=$(curl --silent --fail-with-body \
  --request POST "$IMAGE_BASE/enhance-gen/async" \
  --header "X-API-KEY: $TOPAZ_API_KEY" \
  --form "model=Wonder 3.5" \
  --form "output_format=jpeg" \
  --form "image=@photo.jpg")

process_id=$(printf '%s' "$response" | jq -r '.process_id')

# Poll for completion
while true; do
  status=$(curl --silent --fail-with-body \
    --header "X-API-KEY: $TOPAZ_API_KEY" \
    "$IMAGE_BASE/status/$process_id" | jq -r '.status')

  echo "Status: $status"
  if [ "$status" = "Completed" ]; then
    break
  elif [ "$status" = "Failed" ] || [ "$status" = "Cancelled" ]; then
    echo "Job ended with status: $status" >&2
    exit 1
  fi
  sleep 2
done

# Download the result
download_url=$(curl --silent --fail-with-body \
  --header "X-API-KEY: $TOPAZ_API_KEY" \
  "$IMAGE_BASE/download/$process_id" | jq -r '.download_url')

echo "Download your image: $download_url"
```

{% endtab %}
{% endtabs %}

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-cover data-type="image">Cover image</th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><a class="button secondary medium">Image | Generative</a></td><td><h4>Wonder 3.5</h4></td><td>Upscale degraded or compressed photos with realistic detail, precise text, and clean graphics.</td><td></td><td><a href="/image-models/upscaling-and-enhancement/generative/wonder-3.5.md">Wonder 3.5</a></td></tr><tr><td><a class="button secondary medium">Image | Creative</a></td><td><h4>Bloom 2</h4></td><td>Transform AI-generated artwork, illustrations, and CG with new creative detail.</td><td></td><td><a href="/image-models/upscaling-and-enhancement/creative/bloom-2.md">Bloom 2</a></td></tr></tbody></table>

Once you find a model that you want to use in our "Models" tab, you can grab the URL from the model's dedicated page. Individual model pages also provide some important information about the model including use cases and examples of how you can call it.

Check out our [Model Playground](https://playground.topazlabs.com/) to tinker with these models and let us know your feedback and questions on our [Developer Discord](https://discord.gg/pUqhyZvRHD).

<details>

<summary>How do I make an API call from the Model Playground?</summary>

<figure><img src="https://938351258-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fik4tc42rkpL9SRR51NLK%2Fuploads%2FOkn9w1ictjQN1DOGOys7%2FScreen%20Recording%20Jul%2015%202025%20from%20Topaz%20Labs.gif?alt=media&amp;token=de2207ed-75b8-4862-9386-a5ef447fe0d7" alt=""><figcaption></figcaption></figure>

It's now easier more than ever to create and send your first API request. Once you have a Topaz Labs account and you have created your first API key, navigate over to our [Model Playground](https://playground.topazlabs.com/) to better understand how to build requests. Please see the walkthrough above for an example of an image being upscaled with our Enhance Synchronous endpoint on the Image API.

</details>

### More Information

<details>

<summary>API Restrictions</summary>

* The API has access rate limits depending on the current load on the servers. If you receive a HTTP 429 response, please try again (soon). We recommend using an exponential backoff for the requests to avoid immediately hitting the limit again.
* The API only responds to HTTPS-secured communications. Any requests sent via HTTP return an HTTP 301 redirect to the corresponding HTTPS resources.
* The API enforces a request size limit of 500MB. If a request exceeds this limit, the server responds with an HTTP 413. Please ensure that requests stay within the size constraint to avoid this error.

</details>

Please reach out to <help@topazlabs.com> with any questions.

### Next Steps

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><i class="fa-cube">:cube:</i></td><td><h4>Model Selection</h4></td><td>Find the best model for your use case.</td><td><a href="/getting-started/model-selection.md">Model Selection</a></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developer.topazlabs.com/getting-started/image-quickstart.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
