ℹ️ Your data is safe here... unless you make the SNIP gods angry. And let's just say they have a really bad sense of humor.

Create pastes from the commandline

API URL

https://p.libren.ms/api

Get paste

https://p.libren.ms/api/paste/[pasteid]

Get random paste

https://p.libren.ms/api/random

Get recent pastes

https://p.libren.ms/api/recent

Get trending pastes

https://p.libren.ms/api/trending

List available languages

https://p.libren.ms/api/langs

Create a paste

https://p.libren.ms/api/create

POST parameters

text=[your paste text]

The paste content. Required.

title=[title]

Title for the paste.

name=[name]

The author's name.

private=1

Make paste private.

lang=[language]

Use alternative syntax highlighting.
Possible values: text, html5, css, javascript, php, python, ruby, lua, bash, erlang, go, c, cpp, diff, latex, sql, xml, 4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript, actionscript3, ada, aimms, algol68, apache, applescript, apt_sources, arm, asm, asymptote, asp, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, basic4gl, bbcode, bf, bibtex, blitzbasic, bnf, boo, c_loadrunner, c_mac, c_winapi, caddcl, cadlisp, cfdg, cfm, chaiscript, chapel, cil, clojure, cmake, cobol, coffeescript, cpp-winapi, csharp, cuesheet, d, dart, dcs, dcl, dcpu16, delphi, div, dos, dot, e, ecmascript, eiffel, email, epc, euphoria, ezt, f1, falcon, fo, fortran, freebasic, freeswitch, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, groovy, gwbasic, haskell, haxe, hicest, hq9plus, html4strict, icon, idl, ini, inno, intercal, io, ispfpanel, j, java, java5, jcl, jquery, klonec, klonecpp, kotlin, lb, ldif, lisp, llvm, locobasic, logcat, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, m68k, magiksf, make, mapbasic, matlab, mirc, mmix, modula2, modula3, mpasm, mxml, mysql, nagios, netrexx, newlisp, nginx, nimrod, nsis, oberon2, objc, objeck, ocaml, octave, oobas, oorexx, oracle11, oracle8, oxygene, oz, parasail, parigp, pascal, pcre, per, perl, perl6, pf, pic16, pike, pixelbender, pli, plsql, postgresql, postscript, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pys60, q, qbasic, qml, racket, rails, rbs, rebol, reg, rexx, robots, roff, rpmspec, rsplus, rust, sas, scala, scheme, scilab, scl, sdlbasic, smalltalk, smarty, spark, sparql, sshconfig, standardml, stonescript, systemverilog, tcl, teraterm, thinbasic, tsql, typoscript, unicon, uscript, upc, urbi, vala, vb, vbnet, vbscript, vedit, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, wolfram, xbasic, xorg_conf, xpp, yaml, z80, zxbasic

expire=[minutes]

Set paste expiration.

reply=[pasteid]

Reply to existing paste.

Return values

On success, the API returns the paste URL: {"url":"https://p.libren.ms/view/[pasteid]"}
On error, the API returns the error message: {"error":"Missing paste text"}

Examples

Create paste

curl -d text='this is my text' https://p.libren.ms/api/create

Create a paste with the text 'this is my text'.

Create paste from a file

curl -d private=1 -d name=Herbert --data-urlencode text@/etc/passwd https://p.libren.ms/api/create

Create a private paste with the author 'Herbert' and the contents of '/etc/passwd'.

Create paste from a php file

curl -d lang=php --data-urlencode text@main.php https://p.libren.ms/api/create

Create a paste with PHP syntax highlighting.

Create paste via a pipe

echo foo | curl --data-urlencode text@- https://p.libren.ms/api/create

Create a paste based on standard output of a command.

Create paste via a pipe with sudo, text format, setting the author and a 30 minute expiry

sudo dmesg | curl -d private=1 -d lang=text -d name=`whoami` -d expire=30 --data-urlencode text@- https://p.libren.ms/api/create

Create a paste based capturing sudo dmesg and showing how to employ optional parameters to the paste creation.

Get paste ;-)

curl https://p.libren.ms/view/raw/[pasteid]

Display paste.