You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
paste has a simple HTTP API which can be used to read and write pastes programmatically.
7
+
8
+
> [!IMPORTANT]
9
+
> If you are using the official instance of paste (https://pastes.dev), please note the following:
10
+
>
11
+
> * You must **provide a `User-Agent` header** to uniquely identify your application in all requests. This should include the application name and contact information, e.g. `ExampleApp (github.com/ExampleUser/ExampleApp)` or `MyExampleScript (github.com/ExampleUser)`.
12
+
> * You must **only upload content when prompted by a user action**, e.g. a button click or command line input. Automated or scheduled uploads are not allowed.
13
+
> * An additional **terms of service** applies. In summary:
14
+
> * No Illegal Use *(no illegal, harmful or unlawful content)*
15
+
> * No Malicious Content *(no malware, phishing, personal data without consent, etc.)*
16
+
> * Content Responsibility *(you are responsible for what you post)*
17
+
> * Moderation *(we reserve the right to remove content or block access)*
18
+
> * No Liability *(the service is provided "as is" without warranties)*
19
+
>
20
+
> Otherwise, please enjoy using the service! :)
21
+
22
+
### Base URL
23
+
The base URL for the 'official' paste instance is: `https://api.pastes.dev/`.
24
+
25
+
If you are self-hosting, use the base URL of your own instance. With the default Docker Compose setup, this will be `http://localhost:8080/data/`.
26
+
27
+
## Upload: `POST {BASE URL}/post`
28
+
29
+
To upload content, send an HTTP `POST` request to `{BASE URL}/post`.
30
+
31
+
* Include the content in the request body.
32
+
* Specify the language with the `Content-Type: text/<language>` header
33
+
* If using the official instance, please remember to provide a suitable `User-Agent` header as well. (see above for more details)
34
+
* The paste "key" is returned in the `Location` header, and in the response body as a JSON object in the format `{"key": "<key>"}`.**
35
+
36
+
## Read: `GET {BASE URL}/{key}`
37
+
38
+
To read content, send an HTTP `GET` request to `{BASE URL}/{key}`.
39
+
40
+
* Replace `{key}` with the id of the paste.
41
+
* The content is returned in the response body.
42
+
* The `Content-Type` header is `text/<language>`, where language is the id of the language the paste was saved with.
<summary>If curl isn't installed on your system, you can also post using <b>netcat</b>.</summary>
28
-
29
-
```shell
30
-
# Pipe in some output from any command
31
-
>echo"Hello world"| nc nc.pastes.dev 1337
32
-
33
-
# Upload the contents of a file
34
-
> cat example.txt | nc nc.pastes.dev 1337
35
-
```
36
-
</details>
37
-
38
26
<details>
39
27
<summary>If you don't want to do so much typing, you can create a shorter <b>alias</b>.</summary>
40
28
@@ -56,8 +44,8 @@ You can submit content most easily using [curl](https://curl.se/docs/manpage.htm
56
44
```
57
45
</details>
58
46
59
-
##### 3) From Code
60
-
Send GET/POST/PUT requests to `https://api.pastes.dev/`. More info [below](#pastesdev-api).
47
+
##### 3) From Code / Scripts
48
+
Please see the [API Documentation](/API.md). :)
61
49
62
50
___
63
51
@@ -66,28 +54,6 @@ The frontend _(this repository)_ is written using the React framework. The backe
66
54
67
55
The user-interface is based on the [Monaco Editor](https://microsoft.github.io/monaco-editor/), the engine behind the popular Visual Studio Code text editor. It's quite simple; it supports syntax highlighting, automatic indentation, many supported languages, themes, zooming in/out, linking to specific lines or sections, and more!
68
56
69
-
### pastes.dev
70
-
71
-
I host a public instance at https://pastes.dev. Please feel free to use it to share code/configs/whatever!
72
-
73
-
Please note that the following (very-non-legally worded) [terms of service](https://github.com/lucko/bytebin#public-instances) apply.
74
-
If you come across any content which is illegal or infringes on copyright, please [get in touch](https://lucko.me/contact) and let me know so I can remove it.
75
-
76
-
Uploaded content is retained for 90 days then deleted.
77
-
78
-
### pastes.dev API
79
-
80
-
* To **read** content, send a HTTP `GET` request to `https://api.pastes.dev/<key>`.
81
-
* Replace `<key>` with the id of the paste.
82
-
* The content is returned in the response body.
83
-
* The `Content-Type` header is `text/<language>`, where language is the id of the language the paste was saved with.
84
-
* To **upload** content, send a HTTP `POST` request to `https://api.pastes.dev/post`.
85
-
* Include the content in the request body.
86
-
* Specify the language with the `Content-Type: text/<language>` header, and please provide a `User-Agent` header too.
87
-
* The paste "key" is returned in the `Location` header, or in the response body as a JSON object in the format `{"key": "<key>"}`.
88
-
89
-
The API is powered by the [bytebin](https://github.com/lucko/bytebin) service, so more information about how it works can be found there.
0 commit comments