API Documentation

POST /item

Add a new item
https://api.vendbits.com/v1/item

Parameters

api_token required string API token
title required string Title of Item
Must be 20-82 characters
description required string Description of Item
Must be 20-2000 characters
price_usd required decimal Price of Item in USD
Minimum 0.50
quantity required int/string [a number or string 'unlimited'] Quantity to be sold of Item
category required int ID of category of Item
vend_message required string Message revealed to buyer upon purchase which can contain logins or URLs to download files purchased
Minimum 20 characters
status optional int [1 = online, 2 = paused] Online status of Item (default = 1)
expiration optional int/datetime Date & Time in yyyy-mm-dd hh:mm:ss UTC datetime format to close item listing (default = 0)
accept_paypal optional boolean [true / 1 = accept, false / 0 = do not accept] Accept PayPal for Item
accept_stripe optional boolean [true / 1 = accept, false / 0 = do not accept] Accept Stripe for Item
accept_btc optional boolean [true / 1 = accept, false / 0 = do not accept] Accept Bitcoin (BTC) for Item
accept_bch optional boolean [true / 1 = accept, false / 0 = do not accept] Accept Bitcoin Cash (BCH) for Item
tags optional string Comma separated tags for Item
watermark_images optional boolean [true / 1 = watermark images] Apply watermark to preview images
preview_images optional array Array of preview images for Item which are shown on item page (first image in array set as default)
preview_images_titles optional array Array of titles for preview images
vend_images optional array Array of images for Item which are only shown upon purchase
vend_images_titles optional array Array of titles for vend images
preview_audio optional array Array of preview audio files for Item which are shown on item page (first audio in array set as default)
preview_audio_titles optional array Array of titles for preview audio
vend_audio optional array Array of audio files for Item which are only shown upon purchase
vend_audio_titles optional array Array of titles for vend audio
preview_videos optional array Array of preview video files for Item which are shown on item page (first video in array set as default)
preview_videos_titles optional array Array of titles for preview videos
vend_videos optional array Array of video files for Item which are only shown upon purchase
vend_videos_titles optional array Array of titles for preview videos

Example cURL Request

$ curl -X POST -H "Content-Type: multipart/form-data" \
-F "title=This is the Item Title" \
-F "description=This is the Item Description" \
-F "price_usd=3.5" \
-F "accept_paypal=1" \
-F "quantity=unlimited" \
-F "category=1" \
-F "watermark_images=1" \
-F "vend_message=Thank you for your purchase. Here are your files..." \
-F "preview_images[]=@/path/to/file/image.jpg" \
-F "preview_images[]=@/path/to/file/image2.jpg" \
-F "preview_images_titles[]=Image Title " \
-F "preview_images_titles[]=Image Title 2" \
-F "vend_images[]=@/path/to/file/premium-image.jpg" \
-F "vend_images[]=@/path/to/file/premium-image2.jpg" \
-F "vend_images_titles[]=Image Title " \
-F "vend_images_titles[]=Image Title 2" \
https://api.vendbits.com/v1/item?api_token=API_TOKEN

Example Response

