Home About Us Gallery Contact API Login
EN TR

ArtCen API Documentation

ArtCen API allows you to integrate powerful design creation capabilities into your applications. Create professional banners, sliders and social media visuals in seconds.

API Base URL: https://app.artcen.net/api

Authentication

ArtCen API uses API key-based authentication for secure access. You can create your API key from the dashboard.

API Key Usage

You must send your API key with the X-API-KEY header in all API requests:

HTTP
X-API-KEY: YOUR_API_KEY_HERE
Security Note: Never use your API key in client-side code. Store it only on the server side.

Quick Start

3 simple steps to start using ArtCen API:

1. Template Selection

First, select the template you want to use:

JavaScript
const response = await fetch('https://app.artcen.net/api/get-templates', {
    headers: {
        'X-API-KEY': 'YOUR_API_KEY'
    }
});

const templates = await response.json();

2. Get Template Information

Learn the requirements of your selected template:

JavaScript
const infoResponse = await fetch(`https://app.artcen.net/api/get-information/${templateToken}`, {
    headers: {
        'X-API-KEY': 'YOUR_API_KEY'
    }
});

const requirements = await infoResponse.json();

3. Create Design

Create the design by sending your content according to template requirements:

JavaScript
const generateResponse = await fetch(`https://app.artcen.net/api/generate/${templateToken}`, {
    method: 'POST',
    headers: {
        'X-API-KEY': 'YOUR_API_KEY',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        texts: [
            { text: 'Yeni Sezon İndirimleri' },
            { text: '%50'ye varan indirimler' }
        ],
        images: [
            { src: 'https://example.com/product.jpg' }
        ]
    })
});

const result = await generateResponse.json();
console.log(result.url); // Oluşturulan tasarımın URL'i

Template List

GET /api/get-templates

Returns the list of available templates. Size filtering is supported.

Query Parameters

Parameter Type Required Description
dimensionX integer No Width filter
dimensionY integer No Height filter

Example Request

cURL
curl -X GET "https://app.artcen.net/api/get-templates?dimensionX=1080&dimensionY=1080" \
     -H "X-API-KEY: YOUR_API_KEY"

Successful Response

200 OK
JSON
{
    "status": "success",
    "data": [
        {
            "token": "abc123xyz",
            "name": "Instagram Post - Modern",
            "category": "Instagram",
            "width": 1080,
            "height": 1080,
            "preview": "https://app.artcen.net/previews/abc123xyz.jpg"
        },
        {
            "token": "def456uvw",
            "name": "Facebook Cover - Business",
            "category": "Facebook",
            "width": 1640,
            "height": 924,
            "preview": "https://app.artcen.net/previews/def456uvw.jpg"
        }
    ]
}

Template Information

GET /api/get-information/{token}

Returns dynamic field requirements and size information for the specified template.

Path Parameters

Parametre Tip Açıklama
token string Template unique identifier

Successful Response

200 OK
JSON
{
    "requirements": {
        "texts": [
            {
                "tag": "[%TITLE%]",
                "defaultText": "Başlık Metni",
                "maxLength": 50,
                "required": true
            },
            {
                "tag": "[%SUBTITLE%]",
                "defaultText": "Alt Başlık",
                "maxLength": 100,
                "required": false
            }
        ],
        "images": [
            {
                "tag": "product_image",
                "defaultSrc": "https://app.artcen.net/defaults/product.jpg",
                "minWidth": 500,
                "minHeight": 500,
                "required": true
            }
        ]
    },
    "sizes": [
        {
            "name": "Original",
            "suffix": "",
            "quality": 100
        },
        {
            "name": "Medium",
            "suffix": "?q=med",
            "quality": 80
        },
        {
            "name": "Thumbnail",
            "suffix": "?q=low",
            "quality": 60
        }
    ],
    "dimension": {
        "width": 1080,
        "height": 1080,
        "aspect_ratio": "1:1"
    }
}

Generate Design

POST /api/generate/{token}

Creates a design with dynamic content based on the template and returns the URL.

Request Body

Parameter Type Required Description
texts array Yes Array of text contents
texts[].text string Yes Text to replace
images array Yes Array of image URLs
images[].src string Yes Image URL

Example Request

