Skip to main content

Overview

This guide shows the basic workflow for using the Deep Art API: buy credits, create or copy an API key, check your balance, and send your first request.

For the endpoint-by-endpoint setup, continue with the Quickstart.

Buy API credits

API usage is paid with credits on your Deep Art account. Credits must be available on the account connected to the API key before image or video generation requests can run.

  1. Open the Deep Art Account.
  2. Sign in with the account you want to use for API access.
  3. Go to the credits area.
  4. Choose a credit package and complete checkout.
  5. Create an API key and copy it.
  6. Make a test request to check token balance before starting a generation request.

You can confirm the balance at any time with GET /v1/tokens/balance.

curl "$DEEP_ART_API_URL/v1/tokens/balance" \
-H "X-API-Key: $DEEP_ART_API_KEY"

Example response:

{
"tokensBalance": 100
}

JavaScript example

The API uses the X-API-Key header for authentication. Keep API keys on your server and do not expose them in browser-side JavaScript.

const DEEP_ART_API_URL = process.env.DEEP_ART_API_URL ?? "https://api.deepart.ai";
const DEEP_ART_API_KEY = process.env.DEEP_ART_API_KEY;

if (!DEEP_ART_API_KEY) {
throw new Error("Set DEEP_ART_API_KEY before calling the API.");
}

async function generateImage() {
const response = await fetch(`${DEEP_ART_API_URL}/v1/images/generate`, {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": DEEP_ART_API_KEY,
},
body: JSON.stringify({
prompt: "A cinematic portrait of a glass city at sunrise"
}),
});

if (!response.ok) {
const errorBody = await response.text();
throw new Error(`Deep Art API request failed: ${response.status} ${errorBody}`);
}

return response.json();
}

generateImage()
.then((result) => {
console.log("Generated image URL:", result.url);
})
.catch((error) => {
console.error(error);
});

Next step

Read the Quickstart for complete curl examples covering balance checks, image generation, video generation, and polling video jobs.