{
    "item_id": AbCdE12345,
    "visibility": "public",
    "url": "https://vendbits.com/item/AbCdE12345",
    "title": "This is the item title",
    "description": "This is the item description",
    "price_usd": "3.50",
    "accept_paypal": true,
    "accept_stripe": true,
    "accept_btc": false,
    "accept_bch": false,
    "category": {
        "category": "Audio",
        "url": "https://vendbits.com/category/audio"
    },
    "tags": [
        {
            "tag": "tag",
            "url": "https://vendbits.com/tag/tag"
        },
        {
            "tag": "tag2",
            "url": "https://vendbits.com/tag/tag2"
        },
        {
            "tag": "tag3",
            "url": "https://vendbits.com/tag/tag3"
        }
    ],
    "reviews_total": 12,
    "reviews_avg": 4.60,
    "seller": {
        "username": "funnyman",
        "url": "https://vendbits.com/funnyman",
        "avatar": "https://vendbits.com/images/no-avatar.png",
        "reviews_total": 24,
        "reviews_avg": 4.80
    },
    "quantity_remaining": "unlimited",
    "expiration": null,
    "vend_message": "Thank you for your purchase. Here are your files...",
    "default_preview_image_thumb": [
        {
            "image_id": 1,
            "src": "https://vendbits.com/images/t_kJDyFTJNnkVk2cv9A1X1sqfMXCct8A.png",
            "width": 222,
            "height": 252,
            "filesize": 62998
        }
    ],
    "preview_images_thumbs": [
        {
            "image_id": 1,
            "src": "https://vendbits.com/images/t_kJDyFTJNnkVk2cv9A1X1sqfMXCct8A.png",
            "width": 222,
            "height": 252,
            "filesize": 62998
        },
        {
            "image_id": 2,
            "src": "https://vendbits.com/images/t_gAiETXTU0YyNsXBvO2bnLPhaceFeFT.jpg",
            "width": 252,
            "height": 189,
            "filesize": 1122239
        }
    ],
    "default_preview_image": [
        {
            "image_id": 1,
            "src": "https://vendbits.com/images/kJDyFTJNnkVk2cv9A1X1sqfMXCct8A.png",
            "width": 510,
            "height": 578,
            "filesize": 62998
        }
    ],
    "preview_images": [
        {
            "image_id": 1,
            "src": "https://vendbits.com/images/kJDyFTJNnkVk2cv9A1X1sqfMXCct8A.png",
            "width": 510,
            "height": 578,
            "filesize": 62998
        },
        {
            "image_id": 2,
            "src": "https://vendbits.com/images/gAiETXTU0YyNsXBvO2bnLPhaceFeFT.jpg",
            "width": 4032,
            "height": 3024,
            "filesize": 1122239
        }
    ],
    "vend_images": [
        {
            "image_id": 3,
            "src": "https://vendbits.com/images/ZjX2jtYAUiF9IUHw442F6uDJdZGI6z.png",
            "width": 1334,
            "height": 750,
            "filesize": 1892782
        }
    ],
    "default_preview_audio": [
        {
            "audio_id": 1,
            "src": "https://vendbits.com/audio/7oQZjiLvzr3mNEeDJYzgGtqfjyrVuR.mp4",
            "duration": 6,
            "filesize": 6451477
        }
    ],
    "preview_audio": [
        {
            "audio_id": 1,
            "src": "https://vendbits.com/audio/7oQZjiLvzr3mNEeDJYzgGtqfjyrVuR.mp4",
            "duration": 6,
            "filesize": 6451477
        }
    ],
    "vend_audio": [
        {
            "audio_id": 2,
            "src": "https://vendbits.com/audio/1VCT9chpclFAQhqkQoPhbk7gYVOGjz.wav",
            "duration": 86,
            "filesize": 16473678
        },
        {
            "audio_id": 3,
            "src": "https://vendbits.com/audio/o6f2sRBC6e5LemV39nXj5Wi2nU7w5w.mp3",
            "duration": 1,
            "filesize": 5616
        }
    ],
    "default_preview_video": [
        {
            "video_id": 1,
            "src": "https://vendbits.com/videos/ilFBF7ICacfBk0n8D2yg4RjpwzhKmf.mov",
            "duration": 8,
            "filesize": 6938057,
            "compat_src": "https://vendbits.com/videos/ilFBF7ICacfBk0n8D2yg4RjpwzhKmf.mp4",
            "compat_filesize": 984765
        }
    ],
    "preview_videos": [
        {
            "video_id": 1,
            "src": "https://vendbits.com/videos/ilFBF7ICacfBk0n8D2yg4RjpwzhKmf.mov",
            "duration": 8,
            "filesize": 6938057,
            "compat_src": "https://vendbits.com/videos/ilFBF7ICacfBk0n8D2yg4RjpwzhKmf.mp4",
            "compat_filesize": 984765
        }
    ],
    "vend_videos": [
        {
            "video_id": 2,
            "src": "https://vendbits.com/videos/7KujavAHpCunAXoAEnAnhcwobUREKI.mp4",
            "duration": 8,
            "filesize": 6938057,
            "compat_src": "https://vendbits.com/videos/7KujavAHpCunAXoAEnAnhcwobUREKI.mp4",
            "compat_filesize": 984765
        }
    ]
}

HTTP Status Response Codes