cURL
curl -X POST "https://app.artcen.net/api/generate/abc123xyz" \
     -H "X-API-KEY: YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{
         "texts": [
             {"text": "Yaz Sezonu İndirimleri"},
             {"text": "%70'e varan indirimler"}
         ],
         "images": [
             {"src": "https://example.com/summer-product.jpg"}
         ]
     }'

Successful Response

200 OK
JSON
{
    "status": "success",
    "data": {
        "url": "https://app.artcen.net/sm/xYz9aBc3DeF",
        "sizes": [
            {
                "name": "Original",
                "url": "https://app.artcen.net/sm/xYz9aBc3DeF"
            },
            {
                "name": "Medium",
                "url": "https://app.artcen.net/sm/xYz9aBc3DeF?q=med"
            },
            {
                "name": "Thumbnail",
                "url": "https://app.artcen.net/sm/xYz9aBc3DeF?q=low"
            }
        ],
        "dimension": {
            "width": 1080,
            "height": 1080
        },
        "created_at": "2024-01-15T10:30:45.000Z"
    }
}

Rate Limiting

Your API requests are limited according to your plan limit:

Plan Requests/Minute Requests/Month
Starter 10 1,000
Professional 60 10,000
Enterprise Unlimited Unlimited
Rate limit information is returned in every response header:
  • X-RateLimit-Limit: Minute limit
  • X-RateLimit-Remaining: Remaining request count
  • X-RateLimit-Reset: Reset time (Unix timestamp)

Error Codes

The API uses the following HTTP status codes:

Code Status Description
200 OK Request successful
400 Bad Request Invalid request parameters
401 Unauthorized Invalid or missing API key
404 Not Found Template not found
429 Too Many Requests Rate limit exceeded
500 Internal Server Error Server error

Error Response Format

400 Bad Request
JSON
{
    "status": "error",
    "error": {
        "code": "INVALID_PARAMETERS",
        "message": "Zorunlu alan eksik: texts",
        "details": {
            "field": "texts",
            "requirement": "array"
        }
    }
}

JavaScript Example

Example of using ArtCen API with JavaScript/Node.js:

JavaScript
class ArtCenAPI {
    constructor(apiKey) {
        this.apiKey = apiKey;
        this.baseURL = 'https://app.artcen.net/api';
    }

    async request(endpoint, options = {}) {
        const response = await fetch(`${this.baseURL}${endpoint}`, {
            ...options,
            headers: {
                'X-API-KEY': this.apiKey,
                'Content-Type': 'application/json',
                ...options.headers
            }
        });

        if (!response.ok) {
            throw new Error(`API Error: ${response.status}`);
        }

        return response.json();
    }

    async getTemplates(filters = {}) {
        const params = new URLSearchParams(filters);
        return this.request(`/get-templates?${params}`);
    }

    async getTemplateInfo(token) {
        return this.request(`/get-information/${token}`);
    }

    async generateDesign(token, content) {
        return this.request(`/generate/${token}`, {
            method: 'POST',
            body: JSON.stringify(content)
        });
    }
}

// Kullanım
const artcen = new ArtCenAPI('YOUR_API_KEY');

// Instagram post oluştur
async function createInstagramPost() {
    try {
        // 1. Instagram template'lerini getir
        const templates = await artcen.getTemplates({
            dimensionX: 1080,
            dimensionY: 1080
        });

        // 2. İlk template'i seç
        const template = templates.data[0];
        
        // 3. Template bilgilerini al
        const info = await artcen.getTemplateInfo(template.token);
        
        // 4. Tasarım oluştur
        const design = await artcen.generateDesign(template.token, {
            texts: [
                { text: 'Yeni Koleksiyon' },
                { text: 'İlkbahar 2024' }
            ],
            images: [
                { src: 'https://example.com/product.jpg' }
            ]
        });

        console.log('Tasarım oluşturuldu:', design.data.url);
        return design.data;
        
    } catch (error) {
        console.error('Hata:', error);
    }
}

createInstagramPost();

PHP Example

Example of using ArtCen API with PHP:

PHP
<?php
class ArtCenAPI {
    private $apiKey;
    private $baseURL = 'https://app.artcen.net/api';

    public function __construct($apiKey) {
        $this->apiKey = $apiKey;
    }

    private function request($endpoint, $method = 'GET', $data = null) {
        $ch = curl_init($this->baseURL . $endpoint);
        
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, [
            'X-API-KEY: ' . $this->apiKey,
            'Content-Type: application/json'
        ]);

