This repository was archived by the owner on Jun 11, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.yaml
More file actions
591 lines (570 loc) · 17.2 KB
/
openapi.yaml
File metadata and controls
591 lines (570 loc) · 17.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
openapi: 3.1.0
info:
title: BePasted API
description: |
API for BePasted, a free, no-login paste service prioritizing privacy, simplicity, and security.
This API allows programmatic access to create and retrieve pastes with various privacy features including:
- Password protection
- Time-based expiry
- View-based expiry
- Raw content access control
Please note that rate limiting is in effect: 10 paste creations per minute per IP.
version: 2.0.1
contact:
name: BePasted
url: https://bepasted.com
license:
name: ISC
url: https://opensource.org/licenses/ISC
servers:
- url: https://bepasted.com
description: Production server
- url: http://localhost:3000
description: Local development server
tags:
- name: Paste
description: Operations related to pastes
- name: Authentication
description: Operations related to private paste authentication
paths:
/paste:
post:
tags:
- Paste
summary: Create a new paste
description: |
Creates a new paste with options for privacy, expiration, and more.
**Rate Limiting**: 10 paste creations per minute per IP
**Security**: Requires Cloudflare Turnstile token for verification
operationId: createPaste
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreatePasteRequest'
examples:
singleTabPublic:
summary: Simple public paste
value:
tabs:
- id: 0
name: "main.js"
content: "console.log('Hello, world!');"
isPrivate: false
allowRaw: true
token: "1x00000000000000000000AA"
multiTabPrivate:
summary: Multi-tab private paste with expiry
value:
tabs:
- id: 0
name: "index.html"
content: "<html><body><h1>Hello world</h1></body></html>"
- id: 1
name: "style.css"
content: "body { font-family: Arial, sans-serif; }"
isPrivate: true
password: "secret123"
expiry:
value: 7
unit: "days"
token: "1x00000000000000000000AA"
responses:
'200':
description: Paste created successfully
content:
application/json:
schema:
type: object
properties:
id:
type: string
description: Unique ID of the created paste
example: "a1b2c3d4"
'400':
description: Invalid input
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
examples:
validation:
value:
error: "At least one tab with content is required"
size:
value:
error: "Paste size exceeds limit"
details:
totalSize: 2200000
maxSize: 2097152
maxSizeFormatted: "2MB"
'413':
description: Request entity too large
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: "Request entity too large"
maxSize: "25MB"
'429':
description: Rate limit exceeded
content:
application/json:
schema:
$ref: '#/components/schemas/RateLimitError'
example:
error: "Rate limit exceeded. Please try again later."
timeLeft: 42000
security:
- turnstileAuth: []
/api/paste/{id}:
get:
tags:
- Paste
summary: Get a paste by ID
description: |
Retrieves a paste by its unique ID. If the paste is private, a password must be provided.
For private pastes, you should first verify the password using the /paste/{id}/verify-password endpoint.
operationId: getPaste
parameters:
- name: id
in: path
description: The unique ID of the paste
required: true
schema:
type: string
- name: password
in: query
description: Password for private pastes
required: false
schema:
type: string
responses:
'200':
description: Paste retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Paste'
'401':
description: Password required or invalid
content:
application/json:
schema:
type: object
properties:
error:
type: string
example: "Password required"
isPrivate:
type: boolean
example: true
attemptsRemaining:
type: integer
example: 5
'404':
description: Paste not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: "Paste not found"
'410':
description: Paste has expired
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: "Paste has expired"
'429':
description: Too many password attempts
content:
application/json:
schema:
$ref: '#/components/schemas/RateLimitError'
example:
error: "Too many password attempts"
timeLeft: 55000
attemptsRemaining: 0
/api/paste/{id}/raw:
get:
tags:
- Paste
summary: Get raw paste content
description: |
Retrieves the raw content of a paste. This endpoint is only available for:
- Public pastes
- Single-tab pastes
- Pastes with allowRaw set to true
operationId: getRawPaste
parameters:
- name: id
in: path
description: The unique ID of the paste
required: true
schema:
type: string
responses:
'200':
description: Raw paste content
content:
text/plain:
schema:
type: string
example: "console.log('Hello, world!');"
'403':
description: Raw access not allowed
content:
text/plain:
schema:
type: string
example: "Raw access not allowed for this paste"
'404':
description: Paste not found
content:
text/plain:
schema:
type: string
example: "Paste not found"
'410':
description: Paste has expired
content:
text/plain:
schema:
type: string
example: "Paste has expired"
/paste/{id}/verify-password:
post:
tags:
- Authentication
summary: Verify password for a private paste
description: |
Verifies if the provided password is correct for a private paste.
**Rate Limiting**: 6 password attempts per minute per paste per IP
This endpoint should be used before attempting to access a private paste.
operationId: verifyPassword
parameters:
- name: id
in: path
description: The unique ID of the paste
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- password
properties:
password:
type: string
description: Password for the private paste
example:
password: "secret123"
responses:
'200':
description: Password verification result
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
description: Whether the password is correct
example: true
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
examples:
missingPassword:
value:
error: "Password is required"
notPrivate:
value:
error: "Paste is not private"
'401':
description: Invalid password
content:
application/json:
schema:
type: object
properties:
error:
type: string
example: "Invalid password"
attemptsRemaining:
type: integer
example: 5
'404':
description: Paste not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: "Paste not found"
'410':
description: Paste has expired
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: "Paste has expired"
'429':
description: Too many password attempts
content:
application/json:
schema:
$ref: '#/components/schemas/RateLimitError'
example:
error: "Too many password attempts"
timeLeft: 55000
attemptsRemaining: 0
/paste/{id}/report:
post:
tags:
- Paste
summary: Report a paste
description: |
Reports a paste for review by administrators.
**Rate Limiting**: 3 reports per minute per IP
operationId: reportPaste
parameters:
- name: id
in: path
description: The unique ID of the paste
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- reason
properties:
reason:
type: string
description: Reason for reporting the paste
example: "Contains malicious code"
responses:
'200':
description: Paste reported successfully
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
example: true
message:
type: string
example: "Paste reported successfully"
'400':
description: Invalid input
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: "Reason is required"
'404':
description: Paste not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: "Paste not found"
/api/rate-limit-status:
get:
tags:
- Authentication
summary: Check rate limit status
description: |
Checks the current rate limit status for the client.
Redirects to home page if not rate-limited.
operationId: getRateLimitStatus
responses:
'200':
description: Rate limit status
content:
application/json:
schema:
type: object
properties:
timeLeft:
type: integer
description: Time left in milliseconds until rate limit resets
example: 35000
suspicious:
type: boolean
description: Whether this client is flagged as suspicious
example: false
'302':
description: Not rate limited, redirects to home page
components:
schemas:
Tab:
type: object
required:
- id
- name
- content
properties:
id:
type: integer
description: Tab index
example: 0
name:
type: string
description: Tab name (max 50 characters)
example: "main.js"
content:
type: string
description: Tab content (max 2MB per tab)
example: "console.log('Hello, world!');"
CreatePasteRequest:
type: object
required:
- tabs
- token
properties:
tabs:
type: array
description: Array of tabs (max 10)
items:
$ref: '#/components/schemas/Tab'
minItems: 1
maxItems: 10
isPrivate:
type: boolean
description: Whether the paste is private
default: false
password:
type: string
description: Password for private pastes (required if isPrivate is true)
minLength: 1
maxLength: 32
allowRaw:
type: boolean
description: Whether raw access is allowed. Only available for public, single-tab pastes.
default: false
expiry:
type: object
description: Expiry settings
properties:
value:
type: integer
description: Expiry value
minimum: 5
example: 7
unit:
type: string
description: Expiry unit
enum: [seconds, minutes, hours, days]
example: "days"
burnCount:
type: integer
description: Number of views after which paste expires
minimum: 1
maximum: 10000000000
example: 10
token:
type: string
description: Cloudflare Turnstile token for verification (required for bot protection)
example: "1x00000000000000000000AA"
Paste:
type: object
properties:
tabs:
type: array
description: Array of tabs
items:
$ref: '#/components/schemas/Tab'
isPrivate:
type: boolean
description: Whether the paste is private
example: false
allowRaw:
type: boolean
description: Whether raw access is allowed
example: true
expiry:
type: object
description: Expiry settings
properties:
value:
type: integer
description: Expiry value
example: 7
unit:
type: string
description: Expiry unit
enum: [seconds, minutes, hours, days]
example: "days"
expiresAt:
type: string
format: date-time
description: Expiry date in ISO format
example: "2023-12-31T23:59:59Z"
burnCount:
type: integer
description: Number of views after which paste expires
example: 10
currentViews:
type: integer
description: Current number of views
example: 3
createdAt:
type: string
format: date-time
description: Creation date in ISO format
example: "2023-12-24T12:00:00Z"
Error:
type: object
properties:
error:
type: string
description: Error message
example: "Paste not found"
details:
type: object
description: Additional error details
additionalProperties: true
RateLimitError:
type: object
properties:
error:
type: string
description: Error message
example: "Rate limit exceeded. Please try again later."
timeLeft:
type: integer
description: Time left in milliseconds until rate limit resets
example: 35000
attemptsRemaining:
type: integer
description: Remaining attempts (for password verification)
example: 0
securitySchemes:
turnstileAuth:
type: apiKey
name: token
in: header
description: Cloudflare Turnstile token for bot protection