Paste API - Documentation

Base URL:

https://idefasoft.fr/pastes/api

Error Messages

If an error occurs during a request, the server will return a JSON response containing the error code and a human readable error message. Example:

{"code": 400, "message": "The name must be between 2 and 100 characters long"}

Authentication

To use the API, you need to authenticate yourself using your API key. You must use the Authorization HTTP header in the format Authorization: API_KEY. Example:

Authorization: SVO6qVPCsWAZgGqVgiVQtAQdg5AYCRmb

Paste object

Field Type Description
id string ID of the paste
name string name of the paste
content string content of the paste
expiration string expiration of the paste (10 minutes, 1 hour, 1 day, 1 week, 2 weeks, 1 month, 6 months, 1 year or Never)
exposure string exposure of the paste (public, unlisted or private)
burn_after_read boolean whether the paste is automatically deleted after reading

Example Paste

{
    "id": "L4e9tJKKfvSL",
    "name": "Test",
    "content": "Test content",
    "created_at": "15/05/2024, 18:56:01",
    "expiration": "Never",
    "exposure": "public",
    "views": 4,
    "burn_after_read": false
}

User object

Field Type Description
username str the user's username
avatar ?str the user's avatar url
bio ?str the user's bio
badges array of string the user's badges
created_at ISO8601 timestamp when the user created its account
last_login ISO8601 timestamp when the user last logged on
max_paste_chars int The maximum number of characters that can be sent in the whole set of user pastes
pastes array of Paste objects the user's pastes

Example User

{
    "username": "test",
    "avatar": null,
    "bio": "Test account",
    "badges": [],
    "created_at": "2024-05-13T20:14:00.015390+00:00",
    "last_login": "2024-05-15T15:24:57.655769+00:00",
    "max_paste_chars": 1000000,
    "pastes": []
}

Pastes Endpoints

Create a paste

POST /create

Create a new paste. Return a paste object on success. JSON Params:

Field Type Description
name string name of the paste
content string content of the paste
expiration? string expiration of the paste, default value is Never
exposure? string exposure of the paste, default value is public
burn_after_read? boolean whether the paste is automatically deleted after reading, default value is false

Get a paste

GET /paste/@{paste.id}

Return the paste object of the specified paste on success.

Edit a paste

PATCH /edit/{paste.id}

Edit a paste. Return the updated paste object on success. JSON Params:

Field Type Description
id string ID of the paste
name? string name of the paste
content? string content of the paste
expiration? string expiration of the paste
exposure? string exposure of the paste
burn_after_read? boolean whether the paste is automatically deleted after reading

Delete a paste

DELETE /delete/{paste.id}

Delete a paste permanently. Return 204 No Content on success.

Get an user

GET /accounts/@{user.username}

Return the user object of the specified user on success.