A pure Dart Pastebin API Wrapper.


This package covers every endpoint disclosed in Pastebin API documentation (as of 16 May, 2022). The following table links the endpoints to the respective package functions:

API Endpoints Function Description
/api/api_post.php (2-8) paste(pasteText, options) Publishes a paste (with support for optional parameters) in Pastebin.
/api/api_login.php (9) apiUserKey(username, password) Retrieves and refreshes user API key (not developer key).
/api/api_post.php (10) pastes(userKey, limit=50) Fetches an user pastes, with support for limiting how many pastes are returned.
/api/api_post.php (11) delete(pasteKey, userKey) Deletes an user paste.
/api/api_post.php (12) userInfo(userKey) Obtains user information and settings.
/api/api_raw.php (13) rawPaste(pasteKey, visibility, userKey) Gets the raw paste (full text) of a user paste.
/api/raw.php (14) rawPaste(pasteKey, visibility) Gets the raw paste (full text) of paste.

There is also support for multiple API key ingestion, a neat feature for making sure that pastes are published, even if you are rate limited by Pastebin.

// Using Official Pastebin API with a single API Dev Key
var pastebinClient = withSingleApiDevKey(
    apiDevKey: primaryApiDevKey,

// Using Official Pastebin API with multiple API Dev Key
pastebinClient = withMultipleApiDevKey(
    apiDevKeys: [

Side Effects

Powered by Dart null sound + dartz monads, this package is free of null issues and side effects. This is to prevent the throw of any exception that may not be known and caught by developers, and to make sure that information is consistent by contract.

Every HTTP request returns an Either monad that either returns the response result on the right hand, or ResponseError instance on the left hand that is typed to each possible Pastebin error (see available errors here).

Why use pastebin.dart?

The main use case that inspired the development of this package, is to provide developers (mostly indie) a way to publish and read app logs for free.

Bugs and Contributions

Found any bug (including typos) in the package? Do you have any suggestion or feature to include for future releases? Please create an issue via GitHub in order to track each contribution. Also, pull requests are very welcome!


This is not an official library/SDK implemented by the Pastebin team, but rather a developer implementation that uses it.