Netwrck logo Netwrck
Netwrck > Tools > API Documentation

RA1 Art Generator API Documentation

The RA1 Art Generator API provides programmatic access to our advanced AI image generation system. This documentation covers everything you need to integrate with our API.

With our API, you can generate high-quality AI images based on text prompts. Our system uses cutting-edge AI models to create stunning visuals for your applications, websites, or creative projects.

Authentication

All API requests require authentication using your API key (which is the same as your user secret). You can find your API key in your account settings.

Pricing

Each successful image generation costs $0.04 USD. Failed requests are not billed. Charges are processed through Stripe and deducted from your account balance.

Endpoints

POST /api/ra1-art-generator

Generate an AI image based on a text prompt.

Request Body

{
  "api_key": "YOUR_API_KEY",
  "prompt": "A futuristic city with flying cars and neon lights",
  "size": "1024x1024",
  "enable_safety_checker": true
}

Parameters

Parameter Type Required Description
api_key string Required Your API key for authentication (same as your account secret)
prompt string Required Text description of the image you want to generate. Be detailed and descriptive for best results.
size string Optional Image size in width×height format. Available options:
  • 1024x1024 - Square HD (default)
  • 1024x768 - Landscape HD
  • 768x1024 - Portrait HD
enable_safety_checker boolean Optional Whether to enable content safety filtering. Defaults to true.

Success Response (200 OK)

{
  "request_id": "req_1234567890",
  "image_url": "https://storage.googleapis.com/netwrck-generated/images/1234567890.png",
  "prompt": "A futuristic city with flying cars and neon lights",
  "created_at": "2023-09-01T12:34:56Z"
}

Response Object Properties

Property Type Description
image_url string URL to the generated image. Use this to display or download the image.
request_id string Unique identifier for this generation request.
prompt string The original prompt used to generate the image.
created_at string Timestamp when the image was generated (ISO 8601 format).

Error Responses

401 Unauthorized

{
  "error": "Invalid API key",
  "status": 401
}

400 Bad Request

{
  "error": "Invalid prompt",
  "status": 400
}

500 Internal Server Error

{
  "error": "Error generating image",
  "status": 500
}

Code Examples

import requests
import json

url = "https://netwrck.com/api/ra1-art-generator"
api_key = "YOUR_API_KEY"  # Replace with your actual API key

payload = {
    "api_key": api_key,
    "prompt": "A serene beach at sunset with palm trees",
    "size": "1024x768",
    "enable_safety_checker": True
}

headers = {
    "Content-Type": "application/json"
}

response = requests.post(url, headers=headers, json=payload)

if response.status_code == 200:
    result = response.json()
    print(f"Image generated successfully!")
    print(f"Image URL: {result['image_url']}")  # Access the image_url from the response
    print(f"Request ID: {result['request_id']}")
    
    # You can now use the image_url to display or download the image
    # For example, to download the image:
    # image_response = requests.get(result['image_url'])
    # with open('generated_image.png', 'wb') as f:
    #     f.write(image_response.content)
else:
    print(f"Error: {response.status_code}")
    print(response.text)
// Using fetch API
const url = 'https://netwrck.com/api/ra1-art-generator';
const apiKey = 'YOUR_API_KEY'; // Replace with your actual API key

const payload = {
  api_key: apiKey,
  prompt: 'A majestic mountain landscape with a waterfall',
  size: '1024x1024',
  enable_safety_checker: true
};

fetch(url, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(payload)
})
.then(response => {
  if (!response.ok) {
    throw new Error(`HTTP error! Status: ${response.status}`);
  }
  return response.json();
})
.then(data => {
  console.log('Image generated successfully!');
  console.log('Image URL:', data.image_url);  // Access the image_url from the response
  console.log('Request ID:', data.request_id);
  
  // You can now use the image_url to display the image
  // For example:
  // const img = document.createElement('img');
  // img.src = data.image_url;
  // document.body.appendChild(img);
})
.catch(error => {
  console.error('Error:', error);
});
const axios = require('axios');

const url = 'https://netwrck.com/api/ra1-art-generator';
const apiKey = 'YOUR_API_KEY'; // Replace with your actual API key

const payload = {
  api_key: apiKey,
  prompt: 'Abstract digital art with swirling colors',
  size: '768x1024',
  enable_safety_checker: true
};

axios.post(url, payload, {
  headers: {
    'Content-Type': 'application/json'
  }
})
.then(response => {
  console.log('Image generated successfully!');
  console.log('Image URL:', response.data.image_url);  // Access the image_url from the response
  console.log('Request ID:', response.data.request_id);
  
  // You can now use the image_url to display or download the image
  // For example, to download the image:
  // return axios.get(response.data.image_url, { responseType: 'stream' })
  //   .then(imageResponse => {
  //     imageResponse.data.pipe(fs.createWriteStream('generated_image.png'));
  //   });
})
.catch(error => {
  console.error('Error:', error.response ? error.response.data : error.message);
});
curl -X POST \
  https://netwrck.com/api/ra1-art-generator \
  -H 'Content-Type: application/json' \
  -d '{
    "api_key": "YOUR_API_KEY",
    "prompt": "A cyberpunk street scene with rain and neon signs",
    "size": "1024x768",
    "enable_safety_checker": true
  }'

# The response will contain the image_url that you can use to access the generated image:
# {
#   "request_id": "req_1234567890",
#   "image_url": "https://storage.googleapis.com/netwrck-generated/images/1234567890.png",
#   "prompt": "A cyberpunk street scene with rain and neon signs",
#   "created_at": "2023-09-01T12:34:56Z"
# }
<?php
$url = 'https://netwrck.com/api/ra1-art-generator';
$api_key = 'YOUR_API_KEY'; // Replace with your actual API key

$payload = array(
    'api_key' => $api_key,
    'prompt' => 'A fantasy castle on a floating island in the sky',
    'size' => '1024x1024',
    'enable_safety_checker' => true
);

$options = array(
    'http' => array(
        'header'  => "Content-type: application/json\r\n",
        'method'  => 'POST',
        'content' => json_encode($payload)
    )
);

$context  = stream_context_create($options);
$response = file_get_contents($url, false, $context);

if ($response !== false) {
    $result = json_decode($response, true);
    echo "Image generated successfully!\n";
    echo "Image URL: " . $result['image_url'] . "\n";  // Access the image_url from the response
    echo "Request ID: " . $result['request_id'] . "\n";
    
    // You can now use the image_url to display or download the image
    // For example, to display the image:
    // echo "<img src='" . $result['image_url'] . "' alt='Generated Image'>";
} else {
    echo "Error generating image\n";
}
?>

Rate Limits

The API is rate limited to prevent abuse. Current limits:

  • 10 requests per minute per API key
  • 100 requests per day per API key

If you need higher limits, please contact us.

Best Practices

  • Use detailed, descriptive prompts for better results.
  • Include style descriptors like "photorealistic," "digital art," or "watercolor painting" in your prompts.
  • Choose the appropriate aspect ratio for your use case.
  • Store generated image URLs for future reference.
  • Implement error handling for robustness.

Tips for Effective Prompts

The quality of your prompt significantly affects the generated image. Here are some tips:

  • Be specific about visual elements you want included
  • Mention lighting conditions (e.g., "sunset lighting," "studio lighting")
  • Specify camera angles (e.g., "aerial view," "close-up")
  • Include art style references (e.g., "in the style of Van Gogh")
  • Describe the mood or atmosphere (e.g., "serene," "dramatic")

Support

If you need assistance or have questions about the API, please contact our support team.

Try the RA1 Art Generator