201 - Item data is returned.
202 - Partial item data is returned while processing. This response is given while uploaded media files are converting to compatible file formats.
401 - API Token (api_token parameter) incorrect.
422 - Data did not validate.
Response Note: The successful response will be the same as the /item/{id} endpoint and return the item data.

PHP Code Example

<?php
/* set new item details */
$postData = array(
      
'api_token' => 'API_KEY',
      
'title' => 'This is the Item Title',
      
'description' => 'This is the Item Description',
      
'price_usd' => 2.5,
      
'accept_paypal' => 1,
      
'quantity' => 'unlimited',
      
'expiration' => 0,
      
'category' => 1,
      
'watermark_images' => 1,
      
'tags' => 'tag1,tag2,tag3',
      
'vend_message' => 'Thank you for your purchase!',
);

/* set media files (optional) */
$preview_images = array(
    
'/path/to/file/photo.jpg',                                                 
);                  

$vend_images = array(
    
'/path/to/file/premium-photo.jpg',          
);  

$preview_audio = array( 
    
'/path/to/file/audio.wav',    
);

$vend_audio = array( 
    
'/path/to/file/premium-audio.wav',   
);

$preview_videos = array( 
    
'/path/to/file/video.mp4',   
);

$vend_video = array( 
    
'/path/to/file/video.mp4',
);

$preview_images_titles = array(
    
'preview photo title',                                                                                               
);  

$vend_images_titles = array(
    
'vend photo title',                                                                                               
);  

$preview_audio_titles = array(
    
'preview audio title',                                                                                               
);

$vend_audio_titles = array(
    
'vend audio title',                                                                                               
);

$preview_videos_titles = array(
    
'preview videos title',                                                                                               
);

$vend_videos_titles = array(
    
'vend videos title',                                                                                               
);

/* no need to edit below */
$ch curl_init('https://api.vendbits.com/v1/item');
curl_setopt($chCURLOPT_HEADER0);
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
curl_setopt($chCURLOPT_POSTtrue);
curl_setopt($chCURLOPT_TIMEOUT30);

// Create array of files to post
foreach ($preview_images as $index => $image) {
    
$postData['preview_images[' $index ']'] = curl_file_create(
        
realpath($image),
        
mime_content_type($image),
        
basename($image)
    );
}

foreach (
$vend_images as $index => $image) {
    
$postData['vend_images[' $index ']'] = curl_file_create(
        
realpath($image),
        
mime_content_type($image),
        
basename($image)
    );
}

foreach (
$preview_audio as $index => $audio) {
    
$postData['preview_audio[' $index ']'] = curl_file_create(
        
realpath($audio),
        
mime_content_type($audio),
        
basename($audio)
    );
}

foreach (
$vend_audio as $index => $audio) {
    
$postData['vend_audio[' $index ']'] = curl_file_create(
        
realpath($audio),
        
mime_content_type($audio),
        
basename($audio)
    );
}

foreach (
$preview_videos as $index => $video) {
    
$postData['preview_videos[' $index ']'] = curl_file_create(
        
realpath($video),
        
mime_content_type($video),
        
basename($video)
    );
}

foreach (
$vend_videos as $index => $video) {
    
$postData['vend_videos[' $index ']'] = curl_file_create(
        
realpath($video),
        
mime_content_type($video),
        
basename($video)
    );
}            

// media file titles
foreach ($preview_images_titles as $index => $title) {
    
$postData['preview_images_titles[' $index ']'] = $title;
}

foreach (
$vend_images_titles as $index => $title) {
    
$postData['vend_images_titles[' $index ']'] = $title;
}

foreach (
$preview_audio_titles as $index => $title) {
    
$postData['preview_audio_titles[' $index ']'] = $title;
}

foreach (
$vend_audio_titles as $index => $title) {
    
$postData['vend_audio_titles[' $index ']'] = $title;
}

foreach (
$preview_videos_titles as $index => $title) {
    
$postData['preview_videos_titles[' $index ']'] = $title;
}

foreach (
$vend_videos_titles as $index => $title) {
    
$postData['vend_videos_titles[' $index ']'] = $title;
}

curl_setopt($chCURLOPT_POSTFIELDS$postData );
$response curl_exec($ch); ?>