API endpoint for creating pastes. Compatible with Pastebin API but only supports the "paste" option.
Method: POST
URL: /api.php
| Name | Type | Required | Description | 
|---|---|---|---|
| api_dev_key | string | Yes | Your API key obtained from user management. | 
| api_option | string | Yes | Must be "paste". Other options are not supported and will return an error. | 
| api_paste_code | string | Yes | The content/text of the paste. Cannot be empty. | 
| api_paste_private | integer | No | Privacy level: 0 (public), 1 (unlisted), 2 (private). Default: 0. Note: Private pastes are only accessible by the owner, but this API does not yet enforce viewing restrictions for private. | 
| api_paste_name | string | No | Optional title/name for the paste. Used in viewing page. | 
| api_paste_expire_date | string | No | Expiration time: "N" (never), "10M" (10 minutes), "1H" (1 hour), "1D" (1 day), "1W" (1 week), "2W" (2 weeks), "1M" (1 month), "3M" (3 months), "6M" (6 months), "1Y" (1 year). Default: "N". | 
| api_paste_format | string | No | Syntax highlighting format (e.g., "php", "css", "python"). Default: auto-detect. | 
On success, returns the full URL of the created paste (e.g., https://mcbin.dev/abcdef12).
https://mcbin.dev/abcdef12
        | Message | Description | 
|---|---|
| Error 0: Only POST allowed | Only POST requests are allowed. | 
| Error 1: Bad API request, missing api_dev_key | API key is required. | 
| Error 2: Bad API request, invalid api_dev_key | API key is invalid or does not exist. | 
| Error 3: Bad API request, missing api_option | api_option parameter is required. | 
| Error 4: Bad API request, unsupported api_option | Only "paste" is supported. | 
| Error 5: Bad API request, missing api_paste_code | Paste content is required. | 
| Error 6: Bad API request, api_paste_code was empty | Paste content cannot be empty or just whitespace. | 
| Error 7: Paste limit exceeded for your account | User has reached rate or storage limits. | 
| Error 8: [exception message] | Internal server error, e.g., database issues. | 
curl -X POST https://mcbin.dev/api.php \
     -d "api_dev_key=your_api_key" \
     -d "api_option=paste" \
     -d "api_paste_code=Hello, world!" \
     -d "api_paste_name=Example Paste" \
     -d "api_paste_expire_date=1D" \
     -d "api_paste_format=text"
            
        <?php
$url = 'https://mcbin.dev/api.php';
$data = [
    'api_dev_key' => 'your_api_key',
    'api_option' => 'paste',
    'api_paste_code' => 'Hello, world!',
    'api_paste_name' => 'Example Paste',
    'api_paste_expire_date' => '1D',
    'api_paste_format' => 'text',
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
            
        import requests
url = 'https://mcbin.dev/api.php'
data = {
    'api_dev_key': 'your_api_key',
    'api_option': 'paste',
    'api_paste_code': 'Hello, world!',
    'api_paste_name': 'Example Paste',
    'api_paste_expire_date': '1D',
    'api_paste_format': 'text',
}
response = requests.post(url, data=data)
print(response.text)