Pastebin

Pastebin

Cloud Storage & File Sharing

Plain Text Storage & share with unique URL.

Visit API

📚 Documentation & Examples

Everything you need to integrate with Pastebin

🚀 Quick Start Examples

Pastebin Javascript Examplejavascript
// Pastebin API Example
const response = await fetch('https://pastebin.com/api/', {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json'
    }
});

const data = await response.json();
console.log(data);

Introducing Pastebin API

Pastebin is a website where users can store and share codes with others. It provides an API for developers to interact with the platform programmatically. This blog will cover the basics of the Pastebin API and provide example code in JavaScript.

Getting started with Pastebin API

To use the API, you will need to sign up for a Pastebin account and get an API key. You can get an API key by visiting the Developer API documentation. You can then use this API key to make requests to the Pastebin API.

Pastebin API in JavaScript

Here are a few examples of how to use the Pastebin API in JavaScript:

Creating a new paste

const axios = require('axios');
const data = {
    api_dev_key: "YOUR_API_KEY",
    api_option: "paste",
    api_paste_code: "console.log('Hello, world!');",
    api_paste_name: "My New Paste",
    api_paste_expire_date: "N"
}
axios.post('https://pastebin.com/api/api_post.php', data)
  .then(function (response) {
    console.log(response.data);
  })
  .catch(function (error) {
    console.log(error);
  });

Listing pastes for a user

const axios = require('axios');
const data = {
    api_dev_key: "YOUR_API_KEY",
    api_option: "list",
    api_user_key: "USER_API_KEY"
}
axios.post('https://pastebin.com/api/api_post.php', data)
  .then(function (response) {
    console.log(response.data);
  })
  .catch(function (error) {
    console.log(error);
  });

Getting paste information

const axios = require('axios');
const data = {
    api_dev_key: "YOUR_API_KEY",
    api_option: "show_paste",
    api_paste_key: "PASTE_KEY"
}
axios.post('https://pastebin.com/api/api_post.php', data)
  .then(function (response) {
    console.log(response.data);
  })
  .catch(function (error) {
    console.log(error);
  });

These are just a few examples of how to use the Pastebin API in JavaScript. To view the full list of API methods and parameters, visit the Pastebin API documentation.

📊 30-Day Uptime History

Daily uptime tracking showing online vs offline minutes

Jun 2Jun 4Jun 6Jun 8Jun 10Jun 12Jun 14Jun 16Jun 18Jun 20Jun 22Jun 24Jun 26Jun 28Jul 104008001440Minutes
Online
Offline

Related APIs in Cloud Storage & File Sharing