API Documentation
Authentication
The PasteCode Public API uses API tokens to authenticate requests. You can get the API Token in your profile. Authentication to the API is performed using the Bearer auth method in the Authorization header. For example, set Authorization header while using cURL:
curl -H "Authorization: Bearer [API_TOKEN]"
Rate Limits
Public API uses rate limits to help manage the sheer volume of requests we receive. The rate limit is characterized by allowing a maximum number of requests within a time interval. For most of our routes, that limit is 10 requests every 60 seconds. However, we also have routes that have custom rate limits. If the endpoint you are using has a custom rate limit, you will find that information in the documentation of that route.
List all pastes
Lists all current pastes in your account
curl --location 'https://pastecode.dev/api/pastes' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer API_TOKEN'
Example response:
[
{
"url": "https://pastecode.dev/s/5EBCYRbWWp",
"uuid": "5EBCYRbWWp",
"title": "Untitled",
"exposure": "public",
"expiration": "never",
"isPassword": false,
"expirationAt": null,
"createdAt": "2023-08-25T17:05:36.184Z",
"updatedAt": "2023-08-25T17:05:36.184Z",
"pasteFiles": [
{
"filename": "paste1.sql",
"syntax": "tsql",
"language": "Transact-SQL",
"code": "DELETE FROM CUSTOMERS \r\nWHERE AGE = 25;",
"createdAt": "2023-08-25T17:05:36.200Z",
"updatedAt": "2023-08-25T17:05:36.200Z"
}
]
}
]
Create a new paste
curl --location 'https://pastecode.dev/api/pastes' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer API_TOKEN' \
--data '{
"title": "Title",
"exposure": "public",
"expiration": "never",
"pasteFiles": [
{
"syntax": "javascript",
"code": "console.log(1)"
},
{
"syntax": "tsql",
"code": "DELETE FROM CUSTOMERS \r\nWHERE AGE = 25;"
}
]
}'
Paste body
Parameter | Type | Required | Description |
---|---|---|---|
title | string | false | Paste title |
exposure | string | true | Exposure |
expiration | string | true | Expiration |
pasteFiles | array | true | Paste files |
pasteFiles[0][filename] | string | false | Filename |
pasteFiles[0][syntax] | string | true | Language |
pasteFiles[0][code] | string | true | Code |
Value | Description |
---|---|
public | Visible for all users |
unlisted | Invisible for others unless you share your paste link |
private | Can be viewed only by you |
Expiration - Paste will be removed after this time
Value | Description |
---|---|
never | Never |
burnAfterRead | Once accessed it will be permanently removed |
m10 | 10 minutes |
h1 | 1 hour |
d1 | 1 day |
w1 | 1 week |
m1 | 1 month |
m6 | 6 months |
y1 | 1 year |
Language | Code |
---|---|
1C | 1c |
4D | 4d |
ABAP | abap |
ABNF | abnf |
Access logs | accesslog |
Ada | ada |
Apex | apex |
Arduino (C++ w/Arduino libs) | arduino |
ARM assembler | armasm |
AVR assembler | avrasm |
ActionScript | actionscript |
Alan IF | alan |
Alan | ln |
AngelScript | angelscript |
Apache | apache |
AppleScript | applescript |
Arcade | arcade |
AsciiDoc | asciidoc |
AspectJ | aspectj |
AutoHotkey | autohotkey |
AutoIt | autoit |
Awk | awk |
Bash | bash |
Basic | basic |
BBCode | bbcode |
Blade (Laravel) | blade |
BNF | bnf |
BQN | bqn |
Brainfuck | brainfuck |
C# | csharp |
C | c |
C++ | cpp |
C/AL | cal |
C3 | c3 |
Cache Object Script | cos |
Candid | candid |
CMake | cmake |
COBOL | cobol |
Coq | coq |
CSP | csp |
CSS | css |
Cap’n Proto | capnproto |
Chaos | chaos |
Chapel | chapel |
Cisco CLI | cisco |
Clojure | clojure |
CoffeeScript | coffeescript |
CpcdosC+ | cpc |
Crmsh | crmsh |
Crystal | crystal |
cURL | curl |
Cypher (Neo4j) | cypher |
D | d |
Dafny | dafny |
Dart | dart |
Delphi | delphi |
Diff | diff |
Django | django |
DNS Zone file | dns |
Dockerfile | dockerfile |
DOS | dos |
dsconfig | dsconfig |
DTS (Device Tree) | dts |
Dust | dust |
Dylan | dylan |
EBNF | ebnf |
Elixir | elixir |
Elm | elm |
Erlang | erlang |
Excel | excel |
Extempore | extempore |
F# | fsharp |
FIX | fix |
Flix | flix |
Fortran | fortran |
FunC | func |
G-Code | gcode |
Gams | gams |
GAUSS | gauss |
GDScript | gdscript |
Gherkin | gherkin |
Glimmer and EmberJS | glimmer |
GN for Ninja | gn |
Go | go |
Grammatical Framework | gf |
Golo | golo |
Gradle | gradle |
GraphQL | graphql |
Groovy | groovy |
GSQL | gsql |
HTML, XML | xml |
HTTP | http |
Haml | haml |
Handlebars | handlebars |
Haskell | haskell |
Haxe | haxe |
High-level shader language | hlsl |
Hy | hy |
Ini, TOML | ini |
Inform7 | inform7 |
IRPF90 | irpf90 |
Iptables | iptables |
JSON | json |
Java | java |
JavaScript | javascript |
Jolie | jolie |
Julia | julia |
Kotlin | kotlin |
LaTeX | tex |
Leaf | leaf |
Lean | lean |
Lasso | lasso |
Less | less |
LDIF | ldif |
Lisp | lisp |
LiveCode Server | livecodeserver |
LiveScript | livescript |
LookML | lookml |
Lua | lua |
Macaulay2 | macaulay2 |
Makefile | makefile |
Markdown | markdown |
Mathematica | mathematica |
Matlab | matlab |
Maxima | maxima |
Maya Embedded Language | mel |
Mercury | mercury |
MIPS Assembler | mips |
Mint | mint |
mIRC Scripting Language | mirc |
Mizar | mizar |
MKB | mkb |
MLIR | mlir |
Mojolicious | mojolicious |
Monkey | monkey |
Moonscript | moonscript |
Motoko | motoko |
N1QL | n1ql |
NSIS | nsis |
Never | never |
Nginx | nginx |
Nim | nim |
Nix | nix |
Oak | oak |
Object Constraint Language | ocl |
OCaml | ocaml |
Objective C | objectivec |
OpenGL Shading Language | glsl |
OpenSCAD | openscad |
Oracle Rules Language | ruleslanguage |
Oxygene | oxygene |
Pascal | delphi |
PF | pf |
PHP | php |
PHP Template | php-template |
Papyrus | papyrus |
Parser3 | parser3 |
Perl | perl |
Pine Script | pine |
Plaintext | plaintext |
Pony | pony |
PostgreSQL & PL/pgSQL | pgsql |
PowerShell | powershell |
Processing | processing |
Prolog | prolog |
Properties | properties |
Protocol Buffers | proto |
Puppet | puppet |
Python | python |
Python profiler results | profile |
Python REPL | python-repl |
Q# | qsharp |
Q | q |
QML | qml |
R | r |
Razor CSHTML | cshtml |
ReasonML | reasonml |
Rebol & Red | redbol |
RenderMan RIB | rib |
RenderMan RSL | rsl |
Rexx | rexx |
RiScript | riscript |
RISC-V Assembly | riscvasm |
Roboconf | graph |
Robot Framework | robot |
RPM spec files | rpm-specfile |
Ruby | ruby |
Rust | rust |
RVT Script | rvt-script |
SAS | sas |
SCSS | scss |
SQL | sql |
STEP Part 21 | step21 |
Scala | scala |
Scheme | scheme |
Scilab | scilab |
SFZ | sfz |
Shape Expressions | shexc |
Shell | shell |
Smali | smali |
Smalltalk | smalltalk |
SML | sml |
Solidity | solidity |
Splunk SPL | spl |
Stan | stan |
Stata | stata |
Structured Text | iecst |
Stylus | stylus |
SubUnit | subunit |
Supercollider | supercollider |
Svelte | svelte |
Swift | swift |
Tcl | tcl |
Terraform (HCL) | terraform |
Test Anything Protocol | tap |
Thrift | thrift |
Toit | toit |
TP | tp |
Transact-SQL | tsql |
Twig | twig |
TypeScript | typescript |
VB.Net | vbnet |
VBA | vba |
VBScript | vbscript |
VHDL | vhdl |
Vala | vala |
Verilog | verilog |
Vim Script | vim |
Vue.js | vue |
X# | xsharp |
X++ | axapta |
x86 Assembly | x86asm |
x86 Assembly (AT&T) | x86asmatt |
XL | xl |
XQuery | xquery |
YAML | yaml |
ZenScript | zenscript |
Zephir | zephir |
Retrieve a paste
curl --location 'https://pastecode.dev/api/pastes/izT9LekwX6' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer API_TOKEN'
If the password has been set on the paste, then to get the pasteFiles
add to request query parameter ?password=value
Example response:
{
"url": "https://pastecode.dev/s/izT9LekwX6",
"uuid": "izT9LekwX6",
"title": "Title",
"exposure": "public",
"expiration": "never",
"isPassword": false,
"expirationAt": null,
"createdAt": "2023-09-02T05:34:10.973Z",
"updatedAt": "2023-09-02T05:34:10.973Z",
"pasteFiles": [
{
"filename": "file1.js",
"syntax": "javascript",
"language": "JavaScript",
"code": "console.log(1)",
"createdAt": "2023-09-02T05:34:10.989Z",
"updatedAt": "2023-09-02T05:34:10.989Z"
}
]
}
Delete a paste
curl --location --request DELETE 'https://pastecode.dev/api/pastes/izT9LekwX6' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer API_TOKEN'
Response:
{
"message": "success"
}