API Documentation
Base URL
https://idefa.xyz/api
All endpoints below are relative to the base URL.
Error messages
On error, the API returns JSON with an HTTP status code and a human-readable message.
{
"code": 400,
"message": "The name must be between 2 and 100 characters long"
}
Authentication
Send your API key in the Authorization header.
Authorization: hTXg1A27vUncnVdfsNOLdFCJCjCz210q
Paste object
{
"id": "M5f0uKLMgwTM",
"name": "Example",
"content": "Example content",
"created_at": "2025-02-15 17:28:01",
"expiration": "6 months",
"exposure": "public",
"views": 18
}
expiration values:
10 minutes, 1 hour, 1 day, 1 week, 2 weeks, 1 month, 6 months, 1 year, Never
exposure values: public, unlisted, private
User object
{
"username": "admin",
"bio": "Owner",
"flags": 0,
"created_at": "2025-02-14 20:14:00",
"last_login": "2025-02-15 17:30:37",
"max_paste_chars": 1000000,
"pastes": []
}
Create a paste
POST /api/create
Create a new paste. Returns the created Paste object on success.
JSON body
{
"name": "My paste",
"content": "Hello world",
"expiration": "Never",
"exposure": "public"
}
Example
curl -X POST https://idefa.xyz/api/create \
-H "Authorization: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"My paste","content":"Hello world","expiration":"1 day","exposure":"unlisted"}'
Get a paste
GET /api/{paste_id}
Returns the Paste object if it exists and you are allowed to view it.
Example
curl https://idefa.xyz/api/M5f0uKLMgwTM \
-H "Authorization: YOUR_API_KEY"
Edit a paste
PATCH /api/edit/{paste_id}
Edits a paste you own. Returns the updated Paste object on success.
JSON body (all fields optional)
{
"name": "New title",
"content": "Updated content",
"expiration": "1 week",
"exposure": "public"
}
Example
curl -X PATCH https://idefa.xyz/api/edit/M5f0uKLMgwTM \
-H "Authorization: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"expiration":"2 weeks","exposure":"unlisted"}'
Delete a paste
DELETE /api/delete/{paste_id}
Deletes a paste you own. Returns 204 No Content on success.
Example
curl -X DELETE https://idefa.xyz/api/delete/M5f0uKLMgwTM \
-H "Authorization: YOUR_API_KEY" -i
Get your user object
GET /api/@me
Returns your User object, including your pastes.
Example
curl https://idefa.xyz/api/@me \
-H "Authorization: YOUR_API_KEY"