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",
  "expires_at": 1755278881,
  "exposure": "public",
  "views": 18
}

expires_at is a Unix timestamp (or null if it never expires).
Note: When creating or editing a paste, use expiration instead with one of these 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": "idefa",
  "bio": "hello.",
  "flags": 0,
  "created_at": "2025-02-14 20:14:00",
  "last_login": "2025-02-15 17:30:37",
  "max_paste_chars": 1000000,
  "pastes": [],
  "page": 1
}

Create a paste

POST /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":"Be aware","content":"I see you idefa","expiration":"1 day","exposure":"unlisted"}'

Get a paste

GET /{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 /{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/M5f0uKLMgwTM \
  -H "Authorization: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"expiration":"2 weeks","exposure":"unlisted"}'

Delete a paste

DELETE /{paste_id}

Deletes a paste you own. Returns 204 No Content on success.

Example

curl -X DELETE https://idefa.xyz/api/M5f0uKLMgwTM -H "Authorization: YOUR_API_KEY" -i

Get your user object

GET /@me

Returns your User object, including your pastes.

Example

curl https://idefa.xyz/api/@me -H "Authorization: YOUR_API_KEY"