        if ($method === 'POST') {
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
        }

        $response = curl_exec($ch);
        $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        curl_close($ch);

        if ($httpCode !== 200) {
            throw new Exception('API Error: ' . $httpCode);
        }

        return json_decode($response, true);
    }

    public function getTemplates($filters = []) {
        $query = http_build_query($filters);
        return $this->request('/get-templates?' . $query);
    }

    public function getTemplateInfo($token) {
        return $this->request('/get-information/' . $token);
    }

    public function generateDesign($token, $content) {
        return $this->request('/generate/' . $token, 'POST', $content);
    }
}

// Kullanım
$artcen = new ArtCenAPI('YOUR_API_KEY');

try {
    // Banner oluştur
    $templates = $artcen->getTemplates([
        'dimensionX' => 1200,
        'dimensionY' => 500
    ]);

    $template = $templates['data'][0];
    
    $design = $artcen->generateDesign($template['token'], [
        'texts' => [
            ['text' => 'Büyük İndirim'],
            ['text' => 'Sadece Bu Hafta']
        ],
        'images' => [
            ['src' => 'https://example.com/banner-bg.jpg']
        ]
    ]);

    echo "Tasarım URL: " . $design['data']['url'];
    
} catch (Exception $e) {
    echo "Hata: " . $e->getMessage();
}
?>

Python Example

Example of using ArtCen API with Python:

Python
import requests
import json

class ArtCenAPI:
    def __init__(self, api_key):
        self.api_key = api_key
        self.base_url = 'https://app.artcen.net/api'
        self.headers = {
            'X-API-KEY': api_key,
            'Content-Type': 'application/json'
        }
    
    def request(self, endpoint, method='GET', data=None):
        url = f"{self.base_url}{endpoint}"
        
        if method == 'GET':
            response = requests.get(url, headers=self.headers)
        elif method == 'POST':
            response = requests.post(url, headers=self.headers, json=data)
        
        if response.status_code != 200:
            raise Exception(f"API Error: {response.status_code}")
        
        return response.json()
    
    def get_templates(self, **filters):
        params = '&'.join([f"{k}={v}" for k, v in filters.items()])
        return self.request(f"/get-templates?{params}")
    
    def get_template_info(self, token):
        return self.request(f"/get-information/{token}")
    
    def generate_design(self, token, content):
        return self.request(f"/generate/{token}", method='POST', data=content)

# Kullanım
artcen = ArtCenAPI('YOUR_API_KEY')

try:
    # Facebook cover oluştur
    templates = artcen.get_templates(dimensionX=1640, dimensionY=924)
    
    template = templates['data'][0]
    print(f"Template seçildi: {template['name']}")
    
    # Template bilgilerini al
    info = artcen.get_template_info(template['token'])
    print(f"Gereksinimler: {info['requirements']}")
    
    # Tasarım oluştur
    design = artcen.generate_design(template['token'], {
        'texts': [
            {'text': 'Hoş Geldiniz'},
            {'text': 'En İyi Hizmet İçin Buradayız'}
        ],
        'images': [
            {'src': 'https://example.com/cover-image.jpg'}
        ]
    })
    
    print(f"Tasarım oluşturuldu: {design['data']['url']}")
    
    # Farklı kalitelerde indir
    for size in design['data']['sizes']:
        print(f"{size['name']}: {size['url']}")
    
except Exception as e:
    print(f"Hata: {e}")

Webhooks

ArtCen offers webhook support that allows you to track design creation processes asynchronously.

Note: Note: Webhook feature is only available in Professional and Enterprise plans.

Webhook Setup

You can define your webhook URL through the dashboard. ArtCen sends webhooks on the following events:

  • design.created - Design successfully created
  • design.failed - Design creation failed
  • quota.warning - 80% of your API quota is full
  • quota.exceeded - Your API quota is full

Webhook Payload Example

JSON
{
    "event": "design.created",
    "timestamp": "2024-01-15T10:30:45.000Z",
    "data": {
        "design_id": "xYz9aBc3DeF",
        "template_token": "abc123xyz",
        "url": "https://app.artcen.net/sm/xYz9aBc3DeF",
        "user_id": "user_12345",
        "metadata": {
            "request_id": "req_98765",
            "processing_time": 1.234
        }
    }
}